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
In Android, use TCPDUMP to capture Wireshark to analyze data.GuideIf you want to analyze the network data interaction of an APP in Android, You need to capture packets on the Android mobile phone. The most common packet capture tool is not tcpdump, and tcpdump is used to generate pcap files identified by Wireshark, then, download the
Wireshark is the most popular network analysis tool in the world. This powerful tool captures data from the network and provides users with a variety of information about the network and upper layer protocols. Like many other network tools, Wireshark uses the Pcapnetwork library for packet capture.AD:Wireshark is the most popular network analysis tool in the world. This powerful tool captures data from the
and look for it. I will not explain it.
ØADB push c: \ wherever_you_put \ tcpdump/data/local/tcpdump
Modify file attributes
ADB Shell
Su
Chmod 6755/data/local/tcpdump
Command Line packet capture
/Data/local/tcpdump-p-VV-S 0-W/Sdcard/capture. pcap-Which path do you write by the way?
(If tcpdump: no suitable device found appears. Make sure that you are using the root permission)
^ C after the packet capture is complete and exit Android bash
ADB pull/
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 (
Wireshark Data capture Wireshark basic knowledge wireshark basic knowledge of the teaching and learning routinesIn this network Information age, computer security is always a worrying problem, network security is more. Wireshark, as an internationally renowned network data capture and analysis tool, can be widely used
toolsFiddler accesses traffic on the PC as a proxy on the mobile phone side. Then Wireshark can crawl the request on the PC, so as to use Wireshark to grab the phone's request.The second type: Wireshark+tcpdump toolsOf course, we can also use the Tcpdump tool to directly grab the phone's request data, generally saved as pcap
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
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
Wireshark data grasping Wireshark capturing data Wireshark grasping the packet methodWhen using Wireshark to capture Ethernet data, you can capture the analysis to your own packets, or you can capture the same LAN and capture the other person's packets in case you know the IP address of the other.Wireshark capturing it
after a rough look. In both cases, you do not have to set options for this area.2.2.1 Input Box: FileSimply, specify the file name and its full path directly by typing or using the rear brose button. The default is white space, which means that the captured packets are stored in a temporary file in the default cache directory.2.2.2 Options: Use pcap-ng formatChecking this option means that you want to use the PCAPNG format for
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
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--
Pcap, the packet Capture library, grabs the package library and provides a high-level interface to the capture system. All packets on the network, even those sent to other hosts, can be captured through this mechanism. It also supports saving captured packets as local files and reading information from local files. There are a few more details to refer to: http://baike.baidu.com/view/6584893.htm Some introductions of Libpcap, http://baike.baidu.com/v
Demand:1. Read the PCAP message captured by Wireshark2. Filter out specific messages3, analysis of the interval between the specific message is consistent with the lawKey function or variable:Rdpcap ()Filter (): Using a lambda functionP.timeLS () can be used to check the text of the supported fields, because the link layer and the IP layer with the field is repeated, you may use P[IP].SRC to represent the IP source address, type is a string.P.load rep
.
For definitions, see http :\\
3. Block length (16 bit)
The block length includes chunk type, Chunk flags, Chunk length, and Chunk value.
4. Block Value (variable length)
The block value content transmits the actual information in the block. The content is determined by the message block type. The length of the block value is not long.Sctp struct Definition
// Sctp header typedef struct _ sctp_header {_ int16 srcport; _ int16 dstport; _ int32 ivertag; _ int32 ichecksum;} _ sctpheader; // chunk
Pcap file format Analysis
I. Basic Format:File header data packet ......
Ii. File Header structure:Sturct pcap_file_header {DWORD magic; Word version_major; Word version_minor; DWORD thiszone; DWORD sigfigs; DWORD snaplen; DWORD linktype;} Description: 1. identifier: 32-bit, the value of this flag is 0xa1b2c3d4 in hexadecimal notation. A 32-bit magic number, the magic number has the value hex a1b2c3d4.2, Master version number: 16 bits, default value:
1. Copyright NoticeThis series of articles is I spent a lot of effort written, Wireshark is open source software, I am also willing to share technical knowledge and experience, is to appreciate and promote the spirit of open source, so anyone who see this article can be reproduced at will , but only a request:In the case of large paragraphs or even full-text references to this series of articles, it is necessary to retain My Network name (Zhaozi) and
Install and run wireshark in linux, and run wireshark in linux
I. InstallationRun the command as root: yum install wiresharkIi. RunningEnter the command in the terminal:# WiresharkBash: wireshark: command not found# Whereis wiresharkWireshark:/usr/lib/wireshark/usr/share/wireshark
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.