[SOLVED] C program that will take as input a single binary file containing captured Ethernet d
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Before doing this assignment, you should know the various layers of networking technologies used on the Internet. Specifically, you need to know how headers (and often, footers) are added at each level. These headers contain data such as, oh, MAC and IP addresses.
Study the binary data with a good binary viewer/editor. If offset values are consistent from packet to packet, use offsets. Else, you will have to employ other means. In other words: first determine how you as a human can detect where the germane data are located. Then write your C code accordingly.
You need to understand the layout of your file. There maybe a correlation between your file and the network protocols, in which case understanding them will help but a binary file (if that is what it truly is) could be in any format so you need to get to the bottom of that first.
Thank u all.
The first 14 bytes from the file contains the MAC addresses. I am using fopen and fread to read the data into the array, should i allocate memory for the array? could somebody provide a sample code for creating the array and read in data?
You do need to allocate the memory before you read in the data.
You should be able to get examples of using fread() by a simple search, for example this link reads in the whole file, you don't need to do that but pay close attention to the malloc() and fread() statements along with the two error checking statements that follow them.