mirror of
https://github.com/calebstewart/pwncat.git
synced 2024-11-27 19:04:15 +01:00
Added extra check for weird bash behavior
This commit is contained in:
parent
ff10fdaa1e
commit
c2da0f1106
@ -803,6 +803,7 @@ class Victim:
|
||||
if wait:
|
||||
|
||||
response = self.recvuntil(edelim.encode("utf-8"))
|
||||
|
||||
response = response.split(edelim.encode("utf-8"))[0]
|
||||
if sdelim.encode("utf-8") in response:
|
||||
response = b"\n".join(response.split(b"\n")[1:])
|
||||
@ -850,8 +851,14 @@ class Victim:
|
||||
|
||||
if delim:
|
||||
# Receive until we get our starting delimeter on a line by itself
|
||||
while not self.recvuntil(b"\n").startswith(sdelim.encode("utf-8")):
|
||||
pass
|
||||
while True:
|
||||
x = self.recvuntil(b"\n")
|
||||
if x.startswith(sdelim.encode("utf-8")):
|
||||
break
|
||||
|
||||
data = self.client.recv(len(command), socket.MSG_PEEK)
|
||||
if data == command.encode("utf-8"):
|
||||
self.client.recv(len(command))
|
||||
|
||||
return sdelim, edelim
|
||||
|
||||
@ -1462,12 +1469,13 @@ class Victim:
|
||||
|
||||
return output
|
||||
|
||||
def reset(self):
|
||||
def reset(self, hard: bool = True):
|
||||
"""
|
||||
Reset the remote terminal using the ``reset`` command. This also restores
|
||||
your prompt, and sets up the environment correctly for ``pwncat``.
|
||||
|
||||
"""
|
||||
if hard:
|
||||
self.run("reset", wait=False)
|
||||
self.has_cr = True
|
||||
self.has_echo = True
|
||||
|
Loading…
Reference in New Issue
Block a user