hi, when i use tshark to sniffer, it always appear error:Unhandled Exception (group=1, code=6) My cmd is "tshark -nn -i eth1 -t ad -R '(tcp.flags.syn == 1 and tcp.flags.ack == 0 and ip.dst<192.168.0.0 or ip.dst>192.168.255.255)'" Firstly, i thought maybe the memory isn`t enough, but after i freed memory,i found it still error and now the free memory have 4G, Can you tell me how to solve? Thank you. asked 17 May '12, 01:00 mastertu showing 5 of 6 show 1 more comments |
One Answer:
This may very well be caused by running out-of-memory. Especially since you say you are on a high bandwidth network and using display filters instead of capture filters. Tshark is a statefull analyzer which means it does keep state of all kinds of sessions. It also does reassembly of higher layer protocols. All of this will increase its memory footprint while capturing. So it is best to present tshark as little data as possible to reduce the memory footprint while capturing. This can be done by using capture filters. The equivalent capture filter for your display filter would be:
(tcp[13] points to the TCP flags in the TCP header, the SYN bit has value 2, he ACK bit has value 16, so to only select SYN packets without SYN/ACK packets anding with 16+2 should result in 2. Then your not interested in TCP SYN's to systems in 192.168.0.0/16, so exclude those destinations with the "dst net" filter) So you could use the command:
Which should make it possible to run tshark for much longer periods than with your previous command. However, it will not run forever. Please also note that using display filters in recent versions of tshark is not possible anymore while capturing as the capture engine has been moved to a separate process for privilege separation. answered 17 May '12, 02:49 SYN-bit ♦♦ edited 17 May '12, 06:19 Yes, he's running out of memory. Unfortunately tshark didn't catch the OutOfMemory exception until r39798. (After that rev tshark will tell you what the problem is rather than just failing to catch the exception.) (17 May '12, 05:54) JeffMorriss ♦ when i use "tshark -nn -i eth1 -t ad -f "tcp[13]&18=2 and not (dst net 192.168.0.0 mask 255.255.0.0)"" (18 May '12, 02:33) mastertu What do you mean by "caught"? This capture filter does the same as your display filter. The output on screen should be the same (which I just verified myself with some test traffic). Which traffic do you suspect is not caught? (18 May '12, 02:50) SYN-bit ♦♦ Sorry,please forgive my english. I mean that when i use cmd"tshark -nn -i eth1 -t ad -R '(tcp.flags.syn == 1 and tcp.flags.ack == 0 and ip.dst<192.168.0.0 or ip.dst>192.168.255.255)'" The sniffer result is right. But when i use cmd"tshark -nn -i eth1 -t ad -f "tcp[13]&18=2 and not (dst net 192.168.0.0 mask 255.255.0.0)" I found the result is very less. I found the reson maybe caused by this capture "tcp[13]&18=2", can you tell me why? Thany you. (18 May '12, 03:01) mastertu As the filters should work the same (and they seem to do on my system), I'm very curious to see how the output differs. Can you start both commands and send me the some output that is missing from my command? Please also supply the exact commands that you used in the test. (18 May '12, 03:12) SYN-bit ♦♦
(18 May ‘12, 03:18) mastertu sorry,the format hasn (19 May ‘12, 11:26) mastertu Running out of memory is inevitable as (19 May ‘12, 15:03) helloworld …as described in the OutOfMemory wiki:
(19 May ‘12, 15:04) helloworld hi,i found another question, Please see the data,between 58.58.58.58 and TCP,there is two space But between the other dstip and TCP only has one space. I want make all of them one space, can you help me? Thank you. (20 May ‘12, 20:30) mastertu i delete the space by tr -s ' ‘ (20 May ‘12, 21:07) mastertu showing 5 of 14 show 9 more comments |
Regards
Kurt
my sniffer data is very much, wheather it caused this errror?
maybe. When does the error occur. Right at the beginning?
BTW: before we are looking for possible errors in an older version of tshark, can you please upgrade to tshark 1.6? As CentOS 6.2 only provides wireshark 1.2, I suggest to look for a 1.6 rpm elsewhere or compile it yourself.
not right at the beginning, it after six or seven minutes.
Ok, i will upgrade it and try again