Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a domain name registration IP address query method, which is used for comprehensively and visually displaying a registration domain name, a domain name IP address field and domain name owner information and querying according to the requirements of a user, and as shown in figure 1, the method comprises the following steps:
step 101: receiving a user query instruction;
step 102: inquiring in a registered IP address management database according to a user inquiry instruction to obtain an inquiry result; wherein, the query result comprises: registering a domain name, domain name owner information and a domain name IP address field; the registered IP address management database is pre-established according to an APNIC data file of the Asia-Pacific Internet information center;
step 103: and sending the query result to the user side.
As can be seen from fig. 1, in the embodiment of the present invention, a user query instruction is received; inquiring in a registered IP address management database according to a user inquiry instruction to obtain an inquiry result; wherein, the query result comprises: registering a domain name, domain name owner information and a domain name IP address field; the registered IP address management database is pre-established according to an APNIC data file of the Asia-Pacific Internet information center; sending the query result to the user side; the domain name IP address field and the domain name owner information of the registered domain name can be comprehensively and visually displayed, and the query is carried out according to the received user query instruction to obtain the query result meeting the user requirements.
In a specific implementation, a user query instruction is first received, where the user query instruction may include any known information of the registered domain name to be queried, such as the registered domain name, the domain name owner, the domain name IP address field, or any combination thereof.
After receiving a user query instruction, querying in a registered IP address management database according to the user query instruction to obtain a query result; wherein, the query result comprises: registering a domain name, domain name owner information and a domain name IP address field; the registered IP address management database is established in advance according to the APNIC data file of the Asia-Pacific Internet information center.
The registered IP address management database is pre-established according to the method shown in fig. 2, and includes:
step 201: acquiring an APNIC data file; the APNIC data file comprises a plurality of registration domain names;
step 202: extracting domain name registration information based on whois inquiry instructions according to the APNIC data file; the domain name registration information comprises domain name owner information and a domain name IP address field;
step 203: and storing the registered domain name, the registered owner information and the domain name IP address field into a registered IP address management database in a tree structure.
In specific implementation, the domain name owner information may be directly extracted according to the whois query instruction, or the domain name user name netname may be extracted according to the whois query instruction, and more detailed information of the registered owner may be obtained through analysis according to the extracted netname.
When extracting the domain IP address field in the domain registration information, there may be three cases:
the extracted domain name IP address field is completely the same as that which is required to be obtained at present, namely, the obtaining is finished at one time;
when the extracted domain name IP address field is a subsection of the current section which needs to be obtained, the domain name IP address field needs to be obtained for many times;
the initial address of the domain name IP address field obtained by extraction is smaller than the initial address of the field to be obtained, and multiple times of obtaining are required.
For the above three cases,step 202 specifically includes:
judging whether the extracted domain name registration information meets preset conditions or not according to the preset range of the IP address field;
if the range of the domain name IP address field obtained by extraction is smaller than the preset range of the IP address field, re-extracting the domain name IP address field obtained by extraction according to the first preset configuration parameter until the domain name registration information obtained by extraction meets the preset condition;
if the initial address of the domain name IP address field obtained by extraction is smaller than the initial address in the preset range of the IP address field, re-extracting the domain name IP address field obtained by extraction according to a second preset configuration parameter until the domain name registration information obtained by extraction meets the preset condition;
and if the extracted domain name registration information meets the preset condition, not processing.
In specific implementation, the extracted domain name IP address field is re-extracted according to the first preset configuration parameter, for example, the integer value of the termination address of the extracted domain name IP address is added with 1, and then re-extracted repeatedly until the domain name registration information obtained by extraction meets the preset condition; and re-extracting the extracted domain name IP address field according to a second preset configuration parameter, for example, adding 256 to the integer value of the initial address of the extracted domain name IP address, and re-extracting repeatedly until the extracted domain name registration information meets the preset condition.
For example, when the domain name registration information is obtained from a certain large segment of IP address record, multiple segments of domain name IP addresses registered to each child node may be included, for example, in beijing telecommunications, there may be several subsections of domain name IP addresses below hai lake, happy, and the like, the domain name registration information of hai lake is returned for the first time, it is determined that the end address of the hai lake is still within the preset range of the IP address segment (beijing), and if the end address needs to be searched again after +1, the happy domain name registration information is returned until all the domain name registration information corresponding to the preset range of the IP address segment is successfully obtained. And when the preset range of the IP address field is happy, returning the domain name registration information of the hai lake and the happy for the first time, wherein the initial address of the extracted domain name IP address field is smaller than the initial address in the preset range of the IP address field, the initial address needs to be shifted backwards by 1C (integer value plus 256), searching is carried out again, and the happy domain name registration information can be returned after repeating for many times.
In a specific embodiment, the implementation process ofstep 203 includes:
the information of registered owners is used as a root node of a tree structure and is stored in a registered IP address management database;
taking the registered domain name as a branch node of a tree structure, and storing the branch node into a registered IP address management database; the registered domain names of the same registered owner are stored under the same root node;
taking the domain name IP address field as a leaf node of a tree structure, and storing the leaf node in a registered IP address management database; and the domain name IP address fields of the same registered domain name are stored under the same branch node.
The tree structure is a nested structure of a hierarchy, and the outer layer and the inner layer of the tree structure have similar structures, so that the structure can be expressed recursively. The various dendrograms in the classic data structure are a typical tree structure: a tree can be simply represented as a root, subtree (branch), leaf. A tree structure is a data structure in which a "one-to-many" tree relationship exists between data elements.
After the storage is finished, the tree structure and the stored information can be displayed to the user so as to comprehensively and visually reflect the corresponding relation among the registered domain name, the domain name IP address field and the domain name owner information.
In a specific embodiment, the number of registered domain names of the same domain name owner, the number of domain name IP addresses, and the like may be counted, and the statistical result may be displayed to the user.
A specific example is given below to illustrate how embodiments of the present invention perform domain name registration IP address queries. The present example is a domain name registration IP address query system constructed by applying the above domain name registration IP address query method.
The system comprises a registration information browsing and inquiring subsystem, a data file acquiring subsystem, a registration information acquiring and analyzing subsystem and a registration information warehousing subsystem. The data file acquisition subsystem, the registration information acquisition and analysis subsystem and the registration information storage subsystem are used for pre-establishing a registration IP address management database, and the registration information browsing and query subsystem is used for managing the database according to the established registration IP address and querying corresponding information according to user requirements.
First, the data file acquisition subsystem commands, via wget (a free tool for automatically downloading files from the network):
http://ftp.apnic.net/apnic/dbase/data/country-ipv4.lst--output-document=/slview/nms/d
ata/country-ipv4.lst
to obtain an APNIC data file, this file is currently IPV4(Internet Protocol version 4), and it may be extended to support obtaining IPV6(Internet Protocol version 6) file in the future.
After the data file is successfully acquired, calling a registration information acquisition and analysis subsystem interface, and extracting and acquiring domain name registration information through whois3-L IP command, wherein the specific execution logic is shown in FIG. 3, and because the function of the registration information acquisition and analysis subsystem is complex, the subsystem is divided into a plurality of sub-modules shown in FIG. 4: the system comprises a registration information extraction module, a registration information segmentation searching module, a registration information analysis module, a registration information memory writing module and a segmentation searching exception handling module. By dividing a plurality of processing modules under the subsystem, nesting calling and organic coupling are realized among the modules, so that the processing logic is more flexible, the program errors are reduced, and the extraction efficiency is improved.
An execution logic diagram of the registration information extraction module is shown in fig. 5, and is used for extracting and obtaining domain name registration information based on a whois query instruction according to an apic data file, where the domain name registration information includes domain name owner information and a domain name IP address field. When the range of the extracted domain name IP address field is smaller than the preset range of the IP address field, the registration information segment search module is called in a nested manner, and a specific execution logic diagram is shown in fig. 6. When the initial address of the extracted domain name IP address field is smaller than the initial address in the preset range of the IP address field, the segment search exception handling module is called in a nested manner, and the specific execution logic is as shown in fig. 7. The processing procedures shown in fig. 5, fig. 6, and fig. 7 may all call a registration information analysis module in a nested manner, so as to analyze and obtain more detailed information of all registered persons, and a specific execution logic of the registration information analysis module is shown in fig. 8.
Since the time required for acquiring the APNIC address information is long, when extracting the registration information, as shown in fig. 9, the data may be directly recorded in the memory data structure by using the registration information memory writing module, and the registration information memory writing module is further configured to calculate the NetID of the network code of each registration domain name. The calculation formula is as follows:
NetID=a×1014+b×1010+c×106+d
wherein a represents 4-bit national code and is represented by national prefix in international long term, for example, China is 0086;
b represents 4-bit operator codes, the codes are represented by [1-9999], wherein 9999 represents independent companies which do not belong to any operator and represent non-operators;
c represents 4-bit province code, the code range is represented by [ 0000-: 351, a step of; 9999 represents no province found;
d represents sequence coding, the coding range is represented by [1-999999], if the domain name owner is an operator, the segment is 0, and if the domain name owner is an independent company of a non-operator, the sequence is sequentially increased.
After extraction is completed, a registration information storage subsystem is called, a domain name, information of a registered owner and a domain name IP address field are registered in a memory data structure and stored in a database in a tree structure, and the network coding NetID can be stored in the database together.
After the storage is completed, the tree structure and the stored information can be displayed to the user, as shown in fig. 10, the interface adopts a Frame (label) separation mode, the tree structure on the left displays information of countries, domain name owners and the like, and the detailed information of corresponding levels is displayed on the right. After clicking China, all domain name owners in China and the registered domain names owned by all the owners can be seen, and the right side displays the registered domain name number counting result and the IP address number counting result of all the domain name owners.
In the tree structure on the left side, a certain operator, such as chinese telecommunications, is clicked, and a specific interface is displayed as shown in fig. 11, including all registered domain names (network names), specific domain user names (network chinese), network codes NetID, network descriptions, and domain IP address statistics of chinese telecommunications.
In the tree structure, clicking a branch company of a certain operator, such as china-QH, or double clicking the network code in fig. 11, the display interface is shown in fig. 12, and specific domain IP addresses, such as start address, end address, address type, etc., are displayed.
In the tree structure, the independent company is clicked, the display interface is as shown in fig. 13, after the network name which the user wants to query is input in the network name, the query is clicked, the statistical list can be filtered, and the query is performed in a fuzzy matching mode. Double-clicking a certain network code in fig. 13, the display interface is shown in fig. 14, and displays specific domain IP addresses, such as start address, end address, address type, registration name, etc.
Meanwhile, if it is desired to query information such as a registered domain name and a domain name owner corresponding to a certain IP address, the address query link in the page shown in fig. 10 may be clicked, and the display interface is as shown in fig. 15. When a user inputs an IP address format of a desired query as a.b.c.d/mm, for example, an address segment of the desired query is 110.116.0.0/24, the query needs to be converted into a start-stop address in a numeric format (only one IP address is input, and the start-stop address is the same), and the conversion algorithm is:
nIP (initial) ═ A × 2563+B×2562+C×256+D;
nIP (end) nIP (start) + mm
Wherein nIP (start) indicates the integer number format of the start IP address; nIP (end) indicates the integer number format of the end IP address.
If the user inputs an IP address segment, the IP address is firstly converted into an integer format, then the difference is calculated, and the implementation code is as follows:
nDiffIp=nStopIp–nStartIp+1
IF nDiffIp>2563THEN
Ret_classA=nDiffIp/2563
ELSEIF nDiffIp>2562
Ret_classB=nDiffIp/2562
ELSEIF nDiffIp>256
Ret_classC=nDiffIp/256
ELSE
Ret_IpNumber=nDiffIp
ENDIF
through the address conversion, IP addresses in various forms can be inquired, the inquiry is more flexible, and the operation of a user is facilitated.
According to a certain IP address, inquiring corresponding information, wherein the starting and ending address of the domain name IP address in the returned inquiry result is (x, y), and the condition that the (x, y) and the starting and ending address (p, q) of the certain IP address in the inquiry condition are in crossed record is required to be met, namely x is less than or equal to p and y is more than or equal to q.
The pages shown in fig. 10-15 can support functions of sorting by category, page display, Excel export and the like.
Based on the same inventive concept, embodiments of the present invention further provide a domain name registration IP address query apparatus, and since the principle of the problem solved by the apparatus is similar to the domain name registration IP address query method, the implementation of the domain name registration IP address query apparatus can refer to the implementation of the domain name registration IP address query method, and the repeated parts are not repeated, and the specific structure is shown in fig. 16:
aninstruction receiving module 1601, configured to receive a user query instruction;
aninformation query module 1602, configured to query in the registered IP address management database according to the user query instruction, so as to obtain a query result; wherein, the query result comprises: registering a domain name, domain name owner information and a domain name IP address field; the registered IP address management database is pre-established according to an APNIC data file of the Asia-Pacific Internet information center;
aresult sending module 1603, configured to send the query result to the user side.
In specific implementation, the apparatus for querying a domain name registration IP address according to a specific embodiment further includes: the database presetting module, as shown in fig. 17, specifically includes:
afile acquiring unit 1701 for acquiring an apic data file; wherein the APNIC data file comprises a plurality of registration domain names;
a domainname analyzing unit 1702, configured to extract domain name registration information based on the whois query instruction according to the apic data file; the domain name registration information comprises domain name owner information and a domain name IP address field;
astatistic storage unit 1703, configured to store the registered domain name, the information of the registered owner, and the domain name IP address field in a registered IP address management database in a tree structure.
In specific implementation, the domainname analysis unit 1702 is specifically configured to:
judging whether the extracted domain name registration information meets preset conditions or not according to the preset range of the IP address field;
if the range of the domain name IP address field obtained by extraction is smaller than the preset range of the IP address field, re-extracting the domain name IP address field obtained by extraction according to the first preset configuration parameter until the domain name registration information obtained by extraction meets the preset condition;
if the initial address of the domain name IP address field obtained by extraction is smaller than the initial address in the preset range of the IP address field, re-extracting the domain name IP address field obtained by extraction according to a second preset configuration parameter until the domain name registration information obtained by extraction meets the preset condition;
and if the extracted domain name registration information meets the preset condition, not processing.
In specific implementation, thestatistical storage unit 1703 is specifically configured to:
the information of registered owners is used as a root node of a tree structure and is stored in a registered IP address management database;
taking the registered domain name as a branch node of a tree structure, and storing the branch node into a registered IP address management database; the registered domain names of the same registered owner are stored under the same root node;
taking the domain name IP address field as a leaf node of a tree structure, and storing the leaf node in a registered IP address management database; and the domain name IP address fields of the same registered domain name are stored under the same branch node.
The embodiment of the invention also provides computer equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor realizes the domain name registration IP address query method when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, which stores a computer program for executing the domain name registration IP address query method.
In summary, in the embodiment of the present invention, a user query instruction is received; inquiring in a registered IP address management database according to a user inquiry instruction to obtain an inquiry result; wherein, the query result comprises: registering a domain name, domain name owner information and a domain name IP address field; the registered IP address management database is pre-established according to an APNIC data file of the Asia-Pacific Internet information center; sending the query result to the user side; the registered domain name, the domain name IP address field and the domain name owner information can be comprehensively and visually displayed, and the query is carried out according to the received user query instruction to obtain the query result meeting the user requirements. The registered IP address management database is established according to the APNIC data file, the data source is authoritative, the accuracy of the query result is high, the acquisition of the registered IP address information of all domestic operators, companies and other units which perform domain name registration on the APNIC can be supported, and the coverage is wide. The user can obtain all the associated information by inquiring according to any item of the IP address, the registered domain name and the domain name owner, and the user can conveniently inquire and use the information.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes may be made to the embodiment of the present invention by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.