資源描述:
《安卓手機利用adb和tcpdump手機抓包》由會員上傳分享,免費在線閱讀,更多相關內容在工程資料-天天文庫。
1、IT在線教育領跑者——麥子學院http://www.maziedu.com準備:1.手機要有root權限2.下載tcpdump步驟:1.adbpushtcpdump/data/local/tcpdump2.adbshellchmod6755/data/local/tcpdump3.adbshell,su獲得root權限4.cd/data/local5./tcpdump-iany-p-s0-w/data/capture.pcap命令參數(shù):#"-iany":listenonanynetworkinterface #"
2、-p":disablepromiscuousmode(doesn'tworkanyway) #"-s0":capturetheentirepacket #"-w":writepacketstoafile(ratherthanprintingtostdout) ...dowhateveryouwanttocapture,then^Ctostopit...6,adbpull/data/capture.pcapd:/7,在電腦上用wireshark打開capture.pcap即可分析logExecutethefol
3、lowingifyouwouldliketowatchpacketsgobyratherthancapturingthemtoafile(-nskipsDNSlookups.-s0capturestheentirepacketratherthanjusttheheader):adbshelltcpdump-n-s0IT在線教育領跑者——麥子學院http://www.maziedu.comTypicaltcpdumpoptionsapply.Forexample,ifyouwanttoseeHTTPtraffic:只
4、監(jiān)聽httpadbshelltcpdump-X-n-s0port80根據以上的信息,寫一個bat去執(zhí)行(tcpdump文件必須在當前目錄里)。開始tcpdumpadbpushtcpdump/data/local/tcpdumpadbshellchmod6755/data/local/tcpdumpadbshellrm-r/sdcard/capture.pcapadbshell/data/local/tcpdump-iany-p-s0-w/sdcard/capture.pcappause下載tcpdump文件到電腦a
5、dbpull/sdcard/capture.pcapcapture.pcap問題:有些機器root后通過adbshell后,默認不是root用戶,需要輸入su才能切換到root,這樣在執(zhí)行批處理會有問題,解決方法如下adbshell"su-c'sleep1'"adbstart-serveradbpushtcpdump/data/local/tcpdump因沒有root權限導致的問題adbshellsu-c"/data/local/tmp/tcpdump-iany-p-s0-w/sdcard/netCapture.p
6、cap"IT在線教育領跑者——麥子學院http://www.maziedu.com