I'm trying to figure out the correct command syntax. I have a pcap file, and I want to use grep, and grep only to take out all of the uniq ip addresses from without the file
So assuming the file is called capture.pcap and is in my home folder, what should I write?
I assume the regex can be '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'
and that sort
and uniq
must be included also, but it seems the pcap doesn't respond well with grep, for example using the normal syntax of grep file word doesn't work, if I run: grep 239 ./capture.pcap
I get the replay Binary file ./capture/pcap matches
Best Answer
Try adding the
or-a
or--binary-file=text
optionsThis appears to work for a random pcap file that I downloaded from wiki.wireshark.org i.e.
but
etc.
Be aware of the warning (from the man page
man grep
) thatNote that although you can use the
\d
regex (for digit), it is only supported by grep in PCRE mode (i.e. with the-P
switch).