Hello everybody,
I'm trying to code a program which makes the following:
It sends an ARP request frame and when it gets the reply, extracts the IP address of source and writes it to a .txt file. This is gonna be done with many hosts (with a for() loop), so, the text file would look like this:
192.168.1.1
192.168.1.2
192.168.1.3
...
After that loop, the program will construct ARP frames, but it will use as target IP addresses the ones previously written in the .txt file one by frame. I'm okay with sockets, but i need help with the file access.
What i need, is a way to write the addresses in the file from a variable(arp_src_addr, for example), without overwritting previous ones in the file, and once the program is done with receiving frames, a way to read the .txt file and put the first IP of the list into a variable, so i can use that variable to construct a frame with that address, then read again the file and put the second IP address into the variable, then the third, and so on...
Please help me, it's urgent!