Text data protection method and device, computing equipment and storage medium

The text data protection method creates a closed-mode shadow document object model for protected text data, using native code verification to prevent crawler access and tampering, effectively securing web page content.

CN119066705APending Publication Date: 2024-12-03CHINA INT CAPITAL CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411120957.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

Existing anti-crawler strategies, such as image camouflage, are easily cracked by OCR technology, leading to ineffective protection of text data on web pages, and lack detection mechanisms for tampering.

Method used

Implementing a text data protection method that uses an anti-crawler mechanism to create a closed-mode shadow document object model for protected text data, monitored by native code verification, and mounts it on a user-specified host element for rendering, preventing external access.

Benefits of technology

Enhances security by preventing external crawlers from obtaining real text data and detecting tampering attempts, ensuring accurate protection of sensitive information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119066705A_ABST
    Figure CN119066705A_ABST
Patent Text Reader

Abstract

The invention provides a text data protection method. Firstly, an anti-crawler mechanism is obtained. Then, executing the anti-crawler mechanism so as to implement the following steps: obtaining at least part of text data to be protected and processed in the hypertext markup language file and host elements of the text data subjected to protection processing; determining whether a code of an application programming interface method for creating the shadow document object model is a native code; in response to the fact that a code of an application programming interface method used for creating a shadow document object model is a native code, creating at least part of text data to be protected in the hypertext markup language file into the shadow document object model in a closed mode by using the application programming interface method, and mounting the shadow document object model in the closed mode to a host element specified by a user. And finally, rendering the host element and the shadow document object model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of computers, and in particular to a text data protection method and apparatus, a computing device, and a storage medium. Background Art

[0002] With the continuous development of computer technology, accessing web pages has gradually become an important way for people to obtain information in their lives. At the same time, in this environment, the Internet is also full of various crawler software to crawl important text data in web pages. It can be seen that the protection of text data on web pages is becoming more and more important. Anti-crawler is a countermeasure against web crawlers. It uses some countermeasure strategies to hinder or interfere with the normal crawling of crawlers, thereby protecting the resources of the website from being crawled by others and preventing problems such as data leakage. At present, the main anti-crawler strategy based on crawling is adopted. Its main idea is to set crawling obstacles during the crawling of crawlers to prevent or disrupt crawlers from obtaining real data. Take the anti-crawler strategy such as image camouflage as an example. It mixes pictures with text with normal text, making it difficult for crawlers to easily obtain the complete text content. However, with the development of OCR technology, it is very easy to identify and extract text in images. This anti-crawling strategy is not only easy to crack, but also because the cracking process cannot be effectively detected and intercepted, resulting in crawlers not being easily captured and discovered. Summary of the invention

[0003] In view of this, the present disclosure provides a text data protection method and apparatus, a computing device, and a storage medium, which are expected to overcome some or all of the above-mentioned deficiencies and other possible deficiencies.

[0004] According to the first aspect of the present disclosure, a text data protection method is provided. The method first obtains an anti-crawler mechanism. Then, the method executes the anti-crawler mechanism to implement the following steps: obtaining at least part of the text data to be protected in a hypertext markup language file and the host element of the protected text data; determining whether the code of the application programming interface method for creating a shadow document object model is native code; in response to the code of the application programming interface method for creating a shadow document object model being native code, using the application programming interface method to create at least part of the text data to be protected in the hypertext markup language file into a closed mode shadow document object model, and mounting the closed mode shadow document object model on a host element specified by the user. Finally, the method renders the host element and the shadow document object model.

[0005] In some embodiments, the obtaining of the anti-crawler mechanism includes: sending a request to access a target web page; obtaining a hypertext markup language file and a corresponding JavaScript file for the target web page, wherein the JavaScript file includes the anti-crawler mechanism.

[0006] In some embodiments, the JavaScript file also includes at least a portion of the text data to be protected and processed in the hypertext markup language file and a host element for protecting the processed text data; and wherein, obtaining at least a portion of the text data to be protected and processed in the hypertext markup language file and a host element for protecting the processed text data includes: obtaining from the JavaScript file at least a portion of the text data to be protected and processed in the hypertext markup language file and a host element for protecting the processed text data.

[0007] In some embodiments, the method further includes: in response to the code of the application programming interface method for creating the shadow document object model being not a native code, collecting identity information and host element information of the current browser.

[0008] In some embodiments, determining whether the code of the application programming interface method for creating a shadow document object model is native code includes: parsing the code of the application programming interface method for creating a shadow document object model into a string to obtain parsed content; in response to the parsed content being the same as the content of the native code, determining that the code of the application programming interface method for creating the shadow document object model is native code; in response to the parsed content being different from the content of the native code, determining that the code of the application programming interface method for creating the shadow document object model is not native code.

[0009] In some embodiments, the code of the application programming interface method for creating a shadow document object model is parsed into a string to obtain parsed content, including: obtaining the application programming interface method for creating the shadow document object model by the host element; checking whether the parsing method for the application programming interface method has been tampered with; in response to the parsing method not being tampered with, parsing the code of the application programming interface method for creating the shadow document object model into a string using the parsing method to obtain parsed content.

[0010] In some embodiments, the method further includes: determining the host element of the shadow document object model, the mode of the shadow document object model, and the content of the shadow document object model based on a rendering result obtained by rendering the host element and the shadow document object model; deleting the rendering result in response to the host element of the shadow document object model not being the host element of the text data to be protected, the mode of the shadow document object model is not a closed mode, or the content of the shadow document object model is not at least a portion of the text data to be protected in a hypertext markup language file.

[0011] According to a second aspect of the present disclosure, a text data protection device is provided, comprising an acquisition module, an execution module and a rendering module. The acquisition module is configured to acquire an anti-crawler mechanism. The execution module is configured to execute the anti-crawler mechanism to implement the following steps: acquiring at least part of the text data to be protected in a hypertext markup language file and a host element of the protected text data; determining whether the code of the application programming interface method for creating a shadow document object model is native code; in response to the code of the application programming interface method for creating a shadow document object model being native code, using the application programming interface method to create at least part of the text data to be protected in the hypertext markup language file into a closed mode shadow document object model, and mounting the closed mode shadow document object model on a host element specified by a user. The rendering module is configured to render the host element and the shadow document object model.

[0012] According to a third aspect of the present disclosure, a computing device is provided, comprising: a memory configured to store computer-executable instructions; and a processor configured to perform any one of the methods described above when the computer-executable instructions are executed by the processor.

[0013] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, which stores computer-executable instructions. When the computer-executable instructions are executed, any one of the methods described above is executed.

[0014] According to a fifth aspect of the present disclosure, a computer program product is provided, characterized in that the computer program product comprises computer executable instructions, and the computer executable instructions implement any of the methods described above when executed.

[0015] In the text data protection method and device claimed for protection in the present disclosure, an anti-crawler mechanism is first obtained, and then an execution module obtains at least part of the text data to be protected in a hypertext markup language file and a host element of the protected text data as input to the anti-crawler mechanism. When the anti-crawler mechanism determines that the code of the application programming interface method for creating a shadow document object model is native code, the anti-crawler mechanism uses the application programming interface method to create a closed-mode shadow document object model for at least part of the text data to be protected in the hypertext markup language file, and mounts the closed-mode shadow document object model on a host element specified by the user for rendering. In this way, it is monitored in real time whether the code of the application programming interface method used to create the shadow document object model is native code, which prevents external crawler programs from tampering with the application programming interface method and enhances security; and when the code of the application programming interface method used to create the shadow document object model is native code, at least part of the text data to be protected and processed is dynamically created into a closed-mode shadow document object model, thereby preventing the crawler from obtaining the real text data; and the closed-mode shadow document object model is mounted on a user-specified host element for rendering, so as to accurately obtain the target that the crawler is preparing to crack when a crawler exists.

[0016] These and other advantages of the disclosure will be apparent from and elucidated with reference to the embodiments described hereinafter. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Embodiments of the present disclosure will now be described in more detail and with reference to the accompanying drawings, in which:

[0018] Figure 1 An exemplary application scenario in which the technical solution according to the embodiments of the present disclosure can be implemented is illustrated;

[0019] Figure 2 A schematic flow chart of a text data protection method according to an embodiment of the present disclosure is illustrated;

[0020] Figure 3 A schematic diagram illustrating a method for determining whether the code of an application programming interface method for creating a shadow document object model is a native code according to an embodiment of the present disclosure;

[0021] Figure 4 An exemplary structural block diagram of a text data protection device according to an embodiment of the present disclosure is illustrated;

[0022] Figure 5 An example system is illustrated that includes an example computing device that represents one or more systems and / or devices that may implement the various techniques described herein. DETAILED DESCRIPTION

[0023] The following description provides specific details of various embodiments of the present disclosure so that those skilled in the art can fully understand and implement the various embodiments of the present disclosure. It should be understood that the technical solution of the present disclosure can be implemented without some of these details. In some cases, the present disclosure does not show or describe in detail some well-known structures or functions to avoid these unnecessary descriptions from obscuring the description of the embodiments of the present disclosure. The terms used in the present disclosure should be understood in their broadest reasonable manner, even if they are used in conjunction with specific embodiments of the present disclosure.

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

[0025] HTML: Hypertext Markup Language (English: HyperTextMarkup Language, referred to as HTML) is a standard markup language for creating web pages. HTML runs on the browser and is parsed by the browser. It includes a series of tags that can unify the document format on the network and connect scattered Internet 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.

[0026] JavaScript: JS for short, is a lightweight, interpreted or just-in-time compiled programming language with function priority. Its interpreter is called JavaScript engine, which is part of the browser and widely used as a client-side scripting language, usually used on HTML web pages to add dynamic functions to HTML web pages.

[0027] Document Object Model (DOM): Document Object Model (DOM) is a platform- and language-independent model that can be used to represent HTML documents. The document object model defines the logical structure of the document and how programs access and manipulate documents. When a web page is loaded, the browser automatically creates a document object model (DOM) for the current page. In DOM, all parts of a document (such as elements, attributes, text, etc.) are organized into a logical tree structure (similar to a family tree). The end point of each branch in the tree is called a node, and each node is an object. With the help of DOM, JavaScript can be used to access, modify, delete, or add any content in an HTML document.

[0028] Shadow Document Object Model: Shadow DOM, also known as Shadow DOM. Shadow DOM is a specification of HTML, which allows a DOM element subtree to be inserted when the document is rendered, but this subtree is not in the main DOM tree. It allows browser developers to encapsulate their own HTML tags, CSS styles and specific javascript codes, and developers can also create similar <input> , <video> 、 <audio>Such custom first-level tags as . It is used to implement the encapsulation of the DOM tree, isolating the internal structure of the component from the external code. Through Shadow DOM, you can create an independent DOM subtree, the style and behavior of this subtree will not affect the external DOM, nor will it be affected by the external style and behavior. When creating ShadowDOM, you can choose two modes, namely open mode and closed mode. Open mode allows access to Shadow DOM through JavaScript. Closed mode does not allow external JavaScript to access Shadow DOM.

[0029] Host element: The container element of ShadowDOM. It is an element in the normal DOM, which can be called the host element. The host element can be a custom web component, such as a custom tag, video tag, or any other custom element.

[0030] Figure 1 FIG. 1 illustrates an exemplary application scenario 100 in which the technical solution according to an embodiment of the present disclosure can be implemented. Figure 1 As shown, the application scenario shown includes a terminal 110 and a server 120 , and the terminal 110 is communicatively coupled with the server 120 via a network 130 .

[0031] The terminal 110 may be an intelligent terminal device with web page access capability. As an example, a browser application 140 may be run on the terminal 110 to access web pages. The terminal 110 and the browser application 140 support HTML and JS scripts.

[0032] The browser application 140 may send a request to the server 120 to access the target web page based on the URL input by the user. The server 120 stores various web page resources corresponding to the URL provided by the web page or content provider, such as a hypertext markup language file for the target web page and a corresponding JavaScript file. The server 120 may return the hypertext markup language file and the corresponding JavaScript file for the target web page to the browser application based on the request. The browser application may obtain the information of the web page corresponding to the URL based on the hypertext markup language file and render it, so as to display the content of the web page (such as text content; multimedia content such as icons and pictures) to the user, and execute the corresponding JavaScript file (such as the corresponding JavaScript script), etc.

[0033] The JavaScript file may include an anti-crawler mechanism, for example, and the browser application 140 may use the anti-crawler mechanism to obtain at least part of the text data in the hypertext markup language file to be protected and the host element of the protected text data; determine whether the code of the application programming interface method for creating the shadow document object model is native code; in response to the code of the application programming interface method for creating the shadow document object model being native code, use the application programming interface method to create at least part of the text data in the hypertext markup language file to be protected into a closed mode shadow document object model, and mount it on the host element specified by the user. Then, the host element and the shadow document object model may be rendered to be presented to the user.

[0034] It should be noted that the terminal 110 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, an intelligent speaker, a smart watch, etc., but is not limited thereto. The server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application is not limited here. The network 130 can be, for example, a wide area network (WAN), a local area network (LAN), a wireless network, a public telephone network, an intranet, and any other type of network known to those skilled in the art.

[0035] The scenario described above is merely an example in which the embodiments of the present disclosure may be implemented and is not limiting.

[0036] Figure 2 The schematic flow chart of a text data protection method 200 according to an embodiment of the present disclosure is shown. The text data protection method can be used, for example, in Figure 1 The terminal 110 shown is implemented, and specifically, for example, can be implemented on a browser on the terminal 110. Figure 2 As shown, the method 200 includes the following steps.

[0037] In step 210, an anti-crawler mechanism is obtained. The anti-crawler mechanism may be, for example, a predefined anti-crawler policy, which may be expressed as an anti-crawler policy function. In some embodiments, the anti-crawler mechanism may be obtained from a web page or a server of a content provider. As an example, a request to access a target web page may be first sent to a server. Then, for example, a hypertext markup language file and a corresponding JavaScript file for the target web page are obtained from the server, wherein the JavaScript file includes the anti-crawler mechanism.

[0038] In step 220, the anti-crawler mechanism is executed. In the execution of the anti-crawler mechanism, specifically, the following steps 2201-2203 may be implemented.

[0039] In step 2201, obtain at least part of the text data to be protected in the hypertext markup language file and the host element of the text data after protection. In the case where the anti-crawler mechanism is an anti-crawler policy function, at least part of the text data to be protected in the hypertext markup language file and the host element of the text data after protection can be used as two parameters of the anti-crawler policy function. At least part of the text data to be protected in the hypertext markup language file can be determined by the provider of the web page, indicating that at least part of the text data is prohibited from being acquired by various crawler software. The text data to be protected can be part of the text data or all of the text data in the hypertext markup language file, which is not limited here.

[0040] In some embodiments, at least part of the text data to be protected in the hypertext markup language file and the host element of the text data after protection processing can be included in a JavaScript file, and the JavaScript file is transmitted to the browser by the server. In this case, at the browser side, at least part of the text data to be protected in the hypertext markup language file and the host element of the text data after protection processing can be directly obtained from the JavaScript file, which can effectively reduce communication complexity and save network resources, of course, this is not restrictive.

[0041] In step 2202, it is determined whether the code of the application programming interface method for creating the shadow document object model is native code. Whether the code of the application programming interface method for creating the shadow document object model is native code can be determined in any suitable manner.

[0042] Figure 3 FIG. 3 is a schematic diagram of a method 300 for determining whether the code of an application programming interface method for creating a shadow document object model is native code. Figure 3 As shown, the method 300 includes steps 310-330. In step 310, the code of the application programming interface method for creating a shadow document object model is parsed into a string to obtain the parsed content. As an example, the toString method can be used to parse the code of the application programming interface method for creating a shadow document object model and the native code described below can be similarly parsed. In JavaScript, a string is a common data type. toString is one of the methods for operating strings, which is used to convert other data types into string types. This method is widely used and can convert numbers, arrays, objects, functions, etc. into string types. In step 320, it is determined whether the parsed content is the same as the content of the native code. In response to the parsed content being the same as the native code, it is determined in step 330 that the code of the application programming interface method for creating a shadow document object model is native code. In response to the parsed content being different from the content of the native code, it is determined in step 340 that the code of the application programming interface method for creating a shadow document object model is not native code.

[0043] In some embodiments, when the code of the application programming interface method for creating a shadow document object model is parsed into a string, the application programming interface method for creating a shadow document object model by the host element can be first obtained. For example, the attachShadow.valueOf method can be used for the host element to obtain the application programming interface method for creating a shadow document object model. In JavaScript, attachShadow is a method for creating a shadow DOM for a specified element (host element). valueOf is a method that returns the original value of a specified object. Then, check whether the parsing method for the application programming interface method has been tampered with. For example, in the case of parsing with the toString method, check whether the toString method has been tampered with. If the parsing method has not been tampered with, the code of the application programming interface method for creating a shadow document object model is parsed into a string using the parsing method to obtain the parsed content. For example, if the toString method passes the test, that is, there is no tampering, the toString method is used for the application programming interface method to obtain the string type content of the application programming interface method, and the spaces and line breaks in the string are removed to obtain the parsed content. If the parsed content is the same as the string type content of the native code, it is determined that the application programming interface method has not been tampered with. Otherwise, the application programming interface method has been tampered with, rendering is stopped, and user behavior logs are reported, such as to the server or administrator. This can enhance the security of text data and crawler mechanisms.

[0044] In step 2203, in response to the fact that the code of the application programming interface method for creating a shadow document object model is native code, at least part of the text data in the hypertext markup language file to be protected is created into a closed mode shadow document object model using the application programming interface method, and the closed mode shadow document object model is mounted on a host element specified by the user. The closed mode shadow document object model does not allow external JavaScript access, and can effectively protect the text data to be protected. Mounting the closed mode shadow document object model on the host element specified by the user is the basis for the subsequent browser to render the text data. In some embodiments, in response to the fact that the code of the application programming interface method for creating a shadow document object model is not native code, the identity information and host element information of the current browser are collected. Crawler information can be reported, which can enhance the security of text data.

[0045] In step 230, the host element and the shadow document object model are rendered. The rendering result obtained by rendering the host element and the shadow document object model can be presented in the browser. In some embodiments, the host element of the shadow document object model, the mode of the shadow document object model, and the content of the shadow document object model can also be determined according to the rendering result obtained by rendering the host element and the shadow document object model; then, if the host element of the shadow document object model is not the host element of the text data to be protected, the mode of the shadow document object model is not a closed mode, or the content of the shadow document object model is not the at least part of the text data to be protected in the hypertext markup language file, the rendering result is deleted and the rendering result is not presented. If the host element of the shadow document object model is the host element of the text data to be protected, the mode of the shadow document object model is a closed mode, and the content of the shadow document object model is at least part of the text data to be protected in the hypertext markup language file, the rendering result is presented. Alternatively or additionally, if the host element of the shadow document object model is not the host element of the text data to be protected, the mode of the shadow document object model is not a closed mode, or the content of the shadow document object model is not at least part of the text data to be protected in the hypertext markup language file, it can be considered that a crawler is cracking the anti-crawler mechanism or strategy, and the creation and mounting of the shadow document object model can be terminated. If it has been mounted, immediately delete the content in the host element so that the crawler cannot obtain any content. Then, collect the identity information and host element information of the current browser system, and complete the crawler information reporting. This can enhance the security of text data.

[0046] In the text data protection method claimed by the present disclosure, firstly, an anti-crawler mechanism is obtained, and at least part of the text data to be protected in the hypertext markup language file and the host element of the text data after protection are obtained as inputs of the anti-crawler mechanism. When the anti-crawler mechanism determines that the code of the application programming interface method for creating the shadow document object model is native code, the application programming interface method is used to create at least part of the text data to be protected in the hypertext markup language file into a shadow document object model in a closed mode, and the shadow document object model in the closed mode is mounted on the host element specified by the user for rendering. In this way, whether the code of the application programming interface method for creating the shadow document object model is native code is monitored in real time, which prevents the external crawler program from tampering with the application programming interface method and enhances security; and when the code of the application programming interface method for creating the shadow document object model is native code, at least part of the text data to be protected is dynamically created into a shadow document object model in a closed mode, thereby preventing the crawler from obtaining the real text data; and the shadow document object model in the closed mode is mounted on the host element specified by the user for rendering, so as to accurately obtain the target that the crawler is ready to crack when there is a crawler.

[0047] Figure 4 FIG. 4 is a block diagram of an exemplary structure of a text data protection device 400 according to an embodiment of the present disclosure. Figure 4 As shown, the text data protection device includes an acquisition module 410 , an execution module 420 , and a rendering module 430 .

[0048] The acquisition module 410 is configured to acquire an anti-crawler mechanism. The anti-crawler mechanism may be, for example, a predefined anti-crawler strategy, which may be expressed as an anti-crawler strategy function. In some embodiments, the anti-crawler mechanism may be acquired from a web page or a server of a content provider. As an example, a request to access a target web page may be first sent to a server, for example. Then, for example, a hypertext markup language file and a corresponding JavaScript file for the target web page may be acquired from the server, wherein the JavaScript file includes an anti-crawler mechanism.

[0049] The execution module 420 is configured to execute the anti-crawler mechanism to implement the following steps: obtaining at least part of the text data to be protected in the hypertext markup language file and the host element of the protected text data; determining whether the code of the application programming interface method for creating the shadow document object model is native code; in response to the code of the application programming interface method for creating the shadow document object model being native code, using the application programming interface method to create at least part of the text data to be protected in the hypertext markup language file into a closed mode shadow document object model, and mounting the closed mode shadow document object model on a host element specified by the user.

[0050] In some embodiments, at least part of the text data to be protected in the hypertext markup language file and the host element of the text data after protection processing can be included in a JavaScript file, and the JavaScript file is transmitted to the browser by the server. In this case, at the browser side, at least part of the text data to be protected in the hypertext markup language file and the host element of the text data after protection processing can be directly obtained from the JavaScript file, which can effectively reduce communication complexity and save network resources, of course, this is not restrictive.

[0051] The rendering module 430 is configured to render the host element and the shadow document object model. The rendering result obtained by rendering the host element and the shadow document object model can be presented in the browser. In some embodiments, the host element of the shadow document object model, the mode of the shadow document object model, and the content of the shadow document object model can also be determined based on the rendering result obtained by rendering the host element and the shadow document object model; then, if the host element of the shadow document object model is not the host element of the text data to be protected, the mode of the shadow document object model is not a closed mode, or the content of the shadow document object model is not at least part of the text data to be protected in the hypertext markup language file, the rendering result is deleted and the rendering result is not presented.

[0052] In the text data protection device claimed to be protected by the present disclosure, an anti-crawler mechanism is first obtained, and then an execution module obtains at least part of the text data to be protected in a hypertext markup language file and a host element of the protected text data as input to the anti-crawler mechanism. When the anti-crawler mechanism determines that the code of the application programming interface method for creating a shadow document object model is native code, the anti-crawler mechanism uses the application programming interface method to create a closed-mode shadow document object model from at least part of the text data to be protected in the hypertext markup language file, and mounts the closed-mode shadow document object model on a host element specified by a user for rendering. In this way, it is monitored in real time whether the code of the application programming interface method used to create the shadow document object model is native code, which prevents external crawler programs from tampering with the application programming interface method and enhances security; and when the code of the application programming interface method used to create the shadow document object model is native code, at least part of the text data to be protected and processed is dynamically created into a closed-mode shadow document object model, thereby preventing the crawler from obtaining the real text data; and the closed-mode shadow document object model is mounted on a user-specified host element for rendering, so as to accurately obtain the target that the crawler is preparing to crack when a crawler exists.

[0053] Figure 5 An example system 500 is illustrated, which includes an example computing device 510 that represents one or more systems and / or devices that can implement the various techniques described herein. Computing device 510 can be, for example, a server of a service provider, a device associated with a server, a system on a chip, and / or any other suitable computing device or computing system. Figure 4 The described text data protection apparatus 400 may take the form of a computing device 510. Alternatively, the text data protection apparatus 400 may be implemented as a computer program in the form of an application 516.

[0054] The example computing device 510 as shown includes a processing system 511, one or more computer-readable media 512, and one or more I / O interfaces 513 that are communicatively coupled to each other. Although not shown, the computing device 510 may also include a system bus or other data and command transmission system that couples various components to each other. The system bus may include any one or combination of different bus structures, such as a memory bus or memory controller, a peripheral bus, a universal serial bus, and / or a processor or local bus utilizing any one of a variety of bus architectures. Various other examples are also contemplated, such as control and data lines.

[0055] Processing system 511 represents the functionality of performing one or more operations using hardware. Thus, processing system 511 is illustrated as including hardware elements 514 that may be configured as processors, functional blocks, and the like. This may include other logic devices implemented in hardware as application specific integrated circuits or formed using one or more semiconductors. Hardware elements 514 are not limited by the materials from which they are formed or the processing mechanisms employed therein. For example, a processor may be composed of (multiple) semiconductors and / or transistors (e.g., electronic integrated circuits (ICs)). In such a context, processor executable instructions may be electronic executable instructions.

[0056] Computer-readable media 512 is illustrated as including memory / storage 515. Memory / storage 515 represents memory / storage capacity associated with one or more computer-readable media. Memory / storage 515 may include volatile media (such as random access memory (RAM)) and / or non-volatile media (such as read-only memory (ROM), flash memory, optical disks, magnetic disks, etc.). Memory / storage 515 may include fixed media (e.g., RAM, ROM, fixed hard drives, etc.) and removable media (e.g., flash memory, removable hard drives, optical disks, etc.). Computer-readable media 512 may be configured in various other ways as further described below.

[0057] One or more I / O interfaces 513 represent functionality that allows a user to input commands and information to the computing device 510 using various input devices and optionally also allows information to be presented to the user and / or other components or devices using various output devices. Examples of input devices include a keyboard, a cursor control device (e.g., a mouse), a microphone (e.g., for voice input), a scanner, touch functionality (e.g., a capacitive or other sensor configured to detect physical touch), a camera (e.g., that can detect motion that does not involve touch as gestures using visible or invisible wavelengths (such as infrared frequencies), etc.). Examples of output devices include a display device (e.g., a monitor or projector), a speaker, a printer, a network card, a tactile response device, etc. Thus, the computing device 510 can be configured in various ways as further described below to support user interaction.

[0058] The computing device 510 also includes an application 516. The application 516 may be, for example, a software instance of the text data protection apparatus 400, and in combination with other elements in the computing device 510 implements the techniques described herein.

[0059] Various techniques may be described herein in the general context of software hardware elements or program modules. Generally, these modules include routines, programs, objects, elements, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The terms "module", "function" and "component" as used herein generally refer to software, firmware, hardware or a combination thereof. The features of the techniques described herein are platform-independent, meaning that these techniques can be implemented on a variety of computing platforms with a variety of processors.

[0060] An implementation of the described modules and techniques may be stored on or transmitted across some form of computer-readable media. Computer-readable media may include various media accessible by computing device 510. By way of example and not limitation, computer-readable media may include “computer-readable storage media” and “computer-readable signal media”.

[0061] "Computer-readable storage media" refers to media and / or devices capable of persistently storing information, as opposed to simple signal transmissions, carrier waves, or signals themselves, and / or tangible storage devices. Therefore, computer-readable storage media refers to non-signal bearing media. Computer-readable storage media include hardware such as volatile and non-volatile, removable and non-removable media and / or storage devices implemented in a method or technology suitable for storing information (such as computer-readable instructions, data structures, program modules, logic elements / circuits, or other data). Examples of computer-readable storage media may include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical storage devices, hard disks, cassettes, magnetic tape, magnetic disk storage devices or other magnetic storage devices, or other storage devices, tangible media, or articles of manufacture suitable for storing desired information and accessible by a computer.

[0062] "Computer-readable signal media" refers to signal-bearing media that is configured to send instructions to the hardware of the computing device 510, such as via a network. Signal media typically can embody computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave, data signal, or other transport mechanism. Signal media also include any information delivery media. The term "modulated data signal" refers to a signal that has one or more of its characteristics set or changed so as to encode information into the signal. By way of example and not limitation, communication media include wired media such as a wired network or direct connection and wireless media such as acoustic, RF, infrared, and other wireless media.

[0063] As previously described, hardware elements 514 and computer-readable media 512 represent instructions, modules, programmable device logic, and / or fixed device logic implemented in hardware form, which in some embodiments can be used to implement at least some aspects of the technology described herein. Hardware elements can include integrated circuits or systems on a chip, application-specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), complex programmable logic devices (CPLDs), and other implementations in silicon or components of other hardware devices. In this context, hardware elements can be used as processing devices for executing program tasks defined by instructions, modules, and / or logic embodied by hardware elements, as well as hardware devices for storing instructions for execution, such as the computer-readable storage media described previously.

[0064] The aforementioned combinations may also be used to implement the various techniques and modules described herein. Therefore, software, hardware or program modules and other program modules may be implemented as one or more instructions and / or logic embodied on some form of computer-readable storage medium and / or by one or more hardware elements 514. The computing device 510 may be configured to implement specific instructions and / or functions corresponding to the software and / or hardware modules. Therefore, for example, by using a computer-readable storage medium and / or hardware element 514 of a processing system, the module may be implemented as a module executable by the computing device 510 as software, at least in part, in hardware. Instructions and / or functions may be executable / operable by one or more articles (e.g., one or more computing devices 510 and / or processing systems 511) to implement the techniques, modules and examples described herein.

[0065] In various embodiments, computing device 510 can be implemented in various configurations. For example, computing device 510 can be implemented as a computer-type device including a personal computer, a desktop computer, a multi-screen computer, a laptop computer, a netbook, etc. Computing device 510 can also be implemented as a mobile device-type device including mobile devices such as mobile phones, portable music players, portable game devices, tablet computers, multi-screen computers, etc. Computing device 510 can also be implemented as a television-type device, which includes a device with or connected to a generally larger screen in a casual viewing environment. These devices include televisions, set-top boxes, game consoles, etc.

[0066] The techniques described herein can be supported by these various configurations of computing device 510, and are not limited to the specific examples of the techniques described herein. Functionality can also be implemented in whole or in part on the "cloud" 520 by using a distributed system, such as through platform 522 as described below.

[0067] Cloud 520 includes and / or represents a platform 522 for resources 524. Platform 522 abstracts the underlying functionality of the hardware (e.g., servers) and software resources of cloud 520. Resources 524 may include applications and / or data that may be used when executing computer processing on a server remote from computing device 510. Resources 524 may also include services provided over the Internet and / or over a subscriber network such as a cellular or Wi-Fi network.

[0068] The platform 522 can abstract resources and functionality to connect the computing device 510 with other computing devices. The platform 522 can also be used to abstract the hierarchy of resources to provide a hierarchy of corresponding levels of demand encountered for resources 524 implemented via the platform 522. Therefore, in an interconnected device embodiment, the implementation of the functionality described herein can be distributed throughout the system 500. For example, the functionality can be implemented in part on the computing device 510 and through the platform 522 that abstracts the functionality of the cloud 520.

[0069] The present disclosure provides a computer-readable storage medium on which computer-readable instructions are stored. When the computer-readable instructions are executed, any of the above methods is implemented.

[0070] The present disclosure provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computing device executes any method provided in the above-mentioned various optional implementations.

[0071] It should be understood that, for the sake of clarity, embodiments of the present disclosure are described with reference to different functional units. However, it will be apparent that, without departing from the present disclosure, the functionality of each functional unit can be implemented in a single unit, in multiple units, or as a part of other functional units. For example, the functionality that is described as being performed by a single unit can be performed by multiple different units. Therefore, reference to a specific functional unit is only considered as a reference to a suitable unit for providing the described functionality, rather than indicating a strict logical or physical structure or organization. Therefore, the present disclosure can be implemented in a single unit, or can be physically and functionally distributed between different units and circuits.

[0072] It will be understood that although the first, second, third, etc. terms may be used to describe various devices, elements, parts or portions in this article, these devices, elements, parts or portions should not be limited by these terms. These terms are only used to distinguish one device, element, part or portion from another device, element, part or portion.

[0073] Although the present disclosure has been described in conjunction with some embodiments, it is not intended to be limited to the specific forms set forth herein. On the contrary, the scope of the present disclosure is limited only by the appended claims. Additionally, although individual features may be included in different claims, these may possibly be advantageously combined, and inclusion in different claims does not imply that the combination of features is not feasible and / or advantageous. The order of features in the claims does not imply any specific order in which the features must work. In addition, in the claims, the word "comprising" does not exclude other elements, and the term "one" or "an" does not exclude a plurality. The figure marks in the claims are provided only as clear examples and should not be interpreted as limiting the scope of the claims in any way.< / audio> < / video>

Claims

1. A text data protection method, comprising: Get anti-crawler mechanism; Execute the anti-crawler mechanism to implement the following steps: Acquire at least a portion of text data to be protected and processed in a hypertext markup language file and a host element of the text data after protection processing; Determining whether code for an application programming interface method used to create a shadow document object model is native code; In response to the code of the application programming interface method for creating the shadow document object model being native code, using the application programming interface method to create at least a portion of the text data to be protected in the hypertext markup language file into a closed-mode shadow document object model, and mounting the closed-mode shadow document object model on a host element specified by a user; The host element and the shadow document object model are rendered.

2. The method according to claim 1, wherein: The obtaining of the anti-crawler mechanism includes: Send a request to access the target web page; Obtain a hypertext markup language file and a corresponding JavaScript file for the target web page, wherein the JavaScript file includes an anti-crawler mechanism.

3. The method according to claim 2, wherein: The JavaScript file also includes at least part of the text data to be protected in the hypertext markup language file and a host element of the text data after protection processing; And wherein, the step of obtaining at least a portion of the text data to be protected in the hypertext markup language file and the host element of the protected text data includes: At least part of the text data to be protected and processed in the hypertext markup language file and a host element of the text data after protection processing are obtained from the JavaScript file.

4. The method according to claim 1, further comprising: In response to the code of the application programming interface method for creating the shadow document object model being not native code, identity information and host element information of the current browser are collected.

5. The method according to claim 1, wherein: The step of determining whether the code of the application programming interface method for creating the shadow document object model is native code comprises: Parsing the code of the application programming interface method for creating the shadow document object model into a string to obtain the parsed content; In response to the parsed content being identical to the content of the native code, determining that the code of the application programming interface method for creating the shadow document object model is the native code; In response to the parsed content being different from the content of the native code, it is determined that the code of the application programming interface method for creating the shadow document object model is not the native code.

6. The method according to claim 5, wherein: Parse the code of the application programming interface method for creating the shadow document object model into a string to obtain the parsed content, including: Obtain an application programming interface method for creating a shadow document object model from the host element; Checking whether the parsing method for the application programming interface method has been tampered with; In response to the parsing method not being tampered with, the code of the application programming interface method for creating the shadow document object model is parsed into a character string using the parsing method to obtain parsed content.

7. The method according to claim 1, further comprising: Determine the host element of the shadow document object model, the mode of the shadow document object model, and the content of the shadow document object model according to a rendering result obtained by rendering the host element and the shadow document object model; In response to the host element of the shadow document object model not being the host element of the text data to be protected, the mode of the shadow document object model is not a closed mode, or the content of the shadow document object model is not at least part of the text data to be protected in the hypertext markup language file, the rendering result is deleted.

8. A text data protection device, comprising: The acquisition module is configured to acquire anti-crawler mechanisms; The execution module is configured to execute the anti-crawler mechanism to implement the following steps: Acquire at least a portion of text data to be protected and processed in a hypertext markup language file and a host element of the text data after protection processing; Determining whether code for an application programming interface method used to create a shadow document object model is native code; In response to the code of the application programming interface method for creating the shadow document object model being native code, using the application programming interface method to create at least a portion of the text data to be protected in the hypertext markup language file into a closed-mode shadow document object model, and mounting the closed-mode shadow document object model on a host element specified by a user; The rendering module is configured to render the host element and the shadow document object model.

9. A computing device comprising a memory configured to store computer-executable instructions; A processor, which is configured to perform the method according to any one of claims 1 to 7 when the computer executable instructions are executed by the processor.

10. A computer-readable storage medium storing computer-executable instructions, wherein when the computer-executable instructions are executed, the method according to any one of claims 1 to 7 is executed.

11. A computer program product, characterized in that The computer program product comprises computer executable instructions which, when executed, implement the method according to any one of claims 1 to 7.