Webpage detection method and device and electronic equipment

By extracting web page data information, using high-frequency semantic dictionary to mark and calculate feature data, and inputting it into the decision tree model, the problems of inaccurate recognition and slow response of traditional web page recognition methods are solved, and faster and more accurate web page detection is achieved.

CN119557177APending Publication Date: 2025-03-04CHINA TELECOM NETWORK SECURITY TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411591803.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

Traditional login page recognition methods are limited by hard coding and keyword matching, and it is difficult to deal with diverse front-end technologies and designs, resulting in inaccurate recognition. The prior art recognizes and manages background logins by simulating user behavior. Although it improves accuracy, the process is complex and time-consuming, it depends on external tools and is susceptible to environmental networks, and its response speed and adaptability are limited.

Method used

A web page detection method is provided. By extracting page data information from the target web page, using a keyword dictionary based on high-frequency semantic words related to login operations for marking, calculating the character length ratio and element hit ratio in the form Form tag, and input feature data to the decision tree model to determine whether it is a login page.

Benefits of technology

It improves the speed and accuracy of web page detection, reduces misjudgment, improves the accuracy and robustness of identifying web pages, reduces the need to rely on external tools, and enhances the adaptability to environmental network changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557177A_ABST
    Figure CN119557177A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a webpage detection method and device and electronic equipment. The method comprises the following steps: extracting page data information representing webpage contents from a target webpage; traversing the page data information by adopting the key dictionary, determining whether the page data information contains keywords in the key dictionary or not, and marking to obtain a marked sequence; the ratio of the character length in each form Form label in the target webpage to the webpage content character length is calculated to obtain a content proportion, and the ratio of the number of sub-elements containing the interaction action keywords to the total number of elements in the corresponding Form labels is calculated to obtain an element hit proportion. The feature data after standardization processing are input into the decision tree model, whether the target webpage is a login page or not is determined, and the feature data comprise a mark sequence, a content proportion and an element hit proportion. According to the scheme, the webpage detection accuracy can be improved, and the webpage detection processing efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a web page detection method, device and electronic device. Background Art

[0002] As the scale of networks expands and becomes more complex, the security distribution and management of enterprise internal management systems become increasingly critical. Enterprise internal management systems store the core business data and sensitive information of enterprises, and their security directly affects the economic losses and reputation of enterprises.

[0003] However, traditional login page recognition methods are limited by hard coding and keyword matching, and are difficult to cope with diverse front-end technologies and designs, resulting in inaccurate recognition. Existing technologies simulate user behavior to identify management backend logins, which improves accuracy, but the process is complex and time-consuming, relies on external tools, and is easily affected by the environment and network, with limited response speed and adaptability.

[0004] How to improve the speed and accuracy of web page detection has become a question worth discussing. Summary of the invention

[0005] The embodiments of the present application provide a web page detection method, device and electronic device for improving the speed and accuracy of web page detection.

[0006] In a first aspect, an embodiment of the present application provides a web page detection method, the method comprising:

[0007] Extracting page data information representing the content of the webpage from the target webpage;

[0008] Using a key dictionary to traverse the page data information, determine whether the page data information contains keywords in the key dictionary, and mark them to obtain a tag sequence. The key dictionary is determined based on high-frequency semantic word pairs related to the login operation;

[0009] The ratio of the character length in the Form tag of each form in the target webpage to the character length in the webpage content is calculated to obtain the content ratio, which is used to indicate the element ratio of the Form tag relative to the entire webpage content. The ratio of the number of sub-elements containing the interactive action keyword to the total number of elements in the corresponding Form tag is calculated to obtain the element hit ratio, which is used to indicate the element ratio related to user interaction in the Form tag.

[0010] The input standardized feature data is input into the decision tree model to determine whether the target web page is a login page. The feature data includes tag sequence, content ratio and element hit ratio. The decision tree model is trained based on the training data set containing login pages and non-login pages.

[0011] Optionally, the key dictionary is determined as follows:

[0012] Extract a set of high-frequency words related to the login system from the positive sample set, where the positive sample set includes management system privacy data;

[0013] Input the high-frequency word set into the word vector Word2Vec model to obtain a set of synonym pairs in the interactive high-frequency word set. The Word2Vec model is trained based on the cosine similarity between different words, and the words in the synonym pair are semantically close.

[0014] Inputting the word embedding vectors of the synonym pair set into a second model to obtain corresponding word pair category labels, wherein the second model is obtained by training a neural network model based on a preset data set, and the preset data set includes a plurality of labels for marking the relationship between word pairs;

[0015] The synonym pair set is classified according to preset rules to obtain a key dictionary.

[0016] Optionally, the above classification of the synonym pair set according to preset rules to obtain a key dictionary specifically includes:

[0017] Classify the synonym pair set according to the interactive actions of the web page to obtain the key dictionary;

[0018] Or, the functions of the collection in the web page are classified according to the synonyms to obtain a key dictionary.

[0019] Optionally, the above Word2Vec model is trained as follows:

[0020] Preprocessing the high-frequency word set to be trained according to preset rules to obtain preprocessed text data;

[0021] Perform text segmentation on the preprocessed text data to obtain multiple words;

[0022] Input multiple words into the Word2Vec model to be trained to obtain the corresponding word embedding vectors;

[0023] Calculate the cosine similarity between any set of word embedding vector pairs, and take the word embedding vector pair with the highest cosine similarity as a synonym pair.

[0024] Optionally, the above-mentioned preprocessing of the high-frequency word set to be trained according to preset rules specifically includes:

[0025] Remove the angle brackets of HTML tags, and keep the tag name, text, and attribute values ​​inside the tags;

[0026] Convert text to lowercase:

[0027] Delete the preset special characters and extra spaces to get the preprocessed text.

[0028] Optionally, the extracting of page data information representing the content of the webpage from the target webpage specifically includes:

[0029] If the target web page is dynamically loaded content, simulate the user's web page behavior to obtain the page data information corresponding to the target web page;

[0030] If the target web page is statically loaded content, the client sends a network request to obtain page data information corresponding to the target web page.

[0031] Optionally, the above-mentioned calculation of the ratio of the character length in each form Form tag in the target webpage to the character length of the webpage content to obtain the content ratio specifically includes:

[0032] Use the Hypertext Markup Language HTML parsing library to parse the HTML source code in the page data information, and delete the tags and comment elements in the HTML source code that are not related to the identification of the login page;

[0033] Determine the character length of the form area defined by each Form tag and the remaining character length of the HTML source code;

[0034] The content ratio is calculated by calculating the ratio of the character length in each Form tag to the remaining character length of the HTML source code.

[0035] Optionally, the above calculation is a ratio of the number of sub-elements containing the interactive action keyword to the total number of elements in the corresponding Form tag to obtain the element hit ratio, specifically including:

[0036] Traverse the child elements of each Form tag and check whether the attributes or content of the child elements hit the interactive action key dictionary related to the login operation;

[0037] The element hit ratio is calculated by calculating the ratio of the number of sub-elements containing the interactive action keywords to the total number of elements in the corresponding Form tag.

[0038] Optionally, the above method further includes:

[0039] If there are multiple Form tags on the web page, traverse the hit ratios of all Forms and determine the Form tag with the largest number of sub-elements containing the interactive action keyword as the target tag;

[0040] The ratio of the number of sub-elements of the target tag containing the interactive action keyword to the total number of elements in the target tag is calculated to obtain the element hit ratio.

[0041] Optionally, the above decision tree model is trained in the following way:

[0042] Feature extraction is performed on the training data set including login pages and non-login pages to obtain feature data to be trained, which includes the tag sequence, content ratio and element hit ratio of each web page in the training data set.

[0043] Perform data preprocessing on the feature data according to preset rules to obtain standardized data;

[0044] A preset decision tree algorithm is used to train the decision tree model to be trained based on standardized data. The decision tree model uses preset parameters to prevent overfitting.

[0045] In a second aspect, an embodiment of the present application provides a webpage detection device, the device comprising:

[0046] A processing module, used for extracting page data information representing the content of the webpage from the target webpage;

[0047] The processing module is further used to traverse the page data information using a key dictionary, determine whether the page data information contains keywords in the key dictionary, and mark them to obtain a mark sequence, where the key dictionary is determined based on high-frequency semantic word pairs related to the login operation;

[0048] A calculation module is used to calculate the ratio of the character length in the Form tag of each form in the target webpage to the character length in the webpage content to obtain a content ratio, which is used to indicate the element ratio of the Form tag relative to the webpage content, and calculate the ratio of the number of sub-elements containing the interactive action keyword to the total number of elements in the corresponding Form tag to obtain an element hit ratio, which is used to indicate the element ratio in the Form tag related to user interaction;

[0049] The processing module is also used to input the standardized feature data into the decision tree model to determine whether the target web page is a login page. The feature data includes tag sequence, content ratio and element hit ratio. The decision tree model is trained based on a training data set containing login pages and non-login pages.

[0050] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the processor implements any one of the web page detection methods in the first aspect.

[0051] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the web page detection method of any one of the first aspects is implemented.

[0052] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which is executed by a processor to implement a web page detection method as described in any one of the first aspects above.

[0053] The technical effects brought about by any one of the implementation methods in the second to fifth aspects can refer to the technical effects brought about by the corresponding implementation method in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 A schematic diagram of an application scenario of web page detection provided in an embodiment of the present application;

[0055] Figure 2 A flow chart of a web page detection method provided in an embodiment of the present application;

[0056] Figure 3 An exemplary flow chart of a web page detection provided in an embodiment of the present application;

[0057] Figure 4 A schematic diagram of a device for web page detection provided in an embodiment of the present application;

[0058] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0059] Below, some terms in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.

[0060] 1. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.

[0061] 2. Uniform Resource Locator (URL), which is used to uniquely identify and locate resources on the Internet. The "resource" here can be a web page, a picture, a video file, a CSS style sheet or a JavaScript script, etc. When a user enters a URL in a browser or clicks a link, the browser will send a request to the server pointed to by the URL.

[0062] 3. HyperText Markup Language (HTML) includes a series of tags, which can unify the document format on the Internet and connect scattered network resources into a logical whole. HTML text is a descriptive text composed of HTML commands. HTML commands can describe text, graphics, animations, sounds, tables, links, etc.

[0063] 4. A statistical method commonly used in information retrieval and text mining (Term Frequency-Inverse Document Frequency, TF-IDF) to evaluate the importance of a word in a document. It combines term frequency (TF) and inverse document frequency (IDF). Words that appear frequently but are common in the corpus are downgraded, while words that appear infrequently but in specific documents are upgraded.

[0064] 5. Word2Vec is a technology used to map words to vector space, which learns the distributed representation of words by training a neural network model. It can capture the semantic relationship between words, such as the similarity and semantic meaning of words, and is often used in natural language processing tasks.

[0065] 6. Feed-forward neural network: Feed-forward neural network is a basic neural network structure, where information passes from the input layer through layers of hidden layers and finally reaches the output layer without feedback connection. It is used to learn from input data and generate output, and is suitable for various machine learning tasks such as classification and regression.

[0066] 7. Selenium: Selenium is a tool set for automating browser operations. It supports multiple browsers and can simulate user operations on web pages, such as clicking, entering text, etc. It is often used for tasks such as testing web applications or crawling web data.

[0067] 8. Min-Max Scaling: Min-Max Scaling is a commonly used data preprocessing technique that scales data to a specific range (usually [0,1] or [-1,1]) through linear transformation. It helps improve the comparison and analysis between different features by calculating the minimum and maximum values ​​of each feature and rescaling the feature values ​​so that the data falls into the predetermined range.

[0068] 9. Form tag: This is the container that contains the login form, which usually has an action attribute (specifies the URL to which the form data is submitted) and a method attribute (specifies the method for submitting the form data, such as GET or POST).

[0069] 10. Input tag: used to collect user input. For login forms, common type attribute values ​​include for username or email (text), for password (password), for email input (email), etc.

[0070] 11. Button tag: used to submit a form or perform other actions. In a login form, it usually has a type="submit" attribute.

[0071] 12. Label tag: Although it is not directly involved in data submission, it is used to define the label of the Input element to improve the accessibility of the form.

[0072] 13. Head tag: Contains document metadata, such as title, character set definition, style link, etc.

[0073] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0074] The application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. It is known to those skilled in the art that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems. In the description of the present application, unless otherwise specified, the meaning of "multiple" is two or more.

[0075] As the scale of networks expands and becomes more complex, the security distribution and management of enterprise internal management systems become increasingly critical. Enterprise internal management systems store the core business data and sensitive information of enterprises, and their security directly affects the economic losses and reputation of enterprises.

[0076] However, traditional login page recognition methods are limited by hard coding and keyword matching, and are difficult to cope with diverse front-end technologies and designs, resulting in inaccurate recognition. Existing technologies simulate user behavior to identify management backend logins, which improves accuracy, but the process is complex and time-consuming, relies on external tools, and is easily affected by the environment and network, with limited response speed and adaptability.

[0077] How to improve the speed and accuracy of web page detection has become a question worth discussing.

[0078] In order to solve the above problems, an embodiment of the present application provides a web page detection method. The method includes: extracting page data information representing the content of the web page from the target web page. Use a key dictionary to traverse the page data information, determine whether the page data information contains keywords in the key dictionary, and mark it to obtain a tag sequence. The key dictionary is determined based on high-frequency semantic word pairs related to the login operation. Calculate the ratio of the character length in each form Form tag in the target web page to the character length of the web page content to obtain the content ratio. The content ratio is used to indicate the element ratio of the Form tag relative to the web page content. Calculate the ratio of the number of sub-elements containing interactive action keywords to the total number of elements in the corresponding Form tag to obtain the element hit ratio. The element hit ratio is used to indicate the element ratio related to user interaction in the Form tag. The input standardized feature data is input into the decision tree model to determine whether the target web page is a login page. The feature data includes a tag sequence, a content ratio, and an element hit ratio. The decision tree model is trained based on a set of training data to be trained containing login pages and non-login pages.

[0079] In this way, by marking the key dictionary related to the login operation, the page content related to the login operation can be accurately identified, reducing the possibility of misjudgment. By considering the proportion of elements in the Form tag relative to the web page content, and the proportion of elements in the Form tag related to user interaction, the situation where complex pages only have login entrances can be excluded, thereby improving the accuracy of identifying web pages. By using feature data including tag sequence, content ratio, and element hit ratio as important elements for identifying web pages, the accuracy and robustness of identifying web pages can be improved. The decision tree model is used to realize automatic identification of web page content, which greatly improves the processing efficiency of web page detection compared to manual identification of web pages.

[0080] A schematic diagram of an application scenario of an optional webpage detection method in an embodiment of the present application. Figure 1 As shown, it includes a server 100 and a terminal 101. The server 100 and the terminal 101 can be communicatively connected through a network to implement the web page detection method of the present application.

[0081] The user can use the server 100 to interact with the terminal 101 through the network, such as receiving or sending messages, etc. Various client applications can be installed on the terminal 101, such as program writing applications, web browser applications, search applications, etc.

[0082] It is understandable that in the embodiment of the present application, the server 100 can be implemented as an independent server or a server cluster composed of multiple servers. The terminal 101 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, desktop computers, etc.

[0083] The server 100 can be used to extract page data information representing the content of the web page from the target web page. The page data information is traversed using a key dictionary to determine whether the page data information contains keywords in the key dictionary, and is marked to obtain a tag sequence. The key dictionary is determined based on high-frequency semantic word pairs related to the login operation. The ratio of the character length in each form Form tag in the target web page to the character length of the web page content is calculated to obtain the content ratio. The content ratio is used to represent the element ratio of the Form tag relative to the web page content. The ratio of the number of sub-elements containing interactive action keywords to the total number of elements in the corresponding Form tag is calculated to obtain the element hit ratio. The element hit ratio is used to represent the element ratio related to user interaction in the Form tag. The input standardized feature data is input into the decision tree model to determine whether the target web page is a login page. The feature data includes a tag sequence, a content ratio, and an element hit ratio. The decision tree model is trained based on a set of training data to be trained that includes login pages and non-login pages.

[0084] like Figure 2 As shown, a flow chart of a web page detection method provided in an embodiment of the present application may specifically include the following steps.

[0085] Step S201: extracting page data information representing the content of the webpage from the target webpage.

[0086] The page data information may include HTML source code, URL, and title of the web page.

[0087] In an optional embodiment, if the target webpage is dynamically loaded, the page data information corresponding to the target webpage is obtained by simulating the user's webpage behavior. If the target webpage is statically loaded, the page data information corresponding to the target webpage is obtained by sending a network request through the client.

[0088] For example, after determining the URL to be crawled, crawl the HTML content of the web page. If the URL to be crawled is dynamically loaded content, the page data information corresponding to the URL that has not been crawled can be obtained in sequence by simulating user behavior and scheduling order. For example, the Selenium tool is used to simulate user behavior and scheduling order to obtain the page data information corresponding to the URL that has not been crawled in sequence. If the URL to be crawled is statically loaded content, the HTML (Hyper Text Markup Language) parser or DOM (Document Object Model) parser is used to obtain the page data information corresponding to the URL that has not been crawled.

[0089] Optionally, after obtaining the page data information, it can be determined whether the page data information is in HTML format. For example, after downloading the target web page content, check whether its content type is text / html. If the Multipurpose Internet Mail Extensions (MIME) type of the web page content is HTML, it can be determined that the target web page is in HTML format.

[0090] Step S202: traverse the page data information using the key dictionary to determine whether the page data information contains keywords in the key dictionary, and mark them to obtain a mark sequence.

[0091] Among them, the key dictionary is determined based on high-frequency semantic word pairs related to the login operation.

[0092] In an optional embodiment, after obtaining the page data information of the web page to be processed, if the page data information is in Html format, the URL key dictionary and the Title key dictionary can be used to traverse the URL string to check whether it contains the words in the URL key dictionary. The page title string is traversed to check whether it contains the keywords in the Title key dictionary, and the tag value is 1 (yes) or 0 (no), and a tag sequence is obtained.

[0093] The keywords in the URL keyword dictionary are used to identify the specific page or resource that the user accesses. For example, the URL of the login page may contain keywords such as "login", while the URL of the user profile page may contain "profile" or "account". The keywords in the Title keyword dictionary are used to describe the main content or function of the page. For example, the title of the login page may contain keywords such as "login" or "Login", while the title of the shopping cart page may contain "shopping cart" or "Cart".

[0094] In this way, the webpage content is marked using the key dictionary related to the login operation. The order of occurrence and contextual relationship of the keywords in the webpage can be reflected through the tag sequence, so as to accurately identify the page content related to the login operation.

[0095] The following describes how to determine the key dictionary:

[0096] In an optional embodiment, a set of high-frequency words related to the login system can be extracted from the positive sample set, wherein the positive sample set includes management system privacy data. Data preprocessing is performed on the high-frequency word set. The high-frequency word set after data preprocessing is input into the Word2Vec model to obtain a set of synonym pairs in the interactive high-frequency word set. The Word2Vec model is trained based on the cosine similarity between different words, and the semantics of the words in the synonym pairs are close. The word embedding vectors of the synonym pair set are input into the second model to obtain the corresponding word pair category labels. The second model is obtained by training a neural network model based on a preset data set, and the preset data set includes multiple labels for marking the relationship between word pairs. The synonym pair set is classified according to preset rules to obtain a key dictionary.

[0097] In this way, by using Word2Vec natural language processing technology to generate vector representations of interactive action terms, words similar to interactive action terms in the input element attributes can be identified. Using the second model trained based on the neural network model to confirm the validity of semantically similar words can effectively handle variants of different languages ​​and expressions and improve recognition accuracy. Synonym pairs in key dictionaries can be used as an important resource for data mining and knowledge discovery. By analyzing the relationship between synonym pairs in key dictionaries, patterns and regularities hidden in the data can be discovered, capturing the semantic relationship between words related to login operations.

[0098] For example, you can select the following websites to obtain a positive sample set: Obtain management system privacy data for common internal management systems of enterprises, such as office automation systems (OA), enterprise resource planning systems (ERP), financial management systems, and customer relationship management systems (CRM).

[0099] Since the HTML source code of the data set to be processed includes elements related to login interaction. Each element has specific tags and attributes. For example, the form tag, input tag, button tag, and label tag related to the login form. For example, the username and password input boxes usually use the input tag, and their type attributes are text or email and password respectively. The login button is usually a button tag or an input tag, and the type attribute is submit or button. When extracting a high-frequency word set related to the login system from the positive sample set, the html source code can be analyzed to extract all possible related tags and attributes, such as input, button, select, etc. in the form tag. TF-IDF can be used to count the frequency of use of each attribute value under the tag and the content in the tag to obtain high-frequency words. For example, the URL and Title are treated as ordinary text strings for processing. First, they are segmented, that is, the string is divided into words or phrases. Then, TF-IDF is used to count the frequency of use of these words or phrases. For example, in the URL, high-frequency paths such as login and / sign-in can be found, and in the Title, high-frequency words such as "login" and "register" can be found.

[0100] Input the high-frequency word set into the Word2Vec model to obtain a set of synonym pairs in the interactive high-frequency word set. The word embedding vectors of the synonym pair set can be concatenated or averaged to obtain a word pair feature vector. The word pair feature vector is input into the second model to obtain the corresponding word pair category label. For example, the word pair category label can be a synonym, a semantically related word, a misidentified word, etc.

[0101] After obtaining the corresponding word pair category label through the second model, the synonym pair set is classified according to the preset rules to obtain a key dictionary. For example, keywords can be classified according to interactive actions, and the key dictionary obtained includes: entering a user name, entering a password, entering a verification code, secondary authentication, and clicking a login button. Among them, entering a user name: the user needs to enter a user name, ID number, mobile phone number or email address in a specific input box. Enter a password: the user needs to enter a password in a specific input box. Enter a verification code: on some websites, in order to enhance security, the user needs to enter a verification code. Secondary authentication: the user enters a single valid password returned by a mobile phone number, email address, mobile phone otp program, etc. Click the login button: the user needs to click a button to submit the login information and try to log in. Identify the characteristics of different interactive actions. For example, according to the network, the functions of the synonym pair set in the web page are classified to obtain a key dictionary. For example, URL key dictionary, title key dictionary.

[0102] The following is an introduction to how to train the Word2Vec model:

[0103] After obtaining the high-frequency word set, the high-frequency word set to be trained is preprocessed according to the preset rules to obtain preprocessed text data. The preprocessed text data is segmented to obtain multiple words. Multiple words are input into the Word2Vec model to be trained to obtain the corresponding word embedding vectors; the cosine similarity between any set of word embedding vector pairs is calculated, and the word embedding vector pair with the highest cosine similarity is used as a synonym pair, and the words in the synonym pair are semantically close.

[0104] Optionally, after obtaining the high-frequency words, the high-frequency words can be preprocessed in the following manner: remove the angle brackets of HTML tags, and retain the tag name, text, and attribute value in the tag. Convert the text to lowercase. Delete the preset special characters and extra spaces to obtain the preprocessed text.

[0105] Since the HTML source code contains a large number of tags, such as <input> Label, <button>Tags, Form tags, etc. These tags do not directly provide the meaning of the interaction in text mining, but interfere with subsequent analysis. Removing the angle brackets (< and >) of the tags, but retaining the tag name, text, and attribute value, can convert HTML structured data into a text format that is easier to process. Because tags contain information directly related to the interaction. You can retain the tag name, text, and attribute value. The tag name, text, and attribute value contain information directly related to the interaction. For example, <input type="text"name="username"> The input, type="text", and name="username" in the example are all important information when analyzing login interactions. Converting text to lowercase helps eliminate unnecessary diversity caused by differences in uppercase and lowercase letters, so that the same or similar words are considered consistent when counting, thereby improving the accuracy of the analysis. To prevent special characters and extra spaces from interfering with text analysis, you can also delete special characters and extra spaces, for example, special characters such as punctuation marks and HTML entities.

[0106] The following is an introduction to how to train the second model:

[0107] In order to enable the second model to correctly classify different word pairs, the second model may adopt supervised learning, that is, a data set with labels is used to train a neural network model to obtain the second model. For example, the neural network model may adopt a feed-forward neural network.

[0108] It is understandable that the data set for training the neural network model may be constructed through manual annotation. For example, as shown in Table 1, the embodiment of the present application provides a word pair category table.

[0109] Table 1: Word pair category table

[0110] Vocabulary 1 Vocabulary 2 Word pair category label password psw 1 password pin 2 password Key 1 password password 1 password securitykey 0

[0111] In Table 1, the label "1" indicates a synonym, the label "same" indicates other semantically related words, and the label "other" indicates an incorrectly recognized word. The word pair category label of password and psw is 1. The word pair category label of password and psw is 1. The word pair category label of password and personal identification number (pin) is 1. The word pair category label of password and key is 1. The word pair category label of password and password is 1. The word pair category label of password and security key is 0.

[0112] Step S203: Calculate the ratio of the character length in each form Form tag in the target web page to the character length of the web page content to obtain the content ratio, and calculate the ratio of the number of sub-elements containing the interactive action keyword to the total number of elements in the corresponding Form tag to obtain the element hit ratio.

[0113] The content ratio is used to indicate the proportion of elements in the Form tag relative to the webpage content. The element hit ratio is used to indicate the proportion of elements in the Form tag that are related to user interaction.

[0114] In an optional embodiment, the content ratio can be obtained by calculating the ratio of the character length in each Form tag to the character length of the web page content in the following manner:

[0115] First, use a hypertext markup language HTML parsing library (such as BeautifulSoup) to parse the HTML source code and delete tags and comment elements that are not related to identifying the login page. For example, tags and comment elements that are not related to identifying the login page include: tags, <script>标签、<svg>标签、<style>标签、<link>标签。删除无关标签和注释元素后,确定HTML源码的剩余字符长度。这样,可以通过HTML源码的剩余字符长度了解页面的复杂度和可能的信息密度。

[0116] 其次,由于字符长度可以作为Form内容的基本特征,有助于了解表单的复杂度。可以确定每个Form标签定义的表单区域的字符长度。例如,由于不同的前端开发框架和用户界面(User Interface,UI)框架可以以不同的方式定义表单。为了可以覆盖大多数常见的表单定义方式,本申请可以使用后缀匹配的方式确定每个Form标签定义的表单区域的字符长度。即,查找所有以form结尾的标签(如<form>),以及属性(如role="form")标识为form的元素(如<div role="form">)。

[0117] 可选的,由于Form标签可以以层叠样式表(Cascading Style Sheets,CSS)样式,或脚本语言(JavaScript)代码而被隐藏。由于隐藏的表单对于用户来说是不可见的,因此在识别登录页面时应该被排除。还可以检查Form标签及其子元素是否在页面上直接显示,删除使用CSS或JavaScript隐藏的隐式表单。

[0118] 最后,计算每个Form标签内的字符长度与HTML源码的剩余字符长度的比值得到内容比例。

[0119] 在一种可选的实施例中,可以采用如下方式计算包含交互动作关键词的子元素数量与对应的Form标签内总元素数量的比值得到元素命中比例:

[0120] 首先,获得与登录操作相关的交互动作关键词典。其中,交互动作关键词典包含与登录过程紧密相关的关键词,比如"登录(login)”、"登录(sign in)”ign用户名(username)”、"密码(password)”、"输入(enter)”等。对于网页内容中的每一个Form标签,遍历Form标签内部的所有子元素,(如输入标签(input)、选择标签(select)等)。其中,子元素用于表示用户与表单进行交互的方式。确定子元素的属性(如名称(name),标识符(identifier,id))或内容(如按钮的文本)是否包含交互动作关键词典的某个关键词。如果包含,则该子元素与登录操作相关。

[0121] 其次,在确定form标签内与登录操作相关的子元素后,还可以获取每个Form标签内的总元素数量。计算包含交互动作关键词的子元素数量与对应的Form标签内总元素数量的比值得到元素命中比例。其中,命中比例的数值越高,该Form标签与登录操作的相关性可能越大。

[0122] 可选的,若网页中存在多个Form标签,遍历所有Form的命中比例,确定命中最多交互动作关键词的Form标签作为目标标签。确定包含交互动作关键词的子元素数量最多的Form标签作为目标标签。计算目标标签包含交互动作关键词的子元素数量与目标标签内总元素数量的比值,得到元素命中比例。

[0123] 这样,通过识别并聚焦交互动作最丰富的Form标签,可以确保网页的主要特征得到突出显示,便于后续进行数据分析。

[0124] 可选的,为了确保准确性,可以采用唯一性确保一个元素只能被判定为与一个交互动作相关,避免多重计数。如,可以使用两个映射。第一个映射:元素ID到交互动作关键词的映射(每个元素只能有一个交互动作关键词)。第二个映射:交互动作关键词到元素ID的映射(每个交互动作关键词只能对应一个元素ID)。检查第一个映射中是否已经存在该元素的ID,如果存在且对应的交互动作不同,则未通过检查。检查第二个映射中是否已经存在该交互动作关键词,如果存在且对应的元素ID不同,则未通过检查。如果两个映射都通过了检查,则更新映射以反映新的关联。

[0125] 步骤S204、输入标准化处理后的特征数据输入至决策树模型中,确定目标网页是否为登录页面。

[0126] 其中,特征数据包括标记序列、内容比例以及元素命中比例。决策树模型是基于包含登录页面和非登录页面的待训练数据集合训练得到的。

[0127] 在一种可选的实施例中,可以按照如下预设规则对特征数据进行数据预处理。

[0128] 例如,预设规则可以包括:特征标准化:使用最小-最大标准化(Min-Max Scaling)将非0 / 1特征缩放到[0,1]区间。这样,采用标准化处理方式,可以有助于确保所有特征在同一数量级上,从而提高模型的训练效率和准确性。缺失值处理:检查数据集中是否存在缺失值,并使用均值填充这些缺失值。异常值处理:处理数据集中的异常值,以确保数据质量。

[0129] 下面对训练决策树模型的方式进行说明:

[0130] 对包含登录页面和非登录页面的待训练数据集合分别进行特征提取,得到待训练特征数据,待训练特征数据包括待训练数据集合中每个网页的标记序列、内容比例以及元素命中比例。按照预设规则对特征数据进行数据预处理,得到标准化数据。采用预设决策树算法基于标准化数据训练待训练的决策树模型,决策树模型采用预设参数防止过拟合。

[0131] 这样,通过训练包含登录页面和非登录页面的数据集,决策树模型能够处理复杂的特征组合,对于不同结构和内容的网页都能有较好的适应性,能够学习到登录页面的共同特征,提高识别网页的准确性。

[0132] 例如,包含登录页面的待训练数据可以为上文提及的正样本集合。包含非登录页面的待训练数据可以包括公开可访问网络数据。可以采用如下方式获取公开可访问网络数据。可以选择使用不同前端框架构建的网站。如视图(Vue)、纯HTML / 层叠样式表(CascadingStyle Sheets,CSS) / JavaScript等。收集具有不同框架特性的网站数据可以确保数据的多样性和代表性,有助于在后续的分析或模型训练中更好地处理不同框架构建的网站,提高模型的泛化能力。又例如,为了便于模型能够更好地适应和解析来自不同业务领域和构建技术的网站。还可以选择电商网站、社交媒体平台、企业内部系统、新闻网站等代表了不同的业务领域和数据类型。这些网站在内容结构、用户交互、数据保护政策等方面存在显著差异。收集这些领域的网站数据可以确保数据的全面性和丰富性。

[0133] 可选的,预设的决策树算法可以为分类回归树算法(Classification AndRegression Tree,CART)。可以通过设置最大深度、最小样本分裂数、最小叶节点样本数等参数,防止决策树过度拟合训练数据。还可以通过交叉验证和参数调优,进一步提升模型的准确性和鲁棒性。

[0134] 可选的,为了保证决策树模型的准确性和可靠性,可以使用验证数据集合评估决策树性能。其中,验证数据集合中包括多个已验证是否为登录页面的网页。

[0135] 例如,决策树模型训练完成后,决策树模型对验证数据集合中的每个网页进行分类,预测每个网页是登录页面还是非登录页面。通过比较决策树的预测结果与验证数据集合中的实际标记,评估决策树模型的性能。如,采用正确分类的网页数量占总网页数量的比值评估决策树模型的性能。

[0136] 如图3所示,本申请实施例提一种网页检测方法的示例性的流程图,可以包括以下步骤:

[0137] 步骤S301、从目标网页中提取表示网页内容的页面数据信息;

[0138] 步骤S302、用关键词典遍历页面数据信息,确定页面数据信息是否包含关键词典中的关键词,并进行标记得到标记序列;

[0139] 步骤S303、使用超文本标记语言HTML解析库解析页面数据信息中的HTML源码,删除HTML源码中与识别登录页面无关的标签和注释元素;

[0140] 步骤S304、确定每个Form标签定义的表单区域的字符长度以及HTML源码的剩余字符长度;

[0141] 步骤S305、计算每个Form标签内的字符长度与HTML源码的剩余字符长度的比值得到内容比例;

[0142] 步骤S306、遍历每个Form标签的子元素,并检查子元素的属性或内容是否命中与登录操作相关的交互动作关键词典;

[0143] 步骤S307、计算包含交互动作关键词的子元素数量与对应的Form标签内总元素数量的比值得到元素命中比例;

[0144] 步骤S308、输入标准化处理后的特征数据输入至决策树模型中,确定目标网页是否为登录页面,其中,特征数据包括标记序列、内容比例以及元素命中比例。

[0145] 图4为本申请实施例提供的一种网页检测装置的结构示意图。如图4所示,该装置包括:处理模块401、计算模块402。

[0146] 处理模块401,用于从目标网页中提取表示网页内容的页面数据信息;

[0147] 处理模块401,还用于采用关键词典遍历页面数据信息,确定页面数据信息是否包含关键词典中的关键词,并进行标记得到标记序列,关键词典是基于登录操作相关的高频语义词对确定的;

[0148] 计算模块402,用于计算目标网页中每个表单Form标签内的字符长度与网页内容字符长度的比值得到内容比例,内容比例用于表示Form标签相对于网页内容的元素占比,计算包含交互动作关键词的子元素数量与对应的Form标签内总元素数量的比值得到元素命中比例,元素命中比例用于表示Form标签中与用户交互相关的元素占比;

[0149] 处理模块402,还用于输入标准化处理后的特征数据输入至决策树模型中,确定目标网页是否为登录页面,特征数据包括标记序列、内容比例以及元素命中比例,决策树模型是基于包含登录页面和非登录页面的待训练数据集合训练得到的。

[0150] 可选的,关键词典采取如下方式确定,处理模块401还用于:

[0151] 从正样本集合中提取有关于登录系统的高频词集合,正样本集合包括管理系统隐私数据;

[0152] 输入高频词集合中至词向量Word2Vec模型,得到交互高频词集合中的同义词对集合,Word2Vec模型基于不同词语间的余弦相似度进行训练,同义词对中的词语的语义接近;

[0153] 将同义词对集合的词嵌入向量输入至第二模型中,得到对应的词对类别标签,第二模型是基于预设数据集合对神经网络模型进行训练得到的,预设数据集合包括多个用于标注词对之间关系的标签;

[0154] 根据预设规则对同义词对集合进行分类,得到关键词典。

[0155] 可选的,上述根据预设规则对同义词对集合进行分类,得到关键词典,处理模块401具体用于:

[0156] 根据网页的交互动作对同义词对集合进行分类,得到关键词典;

[0157] 或,根据同义词对集合在网页中的功能进行分类,得到关键词典。

[0158] 可选的,Word2Vec模型采用如下方式进行训练,处理模块401还用于:

[0159] 按照预设规则对待训练的高频词集合进行预处理,得到预处理文本数据;

[0160] 对预处理文本数据进行文本分词,得到多个词语;

[0161] 输入多个词语中至待训练的Word2Vec模型中,得到对应的词嵌入向量;

[0162] 计算任意一组词嵌入向量对之间的余弦相似度,将余弦相似度最高的词嵌入向量对作为同义词对。

[0163] 可选的,按照预设规则对待训练的高频词集合进行预处理,处理模块401具体用于:

[0164] 删除HTML标签尖括号,保留标签内的标签名、文本和属性值;

[0165] 将文本转换为小写:

[0166] 删除预设的特殊字符和多余的空格,得到预处理文本。

[0167] 可选的,上述从目标网页中提取表示网页内容的页面数据信息,处理模块401具体用于:

[0168] 若目标网页为动态加载内容,模拟用户网页行为获取目标网页对应的页面数据信息;

[0169] 若目标网页为静态加载内容,通过客户端发送网络请求获取目标网页对应的页面数据信息。

[0170] 可选的,上述计算目标网页中每个表单Form标签内的字符长度与网页内容字符长度的比值得到内容比例,

[0171] 处理模块401具体用于:使用超文本标记语言HTML解析库解析页面数据信息中的HTML源码,删除HTML源码中与识别登录页面无关的标签和注释元素;

[0172] 确定每个Form标签定义的表单区域的字符长度以及HTML源码的剩余字符长度;

[0173] 计算模块402具体用于:计算每个Form标签内的字符长度与HTML源码的剩余字符长度的比值得到内容比例。

[0174] 可选的,上述计算包含交互动作关键词的子元素数量与对应的Form标签内总元素数量的比值得到元素命中比例,

[0175] 处理模块401具体用于:遍历每个Form标签的子元素,并检查子元素的属性或内容是否命中与登录操作相关的交互动作关键词典;

[0176] 计算模块402具体用于:计算包含交互动作关键词的子元素数量与对应的Form标签内总元素数量的比值得到元素命中比例。

[0177] 可选的,处理模块401还用于:若网页中存在多个Form标签,遍历所有Form的命中比例,确定包含交互动作关键词的子元素数量最多的Form标签作为目标标签;

[0178] 计算模块402还用于:计算目标标签包含交互动作关键词的子元素数量与目标标签内总元素数量的比值,得到元素命中比例。

[0179] 可选的,决策树模型采用如下方式进行训练,处理模块401还用于:

[0180] 对包含登录页面和非登录页面的待训练数据集合分别进行特征提取,得到待训练特征数据,待训练特征数据包括待训练数据集合中每个网页的标记序列、内容比例以及元素命中比例。

[0181] 按照预设规则对特征数据进行数据预处理,得到标准化数据;

[0182] 采用预设决策树算法基于标准化数据训练待训练的决策树模型,决策树模型采用预设参数防止过拟合。

[0183] 基于相同的技术构思,本申请实施例中还提供了一种电子设备,电子设备可以实现前述网页检测装置的功能。

[0184] 图5为本申请实施例提供的电子设备的结构示意图。

[0185] 至少一个处理器501,以及与至少一个处理器501连接的存储器502,本申请实施例中不限定处理器501与存储器502之间的具体连接介质,图5中是以处理器501和存储器502之间通过总线500连接为例。总线500在图5中以粗线表示,其它部件之间的连接方式,仅是进行示意性说明,并不引以为限。总线500可以分为地址总线、数据总线、控制总线等,为便于表示,图5中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。或者,处理器501也可以称为控制器,对于名称不做限制。

[0186] 在本申请实施例中,存储器502存储有可被至少一个处理器501执行的指令,至少一个处理器501通过执行存储器502存储的指令,可以执行前文论述的一种网页检测方法。处理器501可以实现图4所示的装置中各个模块的功能。

[0187] 其中,处理器501是该装置的控制中心,可以利用各种接口和线路连接整个该控制设备的各个部分,通过运行或执行存储在存储器502内的指令以及调用存储在存储器502内的数据,该装置的各种功能和处理数据,从而对该装置进行整体监控。

[0188] 在一种可能的设计中,处理器501可包括一个或多个处理单元,处理器501可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、驾驶人员界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器501中。在一些实施例中,处理器501和存储器502可以在同一芯片上实现,在一些实施例中,它们也可以在独立的芯片上分别实现。

[0189] 处理器501可以是通用处理器,例如中央处理器(CPU)、数字信号处理器、专用集成电路、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本申请实施例中公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的一种网页检测方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。

[0190] 存储器502作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。存储器502可以包括至少一种类型的存储介质,例如可以包括闪存、硬盘、多媒体卡、卡型存储器、随机访问存储器(Random AccessMemory,RAM)、静态随机访问存储器(Static Random Access Memory,SRAM)、可编程只读存储器(Programmable Read Only Memory,PROM)、只读存储器(Read Only Memory,ROM)、带电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性存储器、磁盘、光盘等等。存储器502是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本申请实施例中的存储器502还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和 / 或数据。

[0191] 通过对处理器501进行设计编程,可以将前述实施例中介绍的一种网页检测方法所对应的代码固化到芯片内,从而使芯片在运行时能够执行图2所示的实施例的一种网页检测方法。如何对处理器501进行设计编程为本领域技术人员所公知的技术,这里不再赘述。

[0192] 在此需要说明的是,本申请实施例提供的上述通电子设备,能够实现上述方法实施例所实现的所有方法步骤,且能够达到相同的技术效果,在此不再对本实施例中与方法实施例相同的部分及有益效果进行具体赘述。

[0193] 本申请实施例还提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机可执行指令,计算机可执行指令用于使计算机执行上述实施例中的一种网页检测方法。

[0194] 本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一条或多条其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。

[0195] 本申请是参照根据本申请的方法、设备(系统)、和计算机程序产品的流程图和 / 或方框图来描述的。应理解可由计算机程序指令实现流程图和 / 或方框图中的每一流程和 / 或方框、以及流程图和 / 或方框图中的流程和 / 或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一条机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一条流程或多条流程和 / 或方框图一条方框或多条方框中指定的功能的装置。

[0196] 这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一条流程或多条流程和 / 或方框图一条方框或多条方框中指定的功能。

[0197] 这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一条流程或多条流程和 / 或方框图一条方框或多条方框中指定的功能的步骤。

[0198] 显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。< / script> < / button>

Claims

1. A web page detection method, characterized in that: The method comprises: Extracting page data information representing the content of the webpage from the target webpage; Using a key dictionary to traverse the page data information, determine whether the page data information contains a keyword in the key dictionary, and mark it to obtain a tag sequence, wherein the key dictionary is determined based on high-frequency semantic word pairs related to the login operation; The ratio of the character length in the Form tag of each form in the target webpage to the character length in the webpage content is calculated to obtain the content ratio, which is used to indicate the element ratio of the Form tag relative to the webpage content. The ratio of the number of sub-elements containing the interactive action keyword to the total number of elements in the corresponding Form tag is calculated to obtain the element hit ratio, which is used to indicate the element ratio related to user interaction in the Form tag. The input standardized feature data is input into the decision tree model to determine whether the target web page is a login page, the feature data includes the tag sequence, the content ratio and the element hit ratio, and the decision tree model is trained based on a training data set including login pages and non-login pages.

2. The method according to claim 1, characterized in that The key dictionary is determined in the following manner: Extracting a high-frequency word set related to logging into the system from a positive sample set, wherein the positive sample set includes management system privacy data; Input the high-frequency word set into the word vector Word2Vec model to obtain a synonym pair set in the interactive high-frequency word set, wherein the Word2Vec model is trained based on the cosine similarity between different words, and the words in the synonym pair are semantically close; Inputting the word embedding vectors of the synonym pair set into a second model to obtain corresponding word pair category labels, wherein the second model is obtained by training a neural network model based on a preset data set, and the preset data set includes a plurality of labels for marking the relationship between word pairs; The synonym pair set is classified according to preset rules to obtain the key dictionary.

3. The method according to claim 2, characterized in that The classifying the synonym pair set according to the preset rules to obtain the key dictionary specifically includes: Classifying the synonym pair set according to the interactive actions of the web page to obtain the key dictionary; Or, the functions collected in the web page are classified according to the synonyms to obtain the key dictionary.

4. The method according to claim 2, characterized in that: The Word2Vec model is trained in the following way: Preprocessing the high-frequency word set to be trained according to preset rules to obtain preprocessed text data; Performing text segmentation on the preprocessed text data to obtain a plurality of words; Input the multiple words into the Word2Vec model to be trained to obtain corresponding word embedding vectors; Calculate the cosine similarity between any set of word embedding vector pairs, and take the word embedding vector pair with the highest cosine similarity as a synonym pair.

5. The method according to claim 4, characterized in that The preprocessing of the high-frequency word set to be trained according to the preset rules specifically includes: Remove the angle brackets of HTML tags, and keep the tag name, text, and attribute values ​​inside the tags; Convert text to lowercase: The preset special characters and extra spaces are deleted to obtain the preprocessed text.

6. The method according to claim 1, characterized in that The step of extracting page data information representing the content of the webpage from the target webpage specifically includes: If the target web page is dynamically loaded content, simulate the user's web page behavior to obtain the page data information corresponding to the target web page; If the target webpage is statically loaded content, the client sends a network request to obtain page data information corresponding to the target webpage.

7. The method according to claim 1, characterized in that The calculating of the ratio of the character length in each Form tag in the target webpage to the character length of the webpage content to obtain the content ratio specifically includes: Parsing the HTML source code in the page data information using a hypertext markup language HTML parsing library, and deleting tags and comment elements in the HTML source code that are not related to identifying the login page; Determine the character length of the form area defined by each Form tag and the remaining character length of the HTML source code; The content ratio is obtained by calculating the ratio of the character length in each Form tag to the remaining character length of the HTML source code.

8. The method according to claim 1, characterized in that The calculation of the ratio of the number of sub-elements containing the interactive action keyword to the total number of elements in the corresponding Form tag to obtain the element hit ratio specifically includes: Traverse the child elements of each Form tag and check whether the attributes or content of the child elements hit the interactive action key dictionary related to the login operation; The element hit ratio is calculated by calculating the ratio of the number of sub-elements containing the interactive action keywords to the total number of elements in the corresponding Form tag.

9. The method according to claim 1 or 8, characterized in that: The method further comprises: If there are multiple Form tags on the web page, traverse the hit ratios of all Forms and determine the Form tag with the largest number of sub-elements containing the interactive action keyword as the target tag; The ratio of the number of sub-elements of the target tag containing the interactive action keyword to the total number of elements in the target tag is calculated to obtain the element hit ratio.

10. The method according to claim 1, characterized in that The decision tree model is trained in the following way: Performing feature extraction on a training data set including login pages and non-login pages to obtain feature data to be trained, wherein the feature data to be trained includes a tag sequence, a content ratio, and an element hit ratio of each web page in the training data set; Performing data preprocessing on the characteristic data according to preset rules to obtain standardized data; A preset decision tree algorithm is used to train a decision tree model to be trained based on the standardized data, and the decision tree model uses preset parameters to prevent overfitting.

11. A web page detection device, characterized in that: The device comprises: A processing module, used for extracting page data information representing the content of the webpage from the target webpage; The processing module is further used to traverse the page data information using a key dictionary, determine whether the page data information contains a keyword in the key dictionary, and mark it to obtain a mark sequence, wherein the key dictionary is determined based on high-frequency semantic word pairs related to the login operation; A calculation module is used to calculate the ratio of the character length in each form Form tag in the target webpage to the character length in the webpage content to obtain a content ratio, where the content ratio is used to indicate the element ratio of the Form tag relative to the webpage content, and calculate the ratio of the number of sub-elements containing the interactive action keyword to the total number of elements in the corresponding Form tag to obtain an element hit ratio, where the element hit ratio is used to indicate the element ratio in the Form tag related to user interaction; The processing module is also used to input the standardized feature data into the decision tree model to determine whether the target web page is a login page, the feature data includes the tag sequence, the content ratio and the element hit ratio, and the decision tree model is trained based on a set of training data including login pages and non-login pages.

12. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 10 is implemented.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is used to cause the computer to execute the method according to any one of claims 1 to 10.

14. A computer program product, characterized in that When the computer program product is called by a computer, the computer is caused to execute the method according to any one of claims 1 to 10.

Citation Information

Cited By

  • Webpage wrong word detection method and device, equipment and storage medium

    CN121543586A