Generating random packets with certain characteristics and writing them to pcap file

Discussion in 'C Programming' started by cowboy2474, Oct 2, 2013.

  1. cowboy2474


    Oct 2, 2013
    Likes Received:

    I'm trying to generate random packets (not so much random in contents but more so random in wait times between them) and output them to a pcap file.

    Is there any way to do this using the libpcap library? I know I've included a <pcap.h> in the past to read through existing pcap files and traverse the packets in a sequential manner (to replay them back out), but what about generating random timestamps and writing certain payloads to a pcap file? I want to be able to do this for arbitrary Ethernet frames (not just IP, UDP, TCP, etc. just the raw Ethernet frames), and provide microsecond timestamps.

    Any experience with this? Am I better off doing this in a language like Python (or Haskell, etc.) -- is there an easier way in one of those?

    Thank you all!

    cowboy2474, Oct 2, 2013
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.