EvilZone
Programming and Scripting => Scripting Languages => : d4rkcat April 09, 2014, 04:58:00 PM
-
Hey guys,
With this script, you can receive and send messages, tunnel ports and a few other nifty features.
I wrote this bot for fun, and as I wrote, more ideas came, and so here is the result:
SkyB0t Commands:
ls ONLINE/OFFLINE - Display friends status
chat USER - Enter into chat mode with USER
msg USER MESSAGE - Message USER with MESSAGE
flood USER TIMES MESSAGE - Flood USER TIMES with MESSAGE
eflood USER TIMES - Flood USER TIMES with random emoticons
egroupflood TIMES - Flood any group chat TIMES with random emoticons
groupflood TIMES MESSAGE - Flood any group chat TIMES with MESSAGE
call USER - Call USER
search USER - Search for USER
add USER - Add USER to contacts
send USER - Send a file to USER
resolve USER - Attempt to resolve USER IP address
isabot USER - Check if USER is running SkyB0t
cmdshellserver USER - Spawn a command shell and tunnel over skype to USER
cmdshellclient USER - Connect to a command shell tunneled over skype from USER
history USER FILE - Dump chat history with USER to FILE
voice ON/OFF SPEED PITCH - On or off, speed (80-450 default: 175), pitch (0-99 default: 50)
callhistory - Open call history in client
contacts - Open contacts in client
info USER - Open USER profile in client
status STATE - Change your status to STATE
tunnelserver USER PORT - Serve local PORT to USER through skype tunnel
tunnelclient USER PORT - Access tunneled service of USER on local PORT
cleverbot - Get cleverbot to answer all your chat messages
debug - Show Skype API debug
show - Show the Skype client
hide - Hide the Skype client
Commands for other users
ping HOST - Ping HOST
dig HOST - DNS details for HOST
whois HOST - Whois record for HOST
traceroute HOST - Traceroute to HOST
whatis THING - Get definition of THING
wolf QUESTION - Ask Wolfram Alpha a QUESTION
PS If your going to bitch about the code, you better give alternative code that demonstrates your point. I don't want to hear how i should do this and I should do that unless your willing to put some effort in.
Enjoy!
https://github.com/d4rkcat/skybot
[gist]d4rkcat/10280313[/gist]
-
Oh wow. So it works like a Skype extension? does Skype asks if you want to confirm it?
-
Oh wow. So it works like a Skype extension? does Skype asks if you want to confirm it?
It does ask, but i took the liberty of auto clicking accept, using xdotool.
You need xdotool and espeak for full functionality.
At the moment only tested on Kali and ubuntu.
-
I know you're going to hate me now...
BUT, what is up with all those elif statements? Boy, you should always take a step back and re-think the structure of your code if you find yourself making 27 elif statements right after each other!
-
PS If your going to bitch about the code, you better give alternative code that demonstrates your point. I don't want to hear how i should do this and I should do that unless your willing to put some effort in.
Thanks for that mate, can you take the time to re-write two of those statements in a way that makes you happy?
I will be happy to fix it if you can offer some constructive criticism.
-
Interessting project, I got some suggestions which I think could improve your code:
- Line 493, else statement is redundant
- Line 313, invert the if check and continue instead of nesting all code under one if check
- Line 236, return statement returns the bool before you reach break, thus break is redundant
- Line 143, instead of checking for status "RECEIVED" you could check for the negative,
this would reduce the nesting in the OnMessageStatus method. - Line 151, ommit the else statement, this will also reduce the nesting, inside your if check
(line 149) you could add a return statement as you don't do anything else besides "s.SendMessage(foo)" - Line 99 and 115, invert the if statement and put the else body inside the if body and return early, this
will remove nesting once again. - Line 113, you should never catch all errors in one try-catch block, this could hide critical errors.
- Line 72, the if check could once again, be negated, use continue instead of a single if statement
to reduce nesting, check for "if user.Handle == 'echo123': continue" and put the rest of the body inside
the for loop. - I'd recommend use format strings for the fhelp() method to improve readability, currently the plus signs
make it a bit hard to read. Additionally you could add a method which returns a colored string which takes a color
as argument to reduce the repetition in your status messages. - Line 18-21, importing all modules inside one single, all error catching, try-catch block could hide a real error,
check for "ImportError" instead of the all ommiting error catcher. - General style guide violating rule, you exceed the 80 char per line recommendation, this makes your code hard
to read.
That's about all I can spot for now, besides the above things I must say a very neat tool you wrote, good job.
if you don't fully understand one of my points I'll post some code snippets regarding your code which should be obvious.
-
I know you're going to hate me now...
BUT, what is up with all those elif statements? Boy, you should always take a step back and re-think the structure of your code if you find yourself making 27 elif statements right after each other!
Actually was 30
Don't you dare else: pass me, young man!
Github requests coming soon though.
-
Daxda, thanks very much for taking the time to write that, I find it very helpful and will act on it as soon as I sit down to code next. I think I understand the points you made I guess we will have to wait until I attempt to fix it to see if i've covered those areas! :D
I hacked together this code piece by piece with no planning, in fact it was just meant to be an experiment at first to see if i could send and receive messages through the terminal. Then I just kept adding stuff, coz woz bored. All three of the scripts in the modules section are other people's work. I just wrote the main skybot.py to tie them all together.
Architect I will in no way pass you up bro, shoot those requests my way and they will get merged, i'm already following you on the githezzey :D
-
One thing I can add to daxda's post is try to work in classes. Look up OOP programming with python. Make multiple .py files so the source code becomes more clear and modular at the same time.
-
Lookup d0xbase for an example of how it works with classes...
-
Added IP resolver, 8) (finally)
With great power comes great responsibility, please don't get me in trouble check your local laws before doing anything I am NOT responsible for your actions.
Furthermore, Enjoy!