Snippets

Doug Freed T-Mobile tether limit bypass

Created by Doug Freed
1
2
3
#!/tmp-mksh/tmp-mksh
iptables -D natctrl_tether_counters -i rndis0 -o clat4 -m quota2 --grow  --name rndis0_rmnet1  --quota 0  -j RETURN
iptables -D natctrl_tether_counters -i clat4 -o rndis0 -m quota2 --grow  --name rmnet1_rndis0  --quota 0  -j RETURN
#!/tmp-mksh/tmp-mksh
iptables -I natctrl_FORWARD 1 -i clat4 -o rndis0 -m state --state RELATED,ESTABLISHED -g natctrl_tether_counters
iptables -I natctrl_FORWARD 2 -i rndis0 -o clat4 -m state --state INVALID -j DROP
iptables -I natctrl_FORWARD 3 -i rndis0 -o clat4 -g natctrl_tether_counters
iptables -D natctrl_FORWARD -i rmnet1 -o rndis0 -m state --state RELATED,ESTABLISHED -g natctrl_tether_counters
iptables -D natctrl_FORWARD -i rndis0 -o rmnet1 -m state --state INVALID -j DROP
iptables -D natctrl_FORWARD -i rndis0 -o rmnet1 -g natctrl_tether_counters
iptables -I natctrl_tether_counters 1 -i rndis0 -o clat4 -m quota2 --grow  --name rndis0_rmnet1  --quota 0  -j RETURN
iptables -I natctrl_tether_counters 2 -i clat4 -o rndis0 -m quota2 --grow  --name rmnet1_rndis0  --quota 0  -j RETURN
iptables -D natctrl_tether_counters -i rndis0 -o rmnet1 -m quota2 --grow  --name rndis0_rmnet1  --quota 0  -j RETURN
iptables -D natctrl_tether_counters -i rmnet1 -o rndis0 -m quota2 --grow  --name rmnet1_rndis0  --quota 0  -j RETURN
iptables -t nat -I natctrl_nat_POSTROUTING 1 -o clat4 -j MASQUERADE
iptables -t nat -D natctrl_nat_POSTROUTING -o rmnet1 -j MASQUERADE
ip rule del from 192.168.42.0/24
1
2
3
4
5
6
7
#!/bin/bash

sysctl net.ipv4.ip_forward=1 net.ipv4.conf.all.forwarding=1 >/dev/null 2>&1
if ! iptables-save -t nat | grep -q MASQUERADE; then
	iptables -t nat -A POSTROUTING -j MASQUERADE
fi
sleep 10
#!/bin/bash

remote=$1
gateway=$(route -n get $remote | grep gateway | cut -d : -f 2 | tr -d ' ')

adb push /Users/dwfreed/android-nat.sh /sdcard/android-nat.sh
adb push /Users/dwfreed/android-nat-cleanup.sh /sdcard/android-nat-cleanup.sh
adb shell su -c 'mount -o remount,rw /system'
adb shell su -c 'cp /sdcard/android-nat.sh /sdcard/android-nat-cleanup.sh /system/xbin'
adb shell su -c 'chmod 700 /system/xbin/android-nat.sh /system/xbin/android-nat-cleanup.sh'
adb shell su -c 'chown root:root /system/xbin/android-nat.sh /system/xbin/android-nat-cleanup.sh'
adb shell su -c 'mount -o remount,ro /system'
adb shell su -c 'rm /sdcard/android-nat.sh /sdcard/android-nat-cleanup.sh'
adb shell su -c /system/xbin/android-nat.sh

sftp root@$remote <<-"EOF"
	put /Users/dwfreed/bin/tmo-bypass-remote-setup /root/tmo-bypass-remote-setup
	chmod 700 /root/tmo-bypass-remote-setup
	EOF
sudo ssh -vvv -o ServerAliveInterval=1 -o ServerAliveCountMax=60 -o ExitOnForwardFailure=yes -w any:15 -f root@$remote /root/tmo-bypass-remote-setup || exit
sudo route add $remote $gateway

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.