How to Read Incoming packets from ethernet card?

11 views (last 30 days)
I have been given this assignment to read incoming IP packets and display their information in a tabular form. It is something similar to the opensource application Wireshark but I have to make the same in matlab . I am very new to matlab and would seek some guidance on the same . I have to display the packer header information i.e. packet size,packet protocol,source,destination.
  2 Comments
Akshat
Akshat on 19 Aug 2011
Atleast can anyone tell me which function is used to access ethernet packet ?
Victor Haro
Victor Haro on 25 Sep 2012
HI,
Maybe you can USE Tcpdump for mac or linux, or windump for windows.
You can send the results to TXT , example
tcpdump -enni 4 >> text.txt
And you can process the data with Matlab
Regards

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 19 Aug 2011
Wireshark and similar programs require privileged access to the ethernet device, as normally programs can only access packets destined for them.
Based upon what I have seen of the interface provided by the Instrument Control Toolbox, I don't expect this facility would be available using those tools.
I think you might have better success using the tcpudpip MATLAB File Exchange contribution. That would, though, in a sense be cheating, in that contribution uses the NetCat libraries that do all of the hard work and then just transfer the packets over to MATLAB.
  2 Comments
Akshat
Akshat on 20 Aug 2011
Thanks Walter for the valuable input. I discussed the same with my professor and he has asked me to generate the same output but from a stored *.pcap(Packet capture) file. I have found out about the Matshark(SharkTools) dissector tool for Matlab which will read from a stored packet database(Pcap). But that seems to work in a Linux environment(Have to learn that). My question now is :
Do you think it will be possible to display this information from the stored pcap file and will I be able to implement any filters to the same ?
Walter Roberson
Walter Roberson on 20 Aug 2011
Should be possible. Once you have the stored packets, the rest is mostly tedium, especially to find the documentation needed to fully decode proprietary protocols.

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!