0

I am trying to output captured packet information to a .txt file. Running the below code in a terminal works (removing the " of course). However java doesn't seem to like ">". I get the following error message; tshark: A default capture filter was specified both with "-f" and with additional command-line arguments.

Process p1 = Runtime.getRuntime().exec(new String[]{"tshark","-f","tcp src port 80","-i","en0","-l",">","raw.txt"});

However if i use "-w" instead of ">" it outputs the binary data just fine.

Angus
  • 15
  • 4

1 Answers1

0

Try quoting the capture filter, e.g.

Process p1 = Runtime.getRuntime().exec(new String[]{"tshark","-f","\"tcp src port 80\"","-i","en0","-l",">","raw.txt"});

Christopher Maynard
  • 5,702
  • 2
  • 17
  • 23