Thread: protocol testing...

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    77

    protocol testing...

    hello, may be someone know, how I can send packets from collected(via tcpdump) those before in pcap-dump to my target ip? I need this for testing my program with specify protocol without real interaction.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by quantt View Post
    hello, may be someone know, how I can send packets from collected(via tcpdump) those before in pcap-dump to my target ip? I need this for testing my program with specify protocol without real interaction.
    Take WinPCAP SDK (sorry - take PCAP lib for linux), take sample code that reads packets from the dump file, write application using this sample, that will read packets and then send them to the preconfigured port...

    As a starting point look for function pcap_open_offline
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    77
    thanks for your reply, but how I can change addres while reading from the dump?

    I'm collecting the data to pcap_t and then injecting it and there I'm unsure with 2 and 3 arguments, where I can get it?

    pcap_t *p;
    // int pcap_inject(pcap_t *p, const void *buf, size_t size)
    sentbytes=pcap_inject(p, (void*)&data , sizeof(data) ));

    and more over, I can't change second argument, because it's a const.

    actually, I can filtering the dump by this...
    pcap_compile();
    pcap_setfilter();

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Software Testing, references & bibliography
    By Mario F. in forum Tech Board
    Replies: 5
    Last Post: 08-23-2009, 09:51 PM
  2. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  3. C++ bit testing
    By Vicious in forum C++ Programming
    Replies: 3
    Last Post: 09-19-2004, 11:44 AM
  4. Blending and Depth Testing
    By Thunderco in forum Game Programming
    Replies: 2
    Last Post: 03-08-2004, 06:37 PM
  5. about testing a program
    By Abdi in forum C Programming
    Replies: 1
    Last Post: 06-09-2002, 12:51 AM