KekSec

Freaks ultimate SSH checker | Can handle mils | ŇułłžŞęç ROX

Mar 17th, 2017
1,065
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.74 KB | None | 0 0
  1. #!/usr/bin/python
  2. #-*-coding:utf8;-*-
  3.  
  4. import socket, threading, time, os
  5.  
  6. print "SSH checker by Freak"
  7. print
  8. #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
  9. print "Reads user:pass:ip and simply checks the IP for port 22."
  10. print "Then writes the logins with SSH running to 'sshopen.txt'"
  11. print "It is VERY fast and extremely efficient."
  12. print "As it splits the file into equal chunks for each thread!"
  13.  
  14. threads = int(raw_input("Threads: "))
  15.  
  16. lines = open("vuln.txt","r").readlines()
  17.  
  18. fh = open("sshopen.txt","a+")
  19.  
  20. def chunkify(lst,n):
  21.     return [ lst[i::n] for i in xrange(n) ]
  22.  
  23. running = 0
  24.  
  25. def check(chunk, fh):
  26.     global running
  27.     running += 1
  28.     threadID = running
  29.     for login in chunk:
  30.         if login.startswith("DUP"):
  31.             continue # skip DUPS cause fuck em
  32.  
  33.         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  34.         s.settimeout(3)
  35.         try:
  36.             s.connect((login.split(":")[2], 22))
  37.             s.close()
  38.             print "[+] " + login + " has SSH open."
  39.             fh.write(login + "\r\n")
  40.         except:
  41.             pass
  42.     print "Thread " + str(threadID) + " has finished scanning " + str(len(chunk)) + " IPs."
  43.     running -= 1
  44.  
  45. lines = map(lambda s: s.strip(), lines) # remove all newlines
  46.  
  47. chunks = chunkify(lines, threads) # make seperate chunk for each thread
  48.  
  49. for thread in xrange(0,threads):
  50.     if thread >= 384:
  51.         time.sleep(0.2)
  52.     try:
  53.         threading.Thread(target = check, args = (chunks[thread], fh,)).start()
  54.     except:
  55.         pass
  56. print "Scanning... Press enter to stop."
  57.  
  58. raw_input()
  59.  
  60. fh.close()
  61.  
  62. os.popen("kill -9 " + str(os.getpid()))
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment