Skip to content

Instantly share code, notes, and snippets.

@cmj
Last active December 12, 2023 10:06
Show Gist options
  • Save cmj/ff87a5ffcceeff745d89f297130d8dd2 to your computer and use it in GitHub Desktop.
Save cmj/ff87a5ffcceeff745d89f297130d8dd2 to your computer and use it in GitHub Desktop.
Quickly grab Twitter guest accounts via tethered phone
#!/bin/bash
# Quickly grab 10 Twitter guest accounts via tethered phone
# needs: https://gist.github.com/cmj/6e6f6cae51c28cf6e161ceba8d108dda
gateway=192.168.0.1
# tether and turn wifi off
# check first with `curl -s ipinfo.io`
# sleep times are just a guess needed for network {dis}association
# setup usb tethering
ADB_LIBUSB=1 adb start-server
sleep2
adb devices
adb shell svc usb setFunctions rndis
sudo route del default gw $gateway
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo dhcpcd usb0 # or enx1234567890ab
# TODO manipulate gateways/route priority metric instead of removing routes
#sudo ifmetric usb0 0
# use mobile data
adb shell svc wifi disable
sleep 2
# cycle data service to grab new ipaddr, wait for network to settle
# # set for 10 attempts
for((i=1;i<=10;i++)); do
curl -s ipinfo.io | jq -r '"\(.ip)\t \(.city) \(.region)"' | ts
./guest_tokens.sh >> guest_history.out # 2>> curl.out
adb shell svc data disable
sleep 5
adb shell svc data enable
sleep 5
done
adb shell svc wifi enable
# tether off
adb shell svc usb setFunctions
#adb kill-server
sudo route add default gw $gateway
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
#### clean up option
#grep --no-group-separator -B1 oauth_token_secret guest_history.out | \
# parallel -n2 echo | \
# tr -d ' ' | \
# sed -E 's/(.*":")(.*)(\-.*",".*),/{"id_str":"\2",\1\2\3}/' | \
# jq -s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment