Skip to content

Instantly share code, notes, and snippets.

@HugoGresse
Last active November 27, 2022 11:19
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save HugoGresse/a3c315c3c4eb454a2e89d0b5642ffcbe to your computer and use it in GitHub Desktop.
Save HugoGresse/a3c315c3c4eb454a2e89d0b5642ffcbe to your computer and use it in GitHub Desktop.
Adb command to set proxy (WIP)
#!/bin/bash
usage() {
echo "Usage:"
echo " adbx proxy set"
echo " adbx proxy get"
echo " adbx proxy remove"
}
if [ $# -lt 1 ]
then
usage
exit 1
fi
# adb shell settings get global http_proxy
case $1 in
proxy)
case $2 in
get) adb shell settings get global http_proxy;;
set)
ip=$(ipconfig getifaddr en0)
port=":8888"
adb shell settings put global http_proxy $ip$port;;
remove)
adb shell settings put global http_proxy :0
*) usage;;
esac
;;
*) usage;;
esac
@BruceZhang1993
Copy link

works good. but any solution to remove proxy without restarting device?

@HugoGresse
Copy link
Author

no, not for the moment, which quiet suck

@BruceZhang1993
Copy link

no, not for the moment, which quiet suck

Uhhh.. thanks anyway

@superbsocial
Copy link

To remove proxy setting instantly use below command. It will be take effect without reboot
adb shell settings put global http_proxy :0

works good. but any solution to remove proxy without restarting device?

@BruceZhang1993
Copy link

To remove proxy setting instantly use below command. It will be take effect without reboot
adb shell settings put global http_proxy :0

works good. but any solution to remove proxy without restarting device?

Thx!

@HugoGresse
Copy link
Author

i've updated the gist with the comment of @superbsocial

To remove proxy setting instantly use below command. It will be take effect without reboot
adb shell settings put global http_proxy :0

works good. but any solution to remove proxy without restarting device?

@jolieprince
Copy link

How to run this script btw?

@HugoGresse
Copy link
Author

it's a bash script, so:

./adbx proxy set
./adbx proxy remove

@redcatsec
Copy link

is there any thin similer for ios ?

@HugoGresse
Copy link
Author

is there any thin similer for ios ?

No idea sorry.

@elmissouri16
Copy link

@HugoGresse any idea of how to implement one on proxy that's require authentication i found this but seem not working or its working or I have no idea but when I set proxy with it and I use for example browser its ask for auth for proxy

@HugoGresse
Copy link
Author

HugoGresse commented Apr 24, 2021

@elmissouri16 no idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment