feat: tcpdump 时过滤掉 vnc 数据包
1. 项目启动时从 ./lib/droidvnc-np-defaults.json 读取 vnc port 2. 不论是否输入package name 全部过滤掉 vnc 流量 3. 结束捕包时删除 pcap 文件
This commit is contained in:
@@ -29,6 +29,8 @@ public class AdbUtil {
|
||||
private String host;
|
||||
private Integer port;
|
||||
|
||||
private Integer vncPort;
|
||||
|
||||
private ExecutorService threadPool;
|
||||
|
||||
public String getSerial() {
|
||||
@@ -42,6 +44,7 @@ public class AdbUtil {
|
||||
this.serial = T.StrUtil.emptyToDefault(adb.getSerial(), "");
|
||||
this.host = adb.getHost();
|
||||
this.port = adb.getPort();
|
||||
this.vncPort = adb.getVncPort();
|
||||
// adb connect
|
||||
this.connect();
|
||||
// init
|
||||
@@ -585,7 +588,7 @@ public class AdbUtil {
|
||||
String pcapFilePath = "/data/local/tmp/capture_" + userId + "_" + packageName + "_" + taskId + ".pcap";
|
||||
CommandExec.execForProcess(AdbCommandBuilder.builder()
|
||||
.serial(this.getSerial())
|
||||
.buildShellCommand(String.format("shell tcpdump -i nflog:%s -w %s &", userId, pcapFilePath))
|
||||
.buildShellCommand(String.format("shell tcpdump not port %s -i nflog:%s -w %s &", this.vncPort, userId, pcapFilePath))
|
||||
.build());
|
||||
} else {
|
||||
log.info("[startTcpdump] [capture all package]");
|
||||
@@ -593,7 +596,7 @@ public class AdbUtil {
|
||||
String pcapFilePath = "/data/local/tmp/capture_all_" + taskId + ".pcap";
|
||||
CommandExec.execForProcess(AdbCommandBuilder.builder()
|
||||
.serial(this.getSerial())
|
||||
.buildShellCommand(String.format("shell tcpdump -w %s &", pcapFilePath))
|
||||
.buildShellCommand(String.format("shell tcpdump not port %s -w %s &", this.vncPort, pcapFilePath))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user