This repository has been archived on 2025-07-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
analytics/test/sinkhole.py
AKP 0e543f9757
Initial processing and storage of logs
Signed-off-by: AKP <tom@tdpain.net>
2023-03-31 18:30:14 +01:00

24 lines
644 B
Python

#!/usr/bin/env python3
import socket
import sys
SOCKET=7502
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind(('localhost', SOCKET))
serversocket.listen(5) # become a server socket, maximum 5 connections
print(f"[*] Alive at localhost:{SOCKET}", file=sys.stderr)
while True:
connection, address = serversocket.accept()
print(f"[+] New connection {address=}", file=sys.stderr)
while True:
buf = connection.recv(64)
if len(buf) > 0:
print(buf)
else:
connection.close()
print(f"[-] Connection closed", file=sys.stderr)
break