A training and application method and device for web page tampering detection model

By cleaning the description and text fields of the web page and encoding the Bert model, semantic contradiction detection results are generated, and the web page tampering detection model is trained, which solves the problem of network attackers tampering with web pages and achieves efficient and accurate web page tampering detection and prevention.

CN114201606BActive Publication Date: 2024-10-29BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111506272.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-10
Publication Date
2024-10-29
Estimated Expiration
2041-12-10

AI Technical Summary

Technical Problem

Network attackers often tamper with web pages and implant dark links or Trojans, putting users at risk. Existing technologies are difficult to efficiently detect and prevent web page tampering.

Method used

By obtaining the description field and text field content of the web page, perform data cleaning and Bert model encoding, generate semantic contradiction detection results, train the web page tampering detection model, and realize automatic batch detection of web page tampering.

Benefits of technology

It achieves high-precision web page tampering detection, can identify tampered web pages and provide security precautions, improving detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114201606B_ABST
    Figure CN114201606B_ABST
Patent Text Reader

Abstract

The present application provides a training, application method and device for a webpage tampering detection model. The training method for the webpage tampering detection model includes: obtaining the description field content and the text field content in multiple webpages, and performing data cleaning processing to obtain the description pure content and the text pure content; encoding the description pure content and the text pure content according to a preset Bert model to obtain an encoded field; obtaining a semantic contradiction detection result matching the encoded field; training according to the semantic contradiction detection result, the description pure content, the text pure content and the preset training conditions to obtain a webpage tampering detection model. It can be seen that by implementing this implementation method, a high-precision webpage tampering detection model can be trained based on the contextual semantic contradictions in the webpage, so that the webpage tampering detection model can perform tampering detection on webpages in batches, so that users can recognize tampered webpages and take security precautions against them.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security, and more specifically, to a method and device for training and applying a web page tampering detection model. Background Art

[0002] At present, cyber attackers will target normal web pages and tamper with the content of normal web pages. The most common method is that cyber attackers gain control of the server where the website is located and tamper with the web pages through the server. Some even implant dark links or mount Trojans while tampering with the web pages, so that users can easily perform dangerous operations after opening the web pages. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a training, application method and device for a web page tampering detection model, which can train a high-precision web page tampering detection model based on the contextual semantic inconsistencies in the web page, so that the web page tampering detection model can perform tampering detection on web pages in batches, thereby enabling users to recognize tampered web pages and take security precautions against them.

[0004] A first aspect of an embodiment of the present application provides a method for training a webpage tampering detection model, comprising:

[0005] Get the description field content and text field content in multiple web pages;

[0006] Performing data cleaning on the description field content and the text field content to obtain pure description content and pure text content;

[0007] Encode the description clean content and the text clean content according to a preset Bert model to obtain a coding field;

[0008] Acquire a semantic contradiction detection result matching the encoding field; the semantic contradiction detection result is used to indicate whether there is a semantic contradiction between the pure content of the description and the pure content of the text;

[0009] Generate a data training set according to the semantic contradiction detection result, the description clean content and the text clean content;

[0010] The data training set is input into a preset original detection model so that the original detection model is trained according to preset training conditions to obtain a webpage tampering detection model.

[0011] In the above implementation process, the method can crawl the description field content and text field content in a large number of web pages, and after preprocessing the description field content and the text field content, obtain two json files for each web page; then, the method performs binary classification based on the contextual relationship between the two json files, so as to determine whether there is a semantic contradiction between the description field content and the text field content; wherein, if there is a semantic contradiction, the web page is considered to be tampered with, and if there is no semantic contradiction, the web page is considered to be normal; based on this, all input data and analysis results are packaged to form a data training set, so that the data training set can be used for the training of the artificial intelligence model, thereby obtaining a web page tampering detection model. It can be seen that the implementation of this implementation method can determine whether there is a contextual semantic contradiction based on the description field content and the text field content in the web page, and then perform web page tampering detection based on the contextual semantic contradiction, and train a web page tampering detection model that can automatically perform tampering detection on web pages in batches.

[0012] Furthermore, the step of obtaining the description field contents and the text field contents in the plurality of web pages includes:

[0013] Crawl multiple web pages according to a preset web crawler framework to obtain the description field content and text field content corresponding to each web page.

[0014] Furthermore, the step of performing data cleaning on the description field content and the text field content to obtain clean description content and clean text content includes:

[0015] In the description field content and the text field content, HTML tags and special characters are removed to obtain pure description content and pure text content.

[0016] Furthermore, the step of encoding the description clean content and the text clean content according to a preset Bert model to obtain a coding field includes:

[0017] According to the preset Bert model, [CLS] is inserted before the clean content of the description, [SEP] is inserted after the clean content of the description and before the clean content of the text, and [SEP] is inserted after the clean content of the text to obtain a coding field.

[0018] Furthermore, the step of obtaining a semantic contradiction detection result matching the encoding field includes:

[0019] Extracting a sentence pair feature vector corresponding to the encoding field;

[0020] The sentence pair feature vector is input into a semantic contradiction detection binary classification network to obtain a semantic contradiction detection result.

[0021] Furthermore, the step of inputting the data training set into a preset original detection model so that the original detection model is trained according to preset training conditions to obtain a webpage tampering detection model includes:

[0022] The data training set is input into a preset original detection model so that the original detection model is trained according to a preset number of training rounds, a preset batch size, a preset learning rate, a preset description maximum input length, a preset text maximum input length and a preset cross entropy loss function to obtain a web page tampering detection model.

[0023] A second aspect of the embodiments of the present application provides an application method of a webpage tampering detection model, wherein the webpage tampering detection model is trained by the webpage tampering detection model training method described in the first aspect of the embodiments of the present application, and the method comprises:

[0024] Get the description field content and text field content of the web page to be detected;

[0025] Performing data cleaning on the description field content and the text field content to obtain pure description content and pure text content;

[0026] The description clean content and the text clean content are input into a web page tampering detection model, so that the web page tampering detection model outputs a web page tampering detection result.

[0027] In the above implementation process, the method can receive the description field content and the text field content in the web page, and identify and process the description field content and the text field content and perform tampering detection through the web page tampering detection model, thereby obtaining the web page tampering detection result. It can be seen that by implementing this implementation method, the web pages can be automatically batch-detected through the web page tampering detection model, and the web page tampering detection results can be output, thereby achieving the effect of efficient and batch web page tampering detection.

[0028] A third aspect of an embodiment of the present application provides a training device for a webpage tampering detection model, the training device for a webpage tampering detection model comprising:

[0029] An acquisition unit, used for acquiring the description field content and the text field content in multiple web pages;

[0030] A preprocessing unit, used for performing data cleaning processing on the description field content and the text field content to obtain pure description content and pure text content;

[0031] An encoding unit, used for encoding the description clean content and the text clean content according to a preset Bert model to obtain an encoding field;

[0032] A second classification unit is used to obtain a semantic contradiction detection result matching the encoding field; the semantic contradiction detection result is used to indicate whether there is a semantic contradiction between the pure content of the description and the pure content of the text;

[0033] A generating unit, configured to generate a data training set according to the semantic contradiction detection result, the description clean content and the text clean content;

[0034] The training unit is used to input the data training set into a preset original detection model so that the original detection model is trained according to preset training conditions to obtain a web page tampering detection model.

[0035] In the above implementation process, the device can automatically train a web page tampering detection model so that subsequent web pages can be batch-detected with high precision through the web page tampering detection model, thereby improving the efficiency and accuracy of web page tampering detection.

[0036] In a fourth aspect of the embodiment of the present application, the webpage tampering detection model is obtained by training the webpage tampering detection model training device according to the third aspect of the embodiment of the present application, and the application device of the webpage tampering detection model includes:

[0037] An acquisition unit, used to acquire the description field content and the text field content of the web page to be detected;

[0038] A preprocessing unit, used for performing data cleaning processing on the description field content and the text field content to obtain pure description content and pure text content;

[0039] The detection unit is used to input the description clean content and the text clean content into a web page tampering detection model, so that the web page tampering detection model outputs a web page tampering detection result.

[0040] In the above implementation process, the device can automatically perform web page tampering detection on a large number of web pages according to the web page tampering detection model to obtain web page tampering detection results, thereby realizing high-precision batch detection of tampered web pages.

[0041] A fifth aspect of the embodiments of the present application provides a webpage tampering detection method, the method comprising:

[0042] Get the description field content and text field content in the web page to be detected;

[0043] Performing data cleaning on the description field content and the text field content to obtain pure description content and pure text content;

[0044] Encode the description clean content and the text clean content according to a preset Bert model to obtain a coding field;

[0045] Acquire a semantic contradiction detection result matching the encoding field; the semantic contradiction detection result is used to indicate whether there is a semantic contradiction between the pure content of the description and the pure content of the text;

[0046] When the semantic contradiction detection result is that there is a semantic contradiction, a prompt message indicating that the web page to be detected has been tampered with is output; when the semantic contradiction detection result is that there is no semantic contradiction, a prompt message indicating that the web page to be detected has not been tampered with is output.

[0047] In the above implementation process, the method can judge whether there is a contextual semantic contradiction based on the description field content and the text field content in the web page, and then determine whether the web page to be detected has been tampered with based on the judgment result, thereby achieving the effect of web page tampering detection for a single web page based on the model principle.

[0048] A sixth aspect of an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the training method of the web page tampering detection model described in any one of the first aspect of the embodiment of the present application.

[0049] A seventh aspect of an embodiment of the present application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the training method of the web page tampering detection model described in any one of the first aspect of the embodiment of the present application is executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0051] Figure 1 A flowchart of a method for training a webpage tampering detection model provided in an embodiment of the present application;

[0052] Figure 2 A schematic diagram of a flow chart of an application method of a webpage tampering detection model provided in an embodiment of the present application;

[0053] Figure 3 A schematic diagram of a flow chart of a webpage tampering detection method provided in an embodiment of the present application;

[0054] Figure 4 A schematic diagram of the structure of a training device for a webpage tampering detection model provided in an embodiment of the present application;

[0055] Figure 5 A schematic diagram of the structure of an application device of a web page tampering detection model provided in an embodiment of the present application. DETAILED DESCRIPTION

[0056] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0057] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0058] Example 1

[0059] Please see Figure 1 , Figure 1 A flow chart of a method for training a webpage tampering detection model is provided for an embodiment of the present application. The method for training a webpage tampering detection model includes:

[0060] S101. Crawl multiple web pages according to a preset web crawler framework to obtain description field content and text field content corresponding to each web page.

[0061] In this embodiment, the text content on each web page is crawled through a web crawler framework.

[0062] S102. Remove HTML tags and special characters from the description field content and the text field content to obtain pure description content and pure text content.

[0063] In this embodiment, the method maliciously cleans the text content of the description field and the text field corresponding to each web page to remove HTML tags and special characters contained in the text.

[0064] In this embodiment, after the above steps, the method has converted each web page into a json file represented by three fields, wherein the fields are url field, description field, and text field, and these fields are all pure content.

[0065] S103. According to the preset Bert model, [CLS] is inserted before the clean content of description, [SEP] is inserted after the clean content of description and before the clean content of text, and [SEP] is inserted after the clean content of text to obtain a coding field.

[0066] In this embodiment, by using this encoding method, the clean description content and the clean text content can be processed as a whole, which is conducive to capturing the semantic contradiction between the tampered content and the normal content.

[0067] In this embodiment, the method uses the Bert model to encode the text content of the description field and the text content of the text field. Specifically, the method treats the text content of the description field as the first sentence and inserts [CLS] at the beginning of the first sentence; then treats the text content of the text field as the second sentence and inserts [SEP] in the middle of the two sentences and at the end of the second sentence.

[0068] S104: Extract sentence pair feature vectors corresponding to the encoding fields.

[0069] In this embodiment, the method can return the sentence pair feature vector of the encoding field through the Bert model.

[0070] S105, inputting the sentence pair feature vector into a semantic contradiction detection binary classification network to obtain a semantic contradiction detection result.

[0071] In this embodiment, the semantic contradiction detection result is used to indicate whether there is a semantic contradiction between the pure content of description and the pure content of text.

[0072] In this embodiment, if there is a semantic contradiction, it is considered that the webpage has been tampered with, and if there is no semantic contradiction, it is considered that the webpage has not been tampered with.

[0073] S106. Generate a data training set based on the semantic contradiction detection result, the description pure content and the text pure content.

[0074] S107. Input the data training set into the preset original detection model, so that the original detection model is trained according to the preset number of training rounds, the preset batch size, the preset learning rate, the preset description maximum input length, the preset text maximum input length and the preset cross entropy loss function to obtain a web page tampering detection model.

[0075] In this embodiment, the method can further input the URL field of the web page into the original detection model so that the original detection model can be trained to produce better web page tampering detection results. Specifically, when the URL field is input into the original detection model for training, the original detection model can identify the type of the URL according to the URL field, and determine whether the semantic contradiction between the description field and the text field is reasonable based on the type of the URL, and then give an accurate web page tampering detection result.

[0076] In this embodiment, the method can set the number of training rounds (epoch), batch size (batch size), learning rate (lr), the maximum length of description input and the maximum length of text input in the original detection model, and use the cross entropy loss function as the loss function.

[0077] In this embodiment, during the process of training the model, the hyperparameters are adjusted so that the trained webpage tampering detection model is in an optimal state.

[0078] In this embodiment, the maximum length of the description input and the maximum length of the text input can limit the input of the web page tampering detection model, thereby avoiding the instability of the web page tampering detection model caused by excessively long text input.

[0079] According to the current network environment, the keywords and company names tampered in the tampered webpages usually have significant semantic differences from the keywords and companies in the original normal text. For example, the website of a company engaged in equipment manufacturing and the website of a gambling company obviously have great differences in keywords and company descriptions. Therefore, the tampered webpages usually have inconsistencies between the webpage description and the webpage text context. And it is for this reason that the webpage tampering detection model trained by this method can accurately and efficiently detect tampered webpages.

[0080] In this embodiment, the execution subject of the method may be a computing device such as a computer or a server, and no limitation is made in this embodiment.

[0081] In this embodiment, the execution subject of the method may also be a smart device such as a smart phone, a tablet computer, etc., which is not limited in this embodiment.

[0082] It can be seen that the training method of the web page tampering detection model described in this embodiment can determine whether there is a contextual semantic contradiction based on the content of the description field and the text field in the web page, and then perform web page tampering detection based on the contextual semantic contradiction, and train a web page tampering detection model that can automatically detect tampering of web pages in batches.

[0083] Example 2

[0084] Please see Figure 2 , Figure 2 A flow chart of an application method of a webpage tampering detection model is provided for an embodiment of the present application. The webpage tampering detection model is trained by the webpage tampering detection model training method in embodiment 1. Specifically, the application method of the webpage tampering detection model includes:

[0085] S201, obtaining the description field content and the text field content of the web page to be detected.

[0086] S202: Perform data cleaning on the description field content and the text field content to obtain pure description content and pure text content.

[0087] S203: input the clean content of description and the clean content of text into a web page tampering detection model, so that the web page tampering detection model outputs a web page tampering detection result.

[0088] In this embodiment, for the same or similar explanations, reference may be made to the description in Embodiment 1, which will not be further elaborated in this embodiment.

[0089] In this embodiment, the execution subject of the method may be a computing device such as a computer or a server, and no limitation is made in this embodiment.

[0090] In this embodiment, the execution subject of the method may also be a smart device such as a smart phone, a tablet computer, etc., which is not limited in this embodiment.

[0091] It can be seen that the application method of the webpage tampering detection model described in this embodiment can receive the description field content and the text field content in the webpage, and identify and process the description field content and the text field content and perform tampering detection on the webpage tampering detection model, thereby obtaining the webpage tampering detection result. It can be seen that the implementation of this embodiment can automatically detect webpages in batches through the webpage tampering detection model, output the webpage tampering detection results, thereby achieving the effect of efficient and batch webpage tampering detection.

[0092] Example 3

[0093] Please see Figure 3 , Figure 3 A schematic flow chart of a webpage tampering detection method is provided for an embodiment of the present application. The webpage tampering detection method includes:

[0094] S301, obtaining the description field content and the text field content in the web page to be detected.

[0095] S302: Perform data cleaning on the description field content and the text field content to obtain pure description content and pure text content.

[0096] S303: Encode the description clean content and the text clean content according to a preset Bert model to obtain a coding field.

[0097] S304, obtaining a semantic contradiction detection result matching the encoded field; the semantic contradiction detection result is used to indicate whether there is a semantic contradiction between the pure content of description and the pure content of text.

[0098] S305: When the semantic contradiction detection result is that there is a semantic contradiction, output prompt information that the web page to be detected has been tampered with; when the semantic contradiction detection result is that there is no semantic contradiction, output prompt information that the web page to be detected has not been tampered with.

[0099] In this embodiment, for the same or similar explanations, reference may be made to the description in Embodiment 1, which will not be further elaborated in this embodiment.

[0100] In this embodiment, the execution subject of the method may be a computing device such as a computer or a server, and no limitation is made in this embodiment.

[0101] In this embodiment, the execution subject of the method may also be a smart device such as a smart phone, a tablet computer, etc., which is not limited in this embodiment.

[0102] It can be seen that the web page tampering detection method described in this embodiment can be implemented to determine whether there is a contextual semantic contradiction based on the description field content and the text field content in the web page, and then determine whether the web page to be detected has been tampered with based on the judgment result, thereby achieving the effect of web page tampering detection for a single web page based on the model principle.

[0103] Example 4

[0104] Please see Figure 4 , Figure 4 A schematic diagram of the structure of a training device for a webpage tampering detection model provided in an embodiment of the present application. Figure 4 As shown, the training device of the webpage tampering detection model includes:

[0105] The acquisition unit 410 is used to acquire the description field content and the text field content in multiple web pages;

[0106] A preprocessing unit 420 is used to perform data cleaning on the description field content and the text field content to obtain pure description content and pure text content;

[0107] The encoding unit 430 is used to encode the description clean content and the text clean content according to a preset Bert model to obtain an encoding field;

[0108] The second classification unit 440 is used to obtain a semantic contradiction detection result matching the encoding field; the semantic contradiction detection result is used to indicate whether there is a semantic contradiction between the pure content of description and the pure content of text;

[0109] A generating unit 450 is used to generate a data training set according to the semantic contradiction detection result, the description clean content and the text clean content;

[0110] The training unit 460 is used to input the data training set into the preset original detection model so that the original detection model is trained according to the preset training conditions to obtain the webpage tampering detection model.

[0111] As an optional implementation, the acquisition unit 410 is specifically configured to crawl multiple web pages according to a preset web crawler framework to obtain the description field content and the text field content corresponding to each web page.

[0112] As an optional implementation, the preprocessing unit 420 is specifically configured to remove HTML tags and special characters from the description field content and the text field content to obtain pure description content and pure text content.

[0113] As an optional implementation, the encoding unit 430 is specifically used to insert [CLS] before the description clean content, insert [SEP] after the description clean content and before the text clean content, and insert [SEP] after the text clean content according to a preset Bert model to obtain a coding field.

[0114] As an optional implementation, the binary classification unit 440 includes:

[0115] An extraction subunit 441, for extracting a sentence pair feature vector corresponding to a coding field;

[0116] The classification subunit 442 is used to input the sentence pair feature vector into a semantic contradiction detection binary classification network to obtain a semantic contradiction detection result.

[0117] As an optional implementation, the training unit 460 is specifically used to input the data training set into a preset original detection model, so that the original detection model is trained according to a preset number of training rounds, a preset batch size, a preset learning rate, a preset description maximum input length, a preset text maximum input length and a preset cross entropy loss function to obtain a web page tampering detection model.

[0118] In this embodiment, the explanation of the training device for the webpage tampering detection model can refer to the description in Embodiment 1, and will not be further elaborated in this embodiment.

[0119] It can be seen that the training device for the web page tampering detection model described in this embodiment can automatically train a web page tampering detection model so that subsequent web pages can be batch-detected with high precision through the web page tampering detection model, thereby improving the efficiency and accuracy of web page tampering detection.

[0120] Example 5

[0121] Please see Figure 5 , Figure 5 A schematic diagram of the structure of an application device of a webpage tampering detection model provided in an embodiment of the present application. Figure 5 As shown, the application device of the webpage tampering detection model includes:

[0122] The acquisition unit 510 is used to acquire the description field content and the text field content of the web page to be detected;

[0123] A preprocessing unit 520 is used to perform data cleaning on the description field content and the text field content to obtain pure description content and pure text content;

[0124] The detection unit 530 is used to input the clean content of description and the clean content of text into the web page tampering detection model, so that the web page tampering detection model outputs the web page tampering detection result.

[0125] In this embodiment, the webpage tampering detection model can be trained by the webpage tampering detection model training device in Embodiment 4.

[0126] In the embodiment of the present application, the explanation of the application device of the web page tampering detection model can refer to the description in Example 1, and no further elaboration will be given in this embodiment.

[0127] It can be seen that the application device that implements the web page tampering detection model described in this embodiment can automatically perform web page tampering detection on a large number of web pages according to the web page tampering detection model to obtain web page tampering detection results, thereby achieving high-precision batch detection of tampered web pages.

[0128] This embodiment provides an electronic device, including a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the training method of the web page tampering detection model in Example 1 of the present application.

[0129] This embodiment provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the training method of the web page tampering detection model in Embodiment 1 of the present application is executed.

[0130] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0131] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0132] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0133] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0134] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0135] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

Claims

1. A training method for a webpage tampering detection model, characterized in that: The method comprises: Get the description field content and text field content in multiple web pages; Performing data cleaning on the description field content and the text field content to obtain pure description content and pure text content; Encode the description clean content and the text clean content according to a preset Bert model to obtain a coding field; Acquire a semantic contradiction detection result matching the encoding field; the semantic contradiction detection result is used to indicate whether there is a semantic contradiction between the pure content of the description and the pure content of the text; Generate a data training set according to the semantic contradiction detection result, the description clean content and the text clean content; The data training set is input into a preset original detection model so that the original detection model is trained according to preset training conditions to obtain a webpage tampering detection model.

2. The method for training a webpage tampering detection model according to claim 1, characterized in that: The step of obtaining the description field content and the text field content in multiple web pages includes: Crawl multiple web pages according to a preset web crawler framework to obtain the description field content and text field content corresponding to each web page.

3. The method for training a webpage tampering detection model according to claim 1, characterized in that: The step of performing data cleaning on the description field content and the text field content to obtain clean description content and clean text content comprises: In the description field content and the text field content, HTML tags and special characters are removed to obtain pure description content and pure text content.

4. The method for training a webpage tampering detection model according to claim 1, characterized in that: The step of encoding the description clean content and the text clean content according to the preset Bert model to obtain the encoded field includes: According to the preset Bert model, [CLS] is inserted before the clean content of the description, [SEP] is inserted after the clean content of the description and before the clean content of the text, and [SEP] is inserted after the clean content of the text to obtain a coding field.

5. The method for training a webpage tampering detection model according to claim 1, characterized in that: The step of obtaining a semantic contradiction detection result matching the encoding field comprises: Extracting a sentence pair feature vector corresponding to the encoding field; The sentence pair feature vector is input into a semantic contradiction detection binary classification network to obtain a semantic contradiction detection result.

6. The method for training a webpage tampering detection model according to claim 1, characterized in that: The step of inputting the data training set into a preset original detection model so that the original detection model is trained according to preset training conditions to obtain a webpage tampering detection model comprises: The data training set is input into a preset original detection model so that the original detection model is trained according to a preset number of training rounds, a preset batch size, a preset learning rate, a preset description maximum input length, a preset text maximum input length and a preset cross entropy loss function to obtain a web page tampering detection model.

7. An application method of a webpage tampering detection model, characterized in that: The webpage tampering detection model is obtained by training the webpage tampering detection model training method according to any one of claims 1 to 6, the method comprising: Get the description field content and text field content of the web page to be detected; Performing data cleaning on the description field content and the text field content to obtain pure description content and pure text content; The description clean content and the text clean content are input into a web page tampering detection model, so that the web page tampering detection model outputs a web page tampering detection result.

8. A training device for a webpage tampering detection model, characterized in that: The training device of the webpage tampering detection model includes: An acquisition unit, used for acquiring the description field content and the text field content in multiple web pages; A preprocessing unit, used for performing data cleaning processing on the description field content and the text field content to obtain pure description content and pure text content; An encoding unit, used for encoding the description clean content and the text clean content according to a preset Bert model to obtain an encoding field; A second classification unit is used to obtain a semantic contradiction detection result matching the encoding field; the semantic contradiction detection result is used to indicate whether there is a semantic contradiction between the pure content of the description and the pure content of the text; A generating unit, configured to generate a data training set according to the semantic contradiction detection result, the description clean content and the text clean content; The training unit is used to input the data training set into a preset original detection model so that the original detection model is trained according to preset training conditions to obtain a web page tampering detection model.

9. An application device of a webpage tampering detection model, characterized in that: The webpage tampering detection model is obtained by training the webpage tampering detection model training device according to claim 8, and the application device of the webpage tampering detection model includes: An acquisition unit, used to acquire the description field content and the text field content of the web page to be detected; A preprocessing unit, used for performing data cleaning processing on the description field content and the text field content to obtain pure description content and pure text content; The detection unit is used to input the description clean content and the text clean content into a web page tampering detection model, so that the web page tampering detection model outputs a web page tampering detection result.

10. A webpage tampering detection method, characterized in that: The method comprises: Get the description field content and text field content in the web page to be detected; Performing data cleaning on the description field content and the text field content to obtain pure description content and pure text content; Encode the description clean content and the text clean content according to a preset Bert model to obtain a coding field; Acquire a semantic contradiction detection result matching the encoding field; the semantic contradiction detection result is used to indicate whether there is a semantic contradiction between the pure content of the description and the pure content of the text; When the semantic contradiction detection result is that there is a semantic contradiction, a prompt message indicating that the web page to be detected has been tampered with is output; when the semantic contradiction detection result is that there is no semantic contradiction, a prompt message indicating that the web page to be detected has not been tampered with is output.

Citation Information

Patent Citations

  • Webpage feature tampering detection method and device

    CN111797904A

  • Misinformation detection in online content

    US20200004882A1