Skip to content

Instantly share code, notes, and snippets.

@zerkms
Last active December 10, 2018 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zerkms/6bfc35632bfa372eb9c2c244e43ad20f to your computer and use it in GitHub Desktop.
Save zerkms/6bfc35632bfa372eb9c2c244e43ad20f to your computer and use it in GitHub Desktop.
refrag + tcpreplay with libdnet (so that it was possible to refragment packets captured with pcap while replaying them with tcpreplay)

refrag

mkdir -p ~/src/
cd ~/src/
git clone https://github.com/zerkms/ipfrag
cd ipfrag
sudo apt install make virtualenv python-minimal
make
source ./venv/bin/activate
export PATH=$PATH:/usr/sbin

python defrag.py

tcpreplay with libdnet

mkdir -p ~/src/
cd ~/src/

wget http://prdownloads.sourceforge.net/libdnet/libdnet-1.11.tar.gz
tar zxf libdnet-1.11.tar.gz
cd libdnet-1.11
./configure
make
sudo make install

cd ~/src/

wget https://github.com/appneta/tcpreplay/releases/download/v4.2.6/tcpreplay-4.2.6.tar.gz
tar zxf tcpreplay-4.2.6.tar.gz
cd tcpreplay-4.2.6
sudo apt install build-essential libpcap-dev

vi src/fragroute/pkt.h
# Change PKT_BUF_LEN to something like 9000

./configure
make
sudo ln -s /usr/local/lib/libdnet.1 /usr/lib/x86_64-linux-gnu/libdnet.1

./src/tcpreplay --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment