1
0
mirror of https://github.com/calebstewart/pwncat.git synced 2024-11-27 19:04:15 +01:00

Added support for a remote command to be run in the local context with at @ prefix

This commit is contained in:
John Hammond 2020-05-07 21:46:47 -04:00
parent a3e1469085
commit b29dcde252

View File

@ -276,10 +276,15 @@ class PtyHandler:
self.enter_raw() self.enter_raw()
continue continue
if len(line) > 0 and line[0] == "!": if len(line) > 0:
# Allow running shell commands if line[0] == "!":
subprocess.run(line[1:], shell=True) # Allow running shell commands
continue subprocess.run(line[1:], shell=True)
continue
elif line[0] == "@":
result = self.run(line[1:])
sys.stdout.buffer.write(result)
continue
argv = shlex.split(line) argv = shlex.split(line)
@ -351,7 +356,7 @@ class PtyHandler:
with ProgressBar( with ProgressBar(
[("#888888", "downloading with "), ("fg:ansiyellow", f"{download.NAME}")] [("#888888", "downloading with "), ("fg:ansiyellow", f"{download.NAME}")]
) as pb: ) as pb:
counter = pb(range(os.path.getsize(path))) counter = pb(range(size))
last_update = time.time() last_update = time.time()
def on_progress(copied, blocksz): def on_progress(copied, blocksz):