Page content tamper-proofing method, device and equipment and computer readable storage medium
By reading page configuration information and converting the content of the area to be protected into pictures and replacing the original content, the problem of inability to fundamentally prevent web page content from being tampered in the existing technology is solved, and information security and system performance are improved.
Patent Information
- Application Number
- CN202411499183.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-11
AI Technical Summary
The prior art only takes remedial measures when preventing web page content tampering, which has lag, and cannot fundamentally solve the problem of page content tampering and cannot guarantee information security.
When displaying the page, read page configuration information to determine the page to be protected and the area to be protected, obtain the content of these areas and convert it into pictures, replace the original content to generate a new page, thereby preventing tampering.
Effectively prevent page content from being tampered with, ensure information security, reduce server resource consumption, and improve system performance.
Smart Images

Figure CN119415796A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and in particular, relates to a method, device, equipment and computer-readable storage medium for preventing page content from being tampered with. Background Art
[0002] In today's digital age of information explosion, more and more sensitive information is on the web. If the sensitive information on the web is tampered with, it will endanger personal property security and privacy protection. Therefore, it is very important to protect sensitive information on the web from being tampered with.
[0003] At present, in order to prevent the content on the web page from being tampered with, the content in the page is usually monitored in real time. When the content changes, the area where the changed content is located is compared with the server data corresponding to the area to determine whether the content in the area has been tampered with. When the content in the area is tampered with, the server data is used to replace the tampered content.
[0004] However, the prior art only provides timely correction when the page content is tampered with, which is a remedial measure with a lag, and cannot fundamentally solve the problem of page content tampering, and cannot guarantee information security. Summary of the invention
[0005] The embodiments of the present application provide a method, apparatus, device, computer-readable storage medium, and computer program product for preventing page content from being tampered with, which can fundamentally solve the problem of page content being tampered with and ensure information security.
[0006] In a first aspect, an embodiment of the present application provides a method for preventing page content from being tampered with, the method comprising:
[0007] When the first page is displayed, page configuration information is read, wherein the page configuration information includes target page information corresponding to the page to be protected and target area information corresponding to the area to be protected in the page to be protected;
[0008] Determine whether the first page belongs to the page to be protected based on the target page information;
[0009] In a case where the first page belongs to the page to be protected, determining a target area to be protected in the first page based on the target area information;
[0010] Convert the content of the target area to be protected into a first picture, or obtain a second picture corresponding to the content of the target area to be protected from a cache;
[0011] The content of the target area to be protected is replaced with the first picture or the second picture to obtain a second page.
[0012] In a possible implementation, when displaying the first page, reading the page configuration information includes:
[0013] When the initial page is displayed, reading the configuration information;
[0014] When it is monitored that the page uniform resource locator URL changes from the URL corresponding to the initial page to the URL corresponding to the first page, the first page is displayed.
[0015] In a possible implementation manner, converting the content of the target area to be protected into a first picture includes:
[0016] Detecting whether the target area to be protected exists in the first page;
[0017] When the target area to be protected does not exist in the first page, a preset time interval is performed, and the process of detecting whether the target area to be protected exists in the first page is returned until the target area to be protected exists in the first page, and the content of the target area to be protected is converted into a first picture.
[0018] In a possible implementation manner, there are multiple target areas to be protected, and converting the content of the target areas to be protected into the first picture includes:
[0019] Adding the contents of the plurality of target areas to be protected to a protection area content list;
[0020] The content of each target area to be protected in the protection area content list is converted into a first picture in sequence.
[0021] In a possible implementation manner, converting the content of the target area to be protected into a first picture includes:
[0022] Obtaining the area document object corresponding to the content of the target area to be protected;
[0023] Convert the region document object into a canvas object;
[0024] Convert the canvas object into a picture file object;
[0025] Convert the picture file object into the first picture.
[0026] In a possible implementation, obtaining a second picture corresponding to the content of the target area to be protected from a cache includes:
[0027] Obtaining a region content identifier corresponding to the content of the target region to be protected;
[0028] Acquire the image data corresponding to the regional content identifier from the cache;
[0029] The image data corresponding to the area content identifier is converted into the second image.
[0030] In a possible implementation, the image data includes an image URL corresponding to an image file object, and converting the image data corresponding to the regional content identifier into the second image includes:
[0031] Convert the image URL to the second image.
[0032] In a second aspect, an embodiment of the present application provides a device for preventing page content from being tampered with, the device comprising:
[0033] A reading module, used for reading page configuration information when displaying the first page, wherein the page configuration information includes target page information corresponding to the page to be protected and target area information corresponding to the area to be protected in the page to be protected;
[0034] A first determination module, configured to determine whether the first page belongs to the page to be protected based on the target page information;
[0035] A second determining module, configured to determine a target area to be protected in the first page based on the target area information when the first page belongs to the page to be protected;
[0036] An acquisition module, used to convert the content of the target area to be protected into a first image, or to acquire a second image corresponding to the content of the target area to be protected from a cache;
[0037] A replacement module is used to replace the content of the target area to be protected with the first picture or the second picture to obtain a second page.
[0038] In a third aspect, an embodiment of the present application provides an electronic device, the device comprising: a processor and a memory storing computer program instructions;
[0039] When the processor executes the computer program instructions, the processor implements any possible implementation method of the first aspect described above.
[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implements a method in any possible implementation method of the first aspect described above.
[0041] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes a method as any possible implementation method in the first aspect above.
[0042] The page content tamper-proofing method, apparatus, device, computer-readable storage medium, and computer program product of the embodiments of the present application can read the page configuration information when displaying the first page, and can determine whether the first page is a page to be protected based on the target page information corresponding to the page to be protected in the page configuration information and the target area information corresponding to the area to be protected in the page to be protected, and determine the target area to be protected in the first page when the first page is a page to be protected. If the image in the page is tampered with, it is often necessary to first download the image to the local computer for modification, upload the modified image data to the server, add the image data to the page data corresponding to the first page, and then use the modified page data to re-render to generate a new page. For the person who tampered with the page, it is almost impossible to upload the modified image data to the server, add the image data to the page data corresponding to the first page, and then use the modified page data to re-render to generate a new page. Therefore, by obtaining the image corresponding to the content of the target area to be protected (including converting the content of the target area to be protected into a first image, and obtaining the second image corresponding to the content of the target area to be protected from the cache), and replacing the content of the target area to be protected with the first image or the second image, a second page can be obtained. This can prevent sensitive information in the second page from being tampered with, fundamentally solve the problem of page content tampering, and ensure information security. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0044] Figure 1 It is a schematic diagram of the principle of a method for preventing page content from being tampered with provided in an embodiment of the present application;
[0045] Figure 2 It is a flow chart of a method for preventing page content from being tampered with provided in an embodiment of the present application;
[0046] Figure 3 It is a schematic diagram of a process of converting the content of a target page area into a first image provided by an embodiment of the present application;
[0047] Figure 4It is a schematic diagram of a process of obtaining a second picture corresponding to the content of a target area to be protected from a cache provided by an embodiment of the present application;
[0048] Figure 5 It is a flowchart of another method for preventing page content from being tampered with provided in an embodiment of the present application;
[0049] Figure 6 It is a structural schematic diagram of a page content tamper-proof device provided in an embodiment of the present application;
[0050] Figure 7 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0052] 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 statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0053] In addition, the acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.
[0054] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0055] As mentioned in the background technology section, in today's digital age of information explosion, more and more sensitive information (such as payment bills, receipts, invoices, etc.) is available on web pages. If sensitive information on web pages is tampered with, it will endanger personal property security and privacy protection. Therefore, it is very important to protect sensitive information on web pages from being tampered with and ensure the integrity and security of the information.
[0056] At present, in order to prevent the content on the web page from being tampered with, the content in the page is usually monitored in real time. When the content changes, the area where the changed content is located is compared with the server data corresponding to the area to determine whether the content in the area has been tampered with, and when the content in the area has been tampered with, the server data is used to replace the tampered content. Among them, the server data is the real data used to generate the web page.
[0057] However, the existing technology only corrects the page content in time when it is tampered with, which is a remedial measure with lag, and cannot fundamentally solve the problem of page content tampering, and cannot guarantee information security. In addition, the existing technology needs to constantly compare the page data with the server data, resulting in large resource consumption of the server and affecting the server performance.
[0058] Thus, in order to solve the problems of the prior art, the embodiments of the present application provide a method, device, equipment, computer-readable storage medium and computer program product for preventing page content from being tampered with. Among them, the method for preventing page content from being tampered with can be applied to a system for preventing page content from being tampered with. The system for preventing page content from being tampered with can include a client and a server. Among them, the server can include page data. The client can render and display the page based on the page data. The method for preventing page content from being tampered with provided in the embodiments of the present application can be executed by a server and / or a processor in the system for preventing page content from being tampered with.
[0059] The implementation principle of the page content tamper-proof method can be as follows Figure 1 As shown. Figure 1 As shown, the implementation principle can be that when the page rendering is completed, the to-be-protected area A and the to-be-protected area B in the page are first determined, and then the contents in the to-be-protected area A and the to-be-protected area B are respectively intercepted and converted into pictures A and B, and then the content of the to-be-protected area A is replaced with picture A, and the content of the to-be-protected area B is replaced with picture B, so that the content of the to-be-protected area of the page is displayed in the form of pictures, thereby achieving the purpose of preventing the page content from being tampered with.
[0060] exist Figure 1In the example, the area to be protected may be an area containing sensitive information. In actual situations, after a user obtains the area document object corresponding to the area to be protected, the content of the area to be protected can be modified, thereby tampering with the page content. If a user wants to tamper with a picture in a page, it is often necessary to first download the picture to the local computer for modification, then upload the modified picture data to the server, add the picture data to the page data, and then use the page data to re-render and generate the page. However, for a person who tampers with a page, it is almost impossible to upload the modified picture data to the server, add the picture data to the page data, and then use the page data to re-render and generate the page. Therefore, by displaying the content of the area to be protected on the page in the form of a picture, the purpose of preventing the page content from being tampered with can be achieved.
[0061] The following is an introduction to the page content tamper-proofing method provided in the embodiments of the present application.
[0062] Figure 2 FIG. 1 is a flow chart of a method for preventing page content from being tampered with provided in an embodiment of the present application. Figure 2 As shown, the page content tamper-proof method provided in the embodiment of the present application includes the following steps:
[0063] S210, when displaying the first page, reading page configuration information, the page configuration information including target page information corresponding to the page to be protected and target area information corresponding to the area to be protected in the page to be protected;
[0064] S220, determining whether the first page is a page to be protected based on the target page information;
[0065] S230: If the first page is a page to be protected, determine a target area to be protected in the first page based on the target area information;
[0066] S240: Convert the content of the target area to be protected into a first picture, or obtain a second picture corresponding to the content of the target area to be protected from a cache;
[0067] S250: Replace the content of the target area to be protected with the first image or the second image to obtain a second page.
[0068] The page content tamper-proof method of the embodiment of the present application can read the page configuration information when displaying the first page, and can determine whether the first page is a page to be protected based on the target page information corresponding to the page to be protected in the page configuration information and the target area information corresponding to the area to be protected in the page to be protected, and determine the target area to be protected in the first page if the first page is a page to be protected. Since if the image in the page is tampered with, it is often necessary to first download the image to the local computer for modification, upload the modified image data to the server, add the image data to the page data corresponding to the first page, and then use the modified page data to re-render to generate a new page. For the person who tampered with the page, it is almost impossible to upload the modified image data to the server, add the image data to the page data corresponding to the first page, and then use the modified page data to re-render to generate a new page. Therefore, by obtaining the image corresponding to the content of the target area to be protected (including converting the content of the target area to be protected into a first image, and obtaining the second image corresponding to the content of the target area to be protected from the cache), and replacing the content of the target area to be protected with the first image or the second image, a second page can be obtained. This can prevent sensitive information in the second page from being tampered with, fundamentally solve the problem of page content tampering, and ensure information security.
[0069] On this basis, since the problem of page content tampering has been fundamentally solved, there is no need to regularly compare the changed content of the page with the server data, which greatly reduces the pressure on the server and reduces resource usage.
[0070] The specific implementation methods of the above steps are introduced below.
[0071] In some embodiments, in S210, the first page may be a page rendered according to the page data in the server. The first page may be a page in a website or a page in an application. The page data may include a page uniform resource locator (URL). In addition, the page may include multiple areas, and different areas may have different area tags. For example, the area tag may include a title, a subtitle, text content, etc.
[0072] The page configuration information may be pre-configured and used to determine the information of the page to be protected and the area to be protected. The user may determine multiple pages to be protected and at least one area to be protected in each page to be protected by configuration. The page configuration information may include target page information corresponding to the page to be protected and target area information corresponding to the area to be protected in the page to be protected. Among them, the page to be protected may be a page containing sensitive information, and the area to be protected may be an area containing sensitive information in the page to be protected. The target page information may include page identifiers corresponding to each of the multiple pages to be protected. The page identifier may be, for example, a page URL. The target area information may include area tags corresponding to each of the multiple areas to be protected. By determining the page to be protected and the area to be protected according to the page configuration information, the system is made more flexible.
[0073] As an example, when the rendering of the first page is completed, the page configuration information may be read, and based on the page configuration information, it may be determined whether the first page is a page to be protected.
[0074] Based on this, in order to ensure information security, in some embodiments, the above S210 may specifically include:
[0075] When the initial page is displayed, read the configuration information;
[0076] When it is monitored that the page uniform resource locator URL changes from the URL corresponding to the initial page to the URL corresponding to the first page, the first page is displayed.
[0077] Here, the initial page can be a page rendered according to the page data in the server. The initial page can be the homepage of the website or the default page displayed in the application. When the initial page rendering is completed, the page configuration information can be read, and based on the page configuration information, it can be determined whether the initial page is a page to be protected.
[0078] In addition, before displaying the initial page, you can also set up a listener for page URL changes. After that, when the initial page rendering is completed, you can listen to page URL changes by listening to the page popstate event. Specifically, when the page URL changes, the page popstate event can be triggered.
[0079] In this way, the newly displayed page is determined by monitoring the changes in the page URL, and whether the newly displayed page is a protected page is determined based on the page configuration information. In addition, the page content tamper-proof function is enabled when the newly displayed page is a protected page, thereby ensuring information security.
[0080] In some embodiments, in S220, after reading the target page information in the page configuration information, the page URL of the first page can also be obtained, and the page URL of the first page can be compared with the page URL in the target page information. If the target page information includes the page URL of the first page, it can be determined that the first page belongs to the page to be protected, and then the page content tamper-proof function is enabled.
[0081] In some embodiments, in S230, if the first page belongs to a page to be protected, the first page may include one or more areas to be protected. At least one area tag corresponding to the first page may be determined through the target area information. At least one target area to be protected in the first page corresponding to at least one area tag may be determined through at least one area tag.
[0082] In some embodiments, in S240 and S250, the first picture and the second picture may be the same or different, which is not limited here.
[0083] In addition, the server may have pre-cached images corresponding to the content of the target area to be protected, or may not have images corresponding to the content of the target area to be protected. If the server has pre-cached a second image corresponding to the content of the target area to be protected, the second image can be directly obtained from the cache, and the content of the target area to be protected can be replaced with the second image to obtain a second page. The second page can have an anti-tampering function. By giving priority to the use of cached data, system performance can be improved.
[0084] If the server does not have the image corresponding to the content of the target area to be protected, the content of the target area to be protected can be converted into the first image. After that, on the one hand, by replacing the content of the target area to be protected with the first image, a second page can be obtained, so that the second page has an anti-tampering function. On the other hand, the content of the target area to be protected and its corresponding first image can be cached in the server, so that the first image can be directly obtained from the cache when the first page is displayed next time, thereby improving system performance.
[0085] In the case where there is no picture corresponding to the content of the target area to be protected in the cache and the content of the target area to be protected needs to be converted into the first picture, if there is one target area to be protected, the content of the target area to be protected can be directly converted into the first picture. If there are multiple target areas to be protected, the contents of the multiple target areas to be protected can be added to the protection area content list, and according to the order of the multiple target areas to be protected in the protection area list, the content of each target area to be protected in the protection area content list is converted into the first picture in turn. Among them, the first pictures corresponding to different target areas to be protected can be different.
[0086] In some embodiments, the method of converting the content of the target area to be protected into the first picture can be as follows: Figure 3 As shown. Figure 3 As shown, converting the content of the target area to be protected into a first picture may include the following steps:
[0087] S310, obtaining a region document object corresponding to the content of the target region to be protected;
[0088] S320, converting the region document object into a canvas object;
[0089] S330, converting the canvas object into a picture file object;
[0090] S340: Convert the picture file object into a first picture.
[0091] Here, the region document object can be a document object, and the canvas object can be a canvas object. The region document object can be converted into a canvas object using the html2canvas.js library.
[0092] Based on this, in order to ensure the success of converting the content of the target area to be protected into the first picture, in some embodiments, the above S240 may specifically include:
[0093] Detecting whether there is a target area to be protected in the first page;
[0094] When the target area to be protected does not exist in the first page, a preset time interval is maintained and the process returns to detect whether the target area to be protected exists in the first page until the target area to be protected exists in the first page, and the content of the target area to be protected is converted into the first picture.
[0095] In the above, in the process of displaying the first page, the page configuration information can be read and the target area to be protected in the first page can be determined based on the page configuration information. In this way, the target area to be protected may exist in the first page, or the target area to be protected may not exist. If the target area to be protected exists in the first page, the content of the target area to be protected can be converted into the first picture. If the target area to be protected does not exist in the first page, it may be because the target area to be protected has not been rendered. Therefore, a preset time interval can be used to detect whether the target area to be protected exists in the first page again, until it is detected that the target area to be protected exists in the first page, and the target area to be protected is converted into the first picture. Among them, the preset time length can be 300ms, for example.
[0096] In addition, if there are multiple target areas to be protected in the first page, each time a target area to be protected is detected, the target area to be protected is converted into the first image, and other target areas to be protected are detected simultaneously until all the target areas to be protected are detected.
[0097] In this way, by converting the content of the target area to be protected into the first picture when it is detected that the target area to be protected exists in the first page, the success of converting the content of the target area to be protected into the first picture can be ensured.
[0098] In addition, it often takes a certain amount of time to convert the content of the target area to be protected into the first image. Therefore, in order to improve the system performance of the page content anti-tampering system, the information of the target area to be protected and its corresponding image data can be cached in advance, so that when the page changes next time, the cached image data is used to replace the content of the target area to be protected, thereby saving the system resources occupied by converting the content of the target area to be protected into the first image and improving the system performance.
[0099] That is, as described above, in the case where the second image corresponding to the content of the target area to be protected is pre-cached in the server, the second image can be directly obtained from the cache to improve system performance.
[0100] Based on this, in order to improve system performance, in some embodiments, such as Figure 4 As shown, the above S230 may specifically include the following steps:
[0101] S410, obtaining a region content identifier corresponding to the content of the target region to be protected;
[0102] S420, obtaining image data corresponding to the regional content identifier from the cache;
[0103] S430: Convert the picture data corresponding to the regional content identifier into a second picture.
[0104] Here, the area content identifier can uniquely identify the content of the target to-be-protected area of the first page.
[0105] As an example, after obtaining the content of the target area to be protected, the content of the target area to be protected can be converted into a string, a hash value is calculated based on the string, and a part of the numbers in the hash value is used as a unique identifier of the content of the target area to be protected to obtain an area content identifier.
[0106] In addition, the information of the area to be protected mentioned above may specifically be an area content identifier. The area content identifier and its corresponding image data may be cached in the server.
[0107] As an example, after obtaining the regional content identifier, the server may be queried to determine whether the regional content identifier and its corresponding image data exist. If so, the image data may be converted into a second image, and the second image may be used to replace the content of the target area to be protected, thereby obtaining a second page.
[0108] In some embodiments, the image data may include an image URL corresponding to the image file object. Based on this, the above-mentioned conversion of the image data corresponding to the regional content identifier into the second image may specifically include:
[0109] Converts an image URL to a second image.
[0110] As an example, if the server stores an image URL corresponding to the area content identifier, the image URL can be obtained and rendered as a second image, and the content of the target area to be protected is replaced with the second image to obtain a second page.
[0111] As a more specific example, after obtaining the image URL, you can first assemble the image URL into an img tag object corresponding to the second image, then obtain the area document object corresponding to the content of the target area to be protected, call the document object API (replaceChild method) to replace the content of the target area to be protected with the img tag object, and render a second page including the second image.
[0112] The embodiment of the present application obtains a second page by pre-existing a regional content identifier and its corresponding image data in the server, and replacing the content of the target area to be protected with a second image corresponding to the cached image data. This can save system resources occupied by converting the content of the target area to be protected into the first image, thereby improving system performance.
[0113] In addition, the image corresponding to the content of the target area to be protected that is not cached in the server may be image data corresponding to the area content identifier that is not cached in the server. If the image data corresponding to the area content identifier does not exist in the cache, the above steps may be performed to convert the content of the target area to be protected into the first image, and the first image may be used to replace the content of the target area to be protected to obtain a second page.
[0114] In addition, the image data may also include an image file object. Based on this, in order to improve system performance, in some embodiments, after converting the canvas object into an image file object, the method may further include:
[0115] The area content identifier and the image file object corresponding to the content of the target area to be protected are stored in the server, so that when the page changes next time, the cached image data is used to replace the content of the target area to be protected, thereby saving the system resources occupied by converting the content of the target area to be protected into the first image and improving the system performance. It should be noted that after the image file object is stored in the server, the image URL corresponding to the image file object can be generated, so that the image URL can be converted into the second image.
[0116] In order to better describe the entire solution, some specific examples are given based on the above embodiments.
[0117] For example, Figure 5 As shown, a page content tamper-proof method provided by an embodiment of the present application may include the following steps:
[0118] S51, when the initial page rendering is completed, read the page configuration information;
[0119] S52, monitoring the change of the page URL;
[0120] S53, determine whether the page URL has changed; if so, it indicates that a new page (such as the first page) is about to be displayed, and execute S54; if not, execute S52;
[0121] S54, judging whether the first page is a page to be protected based on the target page information in the page configuration information; if so, executing S55; if not, executing S52;
[0122] S55, determining at least one target area to be protected based on the target area information in the page configuration information;
[0123] S56, detecting whether the first page includes at least one target area to be protected, if so, executing S57; if not, interval a preset time length, and continue to execute S56;
[0124] S57, adding the content of at least one target area to be protected to the protection area content list, and executing the following steps in sequence for the content of each target area to be protected in the protection area content list until the traversal is completed;
[0125] S58, obtaining the area content identifier of the content of the target area to be protected;
[0126] S59, query whether the server has cached image data corresponding to the regional content identifier, if so, execute S510, if not, execute S511;
[0127] S510, replacing the content of the target area to be protected with a second image corresponding to the image data to obtain a second page;
[0128] S511, converting the content of the target area to be protected into a first picture, and replacing the content of the target area to be protected with the first picture to obtain a second page;
[0129] S512: Store the regional content identifier and the picture data corresponding to the first picture in the server.
[0130] The embodiment of the present application can prevent sensitive information from being tampered with by converting the content of the area to be protected containing sensitive information in the page into a picture, and then replacing the content of the area. On this basis, there is no need to compare the content of the page changes with the server data at regular intervals, which greatly reduces the pressure on the server and reduces resource occupation. In addition, the embodiment of the present application sets multiple areas of different pages as areas to be protected by means of page configuration information, and replaces the content of the area to be protected of the page to be protected with a picture according to the page configuration information after the page changes, making the system more flexible. In addition, by caching the content of the area to be protected and its corresponding picture data, the cached data can be used preferentially when the page changes next time, greatly improving system performance.
[0131] Based on the page content tamper-proofing method provided in the above embodiment, the present application also provides a specific implementation of the page content tamper-proofing device. Please refer to the following embodiment.
[0132] like Figure 6 As shown, the page content tamper-proof device 600 provided in the embodiment of the present application includes the following modules:
[0133] The reading module 610 is used to read the page configuration information when displaying the first page, wherein the page configuration information includes the target page information corresponding to the page to be protected and the target area information corresponding to the area to be protected in the page to be protected;
[0134] A first determination module 620, configured to determine whether the first page is a page to be protected based on the target page information;
[0135] A second determination module 630 is used to determine a target area to be protected in the first page based on the target area information when the first page is a page to be protected;
[0136] An acquisition module 640 is used to convert the content of the target area to be protected into a first image, or to acquire a second image corresponding to the content of the target area to be protected from a cache;
[0137] The replacement module 650 is used to replace the content of the target area to be protected with the first picture or the second picture to obtain a second page.
[0138] The page content tamper-proof device 600 is described in detail below, as follows:
[0139] In some embodiments, the reading module 610 may specifically include:
[0140] The reading submodule is used to read the configuration information when the initial page is displayed;
[0141] The display submodule is used to display the first page when monitoring that the page uniform resource locator URL changes from the URL corresponding to the initial page to the URL corresponding to the first page.
[0142] In some embodiments, the acquisition module 640 may specifically include:
[0143] The detection submodule is used to detect whether there is a target area to be protected in the first page; if there is no target area to be protected in the first page, a preset time interval is performed and the detection of whether there is a target area to be protected in the first page is returned until there is a target area to be protected in the first page, and the content of the target area to be protected is converted into a first picture.
[0144] In some embodiments, there are multiple target areas to be protected. Based on this, the acquisition module 640 may specifically include:
[0145] Add a submodule, used to add the contents of multiple target areas to be protected to the protection area content list;
[0146] The first conversion submodule is used to convert the content of each target to-be-protected area in the protection area content list into a first picture in turn.
[0147] In some embodiments, the acquisition module 640 may specifically include:
[0148] The first acquisition submodule is used to acquire the area document object corresponding to the content of the target area to be protected;
[0149] A second conversion submodule, used for converting the region document object into a canvas object;
[0150] The third conversion submodule is used to convert the canvas object into a picture file object;
[0151] The fourth conversion submodule is used to convert the image file object into a first image.
[0152] In some embodiments, the acquisition module 640 may specifically include:
[0153] The second acquisition submodule is used to acquire the area content identifier corresponding to the content of the target area to be protected;
[0154] A third acquisition submodule is used to acquire the image data corresponding to the regional content identifier from the cache;
[0155] The fifth conversion submodule is used to convert the picture data corresponding to the regional content identifier into a second picture.
[0156] In some of these embodiments, the image data includes an image URL corresponding to an image file object.
[0157] Based on this, the fifth conversion submodule may specifically include:
[0158] The conversion unit is used to convert the picture URL into a second picture.
[0159] The page content tamper-proof device of the embodiment of the present application can read the page configuration information when displaying the first page, and can determine whether the first page is a page to be protected based on the target page information corresponding to the page to be protected in the page configuration information and the target area information corresponding to the area to be protected in the page to be protected, and determine the target area to be protected in the first page if the first page is a page to be protected. If the image in the page is tampered with, it is often necessary to first download the image to the local computer for modification, upload the modified image data to the server, add the image data to the page data corresponding to the first page, and then use the modified page data to re-render to generate a new page. For the person who tampered with the page, it is almost impossible to upload the modified image data to the server, add the image data to the page data corresponding to the first page, and then use the modified page data to re-render to generate a new page. Therefore, by obtaining the image corresponding to the content of the target area to be protected (including converting the content of the target area to be protected into a first image, and obtaining the second image corresponding to the content of the target area to be protected from the cache), and replacing the content of the target area to be protected with the first image or the second image, a second page can be obtained. This can prevent sensitive information in the second page from being tampered with, fundamentally solve the problem of page content tampering, and ensure information security.
[0160] Based on the page content tamper-proofing method provided in the above embodiment, the embodiment of the present application also provides a specific implementation of the electronic device. Figure 7 A schematic diagram of an electronic device 700 provided in an embodiment of the present application is shown.
[0161] The electronic device 700 may include a processor 710 and a memory 720 storing computer program instructions.
[0162] Specifically, the processor 710 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0163] The memory 720 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 720 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 720 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 720 may be inside or outside the electronic device 700. In a particular embodiment, the memory 720 is a non-volatile solid-state memory.
[0164] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to the first aspect of the present application.
[0165] The processor 710 implements any one of the page content tamper-proofing methods in the above embodiments by reading and executing computer program instructions stored in the memory 720 .
[0166] In one example, the electronic device 700 may further include a communication interface 730 and a bus 740. Figure 7 As shown, the processor 710, the memory 720, and the communication interface 730 are connected via a bus 740 and communicate with each other.
[0167] The communication interface 730 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0168] Bus 740 includes hardware, software or both, and the parts of electronic equipment are coupled to each other.For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 740 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0169] Exemplarily, the electronic device 700 may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA).
[0170] The electronic device can execute the page content anti-tampering method in the embodiment of the present application, thereby realizing the combination Figures 2 to 6 The described method and device for preventing page content from being tampered with.
[0171] In addition, in combination with the page content tamper-proofing method in the above embodiment, the embodiment of the present application can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any of the page content tamper-proofing methods in the above embodiment is implemented.
[0172] In combination with the page content tamper-proofing method in the above embodiment, the present application embodiment can provide a computer program product to implement. When the instructions in the computer program product are executed by a processor of an electronic device, any of the page content tamper-proofing methods in the above embodiment is implemented.
[0173] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0174] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0175] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0176] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.
[0177] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A method for preventing page content from being tampered with, characterized in that: include: When the first page is displayed, page configuration information is read, wherein the page configuration information includes target page information corresponding to the page to be protected and target area information corresponding to the area to be protected in the page to be protected; Determine whether the first page belongs to the page to be protected based on the target page information; In a case where the first page belongs to the page to be protected, determining a target area to be protected in the first page based on the target area information; Convert the content of the target area to be protected into a first picture, or obtain a second picture corresponding to the content of the target area to be protected from a cache; The content of the target area to be protected is replaced with the first picture or the second picture to obtain a second page.
2. The method according to claim 1, characterized in that The step of reading the page configuration information when displaying the first page includes: When the initial page is displayed, reading the configuration information; When it is monitored that the page uniform resource locator URL changes from the URL corresponding to the initial page to the URL corresponding to the first page, the first page is displayed.
3. The method according to claim 1, characterized in that: The converting the content of the target area to be protected into a first picture includes: Detecting whether the target area to be protected exists in the first page; When the target area to be protected does not exist in the first page, a preset time interval is performed, and the process of detecting whether the target area to be protected exists in the first page is returned until the target area to be protected exists in the first page, and the content of the target area to be protected is converted into a first picture.
4. The method according to claim 1, characterized in that: There are multiple target areas to be protected, and converting the content of the target areas to be protected into a first picture includes: Adding the contents of the plurality of target areas to be protected to a protection area content list; The content of each target area to be protected in the protection area content list is converted into a first picture in sequence.
5. The method according to any one of claims 1 to 4, characterized in that: The converting the content of the target area to be protected into a first picture includes: Obtaining the area document object corresponding to the content of the target area to be protected; Convert the region document object into a canvas object; Convert the canvas object into a picture file object; Convert the picture file object into the first picture.
6. The method according to claim 1, characterized in that The acquiring, from the cache, a second picture corresponding to the content of the target area to be protected includes: Obtaining a region content identifier corresponding to the content of the target region to be protected; Acquire the image data corresponding to the regional content identifier from the cache; The image data corresponding to the area content identifier is converted into the second image.
7. The method according to claim 6, characterized in that The picture data includes a picture URL corresponding to a picture file object, and the converting the picture data corresponding to the regional content identifier into the second picture includes: Convert the image URL to the second image.
8. A device for preventing page content from being tampered with, characterized in that: The device comprises: A reading module, used for reading page configuration information when displaying the first page, wherein the page configuration information includes target page information corresponding to the page to be protected and target area information corresponding to the area to be protected in the page to be protected; A first determination module, configured to determine whether the first page belongs to the page to be protected based on the target page information; A second determining module, configured to determine a target area to be protected in the first page based on the target area information when the first page belongs to the page to be protected; An acquisition module, used to convert the content of the target area to be protected into a first image, or to acquire a second image corresponding to the content of the target area to be protected from a cache; A replacement module is used to replace the content of the target area to be protected with the first picture or the second picture to obtain a second page.
9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the page content tamper-proof method as described in any one of claims 1-7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by the processor, the page content tamper-proof method according to any one of claims 1 to 7 is implemented.
11. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the page content tamper-proofing method as described in any one of claims 1 to 7.