Method and apparatus for determining similarity between webpages, method and apparatus for identifying network assets, and device and medium
By constructing an HTML structure tree and calculating similarity based on metadata, the problem of difficulty in identifying web pages with incomplete metadata in the existing technology is solved, and the accuracy and robustness of network asset fingerprint identification are improved.
Patent Information
- Application Number
- PCT/CN2023/085186
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2024-10-03
AI Technical Summary
It is difficult for existing technology to identify web pages with incomplete metadata, especially web pages that hide HTTP header information, making fingerprint identification of network assets difficult.
By obtaining the HTML source code and script file structure of the web page, constructing the HTML structure tree and removing the large differences at the bottom, calculating the web page similarity based on metadata, and using a weighted algorithm to determine the web page similarity, thereby identifying network asset fingerprints.
It improves the accuracy and robustness of web page identification, reduces the false positive rate and false negative rate, can effectively identify web pages with incomplete metadata, and enhances the fingerprint identification capabilities of network assets.
Smart Images

Figure CN2023085186_03102024_PF_FP_ABST
Abstract
Description
Method, device, equipment and medium for determining web page similarity and identifying network assets Technical Field
[0001] The present invention relates to the field of network security technology, and in particular to methods, devices, equipment, and media for determining web page similarity and identifying network assets. Background Art
[0002] With the rapid development of network technology, cybersecurity is receiving increasing attention. Effective fingerprint identification and risk management of network assets have become significant challenges. Fingerprint information for network assets typically includes software and version information. In practice, since many network assets are developed by third parties, comprehensive fingerprint information is difficult to obtain.
[0003] Currently, web page identification is primarily achieved by analyzing metadata such as Hypertext Transfer Protocol (HTTP) header information, and determining the web page's fingerprint based on the identification results. However, this method struggles to identify web pages with incomplete metadata, such as those with hidden HTTP header information.
[0004] Summary of the Invention
[0005] The embodiments of the present invention provide a method, device, electronic device and storage medium for determining web page similarity and identifying network assets.
[0006] A method for determining web page similarity, the method comprising:
[0007] Obtaining metadata of a first webpage, a Hypertext Markup Language (HTML) source code of the first webpage, and a script file structure of the first webpage;
[0008] determining an HTML structure tree of the first webpage based on the HTML source code of the first webpage;
[0009] Determining a first similarity between the HTML structure tree of the first webpage and the HTML structure tree of the second webpage;
[0010] determining a second similarity between the script file structure of the first webpage and the script file structure of the second webpage;
[0011] determining a third similarity between the metadata of the first webpage and the metadata of the second webpage;
[0012] The similarity between the first webpage and the second webpage is determined based on the first similarity, the second similarity, and the third similarity.
[0013] It can be seen that the embodiment of the present invention integrates the HTML structure tree, script file structure and metadata of the web page to jointly determine the web page similarity, and no longer identifies the web page simply by metadata, thereby improving the web page recognition.
[0014] In one embodiment, determining the HTML structure tree of the first webpage based on the HTML source code of the first webpage includes:
[0015] constructing an original HTML structure tree of the first webpage based on the HTML source code of the first webpage;
[0016] Removing a predetermined number of layers of nodes from the original HTML structure tree from bottom to top;
[0017] The remaining HTML structure tree after the removal is determined as the HTML structure tree of the first web page.
[0018] It can be seen that retaining the top structure of the HTML structure tree when calculating the similarity of the HTML structure tree and removing the larger difference part at the bottom of the HTML structure tree can improve the recognition accuracy of complex web pages, thereby improving the robustness of recognition.
[0019] In one embodiment, determining the first similarity between the HTML structure tree of the first webpage and the HTML tree of the second webpage includes:
[0020] Determining a maximum number of matching nodes between the HTML structure tree of the first webpage and the HTML structure tree of the second webpage;
[0021] Determining a first node number in the HTML structure tree of the first webpage;
[0022] Determining the second number of nodes in the HTML structure tree of the second webpage;
[0023] The first similarity is determined based on the maximum number of matching nodes, the first number of nodes, and the second number of nodes.
[0024] Therefore, the first similarity is determined based on the maximum number of matching nodes in the HTML structure tree of the comparison objects (the first webpage and the second webpage) and the number of nodes of each, thereby improving calculation efficiency.
[0025] In one embodiment, determining the second similarity between the script file structure of the first webpage and the script file structure of the second webpage includes:
[0026] Determining a maximum number of matching nodes between the script file structure of the first webpage and the script file structure of the second webpage;
[0027] determining a first node number in a script file structure of the first webpage;
[0028] determining a second number of nodes in the script file structure of the second webpage;
[0029] The second similarity is determined based on the maximum number of matching nodes, the first number of nodes, and the second number of nodes.
[0030] Therefore, based on the maximum number of matching nodes in the script file structures of the comparison objects (the first webpage and the second webpage) and the number of nodes of each, the second similarity can be conveniently determined, thereby improving calculation efficiency.
[0031] In one embodiment, determining the similarity between the first webpage and the second webpage based on the first similarity, the second similarity, and the third similarity includes:
[0032] determining a first product of the first similarity and a predetermined first weight;
[0033] determining a second product of the second similarity and a predetermined second weight;
[0034] determining a third product of the third similarity and a predetermined third weight;
[0035] determining a sum of the first product, the second product, and the third product as the similarity between the first web page and the second web page;
[0036] The third weight is greater than the first weight, and the first weight is greater than the second weight.
[0037] Therefore, the similarity between the first web page and the second web page is accurately calculated by the weighted algorithm. In addition, the largest third weight ensures that the metadata has the largest impact factor, and the first weight is greater than the second weight, ensuring the importance of the impact factor of the HTML structure tree.
[0038] In one embodiment, it further includes:
[0039] When the similarity between the first webpage and the second webpage is greater than a preset threshold, the fingerprint information of the second webpage is determined as the fingerprint information of the first webpage.
[0040] Therefore, based on the similarity calculation between web pages, the fingerprint information of the web page can be easily determined.
[0041] A device for determining web page similarity, the device comprising:
[0042] an acquisition module configured to acquire metadata of a first webpage, an HTML source code of the first webpage, and a script file structure of the first webpage;
[0043] A first determining module is configured to determine an HTML structure tree of the first webpage based on the HTML source code of the first webpage;
[0044] a second determining module configured to determine a first similarity between the HTML structure tree of the first webpage and the HTML structure tree of the second webpage;
[0045] a third determining module configured to determine a second similarity between the script file structure of the first webpage and the script file structure of the second webpage;
[0046] a fourth determining module configured to determine a third similarity between the metadata of the first webpage and the metadata of the second webpage;
[0047] The fifth determining module is configured to determine the similarity between the first webpage and the second webpage based on the first similarity, the second similarity, and the third similarity.
[0048] It can be seen that the embodiment of the present invention integrates the HTML structure tree, script file structure and metadata of the web page to jointly determine the web page similarity, and no longer identifies the web page simply by metadata, thereby improving the web page recognition.
[0049] A network asset identification method, comprising:
[0050] Determining a first web page included in the web asset to be identified;
[0051] determining a set of web pages comprising a plurality of second web pages, wherein each second web page corresponds to a respective identified web asset;
[0052] Determining a similarity between the first web page and each second web page in the web page set, wherein determining the similarity between the first web page and each second web page comprises: obtaining metadata of the first web page, HTML source code of the first web page, and a script file structure of the first web page; determining an HTML structure tree of the first web page based on the HTML source code of the first web page; determining a first similarity between the HTML structure tree of the first web page and the HTML structure tree of each second web page; determining a second similarity between the script file structure of the first web page and the script file structure of each second web page; determining a third similarity between the metadata of the first web page and the metadata of each second web page; and determining a similarity between the first web page and each second web page based on the first similarity, the second similarity, and the third similarity.
[0053] The fingerprint information of the identified network asset corresponding to the second web page having the highest similarity to the first web page is determined as the fingerprint information of the network asset to be identified.
[0054] It can be seen that the fingerprint information of network assets can be easily identified based on the comparison process of web page similarity.
[0055] In one embodiment, determining the HTML structure tree of the first web page based on the HTML source code of the first web page includes: constructing an original HTML structure tree of the first web page based on the HTML source code of the first web page; removing a predetermined number of layers of nodes from the original HTML structure tree in a bottom-to-top direction; and determining the remaining HTML structure tree after the removal as the HTML structure tree of the first web page.
[0056] It can be seen that retaining the top structure of the HTML structure tree when calculating the similarity of the HTML structure tree and removing the larger difference part at the bottom of the HTML structure tree can improve the recognition accuracy of complex web pages, thereby improving the robustness of recognition.
[0057] In one embodiment, based on the first similarity, the second similarity and the third similarity, determining the similarity between the first web page and each of the second web pages includes: determining a first product of the first similarity and a predetermined first weight; determining a second product of the second similarity and a predetermined second weight; determining a third product of the third similarity and a predetermined third weight; and determining the sum of the first product, the second product and the third product as the similarity between the first web page and each of the second web pages; wherein the third weight is greater than the first weight, and the first weight is greater than the second weight.
[0058] Therefore, the similarity between the first web page and the second web page is accurately calculated by the weighted algorithm. In addition, the largest third weight ensures that the metadata has the largest impact factor, and the first weight is greater than the second weight, ensuring the importance of the impact factor of the HTML structure tree.
[0059] A network asset identification device, comprising:
[0060] a webpage determination module configured to determine a first webpage included in the network asset to be identified;
[0061] a web page set determination module configured to determine a web page set comprising a plurality of second web pages, wherein each second web page corresponds to a respective identified web asset;
[0062] The similarity determination module is configured to determine the similarity between the first web page and each second web page in the web page set, wherein the determining the similarity between the first web page and each second web page comprises: obtaining metadata of the first web page, HTML source code of the first web page, and script file structure of the first web page; determining an HTML structure tree of the first web page based on the HTML source code of the first web page; determining a first similarity between the HTML structure tree of the first web page and the HTML structure tree of each second web page; determining a second similarity between the script file structure of the first web page and the script file structure of each second web page; determining a third similarity between the metadata of the first web page and the metadata of each second web page; and determining the similarity between the first web page and each second web page based on the first similarity, the second similarity, and the third similarity.
[0063] The fingerprint determination module is configured to determine the fingerprint information of the identified network asset corresponding to the second web page having the highest similarity to the first web page as the fingerprint information of the network asset to be identified.
[0064] An electronic device, comprising:
[0065] processor;
[0066] a memory for storing executable instructions of the processor;
[0067] The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement any one of the above methods for determining web page similarity or network asset identification methods.
[0068] A computer-readable storage medium stores computer instructions, wherein when the computer instructions are executed by a processor, the method for determining web page similarity or the method for identifying network assets as described above is implemented.
[0069] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the method for determining web page similarity or the method for identifying network assets as described above is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, so that those skilled in the art will understand the above and other features and advantages of the present invention more clearly. In the accompanying drawings:
[0071] FIG1 is a flow chart of a method for determining web page similarity according to an embodiment of the present invention.
[0072] FIG2 is a schematic diagram of an original HTML structure tree according to an embodiment of the present invention.
[0073] FIG3 is a first schematic diagram of an HTML structure tree after nodes are removed according to an embodiment of the present invention.
[0074] FIG4 is a second schematic diagram of an HTML structure tree after nodes are removed according to an embodiment of the present invention.
[0075] FIG5 is a schematic diagram of a JavaScript (JS) structure tree according to an embodiment of the present invention.
[0076] FIG6 is a flow chart of a network asset identification method according to an embodiment of the present invention.
[0077] FIG7 is a structural diagram of an apparatus for determining web page similarity according to an embodiment of the present invention.
[0078] FIG8 is a structural diagram of a network asset identification device according to an embodiment of the present invention.
[0079] FIG. 9 is a diagram showing an exemplary structure of an electronic device according to an embodiment of the present invention.
[0080] The accompanying drawings are numerals as follows: DETAILED DESCRIPTION
[0081] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail with reference to the following examples.
[0082] For the sake of brevity and intuitiveness in description, the solution of the present invention is explained below by describing several representative implementations. A large number of details in the implementations are only used to help understand the solution of the present invention. However, it is obvious that the technical solution of the present invention may not be limited to these details when implemented. In order to avoid unnecessarily obscuring the solution of the present invention, some implementations are not described in detail, but only a framework is given. Hereinafter, "including" means "including but not limited to", and "according to..." means "at least according to..., but not limited to only according to...". Due to the language habits of Chinese, when the number of a component is not specifically specified below, it means that the component can be one or more, or can be understood as at least one.
[0083] The embodiment of the present invention utilizes the metadata, HTML structure and script file structure of a web page to jointly determine the similarity of the web page. Moreover, the network asset fingerprint can be accurately identified based on the similarity calculation result of the web page.
[0084] FIG1 is a flow chart of a method for determining web page similarity according to an embodiment of the present invention. As shown in FIG1 , the method for determining web page similarity includes:
[0085] Step 101: Obtain metadata of a first webpage, HTML source code of the first webpage, and script file structure of the first webpage.
[0086] Here, the first webpage is the webpage whose similarity with the second webpage needs to be determined. For example, the first webpage can be the webpage whose fingerprint needs to be identified. When the first webpage is determined to be relatively similar to the second webpage based on the similarity between the first webpage and the second webpage (for example, the similarity is greater than a predetermined threshold), the fingerprint information of the second webpage can be determined as the fingerprint information of the first webpage.
[0087] The metadata of the first webpage may include at least one of the Uniform Resource Locator (URL) of the first webpage, header information of the HTTP request and response of the first webpage, and specific page information of the first webpage (eg, robot.txt).
[0088] The metadata of the first webpage can be collected through active access or passive acquisition. In the active access method, a request is sent to the first webpage to actively obtain a response message containing the metadata of the first webpage, and the metadata of the first webpage is parsed from the response message. In the passive acquisition method, a response message containing the metadata of the first webpage can be passively obtained when a user browses the first webpage, and the metadata of the first webpage can be parsed from the response message.
[0089] The code that uses HTML syntax rules to display the images, text, and other content contained in the first webpage in the browser is the HTML source code of the first webpage. In one embodiment, after opening the first webpage, you can right-click and select "View Source" to pop up a notepad. The contents of the notepad are the HTML source code of the first webpage. In another embodiment, you can select the "View Source" control in the status bar or toolbar of the browser displaying the first webpage to display the HTML source code of the first webpage.
[0090] By parsing the first web page, the script file structure of the first web page can be obtained, such as the script file directory of the first web page. The script file of the first web page can be implemented as a JavaScript (JS) file. JS is a lightweight, interpreted or just-in-time compiled programming language with function priority, which is often used to add various dynamic functions to web pages. In HTML, JS code is usually located in <script>与< / script> between tags.
[0091] The above exemplary description is a typical example of obtaining the metadata of the first web page, the HTML source code of the first web page and the script file structure of the first web page. Those skilled in the art will appreciate that this description is merely exemplary and is not intended to limit the scope of protection of the embodiments of the present invention.
[0092] Step 102: Determine the HTML structure tree of the first webpage based on the HTML source code of the first webpage.
[0093] In one embodiment, a depth-first search (DFS) algorithm is used to construct an HTML structure tree of the first webpage based on the HTML source code of the first webpage.
[0094] Considering that the HTML structure tree of the first webpage typically contains multiple layers of nodes, directly determining the fingerprint of the first webpage by comparing the original HTML structure tree of the first webpage (i.e., the complete HTML structure tree) with the known HTML structure tree to obtain similarity is not well adapted to the changing HTML page structure. Therefore, the embodiments of the present invention further perform node deletion processing on the original HTML structure tree to improve the robustness of recognition.
[0095] In one embodiment, determining the HTML structure tree of the first web page based on the HTML source code of the first web page includes: constructing an original HTML structure tree of the first web page based on the HTML source code of the first web page; removing a predetermined number of layers of nodes from the original HTML structure tree in a bottom-to-top direction; and determining the remaining HTML structure tree after the removal as the HTML structure tree of the first web page.
[0096] FIG2 is a schematic diagram of an original HTML structure tree according to an embodiment of the present invention. In FIG2 , the original HTML structure tree determined based on the HTML source code of the first webpage includes nodes 10, 11, 12, 13, 21, 22, 23, 31, 32, and 33. Node 10 is the root node. From top to bottom, nodes 11, 12, and 13 are located at the first level. Nodes 21, 22, and 23 are located at the second level. Nodes 31 and 32 are located at the third level. Node 33 is located at the fourth level. The structure tree values include HTML tag information, as well as the values of the class and ID attributes.
[0097] FIG3 is a first schematic diagram of an HTML structure tree after node removal according to an embodiment of the present invention. In FIG3 , from bottom to top, three layers are removed from the original HTML structure tree shown in FIG2 : nodes in the second, third, and fourth layers. Therefore, the removed portion 301 includes: node 21, node 22, node 23, node 31, node 32, and node 33. The remaining portion 302 includes: node 10, node 11, node 12, and node 13. Remaining portion 302 is the HTML structure tree after node removal.
[0098] FIG4 is a second schematic diagram of an HTML structure tree after node removal according to an embodiment of the present invention. In FIG4 , two layers are removed from the original HTML structure tree shown in FIG2 , namely, the nodes in the third and fourth layers. Therefore, the removed portion 401 includes: node 31, node 32, and node 33. The remaining portion 402 includes: node 10, node 11, node 12, node 13, node 21, node 22, and node 23. Remaining portion 402 is the HTML structure tree after the nodes are removed.
[0099] Therefore, when calculating the similarity of the HTML structure tree, retaining the top structure of the HTML structure tree and removing the larger difference part at the bottom of the HTML structure tree can improve the recognition accuracy of complex web pages, thereby improving the robustness of recognition.
[0100] The above exemplary description is of an exemplary instance of removing nodes from an original HTML structure tree. Those skilled in the art will appreciate that such description is merely exemplary and is not intended to limit the scope of protection of the embodiments of the present invention.
[0101] Step 103: Determine a first similarity between the HTML structure tree of the first webpage and the HTML structure tree of the second webpage.
[0102] Here, the second webpage is a similarity comparison object of the first webpage. For example, the second webpage can be a webpage whose fingerprint has been confirmed.
[0103] In one embodiment, determining a first similarity between an HTML structure tree of a first webpage and an HTML structure tree of a second webpage includes: determining a maximum number of matching nodes between the HTML structure tree of the first webpage and the HTML structure tree of the second webpage; determining a first number of nodes in the HTML structure tree of the first webpage; determining a second number of nodes in the HTML structure tree of the second webpage; and determining the first similarity based on the maximum number of matching nodes, the first number of nodes, and the second number of nodes. Therefore, determining the first similarity based on the maximum number of matching nodes in the HTML structure trees of the comparison objects (the first and second webpages) and the number of nodes in each of the two webpages improves computational efficiency.
[0104] For example: the HTML structure tree of the first page is T, and the HTML structure tree of the second page is X i The first similarity between the HTML structure tree of the first web page and the HTML structure tree of the second web page is Similarity(T, X i );in: Where |T| is the number of nodes in the HTML structure tree T of the first web page; |X i | HTML structure tree X for the second page iThe number of nodes in SimpleTreeMatching(T, X i ) represents T and X i The maximum number of matching nodes.
[0105] Step 104: Determine a second similarity between the script file structure of the first webpage and the script file structure of the second webpage.
[0106] Here, the script file structure data of the first webpage may be constructed according to the script file structure of the first webpage (eg, the directory of the script file of the first webpage).
[0107] For example, when the script file of the first web page is a JS file, its directory structure is:
[0108] / A / B / C / D
[0109] / A / B / E / F / G
[0110] / A / B / H
[0111] / A / I / J
[0112] / A / I / K
[0113] Based on the above directory structure, Figure 5 is a schematic diagram of a JS structure tree according to an embodiment of the present invention. In the structure tree of Figure 5, Node A is the root node of the JS structure tree. Based on the directory structure, the child nodes of the root node are Node B and Node I. The child nodes of Node B are Node C, Node E, and Node H. The child nodes of Node I are Node J and Node K. The child node of Node C is Node D. The child node of Node E is Node F. The child node of Node F is Node G.
[0114] In one embodiment, determining a second similarity between a script file structure of a first webpage and a script file structure of a second webpage includes: determining a maximum number of matching nodes between the script file structure of the first webpage and the script file structure of the second webpage; determining a first number of nodes in the script file structure of the first webpage; determining a second number of nodes in the script file structure of the second webpage; and determining the second similarity based on the maximum number of matching nodes, the first number of nodes, and the second number of nodes. Therefore, based on the maximum number of matching nodes in the script file structures of the comparison objects (the first webpage and the second webpage) and the number of nodes in each, the second similarity can be conveniently determined, thereby improving computational efficiency.
[0115] For example: The structure of the script file of the first page is G, and the structure of the script file of the second page is Y i The second similarity between the script file structure of the first web page and the script file structure of the second web page is Similarity(G, Y i );in: Where |G| is the number of nodes in the structure tree G of the script file of the first web page; |X i |Structure tree Y for the script file of the second page i The number of nodes in SimpleTreeMatching(G, Y i ) represents G and Y i The maximum number of matching nodes.
[0116] Step 105: Determine a third similarity between the metadata of the first webpage and the metadata of the second webpage.
[0117] Here, the metadata of the first webpage can be compared with the metadata based on the second webpage to determine a third similarity between the metadata of the first webpage and the metadata of the second webpage. For example, a rule base can be established based on the metadata of the second webpage (such as the URL, HTTP request and response header information, and specific page information, etc.), and then the degree of match between the metadata of the first webpage and the rule base can be checked to determine the third similarity. For example, matching methods may include: exact match, extension match, path match, or default match, etc.
[0118] Step 106: Determine the similarity between the first webpage and the second webpage based on the first similarity, the second similarity, and the third similarity.
[0119] In one embodiment, determining the similarity between a first webpage and a second webpage based on a first similarity, a second similarity, and a third similarity includes: determining a first product of the first similarity and a predetermined first weight; determining a second product of the second similarity and a predetermined second weight; determining a third product of the third similarity and a predetermined third weight; and determining the sum of the first, second, and third products as the similarity between the first and second webpages; wherein the third weight is greater than the first weight, and the first weight is greater than the second weight. Therefore, the weighted algorithm can accurately calculate the similarity between the first and second webpages. Furthermore, the largest third weight ensures that the metadata has the largest impact factor, and the first weight being greater than the second weight also ensures the importance of the impact factor in the HTML structure tree.
[0120] As can be seen, the present invention integrates the HTML structure tree, script file structure, and metadata of a webpage to determine webpage similarity, rather than relying solely on metadata to identify webpages. This improves webpage recognition. When websites expose less information, comparing the HTML structure tree and JS file structure similarities can better identify the fingerprint information of network assets, thereby reducing false positives and false negatives.
[0121] In one embodiment, the method further includes: when the similarity between the first webpage and the second webpage is greater than a preset threshold, determining the fingerprint information of the second webpage as the fingerprint information of the first webpage. Therefore, based on the similarity calculation between the webpages, the fingerprint information of the webpage can be conveniently determined.
[0122] In one embodiment, the fingerprint information of the network asset including the web page can be determined based on the process shown in FIG1. For example, assuming that there are n second pages, each second page corresponds to a respective software with known fingerprint information, and these software are {X1, X2, X3, ..., X n}.
[0123] The metadata of the first web page is matched with the feature database established by the metadata of each known software, including the fields of the extended URL, the fields contained in the HTTP request header and the corresponding values. Finally, the first web page is matched with the software {X1, X2, X3, ..., X n The rule matching feature vector between} is [a1, a2, ..., a n ] T , where [a1, a2, ..., a n ] T The weight of is α1.
[0124] The HTML structure of the first web page and each software with known fingerprint information {X1, X2, X3, ..., X n}, and calculate the similarity between the first web page and all software with known fingerprint information {X1, X2, X3, ..., X n The similarity vector of the HTML tree of} is [s1, s2, ..., s n ] T , where [s1, s2, ..., s n ] T The weight of is α2.
[0125] After obtaining the JS file structure of the first web page, compare it with each software {X1, X2, X3, ..., X n} to compare the JS file structure tree of the first web page with all software with known fingerprint information {X1, X2, X3, ..., X n}’s JS similarity vector is [j1, j2, ..., j n ] T , where [j1, j2, ..., j n ] T The weight is α3, where α1 is greater than α2, and α2 is greater than α3.
[0126] The first web page with all known fingerprint information software {X1, X2, X3, ..., X n The similarity value of} is: The fingerprint information of the first web page is the similarity value The fingerprint information of the software with known fingerprint information corresponding to the maximum value in is obtained. Furthermore, after determining the fingerprint information of the first webpage, the threat intelligence database can be regularly updated based on the fingerprint information of the first webpage. For example, security vulnerabilities and threat information threatening the first webpage can be updated, and feature information of the first webpage can also be updated.
[0127] By comprehensively understanding network assets related to open ports, protocols, domain names, device types, models, manufacturers, application names, versions, operating systems, web services, application components, development frameworks, scripting languages, and CMS, and based on the identified assets, understanding whether vulnerability risk protection in cyberspace assets is effective, and evaluating the impact distribution of vulnerabilities in the identified network asset fingerprint library, industry regulators can understand the current status of asset security and effectively address potential risks. Based on the above description, the embodiments of the present invention also propose a network asset identification method.
[0128] FIG6 is a flow chart of a network asset identification method according to an embodiment of the present invention. As shown in FIG6 , the method includes:
[0129] Step 501: Determine a first web page included in the network asset to be identified.
[0130] For example, the network asset to be identified is an application software that needs to be identified (ie, fingerprint information needs to be determined). The first web page can be any page of the application software, preferably the home page.
[0131] Step 502: Determine a web page set comprising a plurality of second web pages, wherein each second web page corresponds to a respective identified web asset.
[0132] Identified network assets are applications that have been identified (i.e., their fingerprint information has been determined). For example, each second page is the homepage of the corresponding application. For example, assuming the identified network assets are applications 1 through 10, the webpage collection contains 10 second webpages, which are the homepages of applications 1 through 10.
[0133] Step 503: Determine the similarity between the first web page and each second web page in the web page set, wherein determining the similarity between the first web page and each second web page includes: obtaining the metadata of the first web page, the hypertext markup language source code of the first web page, and the script file structure of the first web page; determining the hypertext markup language structure tree of the first web page based on the hypertext markup language source code of the first web page; determining a first similarity between the hypertext markup language structure tree of the first web page and the hypertext markup language structure tree of each second web page; determining a second similarity between the script file structure of the first web page and the script file structure of each second web page; determining a third similarity between the metadata of the first web page and the metadata of each second web page; and determining the similarity between the first web page and each second web page based on the first similarity, the second similarity, and the third similarity.
[0134] Here, based on the process shown in Figure 1, the similarity between the first webpage and each second webpage can be calculated. For example, assuming the identified network assets are applications 1 through 10, the webpage collection contains 10 second webpages, each of which is the homepage of applications 1 through 10. Based on the process shown in Figure 1, the similarity between the first webpage and each of the 10 second webpages can be calculated, that is, 10 similarities can be calculated.
[0135] Step 504: Determine the fingerprint information of the identified network asset corresponding to the second webpage having the highest similarity to the first webpage as the fingerprint information of the network asset to be identified.
[0136] Continuing with the above example, the fingerprint information of the identified network asset corresponding to the second web page with the maximum value among the 10 similarities is determined as the fingerprint information of the network asset to be identified, thereby completing the identification of the network asset to be identified.
[0137] For example, the fingerprint information of an asset specifically includes: open ports, protocols, application names, versions, operating system types, web service response headers, titles, keywords, application components, development frameworks, scripting languages, CMS, and complete response body information.
[0138] It can be seen that the fingerprint information of network assets can be easily identified based on the comparison process of web page similarity.
[0139] In one embodiment, determining the HTML structure tree of the first webpage based on the HTML source code of the first webpage includes: constructing an original HTML structure tree of the first webpage based on the HTML source code of the first webpage; removing a predetermined number of nodes from the original HTML structure tree from bottom to top; and determining the remaining HTML structure tree after the removal as the HTML structure tree of the first webpage. As can be seen, retaining the top structure of the HTML structure tree while removing the larger differences at the bottom of the HTML structure tree when calculating the similarity of the HTML structure trees can improve the recognition accuracy of complex webpages, thereby enhancing the robustness of recognition.
[0140] In one embodiment, determining the similarity between a first webpage and each second webpage based on a first similarity, a second similarity, and a third similarity includes: determining a first product of the first similarity and a predetermined first weight; determining a second product of the second similarity and a predetermined second weight; determining a third product of the third similarity and a predetermined third weight; and determining the sum of the first, second, and third products as the similarity between the first webpage and each second webpage; wherein the third weight is greater than the first weight, and the first weight is greater than the second weight. Thus, the similarity between the first webpage and the second webpage is accurately calculated using a weighted algorithm. Furthermore, the largest third weight ensures that the metadata has the greatest impact factor, and the first weight is greater than the second weight, ensuring the importance of the impact factor in the HTML structure tree.
[0141] FIG7 is a block diagram of an apparatus for determining web page similarity according to an embodiment of the present invention. As shown in FIG7 , the apparatus 600 for determining web page similarity includes: an acquisition module 601 configured to acquire metadata of a first web page, the HTML source code of the first web page, and the script file structure of the first web page; a first determination module 602 configured to determine the HTML structure tree of the first web page based on the HTML source code of the first web page; a second determination module 603 configured to determine a first similarity between the HTML structure tree of the first web page and the HTML structure tree of the second web page; a third determination module 604 configured to determine a second similarity between the script file structure of the first web page and the script file structure of the second web page; a fourth determination module 605 configured to determine a third similarity between the metadata of the first web page and the metadata of the second web page; and a fifth determination module 606 configured to determine the similarity between the first web page and the second web page based on the first similarity, the second similarity, and the third similarity.
[0142] In one embodiment, the first determination module 602 is configured to: construct an original HTML structure tree of the first web page based on the HTML source code of the first web page; remove a predetermined number of nodes from the original HTML structure tree in a bottom-to-top direction; and determine the remaining HTML structure tree after the removal as the HTML structure tree of the first web page.
[0143] In one embodiment, the second determination module 603 is configured to: determine the maximum number of matching nodes between the HTML structure tree of the first web page and the HTML structure tree of the second web page; determine the first number of nodes in the HTML structure tree of the first web page; determine the second number of nodes in the HTML structure tree of the second web page; and determine the first similarity based on the maximum number of matching nodes, the first number of nodes, and the second number of nodes.
[0144] In one embodiment, the third determination module 604 is configured to: determine the maximum number of matching nodes between the script file structure of the first web page and the script file structure of the second web page; determine the first number of nodes in the script file structure of the first web page; determine the second number of nodes in the script file structure of the second web page; and determine the second similarity based on the maximum number of matching nodes, the first number of nodes, and the second number of nodes.
[0145] In one embodiment, the fifth determination module 606 is configured to: determine a first product of the first similarity and a predetermined first weight; determine a second product of the second similarity and a predetermined second weight; determine a third product of the third similarity and a predetermined third weight; and determine the sum of the first product, the second product, and the third product as the similarity between the first web page and the second web page; wherein the third weight is greater than the first weight, and the first weight is greater than the second weight.
[0146] FIG8 is a structural diagram of a network asset identification device according to an embodiment of the present invention. As shown in FIG8 , the network asset identification device 700 includes: a web page determination module 701, configured to determine a first web page included in the network asset to be identified; a web page set determination module 702, configured to determine a web page set including a plurality of second web pages, wherein each second web page corresponds to a respective identified network asset; a similarity determination module 703, configured to determine the similarity between the first web page and each second web page in the web page set, wherein determining the similarity between the first web page and each second web page includes: obtaining metadata of the first web page, HTML source code of the first web page, and script file structure of the first web page; and based on the HTML source code of the first web page, obtaining a similarity between the first web page and each second web page. Determine the HTML structure tree of the first web page; determine a first similarity between the HTML structure tree of the first web page and the HTML structure tree of each second web page; determine a second similarity between the script file structure of the first web page and the script file structure of each second web page; determine a third similarity between the metadata of the first web page and the metadata of each second web page; based on the first similarity, the second similarity and the third similarity, determine the similarity between the first web page and each second web page; the fingerprint determination module 704 is configured to determine the fingerprint information of the identified network asset corresponding to the second web page with the highest similarity to the first web page as the fingerprint information of the network asset to be identified.
[0147] The embodiment of the present invention also proposes an electronic device with a processor-memory architecture. Figure 9 is a structural diagram of an electronic device according to an embodiment of the present invention. As shown in Figure 9, the electronic device 800 includes a processor 801, a memory 802, and a computer program stored on the memory 802 and executable on the processor 801. When the computer program is executed by the processor 801, it implements any of the above methods for determining web page similarity or network asset identification methods. Among them, the memory 802 can be specifically implemented as a variety of storage media such as an electrically erasable programmable read-only memory (EEPROM), a flash memory (Flash memory), and a programmable read-only memory (PROM). The processor 801 can be implemented to include one or more central processing units or one or more field programmable gate arrays, wherein the field programmable gate array integrates one or more central processing unit cores. Specifically, the central processing unit or the central processing unit core can be implemented as a CPU, an MCU, or a DSP, and so on.
[0148] It should be noted that not all steps and modules in the above processes and structure diagrams are required, and certain steps or modules can be omitted based on actual needs. The execution order of the steps is not fixed and can be adjusted as needed. The division of the modules is merely for the convenience of describing the functional division adopted. In actual implementation, a module can be implemented by multiple modules, and the functions of multiple modules can be implemented by the same module. These modules can be located in the same device or in different devices.
[0149] The hardware modules in each embodiment can be implemented mechanically or electronically. For example, a hardware module may include a specially designed permanent circuit or logic device (such as a dedicated processor, such as an FPGA or ASIC) for performing a specific operation. The hardware module may also include a programmable logic device or circuit (such as a general-purpose processor or other programmable processor) temporarily configured by software to perform a specific operation. As for whether to implement the hardware module mechanically, or using a dedicated permanent circuit, or using a temporarily configured circuit (such as configured by software), it can be decided based on cost and time considerations.
[0150] The above are only preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for determining web page similarity, characterized in that: The method comprises: Acquiring (101) metadata of a first web page, a hypertext markup language source code of the first web page, and a script file structure of the first web page; Determining (102) a hypertext markup language structure tree of the first web page based on the hypertext markup language source code of the first web page; Determining (103) a first similarity between the hypertext markup language structure tree of the first web page and the hypertext markup language structure tree of the second web page; determining (104) a second similarity between the script file structure of the first web page and the script file structure of the second web page; determining (105) a third similarity between the metadata of the first webpage and the metadata of the second webpage; Based on the first similarity, the second similarity, and the third similarity, a similarity between the first web page and the second web page is determined (106).
2. The method according to claim 1, characterized in that The determining (102) of the hypertext markup language structure tree of the first webpage based on the hypertext markup language source code of the first webpage comprises: constructing an original hypertext markup language structure tree of the first webpage based on the hypertext markup language source code of the first webpage; Removing a predetermined number of layers of nodes from the original hypertext markup language structure tree from bottom to top; The remaining hypertext markup language structure tree after the removal is determined as the hypertext markup language structure tree of the first web page.
3. The method according to claim 2, characterized in that The determining (103) of the first similarity between the hypertext markup language structure tree of the first webpage and the hypertext markup language structure tree of the second webpage comprises: Determine the maximum number of matching nodes between the hypertext markup language structure tree of the first webpage and the hypertext markup language structure tree of the second webpage; Determining a first node number in a hypertext markup language structure tree of the first webpage; Determining a second number of nodes in a hypertext markup language structure tree of the second webpage; The first similarity is determined based on the maximum number of matching nodes, the first number of nodes, and the second number of nodes.
4. The method according to claim 1, characterized in that: The determining (104) of a second similarity between the script file structure of the first webpage and the script file structure of the second webpage includes: Determine the maximum number of matching nodes between the script file structure of the first webpage and the script file structure of the second webpage; Determining a first number of nodes in a script file structure of the first webpage; Determining a second number of nodes in the script file structure of the second webpage; The second similarity is determined based on the maximum number of matching nodes, the first number of nodes, and the second number of nodes.
5. The method according to any one of claims 1 to 4, characterized in that Determining (106) the similarity between the first web page and the second web page based on the first similarity, the second similarity and the third similarity includes: Determine a first product of the first similarity and a predetermined first weight; determining a second product of the second similarity and a predetermined second weight; determining a third product of the third similarity and a predetermined third weight; Determine the sum of the first product, the second product and the third product as the similarity between the first web page and the second web page; The third weight is greater than the first weight, and the first weight is greater than the second weight.
6. The method according to any one of claims 1 to 4, characterized in that Also includes: When the similarity between the first webpage and the second webpage is greater than a preset threshold, the fingerprint information of the second webpage is determined as the fingerprint information of the first webpage.
7. A device for determining web page similarity, characterized in that: The device comprises: An acquisition module (601) is configured to acquire metadata of a first web page, a hypertext markup language source code of the first web page, and a script file structure of the first web page; A first determination module (602) is configured to determine a hypertext markup language structure tree of the first web page based on a hypertext markup language source code of the first web page; A second determination module (603) is configured to determine a first similarity between the hypertext markup language structure tree of the first web page and the hypertext markup language structure tree of the second web page; A third determination module (604) is configured to determine a second similarity between the script file structure of the first web page and the script file structure of the second web page; a fourth determination module (605), configured to determine a third similarity between the metadata of the first webpage and the metadata of the second webpage; The fifth determination module (606) is configured to determine the similarity between the first web page and the second web page based on the first similarity, the second similarity and the third similarity.
8. A network asset identification method, characterized in that: include: Determining (501) a first web page included in the web asset to be identified; determining (502) a set of web pages comprising a plurality of second web pages, wherein each second web page corresponds to a respective identified web asset; Determine (503) the similarity between the first web page and each second web page in the web page set, wherein the determining (503) the similarity between the first web page and each second web page comprises: obtaining metadata of the first web page, a hypertext markup language source code of the first web page and a script file structure of the first web page; determining a hypertext markup language structure tree of the first web page based on the hypertext markup language source code of the first web page; determining a first similarity between the hypertext markup language structure tree of the first web page and a hypertext markup language structure tree of each second web page; determining a second similarity between the script file structure of the first web page and the script file structure of each second web page; determining a third similarity between the metadata of the first web page and the metadata of each second web page; and determining the similarity between the first web page and each second web page based on the first similarity, the second similarity and the third similarity; The fingerprint information of the identified network asset corresponding to the second web page having the highest similarity to the first web page is determined (504) as the fingerprint information of the network asset to be identified.
9. The method according to claim 8, characterized in that The method of determining the hypertext markup language structure tree of the first web page based on the hypertext markup language source code of the first web page includes: constructing an original hypertext markup language structure tree of the first web page based on the hypertext markup language source code of the first web page; removing a predetermined number of layers of nodes from the original hypertext markup language structure tree in a bottom-to-top direction; and determining the remaining hypertext markup language structure tree after the removal as the hypertext markup language structure tree of the first web page.
10. The method according to claim 8, characterized in that Determining the similarity between the first web page and each of the second web pages based on the first similarity, the second similarity and the third similarity includes: determining a first product of the first similarity and a predetermined first weight; determining a second product of the second similarity and a predetermined second weight; determining a third product of the third similarity and a predetermined third weight; determining the sum of the first product, the second product and the third product as the similarity between the first web page and each of the second web pages; wherein the third weight is greater than the first weight, and the first weight is greater than the second weight.
11. A network asset identification device, characterized in that: include: A web page determination module (701) is configured to determine a first web page included in the network asset to be identified; A web page set determination module (702) is configured to determine a web page set comprising a plurality of second web pages, wherein each second web page corresponds to a respective identified web asset; A similarity determination module (703) is configured to determine the similarity between the first web page and each second web page in the web page set, wherein the determining the similarity between the first web page and each second web page comprises: obtaining metadata of the first web page, a hypertext markup language source code of the first web page and a script file structure of the first web page; determining a hypertext markup language structure tree of the first web page based on the hypertext markup language source code of the first web page; determining a first similarity between the hypertext markup language structure tree of the first web page and a hypertext markup language structure tree of each second web page; determining a second similarity between the script file structure of the first web page and a script file structure of each second web page; determining a third similarity between the metadata of the first web page and the metadata of each second web page; and determining the similarity between the first web page and each second web page based on the first similarity, the second similarity and the third similarity; The fingerprint determination module (704) is configured to determine the fingerprint information of the identified network asset corresponding to the second web page having the highest similarity to the first web page as the fingerprint information of the network asset to be identified.
12. An electronic device, characterized in that: include: Processor (801); A memory (802), configured to store executable instructions of the processor (801); The processor (801) is used to read the executable instructions from the memory (802) and execute the executable instructions to implement the method for determining web page similarity according to any one of claims 1 to 6 or the network asset identification method according to any one of claims 8 to 10.
13. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed by a processor, the method for determining web page similarity according to any one of claims 1 to 6 or the method for identifying network assets according to any one of claims 8 to 10 is implemented.
14. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method for determining the similarity of web pages according to any one of claims 1 to 6 or the method for identifying network assets according to any one of claims 8 to 10.
Citation Information
Patent Citations
Webpage recognition method and device
CN104462152A
Method and device for computing similarity of webpages
CN106021383A
Device and method for selecting webpage
CN107357716A
Webpage similarity calculation method, device and equipment and computer readable storage medium
CN109657208A
Webpage similarity determination method and determination device and computer readable storage medium
CN112818279A
