Fake Ports mit socat
Zur Navigation springen
Zur Suche springen
Socat installieren
- apt install socat
Skript erstellen
- vim /usr/local/sbin/fake-ports.sh
#!/bin/bash
IP="172.24.24.100"
PORTS=(25 389 465 636 139 88 993 445)
for PORT in "${PORTS[@]}"; do
/usr/bin/socat -v TCP-LISTEN:$PORT,bind=$IP,reuseaddr,fork - &
done
#wait
Unit erstellen
- vim /etc/systemd/system/fake-ports.service
[Unit] Description=Fake Port Listener with socat After=network.target [Service] Type=simple ExecStart=/usr/local/sbin/fake-ports.sh Restart=on-failure User=root CapabilityBoundingSet=CAP_NET_BIND_SERVICE AmbientCapabilities=CAP_NET_BIND_SERVICE [Install] WantedBy=multi-user.target
Unit enablen
- systemctl daemon-reload
- systemctl enable --now fake-ports.service
- systemctl status fake-ports.service