This site was migrated to a new server on Friday, April 28. If you run into any problems, please open a bug

OSQA is unmaintained. Help us figure out where to go from here.


Actually, am caught up in a flux and was looking for some help.

I have a 1 GB file with data from multiple IP's. I use ngrp to find a particular keyword in the file and then find the source IP and destination IP of that packet where the keyword was present. I then used tshark and the found IP's to create another PCAP from the large PCAP of packets of only the communication between those two IP's. However, when I run my Python script to decode the created PCAP file, it does not give any results. While the same script on the original PCAP gives results. I have tried multiple options but nothing seems to give me the right results. Can you suggest a method to help me with this problem? Would be really grateful

Best regards,

asked 24 Mar '11, 07:28

John%20Major's gravatar image

John Major
accept rate: 0%

I guess you used tshark like this:

tshark -r 1gb-file.pcap -R "ip.addr == and ip.addr ==" -w just-2-stations.pcap

(24 Mar '11, 09:50) packethunter

I guess your filter is the problem:

Actually I used a little different version of this. I user "ip.src == and ip.dest ==" or "ip.src ==" and "ip.dest =="

If you do it like that you will probably get zero packets, resulting in an empty file (well, it'll have 24 bytes for pcap file headers, but not a single frame). The reason for it is in the way Wireshark prefers "and" and "or" statements when there are no brackets to prioritize - I'm not 100% sure but I think the way Wireshark parsed your statement is like this:

ip.src == and (ip.dest == or ip.src == and ip.dest ==

That way you ended up with the filter requesting both IP source and destination to be the same IP, which of course never matched. You need to either use packethunter's syntax for filtering, or put brackets around the "and" blocks like this:

(ip.src == and ip.dest == or (ip.src == and ip.dest ==

Things for you to do:

  1. load your 1GB with Wireshark, stop the loading process when you're pretty sure there is at least one packet of the communication loaded but before Wireshark runs into an out of memory situation.
  2. If you can't do that build your filter with existing, substituted IP addresses and change them back for the real filtering later.
  3. Test your display filter to give you the results you want for the complete file. If you know that there is at least one packet that should be displayed but isn't you got your display filter syntax wrong.
  4. Use tshark with the working filter
  5. Check the file size: if it is only 24 bytes you created another "empty" pcap file with zero packets, meaning your filter didn't match anything (and your python script won't find anything)
  6. Run your python script.

P.S: next time just comment your question again to bring it back up to anyone's attention if you're wondering why there is no further answer. Trying to email me for private help isn't the exact idea of this Q&A forum - others might be interested in the answers, too ;-)

permanent link

answered 27 Mar '11, 03:43

Jasper's gravatar image

Jasper ♦♦
accept rate: 18%

Actually I used a little different version of this. I user "ip.src == and ip.dest ==" or "ip.src ==" and "ip.dest =="

This way I was trying to capture the entire communication between only two IP's from a host of IP's. Yet, the formed PCAP has some segmentation fault or tcp pur of sequence or malformed packet error. As a result I cant decode it.

permanent link

answered 24 Mar '11, 23:45

John%20Major's gravatar image

John Major
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 24 Mar '11, 07:28

question was seen: 6,653 times

last updated: 27 Mar '11, 03:43

p​o​w​e​r​e​d by O​S​Q​A