Write SNIFF according to IP head format

zhaozj2021-02-17  56

I want to start familiar with the best way to work with some programs to learn about the knowledge of the network, and have a certain understanding of the hack of Hacker. (I don't know if you agree?) :-) So I have organized some online basic knowledge, put it here. Why don't we write your own SNIFF? Let us work hard from the beginning and write some little tools. First, the common IP header format. IP head format =========== version number (4 digits) IP header length (4 digits) Service type (8-bit) Package length (16-bit) identification section (16-bit) flag (16) Bit) Survival Time (8-bit) Transport Protocol (8-bit) Header Authentication (16-bit) Send Address (16 Bit) Target Address (16 Bit) Option Fills Simple Description ============ 1. The IP header calculation is used in 32-bit words. It is often used to calculate the data start offset 2. The length of the packet length is represented by byte, including the length of the head, and thus the maximum length is 65535 bytes 3. The survival time indicates that the data is The time saved on the network before losing, in seconds. 4. The header checksum is the 16-bit and complement of all 16-bit words. 5. Option length is variable, fill zone as the option length change Used to ensure the length of the whole byte. C Description ============ Struct iphdr {byte VersioniHL; Byte Tos; Word Tot_len; Word; Word Frag_off; Byte TTL; Byte Protocol; Word Check; DWORD SADDR; DWORD DADDR; / * PUT OPTIONS Here. * /};

转载请注明原文地址:https://www.9cbs.com/read-30736.html

New Post(0)