Skip to content

Commit

Permalink
adding option to return result to the agent
Browse files Browse the repository at this point in the history
  • Loading branch information
skelsec committed Mar 15, 2019
1 parent 10a301c commit c6b19a0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Binary file modified pypykatz_server/__pycache__/resultprocess.cpython-37.pyc
Binary file not shown.
Binary file modified pypykatz_server/server/__pycache__/pypysocketserver.cpython-37.pyc
Binary file not shown.
9 changes: 8 additions & 1 deletion pypykatz_server/server/pypysocketserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
logging.basicConfig(level=10)

class ThreadedPYPYSocketServer:
def __init__(self, ip, port, resultQ):
def __init__(self, ip, port, resultQ, send_results = False):
self.listen_ip = ip
self.listen_port = port
self.resultQ = resultQ
self.send_results = send_results

self.ssock = None

Expand Down Expand Up @@ -52,6 +53,12 @@ def handle(self, soc, addr):

cmd = PYPYCMD()
cmd.cmdtype = PYPYCMDType.END
if self.send_results == True:
data = ""
for luid in mimi.logon_sessions:
data += str(mimi.logon_sessions[luid])

cmd.params.append(data.encode())
transport.send(cmd)
print('[+] Client finished!')

Expand Down
3 changes: 2 additions & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
socket_group.add_argument('-l', '--listen-ip', default = '0.0.0.0', help='IP address to listen on. Default 0.0.0.0')
socket_group.add_argument('-p', '--listen-port', type=int, default = 54545, help = 'Port to listen on. Default 54545')
socket_group.add_argument('-o', '--out-dir', default = 'creds', help = 'Directory to stroe credentials')
socket_group.add_argument('-r', '--return-data', action='store_true', help = 'Return data to the client after sucsessul dump')

args = parser.parse_args()

Expand All @@ -26,5 +27,5 @@
r.daemon = True
r.start()
print('[+] Starting server...')
server = ThreadedPYPYSocketServer(args.listen_ip, args.listen_port, resQ)
server = ThreadedPYPYSocketServer(args.listen_ip, args.listen_port, resQ, args.return_data)
server.run()

0 comments on commit c6b19a0

Please sign in to comment.