WO2020047736A1 - 网站后台图片资源完整性的验证方法和*** - Google Patents
网站后台图片资源完整性的验证方法和*** Download PDFInfo
- Publication number
- WO2020047736A1 WO2020047736A1 PCT/CN2018/103960 CN2018103960W WO2020047736A1 WO 2020047736 A1 WO2020047736 A1 WO 2020047736A1 CN 2018103960 W CN2018103960 W CN 2018103960W WO 2020047736 A1 WO2020047736 A1 WO 2020047736A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- original
- current
- file
- files
- value
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
Definitions
- the present invention relates to the technical field of network security, and in particular, to a method and system for verifying the integrity of background picture resources of a website.
- Pictures are an important part of the content displayed on the front end of the web page, and the picture can contain a lot of information.
- the picture can be displayed on the front end of the web page.
- the existing anti-tampering technology is to monitor the code of the web page, and it is not allowed to tamper with the file name and file path called in the code, thereby protecting the picture displayed on the web page.
- the monitoring of webpage code can only allow the file name and file path called in the code to not be tampered with. Changes and changes to the image content cannot be effectively monitored and identified, which makes the monitoring scope of the webpage image smaller, which makes the tampering party
- the content on the picture can be tampered with, or the picture with the same file name as the original picture can be replaced in the same path, thereby avoiding the tampering of the web page picture and increasing the chance of the web page being maliciously tampered with.
- the main purpose of the present invention is to provide a method and system for verifying the integrity of background image resources on a website, so as to reduce the technical problem of the probability that a webpage is maliciously tampered with.
- the present invention provides a method for verifying the integrity of the background image resources of a website, including: obtaining a path of a first-level folder to be scanned; generating a file digest algorithm, wherein the digest algorithm is used to calculate a digest value of a file; File information under the first-level folder path to obtain an original file list, and record the number of original files in the original file list; record the number of original files in the original file list calculated according to the digest algorithm Original digest value; generating the current digest value of the file under the path of the first-level folder to be scanned and the current number of files; comparing the current digest value and the original digest value and the current number of files and the number of original files And issue an alert message when the current summary value and the original summary value are different or the current file number and the original file number are different; compare the current file number and the original file number, and An alarm message is issued when the current number of files and the number of original files are different.
- the number of image files in the first-level folder can be obtained, and the digest algorithm can calculate the digest of the image according to the content of the image, thereby generating a file digest value, and thus generating the original digest value and
- the number of original files, and the current summary value and current file number of the picture files in the current first-level folder are obtained regularly, and the current summary value is compared with the original summary value, and the current file number is compared with the original file number.
- FIG. 1 is a schematic flowchart diagram of a method for verifying the integrity of a background image resource of a website according to an embodiment of the present invention
- FIG. 2 is a schematic block diagram of a process for obtaining file information in a first-level folder path of a method for verifying the integrity of background image resources of a website according to an embodiment of the present invention
- FIG. 3 is a schematic block diagram of a process for comparing a current digest value and an original digest value of a website background image resource integrity verification method according to an embodiment of the present invention
- FIG. 4 is a schematic block diagram of a process for comparing the integrity of a background image resource of a website background according to an embodiment of the present invention and comparing the number of current files with the number of original files;
- FIG. 5 is a schematic structural block diagram of a system for verifying the integrity of background image resources of a website according to an embodiment of the present invention
- FIG. 6 is a schematic block diagram of a structure of an electronic device according to an embodiment of the present invention.
- a first aspect of the present invention provides a method for verifying the integrity of a background image resource of a website, including: obtaining a path of a first-level folder to be scanned; generating a file digest algorithm, the digest algorithm being used to calculate a digest value of a file; File information under the first-level folder path to obtain an original file list, and record the number of original files under the original file list; record the original summary of the original files in the original file list calculated according to the digest algorithm Value; generating a current summary value of the file under the path of the first-level folder to be scanned and a current number of files; comparing the current summary value and the original summary value, and the current number of files and the number of original files, and An alarm message is issued when the current digest value and the original digest value are different or when the current file number and the original file number are different.
- obtaining the file information under the path of the first-level folder includes: finding a second-level folder in the first-level folder to be scanned; obtaining the path of the second-level folder, and Iterative search of folders to find all folders and files located in the same path as the all folders, and record the number of original files under the all folders and the original summary value of the original files according to the path of the all folders .
- the method further includes: generating a log file under a predetermined folder, where the log file is used to record the number of the original files and the original summary value under the first-level folder.
- the method further includes: obtaining a file name of the original file, and recording the file name and the original digest value in a key-value pair in the recording file, where the file name and the Match the original digest value of the original file.
- comparing the current digest value with the original digest value includes: obtaining the current file list, and calculating the current digest value of the current file in the current file list through the digest algorithm; according to the The current file list obtains the current file name of the current file, and matches the current file name with the current digest value; obtains the original file name of the original file, and compares the original file name with the original file name.
- the digest values match; the same current file name and the original file name are matched, and the current digest value and the original digest value that match the current file name and the original file name are compared.
- matching the same current file name with the original file name includes: if the current file name and the original file name fail to match, issuing an alarm message.
- comparing the current number of files and the number of original files includes: reading the number of original files; obtaining the current file list, and obtaining the current number of files according to the current file list; comparing the original files The number of files and the current number of files.
- a website background image resource integrity verification system including: a scanning module for scanning a folder path and file information under the folder path; a digest generating module for calculating a digest of a file Value; original file information module, used to obtain the number of original files and the original summary value of the original file according to the scanning module and the summary generation module; the current file information module, used to obtain the original file according to the scanning module and the summary generation module Obtain the current number of files and the current summary value in the current folder; a comparison module for comparing the number of original files and the current number of files, and for comparing the original summary value and the current summary value; a warning sending module Is configured to send an alarm message when the number of original files and the number of current files are different, or when the original summary value and the current summary value are different.
- an electronic device including: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer When the program is implemented, implement the method described in any one of the above.
- a computer-readable storage medium on which a computer program is stored.
- the computer program is executed by a processor, the method according to any one of the foregoing is implemented.
- FIG. 1 is a method for verifying the integrity of the background image resource of the website, including: 1. Obtaining the path of the first-level folder to be scanned. In this embodiment, the first-level folder is automatically obtained by reading the specified file Path, in other embodiments, you can also manually enter the path of the first-level folder by using the system options after the system is running; 2. Generate a file digest algorithm, which is used to calculate the digest value of the file. In this embodiment, the embodiment, the digest algorithm is MD5 algorithm. In other embodiments, the digest algorithm may also be SHA256 algorithm, SHA512 algorithm, national secret algorithm, etc .; 3. Obtain the file information under the first-level folder path to obtain the original file list, and Record the number of original files in the original file list; 4.
- Alarm information is sent when the value is different or when the number of current files and the number of original files are different.
- the alarm information is sent to the management personnel by sending an email.
- the alarm information can be sent to the management personnel by SMS. Or through a custom method, let managers customize the form of sending alarm information; 7.
- the number of files in the picture, and the summary of the picture is calculated according to the content of the picture, so as to generate the summary value of the file, so that the original summary value and the number of original files are generated before the picture has been tampered with, and the current level of the folder under the current level can be obtained regularly.
- the current summary value and current file number of the picture file, and the current summary value is compared with the original summary value, and the current file number is compared with the original file number, if the current summary value is not the same as the original summary value, or Comparison of the number of current files with the number of original files Not the same, that is, sending alarm information, thereby increasing the scope of monitoring Web Images file, reducing the chance of malicious tampering of the page.
- the file information under the path of the first-level folder includes: 31. Find the second-level folder in the first-level folder to be scanned; 32. Iterative search to find all folders and files located in the same path as all folders; 33. Record the number of original files under all folders and the original summary value of the original files according to the path of all the folders mentioned above; thereby obtaining first-level files
- the second-level folder under the folder path, and the third-level folder based on the second-level folder until you find all the folders under each level and the picture files under all the folder paths, and record the original in all folder paths.
- the number of files and the original summary value of the original file are generated, thereby preventing tamperers from bypassing the primary folder and the secondary folder to modify the image file information, thereby increasing the monitoring scope of the web page image file and reducing the maliciousness of the web page. Chance of tampering.
- the method provided by the present invention further includes: 8. Record files are generated in a predetermined folder, and the record files are used to record the number of original files and original summary values in the first-level folder.
- the record file is a file in json format. In other embodiments, the record file can also be a file in the format of xml, plain text, etc .; 9.
- the path of the level folder is used as the file name of the log file, so that the file name of each log file is different, preventing reading errors when reading the log file due to the same file name, and being able to read the file of the log file Name to find the folder path where the recording file is located, so that it is easy to find the picture file under the folder path, so that after the picture file is tampered, it is easy to find the path of the tampered picture file.
- Record files are stored in a predetermined folder uniformly, and are used to record the number of original files and the original summary value of the picture files in the folder; And the number of data pieces of the original document digest value is lost, and the quantity can facilitate reading an original document and the original document digest value, so as to facilitate comparison of the current number of files and the number of original documents, and to facilitate comparison of the current file digest value and the original document digest value.
- the method provided by the present invention further includes: obtaining the file name of the original file, and recording the file name and the original digest value in a record file in the form of a key-value pair, and the file name matches the original digest value of the original file;
- the picture file corresponds to its corresponding original digest value, which makes the records of the original digest value more orderly, thereby making it easier to read the original file's digest value.
- comparing the current digest value with the original digest value includes: 61. Get the current file list, and calculate the current summary value of the current file in the current file list through the digest algorithm; 62. Get the current file current according to the current file list File name, and match the current file name with the current digest value; 63, get the original file name of the original file, and match the original file name with the original digest value; 64, match the same current file name and original file name Match and compare the current digest value and original digest value that match the current file name and original file name; after matching the same file name and original file name, if there is a current file name of the unmatched current file, that is, If the current file name fails to match the original file name, it means that the tamperer added the original file after deleting the original file, so that the number of original files is the same as the number of current files.
- comparing the current number of files with the number of original files 65. Read the number of original files; 66. Get the current file list and get the current number of files based on the current file list; 67. Compare the current number of files with the number of original files Relative; when the number of original files and the number of current files are not the same, it means that the picture file is deleted or added, which leads to the tampering of the picture file on the web page.
- the method provided by the present invention further comprises: comparing the current summary value with the original summary value, and displaying the comparison step after comparing the current file number with the original file number, thereby facilitating the management personnel to view the comparison log, thereby facilitating the analysis of the comparison result, and saving the management personnel analysis Time to compare results.
- the present invention also provides a system for verifying the integrity of the background image resources of the website. Please refer to FIG. 5, which includes: a scanning module 21, a summary generating module 22, an original file information module 23, a current file information module 24, a comparison module 25, and a warning.
- the sending module 26 The sending module 26; the scanning module 21 is used for scanning the folder path and the file information under the folder path; the digest generating module 22 is used for calculating the digest value of the file according to the above file information; the original file information module 23 is used for the scanning module 21 and The summary generation module 22 obtains the number of original files and the original summary value of the original file; the current file information module 24 is used to obtain the current file number and the current summary value of the current file according to the scanning module 21 and the summary generation module 22; the comparison module 25 is used for comparison The number of original files and the number of current files, and the original summary value and the current summary value are compared; the warning sending module 26 is used to issue an alarm message when the number of original files is different from the current number of files, or the original summary value is not the same as the current summary value To monitor the content on the web page image and increase the Monitoring range chip, reducing the chance of malicious tampering of the page.
- the present invention provides a method and system for verifying the integrity of background image resources on a website.
- the working principle or process is as follows: by obtaining the number of original files in the folder and the original summary value of the original file, and obtaining the current files in the folder The number and the current summary value of the current file. If the number of original files is not the same as the current file number, or the original summary value is not the same as the current summary value, it indicates that the picture file has been tampered with and an alarm message is issued immediately, thereby increasing The monitoring scope of web page image files is enlarged, reducing the chance of web pages being tampered with maliciously.
- An embodiment of the present application provides an electronic device. Please refer to 6.
- the electronic device includes: a memory 31, a processor 32, and a computer program stored on the memory 31 and executable on the processor 32.
- the processor 32 executes the computer program. At this time, the method for verifying the integrity of the background image resources of the website described in the foregoing embodiments of FIG. 1 to FIG. 4 is implemented.
- the electronic device further includes: at least one input device 33 and at least one output device 34.
- the memory 31, the processor 32, the input device 33, and the output device 34 are connected through a bus 35.
- the input device 33 may be a camera, a touch panel, a physical button, a mouse, or the like.
- the output device 34 may be a display screen.
- the memory 31 may be a high-speed random access memory (RAM, Random Access Memory) memory, which may also be non-volatile memory, such as disk memory.
- RAM Random Access Memory
- the memory 31 is configured to store a set of executable program code, and the processor 32 is coupled to the memory 31.
- the embodiment of the present application further provides a computer-readable storage medium.
- the computer-readable storage medium may be provided in the electronic device in the foregoing embodiments, and the computer-readable storage medium may be the foregoing FIG. 6.
- the memory 31 in the embodiment is shown.
- a computer program is stored on the computer-readable storage medium, and when the program is executed by the processor 32, the method for verifying the integrity of the background image resource of the website described in the foregoing method embodiment is implemented.
- the computer-storable medium may also be a U disk, a mobile hard disk, or a read-only memory (ROM, Read-Only). Memory), RAM, magnetic disks, or optical disks and other media that can store program code.
- the disclosed apparatus and method may be implemented in other ways.
- the device embodiments described above are only schematic.
- the division of the modules is only a logical function division.
- multiple modules or components may be combined or Can be integrated into another system, or some features can be ignored or not implemented.
- the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or modules, which may be electrical, mechanical or other forms.
- the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objective of the solution of this embodiment.
- each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist separately physically, or two or more modules may be integrated into one module.
- the above integrated modules may be implemented in the form of hardware or software functional modules.
- the integrated module When the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.
- the technical solution of the present application is essentially a part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, which is stored in a readable storage
- the medium includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.
- the foregoing readable storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Storage Device Security (AREA)
Abstract
本发明公开了一种网站后台图片资源完整性的验证方法和***,用于增大网页图片的监控范围,包括:获取待扫描的一级文件夹路径;生成文件摘要算法,摘要算法用于计算文件的摘要值;获取一级文件夹路径下的文件信息,记录原始文件数量;记录原始文件的原始摘要值;生成待扫描的一级文件夹路径下文件的当前摘要值及当前文件数量;对比当前摘要值和原始摘要值以及当前文件数量和原始文件数量,并在当前摘要值和原始摘要值不同或者在当前文件数量及原始文件数量不同时发出告警信息;从而监控网页图片内容及数量,增大了对网页图片的监控范围,从而降低网页被恶意篡改后带来的不良社会影响及经济损失的几率。
Description
本发明涉及网络安全技术领域,尤其涉及一种网站后台图片资源完整性的验证方法和***。
随着互联网的发展,人们对于互联网的安全也愈加重视,当网页前端显示的内容被篡改后,可能会对网页使用方带来不良的社会影响及经济损失。
图片是构成网页前端显示内容的重要组成部分,并且图片上可包含大量的信息,使用代码并通过文件路径及文件名对图片资源进行调用,能够将图片在网页前端显示,而为了降低网页前端显示的图片被篡改的几率,现有的防篡改技术是对网页的代码进行监控,不允许篡改代码中调用的文件名及文件路径,从而对网页显示的图片进行保护。
对网页代码进行监控只能做到不允许篡改代码中调用的文件名及文件路径,对图片内容的更改及变化不能有效地监控和识别,使得对网页图片的监控范围较小,从而使得篡改方可篡改图片上的内容,或在同一路径下更换与原有图片相同文件名的图片,从而避开了监控范围对网页图片进行篡改,从而增加了网页被恶意篡改的几率。
本发明的主要目的在于提供一种网站后台图片资源完整性的验证方法和***,以减小网页被恶意篡改的几率的技术问题。
为实现上述目的,本发明提供一种网站后台图片资源完整性的验证方法,包括:获取待扫描的一级文件夹路径;生成文件摘要算法,所述摘要算法用于计算文件的摘要值;获取所述一级文件夹路径下的文件信息,以获取原始文件列表,并记录所述原始文件列表下的原始文件数量;记录根据所述摘要算法计算出的所述原始文件列表内的原始文件的原始摘要值;生成所述待扫描的一级文件夹路径下文件的当前摘要值及当前文件数量;对比所述当前摘要值和所述原始摘要值以及所述当前文件数量和所述原始文件数量,并在所述当前摘要值和所述原始摘要值不同或者再所述当前文件数量及所述原始文件数量不同时发出告警信息;对比所述当前文件数量及所述原始文件数量,并在所述当前文件数量及所述原始文件数量不同时发出告警信息。
通过采用上述技术解决方案,能够获取一级文件夹下图片文件的数量,并且摘要算法能够根据图片内容而计算图片的摘要,从而生成文件摘要值,从而在图片未被篡改前生成原始摘要值及原始文件数量,并且定时获取当前一级文件夹下的图片文件的当前摘要值及当前文件数量,且将当前摘要值与原始摘要值对比,并将当前文件数量与原始文件数量对比,在当前摘要值和原始摘要值对比结果不同或当前文件数量与原始文件数量的对比结果不同时,则表明图片文件数量或图片内容被篡改,随后发出告警信息,从而增大了对网页图片的监控范围,降低网页被恶意篡改的几率。
图1为本发明实施例网站后台图片资源完整性的验证方法的流程示意框图;
图2为本发明实施例网站后台图片资源完整性的验证方法的获取一级文件夹路径下的文件信息的流程示意框图;
图3为本发明实施例网站后台图片资源完整性的验证方法的对比当前摘要值及原始摘要值的流程示意框图;
图4为本发明实施例网站后台图片资源完整性的验证方法的对比当前文件数量及原始文件数量的流程示意框图;
图5为本发明实施例网站后台图片资源完整性的验证***的结构示意框图;
图6为本发明实施例电子装置的结构示意框图。
本发明第一方面提供一种网站后台图片资源完整性的验证方法,包括:获取待扫描的一级文件夹路径;生成文件摘要算法,所述摘要算法用于计算文件的摘要值;获取所述一级文件夹路径下的文件信息,以获取原始文件列表,并记录所述原始文件列表下的原始文件数量;记录根据所述摘要算法计算出的所述原始文件列表内的原始文件的原始摘要值;生成所述待扫描的一级文件夹路径下文件的当前摘要值及当前文件数量;对比所述当前摘要值和所述原始摘要值以及所述当前文件数量和所述原始文件数量,并在所述当前摘要值和所述原始摘要值不同或者在所述当前文件数量及所述原始文件数量不同时发出告警信息。
进一步地,所述获取所述一级文件夹路径下的文件信息包括:查找所述待扫描的一级文件夹内的二级文件夹;获取所述二级文件夹的路径,并对二级文件夹迭代查找,以查找全部文件夹及与所述全部文件夹位于相同路径的文件,并根据所述全部文件夹的路径记录所述全部文件夹下的原始文件数量及原始文件的原始摘要值。
进一步地,所述方法还包括:在预定文件夹下生成记录文件,所述记录文件用于记录所述一级文件夹下的所述原始文件数量及所述原始摘要值。
进一步地,所述方法还包括:获取所述原始文件的文件名,并将所述文件名及所述原始摘要值以键值对的形式记录于所述记录文件内,所述文件名与所述原始文件的原始摘要值相匹配。
进一步地,所述对比所述当前摘要值及所述原始摘要值包括:获取所述当前文件列表,并通过所述摘要算法计算所述当前文件列表内的当前文件的当前摘要值;根据所述当前文件列表获取所述当前文件的当前文件名,并将所述当前文件名与所述当前摘要值相匹配;获取所述原始文件的原始文件名,并将所述原始文件名与所述原始摘要值相匹配;将相同的所述当前文件名及所述原始文件名相匹配,并对比与所述当前文件名及所述原始文件名相匹配的当前摘要值及原始摘要值。
进一步地,所述将相同的所述当前文件名及所述原始文件名相匹配包括:若所述当前文件名及所述原始文件名匹配失败,则发出告警信息。
进一步地,所述对比所述当前文件数量及所述原始文件数量包括:读取所述原始文件数量;获取所述当前文件列表,并根据所述当前文件列表获取当前文件数量;对比所述原始文件数量及所述当前文件数量。
本发明另一方面提供一种网站后台图片资源完整性的验证***,包括:扫描模块,用于扫描文件夹路径及所述文件夹路径下的文件信息;摘要生成模块,用于计算文件的摘要值;原始文件信息模块,用于根据所述扫描模块及所述摘要生成模块获取原始文件的原始文件数量及原始摘要值;当前文件信息模块,用于根据所述扫描模块及所述摘要生成模块获取当前文件夹内的当前文件数量及当前摘要值;对比模块,用于对比所述原始文件数量及所述当前文件数量,并用于对比所述原始摘要值及所述当前摘要值;警告发送模块,用于在所述原始文件数量及所述当前文件数量不相同,或所述原始摘要值及所述当前摘要值不相同时,发出告警信息。
本发明另一方面提供了一种电子装置,包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时,实现权上述任意一项所述方法。
本发明另一方面提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时,实现上述任意一项所述方法。
请参阅图1,为一种网站后台图片资源完整性的验证方法,包括:1、获取待扫描的一级文件夹路径,在本实施例中,通过读取指定文件自动获取一级文件夹的路径,在其他实施例中,还可通过在***运行后通过***的选项进行手动输入一级文件夹的路径;2、生成文件摘要算法,摘要算法用于计算文件的摘要值,在本实施例中,摘要算法为MD5算法,在其他实施例中,摘要算法还可为SHA256算法、SHA512算法、国密算法等;3、获取一级文件夹路径下的文件信息,以获取原始文件列表,并记录原始文件列表下的原始文件数量;4、记录根据摘要算法计算出的原始文件列表内的原始文件的原始摘要值;5、生成待扫描的一级文件夹路径下文件的当前摘要值及当前文件数量;6、对比当前摘要值和原始摘要值以及当前文件数量和原始文件数量,并在当前摘要值和原始摘要值不同或者在当前文件数量及原始文件数量不同时发出告警信息,在本实施例中,通过发送邮件向管理人员发送告警信息,在其他实施例中,可通过短信向管理人员发送告警信息,或者通过自定义方式,使管理人员自定义告警信息的发送形式;7、对比当前文件数量及原始文件数量,并在当前文件数量及原始文件数量不同时发送警告信息;通过获取一级文件夹下图片的文件数量,并根据图片的内容而计算图片的摘要,从而生成文件的摘要值,从而在图片未被篡改前生成原始摘要值及原始文件数量,并且能够定时获取当前一级文件夹下的图片文件的当前摘要值及当前文件数量,且将当前摘要值与原始摘要值相对比,并将当前文件数量与原始文件数量相对比,若当前摘要值与原始摘要值的对比结果不相同,或者当前文件数量与原始文件数量的对比结果不相同,即发出告警信息,从而增大了网页图片文件的监控范围,降低了网页被恶意篡改的几率。
请参阅图2,获取一级文件夹路径下的文件信息包括:31、查找待扫描的一级文件夹内的二级文件夹;32、获取二级文件夹的路径,并对二级文件夹迭代查找,以查找全部文件夹及与全部文件夹位于相同路径的文件;33、根据上述全部文件夹的路径记录全部文件夹下的原始文件数量及原始文件的原始摘要值;从而获取一级文件夹路径下的二级文件夹,以及基于二级文件夹的三级文件夹,直至找出各级路径下的所有文件夹及所有文件夹路径下的图片文件,记录所有文件夹路径下的原始文件数量,以及生成原始文件的原始摘要值,从而防止篡改者绕过一级文件夹及二级文件夹而修改图片文件信息,从而增大了对网页图片文件的监控范围,降低了网页被恶意篡改的几率。
请参阅图1及图2,本发明提供的方法还包括:8、在预定文件夹下生成记录文件,记录文件用于记录一级文件夹下的原始文件数量及原始摘要值,在本实施例中,记录文件为json格式的文件,在其他实施例中,记录文件还可为xml、纯文本等格式的文件;9、根据各级文件夹下的图片文件生成不同的记录文件,并将该级文件夹的路径作为记录文件的文件名,从而使每个记录文件的文件名有所区别,防止读取记录文件时,因文件名相同而读取错误,并且能够通过读取记录文件的文件名而找出记录文件所在的文件夹路径,从而便于找出该文件夹路径下的图片文件,从而便于在图片文件被篡改后,找出被篡改的图片文件的路径,各级文件夹下的记录文件统一存放在预定文件夹下,并用于记录该级文件夹下的图片文件的原始文件数量及原始摘要值;从而防止原始文件数量及原始文件摘要值的数据丢失,并能够便于读取原始文件数量及原始文件摘要值,从而便于对比当前文件数量和原始文件数量,以及便于对比当前文件摘要值和原始文件摘要值。
本发明提供的方法还包括:获取原始文件的文件名,并将文件名及原始摘要值以键值对的形式记录于记录文件内,文件名与原始文件的原始摘要值相匹配;从而能够将图片文件与其相对应的原始摘要值相对应,使原始摘要值的记录更加有序,从而更加便于读取原始文件的摘要值。
请参阅图3,对比当前摘要值及原始摘要值包括:61、获取当前文件列表,并通过摘要算法计算当前文件列表内的当前文件的当前摘要值;62、根据当前文件列表获取当前文件的当前文件名,并将当前文件名与当前摘要值相匹配;63、获取原始文件的原始文件名,并将原始文件名与原始摘要值相匹配;64、将相同的当前文件名及原始文件名相匹配,并对比与当前文件名及原始文件名相匹配的当前摘要值及原始摘要值;在相同的文件名及原始文件名相匹配后,若有未被匹配的当前文件的当前文件名,即当前文件名与原始文件名匹配失败,则表示篡改者在删除原始文件后,新增了原始文件,从而使原始文件数量与当前文件数量相同,从而若有未被匹配的当前文件的当前文件名,则发出告警信息;在当前文件名及原始文件名全部匹配完成后,对比相匹配的当前文件及原始文件的当前摘要值及原始摘要值,当对比结果相同时,表明图片文件未被篡改,当对比结果不相同时,表明图片文件上的内容被篡改,从而发出告警信息。
请参阅图4,对比当前文件数量及原始文件数量包括:65、读取原始文件数量;66、获取当前文件列表,并根据当前文件列表获取当前文件数量;67、将当前文件数量与原始文件数量相对比;从而当原始文件数量及当前文件数量不相同时,表示图片文件被删除或增加,从而导致网页的图片文件篡改。
本发明提供的方法还包括:对比当前摘要值和原始摘要值,以及对比当前文件数量和原始文件数量后,显示对比步骤,从而便于管理人员查看对比日志,从而便于分析对比结果,节省管理人员分析对比结果的时间。
本发明还提供了一种网站后台图片资源完整性的验证***,请参阅图5,包括:扫描模块21、摘要生成模块22、原始文件信息模块23、当前文件信息模块24、对比模块25及警告发送模块26;扫描模块21用于扫描文件夹路径及文件夹路径下的文件信息;摘要生成模块22用于根据上述文件信息计算文件的摘要值;原始文件信息模块23用于根据扫描模块21及摘要生成模块22获取原始文件的原始文件数量及原始摘要值;当前文件信息模块24用于根据扫描模块21及摘要生成模块22获取当前文件的当前文件数量及当前摘要值;对比模块25用于对比原始文件数量及当前文件数量,并对比原始摘要值及当前摘要值;警告发送模块26用于在原始文件数量与当前文件数量不相同,或原始摘要值与当前摘要值不相同时,发出告警信息,从而对网页图片上的内容进行监控,增大了对网页图片的监控范围,降低了网页被恶意篡改的几率。
本发明提供的一种网站后台图片资源完整性的验证方法和***,其工作原理或过程如下:通过获取文件夹下的原始文件数量及原始文件的原始摘要值,以及获取文件夹下的当前文件数量及当前文件的当前摘要值,若原始文件数量与当前文件数量对比后不相同,或原始摘要值与当前摘要值对比后不相同,则表明图片文件被篡改,并即时发出告警信息,从而增大了对网页图片文件的监控范围,降低网页被恶意篡改的几率。
本申请实施例提供一种电子装置,请参阅6,该电子装置包括:存储器31、处理器32及存储在存储器31上并可在处理器32上运行的计算机程序,处理器32执行该计算机程序时,实现前述附图1至附图4的实施例中描述的网站后台图片资源完整性的验证方法。
进一步的,该电子装置还包括:至少一个输入设备33以及至少一个输出设备34。
上述存储器31、处理器32、输入设备33以及输出设备34,通过总线35连接。
其中,输入设备33具体可为摄像头、触控面板、物理按键或者鼠标等等。输出设备34具体可为显示屏。
存储器31可以是高速随机存取记忆体(RAM,Random Access
Memory)存储器,也可为非不稳定的存储器(non-volatile memory),例如磁盘存储器。存储器31用于存储一组可执行程序代码,处理器32与存储器31耦合。
进一步的,本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质可以是设置于上述各实施例中的电子装置中,该计算机可读存储介质可以是前述图6所示实施例中的存储器31。该计算机可读存储介质上存储有计算机程序,该程序被处理器32执行时实现前述方法实施例中描述的网站后台图片资源完整性的验证方法。进一步的,该计算机可存储介质还可以是U盘、移动硬盘、只读存储器(ROM,Read-Only
Memory)、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个可读存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的可读存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本申请所必须的。
通过获取文件夹下的原始文件数量及原始文件的原始摘要值,以及获取文件夹下的当前文件数量及当前文件的当前摘要值,若原始文件数量与当前文件数量对比后不相同,或原始摘要值与当前摘要值对比后不相同,则表明图片文件被篡改,并即时发出告警信息,从而增大了对网页图片文件的监控范围,降低网页被恶意篡改的几率。
Claims (10)
- 一种网站后台图片资源完整性的验证方法,其特征在于,包括:获取待扫描的一级文件夹路径;生成文件摘要算法,所述摘要算法用于计算文件的摘要值;获取所述一级文件夹路径下的文件信息,以获取原始文件列表,并记录所述原始文件列表下的原始文件数量;记录根据所述摘要算法计算出的所述原始文件列表内的原始文件的原始摘要值;生成所述待扫描的一级文件夹路径下文件的当前摘要值及当前文件数量;对比所述当前摘要值和所述原始摘要值以及所述当前文件数量和所述原始文件数量,并在所述当前摘要值和所述原始摘要值不同或者在所述当前文件数量及所述原始文件数量不同时发出告警信息。
- 根据权利要求1所述的网站后台图片资源完整性的验证方法,其特征在于,所述获取所述一级文件夹路径下的文件信息包括:查找所述待扫描的一级文件夹内的二级文件夹;获取所述二级文件夹的路径,并对二级文件夹迭代查找,以查找全部文件夹及与所述全部文件夹位于相同路径的文件,并根据所述全部文件夹的路径记录所述全部文件夹下的原始文件数量及原始文件的原始摘要值。
- 根据权利要求1所述的网站后台图片资源完整性的验证方法,其特征在于,所述方法还包括:在预定文件夹下生成记录文件,所述记录文件用于记录所述一级文件夹下的所述原始文件数量及所述原始摘要值。
- 根据权利要求3所述的网站后台图片资源完整性的验证方法,其特征在于,所述方法还包括:获取所述原始文件的文件名,并将所述文件名及所述原始摘要值以键值对的形式记录于所述记录文件内,所述文件名与所述原始文件的原始摘要值相匹配。
- 根据权利要求1所述的网站后台图片资源完整性的验证方法,其特征在于,所述对比所述当前摘要值及所述原始摘要值包括:获取所述当前文件列表,并通过所述摘要算法计算所述当前文件列表内的当前文件的当前摘要值;根据所述当前文件列表获取所述当前文件的当前文件名,并将所述当前文件名与所述当前摘要值相匹配;获取所述原始文件的原始文件名,并将所述原始文件名与所述原始摘要值相匹配;将相同的所述当前文件名及所述原始文件名相匹配,并对比与所述当前文件名及所述原始文件名相匹配的当前摘要值及原始摘要值。
- 根据权利要求5所述的网站后台图片资源完整性的验证方法,其特征在于,所述将相同的所述当前文件名及所述原始文件名相匹配包括:若所述当前文件名及所述原始文件名匹配失败,则发出告警信息。
- 根据权利要求1所述的网站后台图片资源完整性的验证方法,其特征在于,所述对比所述当前文件数量及所述原始文件数量包括:读取所述原始文件数量;获取所述当前文件列表,并根据所述当前文件列表获取当前文件数量;对比所述原始文件数量及所述当前文件数量。
- 一种网站后台图片资源完整性的验证***,其特征在于,包括:扫描模块,用于扫描文件夹路径及所述文件夹路径下的文件信息;摘要生成模块,用于计算文件的摘要值;原始文件信息模块,用于根据所述扫描模块及所述摘要生成模块获取原始文件的原始文件数量及原始摘要值;当前文件信息模块,用于根据所述扫描模块及所述摘要生成模块获取当前文件夹内的当前文件数量及当前摘要值;对比模块,用于对比所述原始文件数量及所述当前文件数量,并用于对比所述原始摘要值及所述当前摘要值;警告发送模块,用于在所述原始文件数量及所述当前文件数量不相同,或所述原始摘要值及所述当前摘要值不相同时,发出告警信息。
- 一种电子装置,包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时,实现权利要求1至7中的任意一项所述方法。
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时,实现权利要求1至7中的任意一项所述方法。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2018/103960 WO2020047736A1 (zh) | 2018-09-04 | 2018-09-04 | 网站后台图片资源完整性的验证方法和*** |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2018/103960 WO2020047736A1 (zh) | 2018-09-04 | 2018-09-04 | 网站后台图片资源完整性的验证方法和*** |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020047736A1 true WO2020047736A1 (zh) | 2020-03-12 |
Family
ID=69722652
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2018/103960 WO2020047736A1 (zh) | 2018-09-04 | 2018-09-04 | 网站后台图片资源完整性的验证方法和*** |
Country Status (1)
Country | Link |
---|---|
WO (1) | WO2020047736A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114091122A (zh) * | 2022-01-21 | 2022-02-25 | 南方电网数字电网研究院有限公司 | 网站防篡改方法、装置、计算机设备和存储介质 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104462950A (zh) * | 2014-12-17 | 2015-03-25 | 中国人民解放军国防科学技术大学 | 一种用于操作***的应用程序执行权限控制方法 |
CN105302708A (zh) * | 2014-06-30 | 2016-02-03 | 联发科技(新加坡)私人有限公司 | 一种移动终端及其检测方法 |
CN106295407A (zh) * | 2016-08-22 | 2017-01-04 | 杭州华三通信技术有限公司 | 一种检测文件是否被篡改的方法及装置 |
CN106598785A (zh) * | 2016-12-16 | 2017-04-26 | 广东美晨通讯有限公司 | 文件***备份与还原的方法及装置 |
-
2018
- 2018-09-04 WO PCT/CN2018/103960 patent/WO2020047736A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105302708A (zh) * | 2014-06-30 | 2016-02-03 | 联发科技(新加坡)私人有限公司 | 一种移动终端及其检测方法 |
CN104462950A (zh) * | 2014-12-17 | 2015-03-25 | 中国人民解放军国防科学技术大学 | 一种用于操作***的应用程序执行权限控制方法 |
CN106295407A (zh) * | 2016-08-22 | 2017-01-04 | 杭州华三通信技术有限公司 | 一种检测文件是否被篡改的方法及装置 |
CN106598785A (zh) * | 2016-12-16 | 2017-04-26 | 广东美晨通讯有限公司 | 文件***备份与还原的方法及装置 |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114091122A (zh) * | 2022-01-21 | 2022-02-25 | 南方电网数字电网研究院有限公司 | 网站防篡改方法、装置、计算机设备和存储介质 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI753228B (zh) | 基於區塊鏈的資料驗證方法及裝置、電子設備 | |
JP5103243B2 (ja) | 書類画像を認証するサーバーシステム及び方法 | |
US10116673B1 (en) | System and method for uploading and verifying a document | |
Casey et al. | Leveraging CybOX™ to standardize representation and exchange of digital forensic information | |
US9146953B1 (en) | Method and system to audit physical copy data leakage | |
JP6839267B2 (ja) | 異なるパーティーにまたがるオブジェクトのトレース | |
KR102351947B1 (ko) | 이미지 검증의 자동화 기법 | |
US8844059B1 (en) | Method and apparatus for preventing data loss through screen capture | |
US20080294903A1 (en) | Authenticity assurance system for spreadsheet data | |
US20210073369A1 (en) | Tampering detection method and apparatus and non-transitory computer-readable storage medium | |
Burri et al. | Chronological independently verifiable electronic chain of custody ledger using blockchain technology | |
CN112541181A (zh) | 一种检测服务器安全性的方法和装置 | |
US20230318835A1 (en) | Secure Authentication of Electronic Documents Via A Distributed System | |
CN110347678B (zh) | 一种金融数据的存储方法、***、装置及设备 | |
CN109376553A (zh) | 网站后台图片资源完整性的验证方法和*** | |
CN111832018A (zh) | 病毒检测方法、装置、计算机装置及存储介质 | |
WO2020047736A1 (zh) | 网站后台图片资源完整性的验证方法和*** | |
CN106415588A (zh) | 数据记录方法、装置和***、计算机存储介质 | |
JP6596848B2 (ja) | アクセス権推定装置及びアクセス権推定プログラム | |
CN116055067A (zh) | 一种弱口令检测的方法、装置、电子设备及介质 | |
US20230036217A1 (en) | Systems and methods for using a structured data database and for exchanging electronic files containing unstructured or partially structered data | |
WO2017129068A1 (zh) | 事件执行方法和装置及*** | |
US11704296B2 (en) | Data management system, data management apparatus, and non-transitory computer readable medium storing data management program | |
JP5063440B2 (ja) | 処理装置及び処理方法 | |
JP6780478B2 (ja) | 管理プログラム、管理方法および管理装置 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 18932521 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 18932521 Country of ref document: EP Kind code of ref document: A1 |