![]() ![]() ![]() Now that we have a dump file available, we can try to read its content. A different approach would be to give a specially created method for as a callback or an anonymous delegate. The packets are written to this file by setting the callback to the dump file's Dump() method. ![]() This call opens a dump file and associates it with the interface. A call to OpenDump() is issued once the interface is opened.Press Ctrl+C to stop.") Ĭommunicator.ReceivePackets(0, dumpFile.Dump) Īs you can see, the structure of the program is very similar to the ones we have seen in the previous lessons. Open the dump file using (PacketDumpFile dumpFile = communicator.OpenDump(args))Ĭonsole.WriteLine( "Listening on " + selectedDevice.Description + ". PacketDeviceOpenAttributes.Promiscuous, // promiscuous mode SelectedDevice.Open(65536, // portion of the packet to capture // 65536 guarantees that the whole packet will be captured on all the link layers Open the device using (PacketCommunicator communicator = PacketDevice selectedDevice = allDevices If (! int.TryParse(deviceIndexString, out deviceIndex) || String deviceIndexString = Console.ReadLine() " + device.Name) Ĭonsole.WriteLine( " (" + device.Description + ")") Ĭonsole.WriteLine( " (No description available)") Ĭonsole.WriteLine( "Enter the interface number (1-" + allDevices.Count + "):") Print the list for ( int i = 0 i != allDevices.Count ++i)Ĭonsole.Write((i + 1) + ". IList allDevices = LivePacketDevice.AllLocalMachine Ĭonsole.WriteLine( "No interfaces found! Make sure WinPcap is installed.") Retrieve the device list on the local machine Check command line if (args.Length != 1)Ĭonsole.WriteLine( "usage: " + Environment.GetCommandLineArgs() + " ") ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |