Pages

Wednesday, July 14, 2010

Libpcap

I have written a small sample code to get you started. You can download it here. to compile the code: gcc code.c -lpcap
and then execute the output file as: sudo ./a.out

Here is a code which generates an ICMP packet, you should follow the structure given in this code. Compile and run the code as mentioned above.

4 comments:

  1. Sorry, user dcn is not allowed to execute '/usr/bin/make install' as root on z3d-dcn.

    what to do???

    Hassaan Zaheer

    ReplyDelete
  2. you need to run the output file as an admin. Use the following command

    sudo ./a.out

    As for the error it seems you tried to install something, you dont need to install any new libraries or stuff in order to run the code. just compile as mentioned in post and execute the output file as admin as mentioned.

    ReplyDelete
  3. dcn@z3d-dcn:~/Desktop$ sudo ./a.out
    [sudo] password for dcn:
    Sorry, user dcn is not allowed to execute './a.out' as root on z3d-dcn.

    ReplyDelete
  4. The image you took from university has this issue, either you can wait till Monday or you refer to my post http://zaidmunir.blogspot.com/2010/07/libpcap-in-ubuntu.html

    ReplyDelete