pwncat/test.py

31 lines
974 B
Python
Raw Normal View History

2020-12-30 05:36:54 +00:00
#!./env/bin/python
import json
import stat
import time
2021-06-13 22:48:33 +00:00
import shutil
2021-01-03 23:22:17 +00:00
import subprocess
2020-12-30 05:36:54 +00:00
import pwncat.manager
2021-01-03 23:22:17 +00:00
import pwncat.platform.windows
2020-12-30 05:36:54 +00:00
# Create a manager
with pwncat.manager.Manager("data/pwncatrc") as manager:
2020-12-30 05:36:54 +00:00
# Tell the manager to create verbose sessions that
# log all commands executed on the remote host
# manager.config.set("verbose", True, glob=True)
2021-04-10 19:52:47 +00:00
# Establish a session
# session = manager.create_session("windows", host="192.168.56.10", port=4444)
2021-06-13 22:48:33 +00:00
# session = manager.create_session("windows", host="192.168.122.11", port=4444)
# session = manager.create_session("linux", host="pwncat-ubuntu", port=4444)
2021-06-13 22:48:33 +00:00
session = manager.create_session("linux", host="127.0.0.1", port=4444)
2021-01-10 23:01:08 +00:00
# session.platform.powershell("amsiutils")
2021-06-13 22:48:33 +00:00
with open("/tmp/random", "rb") as source:
with session.platform.open("/tmp/random", "wb") as destination:
shutil.copyfileobj(source, destination)
manager.interactive()