PackETH - Ethernet Packet Generator

PackETH - Ethernet Packet Generator

PackETH is GUI and CLI packet generator tool for ethernet. It allows you to create and send any possible packet or sequence of packets on the ethernet link. It is very simple to use, powerful and supports many adjustments of parameters while sending a sequence of packets.

Features:

  • You can create and send any type of Ethernet packets. Supported protocols:
    • ethernet II, Ethernet 802.3, 802.1q, QinQ, user-defined ethernet frame
    • ARP, IPv4, IPv6, user-defined network layer payload
    • UDP, TCP, ICMP, ICMPv6, IGMP, user-defined transport layer payload
    • RTP (payload with options to send sin wave of any frequency for G.711)
    • JUMBO frames (if network driver supports it)
  • You can customize the following:
    • delay between packets, number of packets to send
    • sending with max speed, approaching the theoretical boundary
    • change parameters while sending (change IP & mac address, UDP payload, 2 user-defined bytes, etc.)
  • Save the configuration to a file and load from it - pcap format supported


Installation

From GitHub:
git clone https://github.com/jemcek/packETH.git
cd packETH
./autogen.sh (you will need aclocal,autoconf,autoheader and automake installed)
./configure
make
make install
./packETH

From SourceForge:
Get the package from the DOWNLOAD page

Unpack it:
tar xjvf packETH.x.y.tar.bz
Cd to the right directory
./configure
make
make install

Depending on your Linux distribution and type of installation, additional packages may be needed.
  • Centos 7.2 (minimal):
yum install bzip2
yum groupinstall 'Development Tools'
yum install gtk2-devel.x86_64

  • Ubuntu 16.04 server:
sudo apt-get install build-essential
sudo apt-get install pkg-config
sudo apt-get install gtk+-2.0


  • Windows:
Get the windows zip package from the DOWNLOAD page. Extract the zip and click on packETH.exe for start.

  • Mac:
1. Download and install GTK+ 2.18.5

2. Download and extract packETH-1.7.1.tar.bz2

3. In packETH-1.7/configure, add the following four lines right after the comments at the top:
PKG_CONFIG_PATH=/Library/Frameworks/GTK+.framework/Versions/2.18.X11/Resources/lib/
pkgconfig
export PKG_CONFIG_PATH
PKG_CONFIG=/Library/Frameworks/GTK+.framework/Versions/2.18.X11/Resources/bin/pkg-config
export PKG_CONFIG

4. In packETH-1.7/src/function_send.c, add the following three lines above '#include <net/if.h>':
#include <net/bpf.h>
#include <fcntl.h>
#include <sys/socket.h>

5. In the same file, delete the following line:
#include <netpacket/packet.h>

6. Repeat steps 4 and 5 for packETH-1.7/src/function.c

7. In packETH-1.7/src/function_send.c, replace the body of the function sendbuilt() with the following line:
{ return 0; }


8. Repeat step 7 for the function sendsequence()

9. Replace the body of the function packet_go_on_the_link() with the following:
///////////////////////////////////////////////////////////////////

{                                                                //

    int c, fd, i;                                                //

                                                                 //

    struct ifreq ifr;                                            //

    char buff[100];                                              //

                                                                 //

    /* do we have the rights to do that? */                      //

    if (getuid() && geteuid())                                   //

    {                                                            //

error("need the su rights");                             //

return -2;                                               //

    }                                                            //

                                                                 //

    memset(&ifr, 0, sizeof(ifr));                                //

    strncpy (ifr.ifr_name, iftext, sizeof(ifr.ifr_name) - 1);    //

    ifr.ifr_name[sizeof(ifr.ifr_name)-1] = '\0';                 //

                                                                 //

    /* check that the specified interface exists */              //

    if(!if_nametoindex(ifr.ifr_name))                            //

    {                                                            //

snprintf(buff, 100, "no such interface: %s", iftext);    //

        error(buff);                                             //

close(fd);                                               //

return -2;                                               //

    }                                                            //

                                                                 //

    /* open a bpf device */                                      //

    fd = -1;                                                     //

                                                                 //

    for( i = 0; i < 100 && fd == -1; i++ )                       //

    {                                                            //

        sprintf( buff, "/dev/bpf%d", i );                        //

        fd = open( buff, O_RDWR );                               //

    }                                                            //

                                                                 //

    if ( fd == -1 )                                              //

    {                                                            //

error( "error - could not open bpf" );                   //

return -2;                                               //

    }                                                            //

                                                                 //

    /* set bpf to use the desired interface */                   //

    if ( ioctl( fd, BIOCSETIF, &ifr) < 0 )                       //

    {                                                            //

        snprintf( buff, 100, "error - BIOCSETIF ioctl failed" ); //

        error( buff );                                           //

        close( fd );                                             //

        return -2;                                               //

    }                                                            //

                                                                 //

    /* Set bpf to use ethernet frames */                         //

    u_int dlt = DLT_EN10MB;                                      //

    if ( ioctl( fd, BIOCSDLT, &dlt ) < 0 )                       //

    {                                                            //

        snprintf( buff, 100, "error - BIOCSDLT ioctl failed" );  //

        error( buff );                                           //

        close( fd );                                             //

        return -2;                                               //

    }                                                            //

                                                                 //

    /* Send the packet */                                        //

    c = write( fd, pkt, nr );                                    //

                                                                 //

    if ( c < 0 )                                                 //

    {                                                            //

        error( "error during write()" );                         //

        return -2;                                               //

    }                                                            //

                                                                 //

    if ( close( fd ) < 0 )                                       //

        error( "warning : close() returned -1" );                //

                                                                 //

    return ( c );                                                //

}                                                                //

///////////////////////////////////////////////////////////////////

10. Open a terminal window and navigate to the packETH-1.7 directory.

11. Execute the following command:
./configure --prefix="/usr/local" && make && make install

12. Run the newly-created packETH executable.


How To Use PackETH (Linux Tutorial)

1. Open terminal or console window

2. Type sudu su (Ubuntu, Debian) or su - root (Redhat, Centos) and enter password

3. Type packeth to start the program. The Builder window will open.


Inside the builder, you can specify whatever parameter you want. Don't forget, packETH uses raw socket, it means it will send whatever packet you specified on the link, regardless of interface IP address, routing, etc... It is a pure L2 generator. Once you specify all the required fields and select interface you are able to send one packet on the link by pressing the send button. In case some of the parameters are wrong you will get a warning. Also in case you are not a superuser, you will not be able to select an interface, the selection box will be empty. But if everything will go fine you will see a status bar message saying how many bytes were sent on selected interface (in case of an error you get -1 as result). If you want to send more than one packet you need to open the Gen-B page:


Inside the Gen-b page, you can select how many packets to send and how fast. Don’t forget this is a software-based generator, it means it maybe won’t be able to send as fast as you selected. But you can try. Anyway, the result is always visible in the status bar and these numbers seem to be accurate.  If the packet constructed inside the builder is ok you will see the contents of the packet in hex bytes. Otherwise, there is a message saying that packet contents are not ok. Inside the Gen-B window, you can also select some parameters that can be changed during sending, depending on what packet you created inside the builder. There are extra check-buttons if you want that checksums are recalculated after the changes. Note that adjusting parameters while sending lowers the total performance and correcting the checksum either. With the version 1.9, you also get the possibility to specify ramp mode for both speed (bandwidth) or size. Ramp can be increasing or decreasing.

If you want to send different kind of packets you need to open the Gen-S page:


Here you can select packets that were previously built inside the Builder. Note that packets must be in pcap format so you can import them also from Wireshark (tcpdump). In the top section, you can select between Auto and Manual mode. In the Auto mode, you can choose one of five distribution modes. Except for the random mode, you can see different timings by choosing a different mode. In the random mode the generator tries to be smart :). Besides timing, you can also specify the amount of traffic for each stream. In the manual mode, you select all of the parameters by hand.

The last window you can open is the Pcap window. Here you can load a pcap file (max 1000 packets will be loaded). By selecting a packet this packet is automatically loaded into Builder, so you can easily import any kind of pcap packet into packETH and send it right again.


Below is a detailed explanation of the MENU line buttons:


  • Builder - the window where you can create packet you want. Pressing on Send button inside the Builder will send one packet on the link.
  • Gen-b - window where you can send multiple copies of the packet currently defined in Builder. You can also adjust some parameters while sending.
  • Gen-s - window where you can send a different kind of packets. Packets have to be in pcap format
  • Pcap - here you can load packets previously captured with tcpdump, Wireshark etc... by clicking on a packet you load packet contents inside Builder.
  • Load - opens the dialog window where you select a packet you want to load into the Builder. if inside Pcap window, the load will open up to 1000 packets stored.
  • Save - you save the packet currently defined in Builder
  • Default (load) - you load the one packet that was lastly stored with the Default (save)
  • Default (save) - you can store the current packet contents and open it later by Default (load)
  • Interface - opens dialog where you can choose the interface you want to send to
  • Send - sends packet or multiple packets depending which window is open (Builder, Gen-s, Gen-b)
  • Stop - stops sending packets




Source: www.effecthacking.com
PackETH - Ethernet Packet Generator PackETH - Ethernet Packet Generator Reviewed by Anonymous on 9:59 PM Rating: 5