PH1K3

Botfinder for botnet roots

Jun 9th, 2015
466
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. this is an tool that never got done but the syntax is in and you could only scan one host at a time
  2. if this code is good for anything to anyone im happy
  3. this tool is to check which of your bots that are online
  4. here:
  5. from threading import Thread
  6. import subprocess
  7. from Queue import Queue
  8.  
  9. print "PH1K3's bot-finder"
  10. print "Find my bots!"
  11.  
  12. num_threads = 7
  13. queue = Queue()
  14. enterip =raw_input("Enter ips of bots: ")
  15. ips = [enterip]
  16. #wraps system ping command
  17.  
  18. headers = {}
  19. headers['User-Agent'] = "the internet Police"
  20.  
  21. def pinger(i, q):
  22. """Pings subnet"""
  23. while True:
  24. ip = q.get()
  25. print "Thread %s: Pinging %s" % (i, ip)
  26. ret = subprocess.call("ping -c 3 %s" % ip,
  27. shell=True,
  28. stdout=open('/dev/null', 'w'),
  29. stderr=subprocess.STDOUT)
  30. if ret == 0:
  31. print "%s: bot is alive" % ip
  32. else:
  33. print "%s: bot is dead" % ip
  34. q.task_done()
  35. #Spawn thread pool
  36. for i in range(num_threads):
  37.  
  38. worker = Thread(target=pinger, args=(i, queue))
  39. worker.setDaemon(True)
  40. worker.start()
  41. #Place work in queue
  42. for ip in ips:
  43. queue.put(ip)
  44. #Wait until worker threads are done to exit
RAW Paste Data