I'm trying to get a list of unique IP-MAC mapping from a PCAP file. There are several answers to similar questions but none of them actually meet this exactly. I've tried for example this:
Which will list all IP-MAC but there will be duplicates. Piping it into Ideally the output I'm looking for would be two columns, IP and MAC, of every single device in the capture (regardless of whether it's asked 09 Jun '15, 16:23 Alexandre Ka... |
2 Answers:
I think this will require some scripting, because of the duplicates you'll get. IP to MAC relationships can be 1-1, 1-n, n-1, and maybe even n-n, so tshark is not enough - you need some sort of database to track what you've seen and correlate things. answered 09 Jun '15, 17:54 Jasper ♦♦ |
O.K. if you want that, you are probably just interested in the MAC address that is "tied" to an IP address. You won't neccesarily see that with your approach. Reason: it will work, if the systems communicate directly!
It won't work, if the systems communicate through a router
Furthermore, if you are printing SRC and DST at the same time (some output line), you will get much more (useless) combinations, which makes using uniq harder. My suggestion:
This should bring up only the unique combinations. If you are communicating through a router, you will see the MAC address of the router many times for different IP addresses. Regards answered 10 Jun '15, 02:54 Kurt Knochner ♦ edited 10 Jun '15, 02:54 |