Set up a proxy

adb shell settings put global http_proxy <ip>:<port>

Remove them

adb shell settings delete global http_proxy
adb shell settings delete global global_http_proxy_host
adb shell settings delete global global_http_proxy_port

又学了一招。

居然必须是小写。
export http_proxy="http://127.0.0.1:10809"
export https_proxy="http://127.0.0.1:10809"

一开始写成HTTP_PROXY.就是不行。

取消是直接unset http_proxy && unset https_proxy

昨天搭了个简单的DNS服务器,就是为了抓取手机里面各种APP的DNS请求。
抓了一堆域名。没打印IP。重新改太麻烦,直接用shell脚本ping出来吧。

#!/bin/bash

n=1

for domain in `cat domains.txt`
do
    ip=`ping ${domain} -c 1|sed '1{s/[^(]*(//;s/).*//;q}'`
    echo -e $n "\t" $domain "\t" $ip
    n=$(($n+1))
done