Author Topic: [Python] SkyB0t.py - Skype bot with port tunneling  (Read 4962 times)

0 Members and 2 Guests are viewing this topic.

Offline d4rkcat

  • Knight
  • **
  • Posts: 287
  • Cookies: 115
  • He who controls the past controls the future. He who controls the present controls the past.
    • View Profile
    • Scripts
[Python] SkyB0t.py - Skype bot with port tunneling
« on: 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:

Code: [Select]

 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

Code: [Select]
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]
« Last Edit: May 01, 2014, 03:35:10 pm by d4rkcat »
Jabber (OTR required): thed4rkcat@einfachjabber.de    Email (PGP required): thed4rkcat@yandex.com    PGP Key: here and here     Blog

<sofldan> not asking for anyone to hold my hand uber space shuttle door gunner guy.


Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [Python] SkyB0t.py - Skype bot with port tunneling
« Reply #1 on: April 09, 2014, 05:57:25 pm »
Oh wow. So it works like a Skype extension? does Skype asks if you want to confirm it?

Offline d4rkcat

  • Knight
  • **
  • Posts: 287
  • Cookies: 115
  • He who controls the past controls the future. He who controls the present controls the past.
    • View Profile
    • Scripts
Re: [Python] SkyB0t.py - Skype bot with port tunneling
« Reply #2 on: April 09, 2014, 06:11:56 pm »
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.
Jabber (OTR required): thed4rkcat@einfachjabber.de    Email (PGP required): thed4rkcat@yandex.com    PGP Key: here and here     Blog

<sofldan> not asking for anyone to hold my hand uber space shuttle door gunner guy.


Offline Phage

  • VIP
  • Overlord
  • *
  • Posts: 1280
  • Cookies: 120
    • View Profile
Re: [Python] SkyB0t.py - Skype bot with port tunneling
« Reply #3 on: April 09, 2014, 09:29:22 pm »
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!
« Last Edit: April 09, 2014, 09:29:54 pm by Phage »
"Ruby devs do, in fact, get all the girls. No girl wants a python, but EVERY girl wants rubies" - connection

"It always takes longer than you expect, even when you take into account Hofstadter’s Law."

Offline d4rkcat

  • Knight
  • **
  • Posts: 287
  • Cookies: 115
  • He who controls the past controls the future. He who controls the present controls the past.
    • View Profile
    • Scripts
Re: [Python] SkyB0t.py - Skype bot with port tunneling
« Reply #4 on: April 09, 2014, 09:33:34 pm »
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.
Jabber (OTR required): thed4rkcat@einfachjabber.de    Email (PGP required): thed4rkcat@yandex.com    PGP Key: here and here     Blog

<sofldan> not asking for anyone to hold my hand uber space shuttle door gunner guy.


Offline daxda

  • Peasant
  • *
  • Posts: 114
  • Cookies: 112
  • Not the guy you're looking for
    • View Profile
    • Daxda on Github
Re: [Python] SkyB0t.py - Skype bot with port tunneling
« Reply #5 on: April 10, 2014, 07:16:03 am »
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.
« Last Edit: April 10, 2014, 07:37:39 am by daxda »

Offline Architect

  • Sir
  • ***
  • Posts: 428
  • Cookies: 56
  • STFU
    • View Profile
    • Rootd IRC
Re: [Python] SkyB0t.py - Skype bot with port tunneling
« Reply #6 on: April 10, 2014, 08:02:43 am »
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.
« Last Edit: April 10, 2014, 08:29:28 am by Architect »

Offline d4rkcat

  • Knight
  • **
  • Posts: 287
  • Cookies: 115
  • He who controls the past controls the future. He who controls the present controls the past.
    • View Profile
    • Scripts
Re: [Python] SkyB0t.py - Skype bot with port tunneling
« Reply #7 on: April 10, 2014, 04:25:16 pm »

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
Jabber (OTR required): thed4rkcat@einfachjabber.de    Email (PGP required): thed4rkcat@yandex.com    PGP Key: here and here     Blog

<sofldan> not asking for anyone to hold my hand uber space shuttle door gunner guy.


Offline nattewasbeer

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 1
  • h4xh4x
    • View Profile
Re: [Python] SkyB0t.py - Skype bot with port tunneling
« Reply #8 on: April 10, 2014, 06:58:40 pm »
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.
~~~~~

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: [Python] SkyB0t.py - Skype bot with port tunneling
« Reply #9 on: April 10, 2014, 07:22:00 pm »
Lookup d0xbase for an example of how it works with classes...

Offline d4rkcat

  • Knight
  • **
  • Posts: 287
  • Cookies: 115
  • He who controls the past controls the future. He who controls the present controls the past.
    • View Profile
    • Scripts
Re: [Python] SkyB0t.py - Skype bot with port tunneling
« Reply #10 on: May 01, 2014, 03:13:24 pm »
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!
Jabber (OTR required): thed4rkcat@einfachjabber.de    Email (PGP required): thed4rkcat@yandex.com    PGP Key: here and here     Blog

<sofldan> not asking for anyone to hold my hand uber space shuttle door gunner guy.