header information, we see cooked Capture, not ethernet! Crucially, the Cooked capture describes a meta-information length of 16 bytes instead of 14 bytes of Ethernet. The following is an example of cooked capture's head:This information can be obtained through linktype. Why do you have this cooked capture type of packet? Because the capture tool in the case of-I any, can not be used in a unified way to deal with the length of the link layer, such as many protocols, the interior also distinguis
packet sent by the client
PSH (1 bit): Push function, request to push buffered data to the receiving application
RST (1 bit): Reset connection
SYN (1 bit): Sync serial number. This flag should be set only for the first packet sent from each end. Some other flags and fields change meaning according to this flag, some only work when set 1 o'clock, while others are only valid at 0 o'clock
FIN (1 bit): Last packet from sender
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: \
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
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 */
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--
Yesterday saw the most important part of analyzing the packet. This process of analyzing UDP is basically readable in front of it, and it is mainly a part of the analysis of the message. The figure found in the blog, for this process, in turn, is: Application layer data, encapsulated into UDP or TCP messages, coupled with the IP header, and then with the Ethernet header, it becomes a data frame can be propagated at the link layer.
The Ether
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
user message cannot be placed in a sctp group, the message can be divided into several data blocks.
Sctp Header
The sctp public grouping header contains the source port number, destination port number, verification tag, and checksum)
1. Source Port Number (16 bits)
The source port number identifies the sctp Port Number of the sctp sending endpoint. The receiver can use the source port number, source IP address, destination port number, and destination IP address to identify the coupling of the
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
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
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
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.