12345678910111213141516171819 |
- kill -9 $(pgrep -f "^socat$")
- sleep 3
- host=$(ifconfig eth0 | sed -En -e 's/.*inet ([0-9.]+).*/\1/p')
- echo "scaning ip range $host"
- for ip in $(nmap -n -sn --unprivileged $host/24 -oG - | awk '/Up$/{print $2}')
- do
- echo socating $ip
- bia=$(echo $ip | awk -F. '{print $4}')
- base1=50000
- port1=$((base1 + bia))
- nohup socat -v tcp-listen:$port1,fork,reuseaddr tcp:$ip:22 >/dev/null 2>&1 &
- base2=58000
- port2=$((base2 + bia))
- nohup socat -v tcp-listen:$port2,fork,reuseaddr tcp:$ip:8000 >/dev/null 2>&1 &
- done
|