标签:android 文件 sp c ad r bs as file
(1)将android的tcpdump命令复制到/data/local/tools/目录下,添加可执行权限#!/bin/bash(3)抓包时执行./adbtcpdump.sh 文件,结束时按Ctrl+C。
filename=`date +%F-%H-%M-%S`".cap"
filepath="/data/local/tmp"
PullFile()
{
# echo $filepath/$filename
adb shell "su -c ‘chmod 777 $filepath/$filename‘"
adb pull $filepath/$filename
adb shell "su -c ‘rm -f $filepath/$filename‘"
}
#trap "PullFile; exit" 0 1 2 3 9 15
# 按下Ctrl+C 时,执行PullFile函数
trap "PullFile; exit" 2
adb shell "su -c ‘/data/local/tools/tcpdump -p -vv -s 0 -w $filepath/$filename‘"
标签:android 文件 sp c ad r bs as file
原文地址:http://www.cnblogs.com/sigmon/p/3999617.html