模拟器连接
>adb devices
List of devices attached
127.0.0.1:5555 device
>adb connect 127.0.0.1:62001
connected to 127.0.0.1:62001
>adb devices
List of devices attached
127.0.0.1:62001 device
127.0.0.1:5555 device
>adb -s 127.0.0.1:62001 shell
>exit
>adb disconnect 127.0.0.1:62001
adb使用
adb devices
adb shell
adb install xxx.apk
adb push xxx.apk /data/local/tmp
adb push pub.dat /sdcard/
adb pull /data/local/tmp/ c:/dex
启动adb服务: adb start-server
关闭adb服务:adb kill-server
关闭端口占用
>netstat -tnl | grep 23946
>ps | grep android_server
root 22062 1 81900 4772 00000000 40110ed5 S ./android_server
>kill -s 9 22062
apk安装报错
1、[INSTALL_FAILED_UPDATE_INCOMPATIBLE]
需要卸载已安装的apk,并且卸载包名
adb uninstall package
2、[INSTALL_FAILED_INVALID_APK]
可能安装目录有中文
3、[INSTALL_FAILED_OLDER_SDK]
在Manifest文件中添加如下语句
3.1、[INSTALL_FAILED_UPDATE_INCOMPATIBLE]
原因,APP是通过系统内置的APP,删掉原生内置的Youtube
方案
先删除-->adb shell rm -rf data/data/com.google.android.youtube/
在挂载根目录---->进行删除
system/app/#mount -o remount,rw /
system/app/#rm -rf YouTube.apk
system/app/#rm -rf YouTube.apk.prof
4、截屏
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png
5、adb代理
设置代理
adb shell settings put global http_proxy
例如:
adb shell settings put global http_proxy 127.0.0.1:8888
移除代理
adb shell settings delete global http_proxy
例如:
adb shell settings delete global http_proxy 127.0.0.1:8888
ida调试APP
准备
1、adb
进入shell
安卓手机,查看cat /proc/cpuinfo
,这里要选择android_server
2、进入IDA 7.0\dbgsrv
目录下,选择对应的android_server
3、将android_server
放入安卓手机,adb push android_server/data/local/tmp
4、进入/data/local/tmp
,赋予权限,chmod 777 android_server
调试
1、进入安卓手机运行android_server
,端口转发adb forward tcp:23946 tcp:23946
2、手机运行应用,电脑打开ida,ida->New->Debugger->Attach->Remote ArmLinux/Android denugger
3、Hostname:127.0.0.1 (密码不用输入)
4、接着出现一个窗口,右键选择,Quick filter->包名[几个字母就行],这记住ID(pid)
5、ctrl+s->右键选择Quick filter->lib的名字->选择可执行的[X->x]
状态
1、进入安卓手机adb shell
2、查看TracerPid,pid在上面调试4可获取,cat /proc/pid/status
3301
tcpdump
1、下载
2、手机root,将tcpdump放入adb push tcpdump /data/local/tmp
3、修改权限chmod 777 tcpdump
4、运行./tcpdump -p -vv -s 0 -w ./01.pcap
5、修改chmod 777 01.pcap
导出adb pull /data/local/tmp/01.pcap f:/pcap
6、Wireshark打开01.pcap
7、Wireshark 过滤 http.request.method == "GET"
网友评论