and you'll see more information. Although the packet has already passed, but Yanguoliusheng, we can get more information by fetching the packet, thanks to Wireshark/tshark (a character interface pcap file analysis tool, similar to Wireshark, but more suitable for playing mechanical keyboard command line powder used) /shookshark (...) These tools allow us to actually analyze
This is a simple analysis of their own pcap file, easy to read Pcap file, we refer to the use of the bar
Copy Code code as follows:
InputStream is = DataParser.class.getClassLoader (). getResourceAsStream ("Baidu_cdr.pcap");
Pcap Pcap = Pcapparser.unpack (IS);Is.close ();byte[] t = pcap.getdata (
Pcap is a data packet capture library, which is used by many software as a data packet capture tool. Wireshark also uses the pcap library to capture data packets. The packets captured by pcap are not the original network byte streams, but are assembled to form a new data format.The file format of a data packet captured by pca
Scapy is easy to operate with Pcap files in a Linux environment, but under Windows, In particular, in the python2.7 environment will encounter a variety of dependency packages can not be used, the most obvious may belong to Dnet and Pcap Python dependency package, because Scapy Conf.use_pcap and Conf.use_ Dnet cannot be configured in a Windows environment and is forcibly set to 1 in scapy\arch\windows\__ini
/* Pcap_1.c */# include # Include # Include # Include # Include # Include # Include
Int main (INT argc, char ** argv)
{
Char * dev;/* Name of the device to use */
Char * Net;/* dot notation of the network address */
Char * mask;/* dot notation of the network mask */
Int ret;/* return code */
Char errbuf [pcap_errbuf_size];
Bpf_u_int32 netp;/* IP */
Bpf_u_int32 maskp;/* subnet mask */
Struct in_addr ADDR;
/* Ask pcap to find a valid device for use to
Step 1: download the relevant source code
Pycap: http://code.google.com/p/pypcap/
Sendpkt: http://code.google.com/p/sendpkt/
Dpkt: http://code.google.com/p/dpkt/
WDP http://www.winpcap.org/install/bin/WpdPack_4_0_2.zip
Mingw: http://www.mingw.org/
Step 2: Compile
1. decompress the two files in pycap and WDP to the same directory. Note:2. Create a setup. cfg file in the decompressed pycap folder with the following content:
[Build]Compiler = mingw32
3. Start Compilation
C: \
Through the TCP/IP protocol learning, I wrote a can achieve the Pcap file in the IPV4 TCP stream extraction, as well as extract the specified TCP stream, in order to learn, did not adopt the third party package parsing pcap, but the analysis of the bytes stream, the core idea is: If you want to extract TCP Content, in the lower-level IPV4 protocol to determine whether the protocol is TCP, and then determine
Recently, in python, I found a pcapy code to process pcap data.Something that was a long time ago should have been a semi-finished product in the project team. Today, I reinstalled the machine and accidentally turned it out. This script reads a file saved by libpcap, filters data as required, and finally saves the filtered data to a new file. The running environment should be 2.5.Original in http://muyublog.appspot.com/2010/08/31/python-pcapy.html1234
Struct pcap [pcap-int.h]{Int FD;/* file description, which is actually socket *//* On the socket, select (), Poll (), and other I/O multiplexing functions can be used */Int selectable_fd;
Int snapshot;/* the maximum length of the captured data packet that the user expects */Int linktype;/* device type */Int tzoff;/* Time Zone location, which is not actually used */Int offset;/* boundary alignment offset */
Tags: http OS AR for SP strong file data Div Pcap is a data packet capture library, which is used by many software as a data packet capture tool. Wireshark also uses the pcap library to capture data packets. The packets captured by pcap are not the original network byte streams, but are assembled to form a new data format.
The file format of a data packet captur
HTTP packets in the PCAP package can be easily parsed using scapy, scapy_httpScapy_http can be downloaded in https://github.com/invernizzi/scapy-http, the address is also given a simple example program, according to this sample program I modified an output PCAP packet in the source destination address of the HTTP packet, The payload applet is as follows:where P is a packet, scapy_http divides it into:Ethern
Pcap File Format
Classification: Comprehensive Technology
Transfer http://songwensheng.javaeye.com/blog/674686
Pcap File Format: The pcap file format is the format in which bpf saves the original data packet. Many software applications are used, such as tcpdump and wireshark,
Understanding the pcap format can enhanc
The pcap file format is the format in which BPF saves the original data packets. Many software applications are used, such as tcpdump and Wireshark. Understanding the pcap format can enhance understanding of the original data packets, you can also manually construct any data packet for testing.
The pcap file format is:File Header in 24 bytesThe data packet header
Preface
The data structure has already been defined, so it's time to formally parse the Pcap file.Note: The following only the core code, the project all the code will be at the end of the article to give the download link Resolution pcap file
1 Read the entire Pcap file to memory
FileInputStream FIS = null;
try {
fis = new FileInputStream (
Installation method One, sudo apt-get install Libpcap-devInstallation Method II,Go to http://www.tcpdump.org/to download the latest libpcap.tar.gz packAfter decompression./configure here I did not add--frefix=path results to see belowMakeMake installDuring the installation process./configure when the error, no lex we use flex instead, yum install flex canError in make will not find the command YACC we use Bison instead, yum install Bison can--------------error when you remember to use make clean
byte sequence (hbo,host byte order): Different machine HBO is not the same, related to CPU design, the order of data is determined by the CPU, and operating system independent.such as the Intel x86 structure, the short type number 0x1234 is expressed as a decimal, the int type number 0x12345678 is expressed as 78 56 34 12such as the IBM Power PC structure, the short type number 0x1234 is expressed as a 0x12345678, the int number is represented as 12 34 56 78For this reason there is no communica
pcap_open () function.Snaplen. For exampleSnaplen= 65535, the four bytes become FF 00.
Then, the network type is recorded in 4 bytes. For example, 1 in decimal format indicates Ethernet, 6 indicates the ring-based network, and 15 indicates the hardware format of Frame Relay. Generally, in an Ethernet environment, the four bytes are 01 00 00.
The above fields are part of the file header, followed by data packets. Each packet has a corresponding 16-byte mark information. The first 8 bytes are
The following describes the default *. pcap file storage format of ethereal.
Description of each field in the pcap File Header 24B:Magic: 4b: 0x1a 2B 3C 4d: used to mark the start of the file Major: 2b, 0x02 00: The main version number of the current file minor: 2b, 0x04 00 current file minor version number thiszone: 4B local standard time; all zero sigfigs: 4B timestamp precision; all zero snaplen: 4B ma
Note that this is the 1.0 series of tcpcopy.
First, please understand the 1.0 series architecture related content:http://blog.csdn.net/wangbin579/article/details/8949315
http://blog.csdn.net/wangbin579/article/details/8950282
having understood the rationale, let's explain how to use the Pcap interface to send request packets
in the online system, the following methods are used to compile tcpcopy./configure--
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.