Untitled
unknown
plain_text
2 months ago
1.1 kB
7
Indexable
#!/usr/bin/env python3
import socket
import datetime
# 🔹 Port, auf dem trd sendet
LISTEN_PORT = 9999
# 🔹 Deine cbftp Instanzen
TARGETS = [
("127.0.0.1", 1337),
("127.0.0.1", 1338),
]
BUFFER_SIZE = 65535
def log(msg):
timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f"[{timestamp}] {msg}")
def main():
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(("0.0.0.0", LISTEN_PORT))
log(f"Listening on UDP port {LISTEN_PORT}...")
while True:
try:
data, addr = sock.recvfrom(BUFFER_SIZE)
log(f"Received {len(data)} bytes from {addr[0]}:{addr[1]}")
for target in TARGETS:
try:
sock.sendto(data, target)
log(f"Forwarded to {target[0]}:{target[1]}")
except Exception as e:
log(f"ERROR sending to {target[0]}:{target[1]} -> {e}")
except Exception as e:
log(f"ERROR receiving packet -> {e}")
if __name__ == "__main__":
main()Editor is loading...
Leave a Comment