Input: IP address ---> output: the country where the IP address is located, place name, and sometimes even fine-tuned to the floor.
The IP database on the network is the most popular with the pure version. lumaqq also uses the pure version of the IP database as the basis for IP query functions. However, there are very few documents about the format, and I finally found several documents on the Internet to find out the details. Now I will talk about qqwry. the data structure of DAT is displayed. Let more people understand its details.
Detailed analysis:
1. Data storage format of QQ. DAT:
1.1 three parts: File Header; record area; index area; 1.2 Details three parts: 1.2.1 First part: the file header is 8 bytes in length, the first four bytes store the absolute address of the first index, and the last four bytes store the absolute address of the last index. Format: 1.2.2 Second: Index Area: the format of the index area is as follows:
Let's talk about the starting IP address and ending IP address. For example, China, the United States, and the United Kingdom each country has a different IP segment, which is composed of the starting IP address and ending IP address, from the starting IP address to the ending IP address, all IP addresses constitute what we call an IP segment. For example: 010.018.132.000 010.018.132.255 [Hebei] [Chengde 169 users]
010.018.160.000 010.018.426255 [Hebei] [Tangshan] Let's talk about the storage structure of the index area. It stores many indexes. The format of each index is 7 bytes. The first four bytes indicate the starting byte of an IP segment, the last three bytes are the addresses of all IP records in the IP segment starting with this starting IP address. That is to say, it is an absolute address used to query the country linked to the record area, region data. 1.2.3 Part 3: record area: the data format in the record area is not fixed. The data mainly includes the following types: A: end IP Address B: Country records (ended at 0x 00) C: region records (ended at 0x 00) D: identifier character: E: absolute offset I have explained this question in detail based on my understanding and feelings. I hope to help you. Appendix: The images in this article are for reference.