Android 安全相关技巧 --正确使用ADB

有很多事情其实都可以用adb shell来完成的,比如...


media server alloc size detect(on userdebug only):

	adb shell setprop libc.debug.malloc 1
	restart
	dumpsys media.player -m

adb 查看当前Android版本的权限列表

<span style="white-space:pre">	</span>adb shell pm list permissions -d -g

adb 查看当前屏幕显示的归属Activity:
<span style="white-space:pre">	</span>adb dumpsys activity activities |grep -A -6 "Running activities"

adb 查看当前屏幕显示的归属组件及其次序:
<span style="white-space:pre">	</span>adb shell dumpsys window w | findstr \/ | findstr name=

adb 启动某一个Fragment:
	am start -n package_name/.activity_name -e android:show_fragment fragment_name

adb shell 查看手机打开的端口以及对应的进程:

<span style="white-space:pre">	</span>netstat

或者

	cat /proc/net/tcp		//ipv4   
	cat /proc/net/tcp6		//ipv6
里面有uid,且地址端口和状态码(st)都是16进制的,而且为小端格式
<span style="white-space:pre">	</span>dumpsys activity|grep uid

adb shell 查找安装路径信息:
	dumpsys meminfo package_name or pid
说起网络相关,有一篇关于Android转包的文章还不错
tcpdump至wireshark:
见url:http://www.freebuf.com/articles/wireless/11175.html方法四.

关于android service :

获得当前系统的service(注册在ServiceManager的)

	adb shell service service list

向对应的service发送service call

adb shell service call servicename code
			
		Usage: service [-h|-?]
			service list
			service check SERVICE
			service call SERVICE CODE [i32 N | i64 N | f N | d N | s16 STR ] ...
				Options:\n"
				i32: Write the 32-bit integer N into the send parcel
				i64: Write the 64-bit integer N into the send parcel
				f:   Write the 32-bit single-precision number N into the send parcel
				d:   Write the 64-bit double-precision number N into the send parcel
				s16: Write the UTF-16 string STR into the send parcel
					intent: Write and Intent int the send parcel. ARGS can be
						action=STR data=STR type=STR launchFlags=INT component=STR categories=STR[,STR,..]


说一个小bug,adb shell有时候与logcat不能并存:
因为使用的adb client版本不同。。。一般是因为由于adb版本不同导致的,可以使用对应AOSP编译环境中的adb 。


Android logcat过滤:
<span style="white-space:pre">	</span>adb logcat|grep -i "DEBUG"

Android bugreport:
<span style="white-space:pre">	</span>adb bugreport

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值