In the previous article, I have already used the online version of tcpcopy. Today I will share with you the usage of the offline version of tcpcopy. The tcpcopy online version requires at least two machines, while the offline version requires only one machine.
Uninstall the online version of tcpcopy
Skip this step if no installation is available.
The code is as follows: |
Copy code |
# Cd tcpcopy-0.6.0 # Make uninstall # Cd .. # Rm-rf tcpcopy-0.6.0
|
Install libpcap
To install the offline version of tcpcopy, you must first install libpcap. The latest version I downloaded is the libpcap-1.3.0
The code is as follows: |
Copy code |
# Tar-zxvf libpcap-1.3.0.tar.gz # Cd libpcap-1.3.0 #./Configure # Make # Make install
|
Three errors will occur during installation.
./Configure: error: Your operating system's lex is insufficient to compile libpcap.
Solution:
# Apt-get install flex
Make: yacc: Command not found
Solution:
# Apt-get install biso
/Usr/local/lib/libpcap. so: undefined reference to 'pcap _ parse'
Solution:
# Apt-get install libpcap-dev
Install the offline version of tcpcopy
The code is as follows: |
Copy code |
# Tar-zxvf tcpcopy-0.6.0 .tar.gz # Cd tcpcopy-0.6.0 #./Configure -- enable-offline # Make # Make install
|
Tcpcopy for offline use
1. Capture packets from online servers
Tcpdump-I any tcp and port <port>-s 0-w online. pcap
2. Start the tested program on the test server.
3. Start intercept on the test server
The code is as follows: |
Copy code |
# Modprobe ip_queue # Iptables-I OUTPUT-p tcp -- sport <port>-j QUEUE # Intercept
|
4. Start tcpcopy on the test server
1
# Tcpcopy-I <packet capture file address>-x <port>-<local ip address >:< port>
Example image: