Android下通過tcpdump抓包

來源:互聯網
上載者:User

標籤:android   style   blog   http   color   ar   使用   sp   檔案   

參考:http://www.cnblogs.com/likwo/archive/2012/09/06/2673944.html

最近因為測試需要,要抓手機APP的包。

a.手機要有root許可權

b.下載tcpdump   http://www.strazzere.com/android/tcpdump

c.此處原文採用 adb push 將 tcpdump 檔案拷貝到 /data/local  不過我執行此操作時發現許可權不夠(手機已經root)換用管理者運行 CMD還是不行,最後決定直接在手機上通過RE瀏覽器直接將tcpdump複製到 /data/local 目錄下。

d.運行adb shell

1 adb shell2 su      //此處手機的root管理程式會彈出是否允許,點擊允許才能從$切換到 #3 #運行tcpdump抓包4 ./data/local/tcpdump -i any -p -s 0

命令參數:

 

        # "-i any": listen on any network interface

  # "-p": disable promiscuous mode (doesn‘t work anyway)

  # "-s 0": capture the entire packet

  # "-w": write packets to a file (rather than printing to stdout)

  ... do whatever you want to capture, then ^C to stop it ...

根據連接埠抓包:

1 adb shell tcpdump -X -n -s 0 port 80

將抓到的內容寫入檔案方便使用wireshark

1 ./data/local/tcpdump -i any -p -s 0 -w /mnt/sdcard0/test.cap

 

Android下通過tcpdump抓包

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.