0

I am able to send a packet to a specific IP address using scapy like this. Now, I am new to libcap and I would like to do the same with pcap_inject(). I am unable to find any code snippet online that uses pcap_inject() to send to specific ip address. Could anyone help me ?

Ahmed Hussein
  • 715
  • 1
  • 15
  • 38
  • Have a look at [this](http://www.microhowto.info/howto/send_an_arbitrary_ethernet_frame_using_libpcap.html) – hessam hedieh Jan 09 '19 at 21:03
  • But this injects a packet on a local device by device name, not the ip address – Ahmed Hussein Jan 10 '19 at 07:13
  • Isnt the ARP sending example code in link above redirecting to a specific IP? – hessam hedieh Jan 10 '19 at 07:19
  • I see but the main function code is missing. All what I see is that the IP parameter is passed to the main function, but it didn't clarify how it was used for the actual redirection – Ahmed Hussein Jan 10 '19 at 09:08
  • first,you want to find mac address of interface and default gateway.After,you can generate an data frame.(ethernet headers+ip headers+tcp or udp headers+application layer protocol headers + data) – Janith Aug 10 '20 at 02:45

0 Answers0