Question

I am working with pcap in an OS X application to understand packet analysis. I am working with a app https://github.com/jpiccari/MacAlyzer but I am getting only raw data but I want to differentiate every domain request into separate and clear way to read request and response value. Please guide me the way to how to develop an application with pcap.

I have tried some code but they translate data into hex format. How do I convert that data into meaningful request and response objects like Charles and Fiddler show?

Was it helpful?

Solution

MacAlyzer wasn't developed for your needs. I know because I'm the author. As already stated, Charles and Fiddler are web proxies and work entirely different (and serve different purposes).

Diving a bit deeper into your question, communication between client and server happens IP-to-IP and not domain-to-domain. Domain information is not contained in the packets at the either the IP or TCP level. Instead computers request domain-to-IP lookup information which is then stored and communication is carried out using the client and server IP addresses.

MacAlyzer, and really libpcap, don't have sophisticated packet dissection (like say Wireshark) and cannot display packet information as verbosely as other programs. Before I lost interest in the project I was planning a library that would allow much richer packet dissection and analysis, but free time became very limited.

As for adding domain information to MacAlyzer, I'll explain at a high-level since it seems you know what you're doing. To include domain information instead of IP address in the Source and Destination columns you could edit function ip_host_string() in ip.m. This function controls how the client and server addresses are displayed. Modifying it to lookup the hostname from IP address and returning the resulting string would cause the domains to be displayed instead of IP addresses.

If you come up with some nice updates, consider submitting a pull request.

OTHER TIPS

Here is the food for thoughts:

http://www.binarytides.com/packet-sniffer-code-c-linux/

Anyway, you will need to use C. Therefore, check the codes of the includes, for example:

http://www.eg.bucknell.edu/~cs363/2014-spring/code/tcp.h

Here is the documentation of "pcap":

http://www-01.ibm.com/support/knowledgecenter/#!/ssw_aix_71/com.ibm.aix.basetrf1/pcap_close.htm

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top