(String filter, String pcap, TcpDumpReceiver receiver)
| 49 | } |
| 50 | |
| 51 | public Child sniff(String filter, String pcap, TcpDumpReceiver receiver) throws ChildManager.ChildNotStartedException { |
| 52 | |
| 53 | StringBuilder sb = new StringBuilder("-nvs 0 "); |
| 54 | |
| 55 | if(pcap != null) { |
| 56 | // TODO: find a way to receive tcpdump output when saving to a file |
| 57 | // NOTE: tcpdump -w - | tee file.pcap | tcpdump -r - |
| 58 | sb.append("-Uw '"); |
| 59 | sb.append(pcap); |
| 60 | sb.append("' "); |
| 61 | } else { |
| 62 | sb.append("-l "); |
| 63 | } |
| 64 | |
| 65 | if(filter != null) { |
| 66 | sb.append(filter); |
| 67 | } |
| 68 | |
| 69 | return super.async(sb.toString(), receiver); |
| 70 | } |
| 71 | |
| 72 | public void sniff(TcpDumpReceiver receiver) throws ChildManager.ChildNotStartedException { |
| 73 | sniff(null, null, receiver); |
no test coverage detected