Download upx:
https://github.com/upx/upx/releases/download/v3.93/upx-3.93-amd64_linux.tar.xz
Compile and compress:
GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -trimpath -ldflags="-s -w" -o generate_204
upx -9 ./generate_204
move it to /bin/
and make it executable: chmod +x /bin/generate_204
Create ~/g204_run_loop.sh:
#!/bin/sh
while true
do
generate_204
done > /dev/null
Install nohub:
opkg update
opkg install coreutils-nohup
Add to /etc/rc.local:
iptables -t nat -A PREROUTING -i wlan0 -p tcp -d 10.0.0.1 --dport 80 -j REDIRECT --to-port 8080
nohup /root/g204_run_loop.sh >/dev/null 2>&1 &
Edit /etc/config/dhcp:
config dnsmasq
...
list address '/android.com/10.0.0.1'
list address '/google.com/10.0.0.1'
list address '/gstatic.com/10.0.0.1'
list address '/apple.com/10.0.0.1'
config dhcp 'wifi'
list dhcp_option '6,192.168.43.1'
Restart dnsmasq:
/etc/init.d/dnsmasq restart
Or:
iptables -P FORWARD DROP
iptables -A FORWARD -i wlan0 -p udp -d 8.8.8.8 --dport 53 -j ACCEPT
iptables -A FORWARD -i wlan0 -p tcp -d google_ip_here --match multiport --dports 80,443 -j ACCEPT
iptables -A FORWARD -o wlan0 -j ACCEPT
config dhcp 'wifi'
list dhcp_option '6,8.8.8.8'