我正在尝试将捕获的数据包信息输出到.txt文件。在终端中运行以下代码是有效的(删除“当然”。但是java似乎不喜欢“>”。我得到以下错误信息;tshark:使用“-f”和其他命令行参数指定了默认捕获筛选器。 Process p1 = Runtime.getRuntime().exec(new String[]{"tshark","-f","tcp src port 80","-i","en0","-l",">","raw.txt"});
但是,如果我使用“-w”而不是“>”,它输出的二进制数据就很好了。
1条答案
按热度按时间ogsagwnx1#
尝试引用捕获筛选器,例如。
Process p1 = Runtime.getRuntime().exec(new String[]{"tshark","-f","\"tcp src port 80\"","-i","en0","-l",">","raw.txt"});