Skip to content

Commit

Permalink
fix: timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
wh0am1i authored and wh0am1i committed Nov 26, 2024
1 parent 63a81bd commit e089a12
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pocsuite3/modules/listener/bind_tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ def read_results(conn, inputs):
return b'\n'


def wait_msg(conn, inputs):
try:
while True:
msg = conn.recv(1024).decode('utf-8', errors='ignore')
if inputs in msg.lower():
break
except Exception:
pass


def flow_redirect(conn):
s = socket.socket()
s.connect((conf.connect_back_host, conf.connect_back_port))
Expand Down Expand Up @@ -142,9 +152,9 @@ def bind_telnet_shell(host, port, user, pwd, check=True):
else:
tn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tn.connect((host, port))
tn.recv(1024)
wait_msg(tn, 'login: ')
tn.sendall((user + "\n").encode('utf-8'))
tn.recv(1024)
wait_msg(tn, 'password: ')
tn.sendall((pwd + "\n").encode('utf-8'))
if check:
flag = random_str(6).encode()
Expand Down

0 comments on commit e089a12

Please sign in to comment.