Android日誌檔案及tcpdump抓包
Android的log檔案分為實時列印的,還有狀態資訊的兩種
1.實時列印的主要有:logcat main,logcat radio,logcat events,tcpdump,以及高通平臺的QXDM日誌
2.狀態資訊的有:adb shell dmesg,adb shell dumpstate, adb shell dumpsys,adb shell bugreport
------adb logcat -b main -v time 列印應用程式的log
------adb logcat -b radio -v time 列印射頻相關的log,SIM STK也會在裡面,modem相關的AT command等
------adb logcat -b events -v time 列印系統事件的日誌,比如觸屏事件
狀態資訊,bugreport就夠了,裡面包含有dmesg,dumpstate和dumpsys.
------dmesg是kernel的log,凡是跟kernel相關的,比如driver出了問題(相機,藍芽,usb,啟動等等)
------dumpstate是系統狀態資訊,裡面比較全,包括手機當前的記憶體資訊,CPU資訊,logcat快取,kernel快取等等
------adb shell dumpsys這個是關於系統service的內容都在這裡面。這個命令還有更詳盡的用法,比如adb shell dumpsys meminfo system是檢視system這個process的記憶體資訊。
tcpdump對於TCP/IP協議相關的都可以使用這個來抓
ex: adb shell tcpdump -s 10000 -w /sdcard/capture.pcap.比如抓mms下載的時候的UA Profile,browser上網的時候使用proxy的APN下載,streaming的相關內容包括UA Profile等。
Android利用tcpdump抓包
command:
adb shell tcpdump -i any -p -s 0 -w /sdcard/capture.pcap
-i any: Listen on any network interface
-p:disable promiscuous mode
-s 0:capture the entire packet
-w: write packets to a file
如果執行此命令無效,請下載tcpdump檔案,http://dl.dbank.com/c0nhafqfyx. 然後push到/system/bin目錄下
Real time packet monitoring
command:
adb shell tcpdump -n -s 0
-n:skip DNS lookups
See HTTP traffic
command:
adb shell tcpdump -X -n -s 0 port 80