Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #-*-coding:utf8;-*-
- import socket, threading, time, os
- print "SSH checker by Freak"
- print
- #simply find and replace newlines to :: then a newline so every IP starts with ::. It will scan those for port 22 or whatever your skiddie heart desires </3
- print "Reads user:pass:ip and simply checks the IP for port 22."
- print "Then writes the logins with SSH running to 'sshopen.txt'"
- print "It is VERY fast and extremely efficient."
- print "As it splits the file into equal chunks for each thread!"
- threads = int(raw_input("Threads: "))
- lines = open("vuln.txt","r").readlines()
- fh = open("sshopen.txt","a+")
- def chunkify(lst,n):
- return [ lst[i::n] for i in xrange(n) ]
- running = 0
- def check(chunk, fh):
- global running
- running += 1
- threadID = running
- for login in chunk:
- if login.startswith("DUP"):
- continue # skip DUPS cause fuck em
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.settimeout(3)
- try:
- s.connect((login.split(":")[2], 22))
- s.close()
- print "[+] " + login + " has SSH open."
- fh.write(login + "\r\n")
- except:
- pass
- print "Thread " + str(threadID) + " has finished scanning " + str(len(chunk)) + " IPs."
- running -= 1
- lines = map(lambda s: s.strip(), lines) # remove all newlines
- chunks = chunkify(lines, threads) # make seperate chunk for each thread
- for thread in xrange(0,threads):
- if thread >= 384:
- time.sleep(0.2)
- try:
- threading.Thread(target = check, args = (chunks[thread], fh,)).start()
- except:
- pass
- print "Scanning... Press enter to stop."
- raw_input()
- fh.close()
- os.popen("kill -9 " + str(os.getpid()))
Advertisement