WO2018171283A1 - 实现文件保护的方法、装置和计算设备 - Google Patents

实现文件保护的方法、装置和计算设备 Download PDF

Info

Publication number
WO2018171283A1
WO2018171283A1 PCT/CN2017/119503 CN2017119503W WO2018171283A1 WO 2018171283 A1 WO2018171283 A1 WO 2018171283A1 CN 2017119503 W CN2017119503 W CN 2017119503W WO 2018171283 A1 WO2018171283 A1 WO 2018171283A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
encryption algorithm
protected
files
user
Prior art date
Application number
PCT/CN2017/119503
Other languages
English (en)
French (fr)
Inventor
潘剑锋
李宜檑
秦光远
邹贵强
刘健锋
Original Assignee
北京奇虎科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN201710184528.2A external-priority patent/CN106789051B/zh
Priority claimed from CN201710184527.8A external-priority patent/CN106971120B/zh
Priority claimed from CN201710186412.2A external-priority patent/CN106980797A/zh
Application filed by 北京奇虎科技有限公司 filed Critical 北京奇虎科技有限公司
Publication of WO2018171283A1 publication Critical patent/WO2018171283A1/zh

Links

Images

Definitions

  • the present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, and a computing device for implementing file protection.
  • the present disclosure has been made in order to provide a corresponding apparatus and computing apparatus for implementing a file protection method that overcomes the above problems or at least partially solves the above problems.
  • a method of implementing file protection comprising:
  • an apparatus for implementing file protection comprising:
  • a file determining unit adapted to determine a file to be protected
  • a file protection unit adapted to monitor operations performed on files to be protected, and when a process is monitored to perform a specific operation on a file to be protected, processing corresponding to the specific operation is performed.
  • a computer program comprising:
  • Computer readable code when the computer readable code is run on a computing device, causes the computing device to perform the method of implementing file protection as described above.
  • a computer readable medium comprising:
  • a computer program for performing the above-described method of implementing file protection is stored.
  • the process is processed accordingly.
  • the file to be protected is determined, and then the operation performed on the file to be protected is monitored in real time, and once the process is monitored to perform a specific operation on the file to be protected, the processing corresponding to the specific operation is performed.
  • a process modifies a file that needs to be protected, it can be backed up.
  • the program can be executed to protect the file to be protected and prevent the unavailability caused by the illegal operation of the file.
  • it also protects the user's own interests and helps to enhance the user experience.
  • FIG. 1 is a schematic flow chart of a method for implementing file protection according to an embodiment of the present disclosure
  • FIG. 2 is a schematic structural diagram of an apparatus for implementing file protection according to an embodiment of the present disclosure
  • FIG. 3 is a schematic structural diagram of an apparatus for implementing file protection according to another embodiment of the present disclosure.
  • FIG. 4 schematically illustrates a block diagram of a computing device for performing a method of implementing file protection in accordance with an embodiment of the present disclosure
  • FIG. 5 schematically illustrates a storage unit for holding or carrying program code that implements a method of implementing file protection in accordance with an embodiment of the present disclosure.
  • FIG. 1 is a schematic flowchart diagram of a method for implementing file protection according to an embodiment of the present disclosure. As shown in FIG. 1, the method includes:
  • step S110 a file to be protected is determined.
  • the files to be protected may be one or more types of files that are default or user-defined, one or more files selected by the user, or some files that are susceptible to illegal modification.
  • the file to be protected is not specifically limited.
  • the default file and the file specified by the user may be used as files to be protected; or only the file selected by the user according to the user.
  • step S120 the operations performed on the files to be protected are monitored.
  • the operations are generally performed on the files that need to be protected, such as modifying files, deleting files, encrypting files, and the like. Therefore, when the file to be protected is determined, the operation performed on the file to be protected is monitored in real time, and whether a specific operation is performed on the file to be protected.
  • Step S130 when it is monitored that a process performs a specific operation on the file to be protected, processing corresponding to the specific operation is performed.
  • Specify some specific operations in advance such as modifying files, deleting files, moving files, copying files, encrypting files, and so on.
  • a process performs a specific operation on a file to be protected
  • the specific operation is to modify the file to be protected, and the modified result is saved
  • the file to be protected may be backed up and the backup file is stored to a specific location.
  • the specific location can be the default location of the system or a user-specified location. It should be noted that the backup here is not to back up the modified file, but to back up the original file before modification, so that the modified file can be restored in the subsequent process.
  • the program can be executed to protect the file to be protected and prevent the unavailability caused by the illegal operation of the file. At the same time, it also protects the user's own interests and helps to enhance the user experience.
  • the determining of the file to be protected in step S110 may be performed by one or more of the following methods:
  • the specified one or more types of files are required as a default protection file. For example, specify a picture file, a text file as a file to be protected, and set these files in the terminal device as files that need to be protected by default.
  • a user-defined interface can be provided, and the user's instruction is received through the user-defined interface, and the file to be protected is determined according to the user's instruction.
  • users can also customize the files that need to be protected to determine which files need to be protected based on user customization, such as video, audio, and so on.
  • users can also specify one or more folders, and the files in the one or more folders are files that need to be protected, regardless of the file type.
  • file to be protected in this embodiment may be any one of the above, or may be any combination of the above.
  • the specific operation in the method shown in FIG. 1 includes one of the following Kind or multiple: modify the contents of the file, modify the file name, delete the file, move the file, copy the file, open the file. Then, when it is monitored that a process performs the above specific operations on the file to be protected, the processing corresponding to the specific operation is performed. The following describes the execution of the processing corresponding to this specific operation:
  • executing the processing corresponding to the specific operation includes: determining whether the file to be protected is opened by the system default tool; if yes, no processing is performed; if not, an alarm prompt is performed.
  • the system default tool is microsoft office word, but when you open the file in the folder, it is not the microsoft office word, it will give an alarm prompt, prompting the user to protect.
  • the file is being opened by a non-default tool.
  • performing processing corresponding to the specific operation includes: performing a popup prompt, and providing "allow", “block”, and “rollback" Operation options.
  • the operation of modifying the file name refers to the operation of completing the file name modification and saving.
  • each option provided corresponds to a different processing strategy:
  • the operation of the rollback process restores the file to the state before the operation by the process.
  • a process operates on a file, it records which operations and what operations the file performs on the file.
  • the file is restored to the state before the operation by the process according to the record information. For example, the process changes the file name to the file, and changes the "work file” to "abcd".
  • the name of the file is changed from “abcd” to the original "work”. file”.
  • the processing corresponding to the specific operation includes: backing up the file to obtain a backup file; after the backup file is obtained, the file is backed up Save to a specific location, so that the user can restore the modified file to be protected according to the saved backup file, preventing the non-user from using the modified file to obtain benefits.
  • the specific location used to save the backup file can be either the system default location or a user-specified location.
  • the specific location may select a disk with the largest remaining space of the disk according to the size of the remaining disk space of each local disk, create a new folder on the disk, and save the backup file to the newly created folder, so that You can make reasonable use of the storage space of this unit.
  • the operation of modifying the content of the file refers to the operation of modifying the content of the completed file and saving it.
  • the determination here whether the file to be protected is modified or not can be opened in the edit mode by the file to be protected, the content is modified, the file is saved, or the file to be protected is opened in the edit mode.
  • the prompt "Do you need to save” is received, the "Yes" command is received. That is to say, when the file to be protected is modified and the saved instruction is triggered, the file is backed up.
  • the backup will not be performed as long as the modification is not saved. Further, the backup here is not to back up the modified file, but to back up the original file before modification, so that the modified file can be restored in the subsequent process.
  • saving the backup file to a specific location includes: encrypting the backup file to obtain an encrypted file; and using the combination of the file name, the original path, and the original size of the backup file as the backup file.
  • Index the file name of the backup file is the MD5 value or the sha-1 value of the content of the file to be protected; the index of the backup file and the encrypted file are saved to a specific location.
  • the encryption process of the backup file can be performed by using a pre-configured encryption algorithm, and the index of the backup file is obtained, so that the user can find the modified file according to the information in the index through the index, and restore the original file to the backup file by using the backup file.
  • the original state can be performed by using a pre-configured encryption algorithm, and the index of the backup file is obtained, so that the user can find the modified file according to the information in the index through the index, and restore the original file to the backup file by using the backup file.
  • the original state can be performed by using a pre-configured encryption algorithm, and the index of the backup file is obtained, so that the user can find the modified file according to the information in the index through the index, and restore the original file to the backup file by using the backup file.
  • the foregoing encryption algorithm may be an MD5 (Message-Digest Algorithm 5) encryption algorithm, and the content of the original file to be protected is subjected to MD5 calculation, and then only the MD5 value of the file to be protected is used as the file name of the corresponding backup file.
  • MD5 Message-Digest Algorithm 5
  • the file name of the backup file has no suffix.
  • the file name of the backup file is just an MD5 value, without the suffix ".doc".
  • the foregoing encryption algorithm may be a sha (Secure Hash Algorithm) encryption algorithm.
  • the sha-1 encryption algorithm performs sha-1 encryption calculation on the content of the original file, and then only uses the sha-1 value of the content of the file to be protected as the file name of the corresponding backup file, similar to the MD5 encryption, so that the backup The file name of the file is without a suffix.
  • the DES encryption algorithm or the RSA encryption algorithm is used.
  • the encryption algorithm is not specifically limited.
  • the solution may provide multiple encryption algorithm tools, and the user may select according to his own needs.
  • the criminals illegally operate the documents that need to be protected.
  • the contents of the documents to be protected are modified, and the documents to be protected are deleted or modified on a large scale. Therefore, in a preferred embodiment of the present disclosure, in order to further determine that the modification to the file to be protected is an illegal modification against the user's will, when the specific operation is to modify the file content, the process corresponding to the specific operation is performed including :
  • the first preset value is 50%
  • the second preset value is 80%.
  • the number of text documents in the machine has exceeded the total number of text documents stored in the machine. 50%
  • the number of words modified for each text document has exceeded 80% of the total number of words in the text document, then it is determined that the modification of the program is illegally modified, and the user of the local machine needs to be alerted, so that corresponding measures can be taken.
  • the number of files modified within the predetermined time exceeds the threshold.
  • the preset threshold is 50%, and within 1 hour, the number of text documents in the machine has exceeded 50% of the total number of text documents stored in the machine, and an alarm is given.
  • the preset time can be customized, and there is no limit here.
  • the modification ratio of the content of a file exceeds the threshold.
  • the number of words can be judged.
  • the preset threshold is 80%, and the number of modified words for each text document has exceeded 80% of the total number of words of the text document, and an alarm is given.
  • the number of files of the same type modified exceeds the threshold. For example, if the number of modifications to the same type of file exceeds 50% of the total number of the same file type, an alert is issued.
  • the amount of modified data for the same type of file exceeds the threshold. For example, an alarm is given when the amount of data (for example, the number of words) of a modification of the same type of file exceeds 50% of the total amount of data of the same file type (for example, the total number of words of all files of the same type).
  • any one of the above conditions may be used, or any combination of the above conditions may be used.
  • the foregoing alarm prompt includes: performing a pop-up prompt, and providing three operation options of “allow”, “block”, and “roll back”; each operation option corresponds to a different processing strategy:
  • the modification operation of the rollback process restores the file to the state before being modified by the process. Because, as above, when the file is modified, the file is backed up, the backup file is obtained, the backup file is obtained, the backup file is saved to a specific location; and the file modification operation of the process has been recorded, when the user selects “rollback” "Operation, you can use the backup file and the file modification operation of the recorded process, roll back the operation of the process, restore the modified file, achieve the effect of protecting the file, and prevent the file from being illegally operated. The situation arises.
  • performing processing corresponding to the specific operation includes:
  • the corresponding executable program exe When the file to be protected is illegally modified, the corresponding executable program exe is usually used. When it is detected that the program is modifying the file, it is determined whether the specified encryption is used in the process of modifying the file.
  • the algorithm performs encryption processing.
  • the specified encryption algorithm here is generally an encryption algorithm already existing in the prior art, and it can be predicted that, in general, in order to reduce the time cost, when the file is illegally encrypted, the existing encryption algorithm is usually used. For example, the DES encryption algorithm. Therefore, in the preferred embodiment, some specified encryption algorithms are pre-configured. When determining whether the process uses the specified encryption algorithm to encrypt the file, the signature of the encryption algorithm may be used for matching. Indicates that the process does encrypt the file using the specified encryption algorithm.
  • the hook function is used to derive the key used by the specified encryption algorithm and save it.
  • the key currently used by the specified encryption algorithm is exported and saved by inserting a hook function.
  • the key can also be obtained by hooking (HOOK) the export function of the system DLL and saving.
  • the storage location of the key may be system default or user-specified.
  • the combination of the name and the original path is used as the index of the key, and the index of the key and the encrypted file are correspondingly saved to a specific location, so that the user can know which files are encrypted, and use the information in the index and the key pair to encrypt the file. Decrypt.
  • the encrypted file is decrypted according to the specified encryption algorithm and the saved key.
  • the user uses the file that has been encrypted, and finds that the file has been encrypted, the user can directly decrypt the encrypted file by using the saved key, without using the illegal element of the executable program exe, The file is decrypted.
  • the present disclosure can realize that after the file is illegally encrypted, the encrypted file is decrypted by using the derived key to recover the encrypted file, the file is effectively protected, the user's own interests are maintained, and the user experience is improved.
  • the signature of the encryption algorithm may be utilized; and, the specified encryption algorithm used by the process that normally performs the file modification operation uses a third-party encryption and decryption library.
  • a call to the encryption algorithm is performed, or an execution program of the encryption algorithm is included in the code of the process itself.
  • the foregoing determining whether the process uses a specified encryption algorithm to encrypt the file includes:
  • a pre-specified dynamic link library DLL is injected into the process, and the DLL scans and determines whether the code of the specified encryption algorithm is included in the code of the third-party encryption and decryption library called by the process and/or the process itself.
  • the dynamic link library DLL provides a way for a process to call functions that are not part of its executable code.
  • the dynamic link library DLL is injected into the process, and it is determined whether the code of the specified encryption algorithm is included in the code of the third-party encryption and decryption library called by the process and/or the process itself.
  • the process If the third-party encryption and decryption library called by the process contains the signature of the specified encryption algorithm, and/or the code of the process itself contains the signature of the specified encryption algorithm, it is determined that the process encrypts the file using the specified encryption algorithm. deal with. For example, if the called third-party encryption/decryption library contains the signature of the DES encryption algorithm, or the code of the exe process itself contains the signature of the DES encryption algorithm, it is determined that the process encrypts the file using the DES encryption algorithm.
  • the key used to derive the specified encryption algorithm by using the hook function includes: using the hook function HOOK third-party encryption and decryption library export interface To intercept the key used by the specified encryption algorithm.
  • the hook function can capture event messages that will occur in all processes in the system. When an event occurs, if a hook function is installed, the hook function in the process will be called. In this embodiment, when it is determined that the event that the process encrypts the file by using the specified encryption algorithm occurs, the pre-installed hook function is called, and the export interface of the HOOK third-party encryption and decryption library is used to intercept the specified encryption algorithm. Key. HOOK can be understood here as "hook”, that is, using the hook function to intercept the key used by the specified encryption algorithm through the export interface of the third-party encryption and decryption library.
  • the key used to derive the specified encryption algorithm by using the hook function includes: setting the hardware execution breakpoint or INT3 at the location of the signature of the specified encryption algorithm.
  • a breakpoint when the process executes to the set breakpoint, triggers an exception, and the hook function that handles the exception finds the key used by the specified encryption algorithm from the context information in the CPU register and/or the stack.
  • the hardware execution breakpoint or INT3 breakpoint is set at the location where the signature of the specified encryption algorithm is located, when the program executes to the location where the signature of the specified encryption algorithm is located, the hardware execution breakpoint or INT3 breakpoint is triggered.
  • the specified trigger an exception
  • the debugger or CPU will catch the exception and stop at the breakpoint, then call the hook function from the breakpoint, find the specified encryption algorithm from the context information in the CPU register and / or stack The key used.
  • the method specified in FIG. 1 specifies that the encryption algorithm is a symmetric encryption algorithm.
  • the data sender processes the plaintext (original data) together with the encryption key through a special encryption algorithm, and then sends it into a complex encrypted ciphertext.
  • the receiving party wants to interpret the original text, it needs to decrypt the ciphertext by using the encrypted used key and the inverse algorithm of the same algorithm to restore it to readable plaintext. That is to say, in the symmetric encryption algorithm, there is only one key used, and both parties of the sending and receiving letter use this key to encrypt and decrypt the data.
  • the process of file modification uses a symmetric encryption algorithm to encrypt the file, the file can be decrypted after the key used by the encryption algorithm has been obtained using the hook function.
  • the premise of the method for protecting a file provided by the present disclosure is that the non-user himself has illegally modified the file, and the program is not required to be executed if only the user himself or herself changes normally. Then, in order to further determine that the modification of the file is an illegal modification.
  • the method before the process of performing the file modification operation determines whether the process encrypts the file using the specified encryption algorithm, the method further includes: determining whether the file modification operation of the process meets the following conditions: One or more of the following: the number of files modified within a predetermined time exceeds the threshold, the modification ratio of the content of one file exceeds the threshold, the number of files of the same type modified exceeds the threshold, and the amount of modified data for the same type of file exceeds the threshold .
  • the step of determining whether the process encrypts the file using the specified encryption algorithm is performed; if the determination is no, the step of determining whether the process encrypts the file using the specified encryption algorithm is not performed. That is to say, when the file modification operation of the process satisfies one or more of the conditions for performing the alarm prompt as described above, the step of determining whether the process encrypts the file using the specified encryption algorithm is performed.
  • any one of the conditions for performing the alarm prompt described above may be used, or any of the conditions for performing the alarm prompt described above may be used. combination.
  • it may be determined that the modification to the file to be protected is an illegal modification by: when the file to be protected is modified, determining whether the file to be protected is modified by the system default tool, and if not, Then it can be judged that the modification is an illegal modification.
  • the method before the process of performing the file modification operation determines whether the process encrypts the file by using the specified encryption algorithm, the method further includes: determining whether the file modified by the process includes the prior Specified as a file that needs to be protected. If included, the step of determining whether the process encrypts the file using the specified encryption algorithm is performed; if not, the step of determining whether the process encrypts the file using the specified encryption algorithm is not performed.
  • the file to be protected here is the same as the file to be protected as described above, and details are not described herein again.
  • the method further includes decrypting the encrypted file according to the specified encryption algorithm and the saved key when needed.
  • the user uses the file that has been encrypted, and finds that the file has been encrypted, the user can directly decrypt the encrypted file by using the saved key, without using the illegal element of the executable program exe, The file is decrypted. This can also effectively protect files, maintain the user's own interests, and improve the user experience.
  • FIG. 2 shows a schematic structural diagram of an apparatus for implementing file protection according to an embodiment of the present disclosure.
  • the apparatus 200 for implementing file protection includes:
  • the file determining unit 210 is adapted to determine a file that needs to be protected.
  • the files to be protected may be one or more types of files that are default or user-defined, one or more files selected by the user, or some files that are susceptible to illegal modification.
  • the file to be protected is not specifically limited.
  • the default file and the file specified by the user may be used as files to be protected; or only the file selected by the user according to the user.
  • the file protection unit 220 is adapted to monitor an operation performed on a file to be protected, and when a process is monitored to perform a specific operation on the file to be protected, processing corresponding to the specific operation is performed.
  • the operations are generally performed on the files to be protected, for example, modifying files, deleting files, moving files, encrypting files, and the like. Therefore, when the file to be protected is determined, the operation performed on the file to be protected is monitored in real time, and whether a specific operation is performed on the file to be protected.
  • the program can be executed to protect the file to be protected and prevent the unavailability caused by the illegal operation of the file. At the same time, it also protects the user's own interests and helps to enhance the user experience.
  • the file determining unit 210 is adapted to determine a file to be protected according to one or more of the following:
  • the specified one or more types of files are required as a default protection file. For example, specify a picture file, a text file as a file to be protected, and set these files in the terminal device as files that need to be protected by default.
  • a user-defined interface can be provided, and the user's instruction is received through the user-defined interface, and the file to be protected is determined according to the user's instruction.
  • users can also customize the files that need to be protected to determine which files need to be protected based on user customization, such as video, audio, and so on.
  • users can also specify one or more folders, and the files in the one or more folders are files that need to be protected, regardless of the file type.
  • file to be protected in this embodiment may be any one of the above, or may be any combination of the above.
  • the specific operation described above includes one or more of the following: File contents, modify file names, delete files, move files, copy files, open files. Then, when it is monitored that a process performs the above specific operations on the file to be protected, the processing corresponding to the specific operation is performed. The following describes the processing corresponding to the specific operation to the file protection unit 220:
  • the file protection unit 220 is adapted to determine whether the file to be protected is opened by the system default tool when the specific operation is to open the file; if yes, no processing is performed; if not, an alarm prompt is performed.
  • the system default tool is microsoft office word, but when you open the file in the folder, it is not the microsoft office word, it will give an alarm prompt, prompting the user to protect.
  • the file is being opened by a non-default tool.
  • the file protection unit 220 is adapted to perform a popup prompt when a specific operation is to modify a file name, delete a file, move a file, or copy a file, and provide an "allow", "block", and "roll back" operation options.
  • the operation of modifying the file name refers to the operation of completing the file name modification and saving.
  • each action option provided corresponds to a different processing strategy: when the user selects the "Allow” action option, no processing is performed on the process.
  • the process is forcibly stopped, preventing the process from deleting, copying, and modifying the file name in the machine.
  • the operation of the rollback process restores the file to the state before the operation by the process.
  • a process operates on a file, it records which operations and what operations the file performs on the file.
  • the file is restored to the state before the operation by the process according to the record information. For example, the process changes the file name to the file, and changes the "work file” to "abcd".
  • the name of the file is changed from “abcd” to the original "work”. file”.
  • the file protection unit 220 is adapted to, when the specific operation is to modify the content of the file, that is, to complete the modification of the file content and save the file, back up the file, obtain the backup file, obtain the backup file, and save the backup file to A specific location, so that the user can restore the modified file to be protected according to the saved backup file, and prevent the non-user from using the modified file to obtain the benefit.
  • the specific location used to save the backup file can be either the system default location or a user-specified location.
  • the specific location may select a disk with the largest remaining space of the disk according to the size of the remaining disk space of each local disk, create a new folder on the disk, and save the backup file to the newly created folder, so that You can make reasonable use of the storage space of this unit.
  • the operation of modifying the content of the file refers to the operation of modifying the content of the completed file and saving it.
  • the determination here whether the file to be protected is modified or not can be opened in the edit mode by the file to be protected, the content is modified, the file is saved, or the file to be protected is opened in the edit mode.
  • the prompt "Do you need to save” is received, the "Yes" command is received. That is to say, when the file to be protected is modified and the saved instruction is triggered, the file is backed up.
  • the backup will not be performed as long as the modification is not saved. Further, the backup here is not to back up the modified file, but to back up the original file before modification, so that the modified file can be restored in the subsequent process.
  • the file protection unit 220 is further configured to perform encryption processing on the backup file to obtain an encrypted file; and use a combination of the file name, the original path, and the original size of the backup file as an index of the backup file.
  • the file name of the backup file is the MD5 value or the sha-1 value of the content of the file to be protected; the index of the backup file and the encrypted file are saved to a specific location.
  • the encryption process of the backup file can be performed by using a pre-configured encryption algorithm, and the index of the backup file is obtained, so that the user can find the modified file according to the information in the index through the index, and restore the original file to the backup file by using the backup file.
  • the original state can be performed by using a pre-configured encryption algorithm, and the index of the backup file is obtained, so that the user can find the modified file according to the information in the index through the index, and restore the original file to the backup file by using the backup file.
  • the original state can be performed by using a pre-configured encryption algorithm, and the index of the backup file is obtained, so that the user can find the modified file according to the information in the index through the index, and restore the original file to the backup file by using the backup file.
  • the foregoing encryption algorithm may be an MD5 (Message-Digest Algorithm 5) encryption algorithm, and the content of the original file to be protected is subjected to MD5 calculation, and then only the MD5 value of the file to be protected is used as the file name of the corresponding backup file.
  • MD5 Message-Digest Algorithm 5
  • the file name of the backup file has no suffix.
  • the file name of the backup file is just an MD5 value, without the suffix ".doc".
  • the foregoing encryption algorithm may be a sha (Secure Hash Algorithm) encryption algorithm.
  • the sha-1 encryption algorithm performs sha-1 encryption calculation on the content of the original file, and then only uses the sha-1 value of the content of the file to be protected as the file name of the corresponding backup file, similar to the MD5 encryption, so that the backup The file name of the file is without a suffix.
  • the DES encryption algorithm or the RSA encryption algorithm is used.
  • the encryption algorithm is not specifically limited.
  • the solution may provide multiple encryption algorithm tools, and the user may select according to his own needs.
  • the file protection unit 220 is adapted to record the specific operation when the file content is modified.
  • the process of modifying the file to be protected by the process. When a program modifies the file, the file is backed up, and what operations and operations of the file are performed on the file are recorded; when the file of the process is When the modification operation satisfies one or more of the following conditions, an alarm prompt is issued:
  • the first preset value is 50%
  • the second preset value is 80%.
  • the number of text documents in the machine has exceeded the total number of text documents stored in the machine. 50%
  • the number of words modified for each text document has exceeded 80% of the total number of words in the text document, then it is determined that the modification of the program is illegally modified, and the user of the local machine needs to be alerted, so that corresponding measures can be taken.
  • the number of files modified within the predetermined time exceeds the threshold.
  • the preset threshold is 50%, and within 1 hour, the number of text documents in the machine has exceeded 50% of the total number of text documents stored in the machine, and an alarm is given.
  • the preset time can be customized, and there is no limit here.
  • the modification ratio of the content of a file exceeds the threshold.
  • the number of words can be judged.
  • the preset threshold is 80%, and the number of modified words for each text document has exceeded 80% of the total number of words of the text document, and an alarm is given.
  • the number of files of the same type modified exceeds the threshold. For example, if the number of modifications to the same type of file exceeds 50% of the total number of the same file type, an alert is issued.
  • the amount of modified data for the same type of file exceeds the threshold. For example, an alarm is given when the amount of data (for example, the number of words) of a modification of the same type of file exceeds 50% of the total amount of data of the same file type (for example, the total number of words of all files of the same type).
  • any one of the above conditions may be used, or any combination of the above conditions may be used.
  • the file protection unit 220 is adapted to perform a pop-up prompt and provides three operation options of “allow”, “block”, and “roll back”.
  • Each action option corresponds to a different processing strategy: when the user selects the "Allow” action option, no processing is done on the process.
  • the process is forcibly stopped, preventing the process from performing the modification in the machine.
  • the modification operation of the rollback process restores the file to the state before being modified by the process.
  • FIG. 3 illustrates a schematic structural diagram of an apparatus for implementing file protection according to another embodiment of the present disclosure.
  • the device 300 for implementing file protection includes: a file determining unit 310, a file protecting unit 320, an encryption determining unit 330, a key obtaining unit 340, and a file decrypting unit 350.
  • the file determining unit 310, the file protecting unit 320, and the file determining unit 210 shown in FIG. 2 have the same functions, and the same portions are not described herein again.
  • the encryption determining unit 330 is adapted to determine whether the process encrypts the file using the specified encryption algorithm when the specific operation is to modify the file content.
  • the encryption algorithm performs encryption processing.
  • the specified encryption algorithm here is generally an encryption algorithm already existing in the prior art, and it can be predicted that, in general, in order to reduce the time cost, when the file is illegally encrypted, the existing encryption algorithm is usually used. For example, the DES encryption algorithm.
  • some specified encryption algorithms are pre-configured, and when the process determines whether the process uses the specified encryption algorithm to encrypt the file, the signature of the encryption algorithm may be used for matching, if it can be matched, The process does encrypt the file using the specified encryption algorithm. In addition, it is also possible to determine whether these programs call the system DLL for encryption.
  • the key obtaining unit 340 is adapted to: when the encryption determining unit 330 determines that the process encrypts the file by using the specified encryption algorithm, uses a hook function to derive and save the key used by the specified encryption algorithm.
  • the key currently used by the specified encryption algorithm is exported and saved by inserting a hook function.
  • the key can also be obtained by hooking (HOOK) the export function of the system DLL and saving.
  • the storage location of the key may be system default or user-specified.
  • the combination of the name and the original path is used as the index of the key, and the index of the key and the encrypted file are correspondingly saved to a specific location, so that the user can know which files are encrypted, and use the information in the index and the key pair to encrypt the file. Decrypt.
  • the file decryption unit 350 is adapted to decrypt the encrypted file according to the specified encryption algorithm and the saved key when needed.
  • the user uses the file that has been encrypted, and finds that the file has been encrypted, the user can directly decrypt the encrypted file by using the saved key, without using the illegal element of the executable program exe, The file is decrypted.
  • the disclosure can realize that after the file is illegally encrypted, the encrypted file is decrypted by using the derived key to recover the encrypted file, which can effectively protect the file, maintain the user's own interests, and improve the user experience.
  • the signature of the encryption algorithm may be utilized; and, the specified encryption algorithm used by the process that normally performs the file modification operation uses a third-party encryption and decryption library.
  • a call to the encryption algorithm is performed, or an execution program of the encryption algorithm is included in the code of the process itself.
  • the encryption determining unit 330 is adapted to inject a pre-specified dynamic link library DLL into the process, and the DLL scans and determines the third-party encryption and decryption library called by the process and/or Or whether the code of the process itself contains the signature of the specified encryption algorithm.
  • the dynamic link library DLL provides a way for a process to call functions that are not part of its executable code.
  • the dynamic link library DLL is injected into the process, and the code of the specified encryption algorithm is scanned and determined in the third-party encryption and decryption library called by the process and/or the code of the process itself.
  • the process If the third-party encryption and decryption library called by the process contains the signature of the specified encryption algorithm, and/or the code of the process itself contains the signature of the specified encryption algorithm, it is determined that the process encrypts the file using the specified encryption algorithm. deal with. For example, if the called third-party encryption and decryption library contains the signature of the DES encryption algorithm, and/or the code of the exe process itself contains the signature of the DES encryption algorithm, it is determined that the process encrypts the file using the DES encryption algorithm. .
  • the dynamic link library DLL provides a way for a process to call functions that are not part of its executable code.
  • the dynamic link library DLL is injected into the process, and it is determined whether the code of the specified encryption algorithm is included in the code of the third-party encryption and decryption library called by the process and/or the process itself.
  • the key obtaining unit 340 is adapted to use the hook function HOOK third-party encryption and decryption library export interface to intercept the specified encryption algorithm when the third-party encryption and decryption library called by the process includes the feature code of the specified encryption algorithm. The key used.
  • the hook function can capture event messages that will occur in all processes in the system. When an event occurs, if a hook function is installed, the hook function in the process will be called. In this embodiment, when it is determined that the event that the process encrypts the file by using the specified encryption algorithm occurs, the pre-installed hook function is called, and the export interface of the HOOK third-party encryption and decryption library is used to intercept the specified encryption algorithm. Key. HOOK can be understood here as "hook”, that is, using the hook function to intercept the key used by the specified encryption algorithm through the export interface of the third-party encryption and decryption library.
  • the key obtaining unit 340 is adapted to: when the code of the process itself includes the feature code of the specified encryption algorithm, set a hardware execution breakpoint or an INT3 breakpoint at a location where the feature code of the encryption algorithm is specified, when the process An exception is triggered when execution reaches the set breakpoint, and the key used to specify the encryption algorithm is found from the CPU register and/or the context information in the stack by the hook function that handles the exception.
  • the hardware execution breakpoint or INT3 breakpoint is set at the location where the signature of the specified encryption algorithm is located, when the program executes to the location where the signature of the specified encryption algorithm is located, the hardware execution breakpoint or INT3 breakpoint is triggered.
  • the specified trigger an exception
  • the debugger or CPU will catch the exception and stop at the breakpoint, then call the hook function from the breakpoint, find the specified encryption algorithm from the context information in the CPU register and / or stack The key used.
  • the encryption algorithm is specified as a symmetric encryption algorithm.
  • the data sender processes the plaintext (original data) together with the encryption key through a special encryption algorithm, and then sends it into a complex encrypted ciphertext.
  • the receiving party wants to interpret the original text, it needs to decrypt the ciphertext by using the encrypted used key and the inverse algorithm of the same algorithm to restore it to readable plaintext. That is to say, in the symmetric encryption algorithm, there is only one key used, and both parties of the sending and receiving letter use this key to encrypt and decrypt the data.
  • the process of performing the file modification operation encrypts the file using a symmetric encryption algorithm, the file can be decrypted after the key used by the encryption algorithm has been acquired by the hook function.
  • the premise of the solution for protecting the file provided by the present disclosure is that the non-user himself has illegally modified the file, and the program is not required to be executed if only the user himself or herself changes normally. Then, in order to further determine that the modification of the file is an illegal modification.
  • the encryption determining unit 330 is adapted to further determine whether the file modification operation of the process is satisfied before determining whether the process uses the specified encryption algorithm to encrypt the file for the process of performing the file modification operation.
  • the number of files modified within a predetermined time exceeds a threshold
  • the modification ratio of the content of one file exceeds a threshold
  • the number of modified same type files exceeds a threshold
  • the modified data for the same type of file The amount exceeds the threshold. If the determination is yes, the step of determining whether the process encrypts the file using the specified encryption algorithm is performed; if the determination is no, the step of determining whether the process encrypts the file using the specified encryption algorithm is not performed.
  • the method of determining whether the process encrypts the file using the specified encryption algorithm is performed. step.
  • any one of the conditions for performing the alarm prompt described above may be used, or any of the conditions for performing the alarm prompt described above may be used. combination.
  • it may be determined that the modification to the file to be protected is an illegal modification by: when the file to be protected is modified, determining whether the file to be protected is modified by the system default tool, and if not, Then it can be judged that the modification is an illegal modification.
  • the method before the process of performing the file modification operation determines whether the process encrypts the file by using the specified encryption algorithm, the method further includes: determining whether the file modified by the process includes the prior Specified as a file that needs to be protected. If included, the step of determining whether the process encrypts the file using the specified encryption algorithm is performed; if not, the step of determining whether the process encrypts the file using the specified encryption algorithm is not performed.
  • the file to be protected here is the same as the file to be protected as described above, and details are not described herein again.
  • FIG. 2 and FIG. 3 are the same as the embodiments of the method shown in FIG. 1 and have been described in detail above, and are not described herein again.
  • Storage device 4 illustrates a computing device that can implement the above-described method of implementing file protection of the present disclosure.
  • the computing device conventionally includes a processor 410 and a computer program product or computer readable medium in the form of a storage device 420.
  • Storage device 420 can be an electronic memory such as a flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • Storage device 420 has a storage space 430 that stores program code 431 for performing any of the method steps described above.
  • storage space 430 storing program code may include various program code 431 for implementing various steps in the above methods, respectively.
  • the program code can be read from or written to one or more computer program products.
  • These computer program products include program code carriers such as a hard disk, a compact disk (CD), a memory card, or a floppy disk. Such computer program products are typically portable or fixed storage units such as those shown in FIG.
  • the storage unit may have storage segments, storage spaces, and the like that are similarly arranged to storage device 420 in the computing device of FIG.
  • the program code can be compressed, for example, in an appropriate form.
  • a storage unit includes computer readable code 431' for performing the steps of the method according to the present disclosure, ie, code that can be read by a processor, such as 410, which when executed by a computing device causes the computing device Perform the various steps in the method described above.
  • the process is processed accordingly.
  • the file to be protected is determined, and then the operation performed on the file to be protected is monitored in real time, and once the process is monitored to perform a specific operation on the file to be protected, the processing corresponding to the specific operation is performed.
  • a process modifies a file that needs to be protected, it can be backed up.
  • the program can be executed to protect the file to be protected and prevent the unavailability caused by the illegal operation of the file.
  • it also protects the user's own interests and helps to enhance the user experience.
  • modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment.
  • the modules or units or components of the embodiments may be combined into one module or unit or component, and further they may be divided into a plurality of sub-modules or sub-units or sub-components.
  • any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed, or All processes or units of the device are combined.
  • Each feature disclosed in this specification (including the accompanying claims, the abstract and the drawings) may be replaced by alternative features that provide the same, equivalent or similar purpose.
  • Various component embodiments of the present disclosure may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
  • a microprocessor or digital signal processor may be used in practice to implement some or all of some or all of the means for implementing file protection and computing devices in accordance with embodiments of the present disclosure.
  • the present disclosure may also be implemented as a device or device program (eg, a computer program and a computer program product) for performing some or all of the methods described herein.
  • Such a program implementing the present disclosure may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

Landscapes

  • Storage Device Security (AREA)

Abstract

一种实现文件保护的方法、装置和计算设备。该方法包括:确定需要保护的文件(S110);监控需要保护的文件上执行的操作(S120);当监控到有进程在需要保护的文件上执行特定操作时,执行与该特定操作对应的处理(S130)。

Description

实现文件保护的方法、装置和计算设备
相关申请的交叉参考
本申请要求于2017年3月24日提交中国专利局、申请号为201710184527.8、名称为“一种实现文件保护的方法、装置和计算设备”,2017年3月24日提交中国专利局、申请号为201710186412.2、名称为“一种实现文件保护的方法、装置和计算设备”以及2017年3月24日提交中国专利局、申请号为201710184528.2、名称为“一种保护文件的方法、装置和计算设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开涉及计算机技术领域,具体涉及一种实现文件保护的方法、装置和计算设备。
背景技术
随着计算机技术在社会生活和工作中的普及,大量的文件被保存在各种终端设备中,例如手机、pad、台式电脑等,其中不乏一些比较重要的文件。有些不法分子会采用各种方法侵入私人终端设备文件进行非法修改等操作,并且要求用户给予一定的报酬,然后才将修改的文件恢复。如果用户听之任之,不仅会造成一定的经济损失,还会纵容该行为的再次发生;如果用户不予理会,则这些被修改的文件,特别是一些重要的文件,将无法恢复到原始状态或直接导致丢失,这无疑会给用户的生活或者工作带来一定的影响和损失,降低用户体验。因此,如何有效进行文件的保护、防止文件被非法修改成为了急需解决的问题。
发明内容
鉴于上述问题,提出了本公开以便提供一种克服上述问题或者至少部分地解决上述问题的实现文件保护的方法相应的装置、计算设备。
依据本公开的一个方面,提供了一种实现文件保护的方法,该方法包括:
确定需要保护的文件;
监控需要保护的文件上执行的操作;
当监控到有进程在需要保护的文件上执行特定操作时,执行与该特定操作对应的处理。
根据本公开的另一方面,提供了一种实现文件保护的装置,该装置包括:
文件确定单元,适于确定需要保护的文件;
文件保护单元,适于监控需要保护的文件上执行的操作,当监控到有进程在需要保护的文件上执行特定操作时,执行与该特定操作对应的处理。
根据本公开的又一方面提供了一种计算机程序,包括:
计算机可读代码,当计算机可读代码在计算设备上运行时,导致计算设备执行上述实现文件保护的方法。
根据本公开的又一方面提供了一种计算机可读介质,包括:
存储了上述执行上述实现文件保护的方法的计算机程序。
根据本公开的技术方案,一旦监控到有进程在需要保护的文件上执行的操作属于特定的操作时,就对该进程进行相应的处理。首先确定需要保护的文件,然后实时监控需要保护的文件上执行的操作,一旦监控到有进程在需要保护的文件上执行特定操作时,就执行与该特定操作对应的处理。例如,当有进程修改需要保护的文件的时候,就可以对该文件进行备份处理。这样,在违背用户本人意愿下,对需要保护的文件进行修改的时候,就可以执行本方案,以达到对需要保护的文件进行保护的效果,防止因文件被非法操作导致的不可用的情况出现,同时也维护了用户的自身利益,有助于提升用户体验。
上述说明仅是本公开技术方案的概述,为了能够更清楚了解本公开的技术手段,而可依照说明书的内容予以实施,并且为了让本公开的上述和其它目的、特征和优点能够更明显易懂,以下特举本公开的具体实施方式。
附图概述
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本公开的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:
图1示出了根据本公开一个实施例的一种实现文件保护的方法的流程示意图;
图2示出了根据本公开一个实施例的一种实现文件保护的装置的结构示意图;
图3示出了根据本公开另一个实施例的一种实现文件保护的装置的结构示意图;
图4示意性地示出了用于执行根据本公开实施例的实现文件保护的方法的计算设备的框图;以及
图5示意性地示出了用于保持或者携带实现根据本公开实施例的实现文件保护的方法的程序代码的存储单元。
本发明的较佳实施方式
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。
图1示出了根据本公开一个实施例的一种实现文件保护的方法的流程示意图,如图1所示,该方法包括:
步骤S110,确定需要保护的文件。
需要保护的文件可以是默认的或者用户自定义的一个或者多个类型的文件,也可以是用户选定的一个或多个文件,也可以是一些容易受到非法修改的文件。本实施例中,对需要保护的文件不做具体的限定,默认的文件、用户指定的文件,均可以作为需要保护的文件;或者仅仅是用户根据自身选择的文件。
步骤S120,监控需要保护的文件上执行的操作。
因为对需要保护的文件进行违背用户本人意愿的操作,一般是针对需要保护的文件自身进行的操作,例如修改文件、删除文件、加密文件等。所以,当需要保护的文件确定后,实时监控需要保护的文件上执行的操作,需要保护的文件上是否执行了特定操作。
步骤S130,当监控到有进程在需要保护的文件上执行特定操作时,执行 与该特定操作对应的处理。
预先指定一些特定的操作,例如修改文件、删除文件、移动文件、复制文件、加密文件等。当监控到有进程在需要保护的文件上执行特定操作时,就确定该需要保护的文件可能是被非法操作,那么就执行与该特定操作对应的处理。例如,该特定操作为对需要保护的文件进行修改,且修改的结果被保存时,则针对该修改文件操作,可以将该需要保护的文件进行备份处理,并将备份文件存储至特定位置。该特定位置可以是系统默认的位置,也可以是用户指定的位置。需要说明的是,此处的备份并非备份修改后的文件,而是备份修改之前的原文件,这样才能够在后续过程中恢复被修改的文件。
这样,如果是在违背用户本人意愿下,对需要保护的文件进行修改,就可以执行本方案,以达到对需要保护的文件进行保护的效果,防止因文件被非法操作导致的不可用的情况出现,同时也维护了用户的自身利益,有助于提升用户体验。
在本公开的一个实施例中,步骤S110中的确定需要保护的文件可以通过如下的一种或多种方式进行:
(1)将指定的一个或多个类型的文件作为默认需要保护文件。例如,指定图片文件、文本文件作为需要保护的文件,将终端设备中的这些文件设定为默认需要保护的文件。
(2)接收用户的指令,根据用户的指令确定需要保护的文件。例如可以提供用户自定义接口,通过该用户自定义接口接收用户的指令,根据用户的指令确定需要保护的文件。除了在(1)中的默认文件,用户还可以自定义需要保护的文件,以根据用户的自定义确定需要保护的文件,例如,视频、音频等。此外用户还可以指定一个或多个文件夹,该一个或多个文件夹中的文件是需要保护的文件,不管文件类型为何种。
(3)扫描本机上存储的文件,将本机上存储的各类文件的类型信息展示给用户供其进行选择,将用户选择的类型对应的文件确定为需要保护的文件。为了方便用户选择,预先扫描本机上已经存储的文件的类型,并展示给用户,用户在了解了本机上的文件的类型后,根据自身需求进行选择需要保护的文件类型,提高用户体验。在另一实施例中,也可以列出本机上存储的所有文件,以供用户选择特定文件进行保护。
(4)将易受攻击的各类文件的类型信息展示给用户供其进行选择,将用户选择的类型对应的文件确定为需要保护的文件。为了进一步的方便用户选择,还可以只给用户展示比较容易受攻击的文件的类型,以便用户选择。例如文档类的文件比较容易受到篡改攻击,因此将此类文件的类型信息(如word、PDF等)展示给用户供用户进行勾选。
需要说明的是,本实施例中的需要保护的文件可以是上述的任意一种,也可以是上述的任意组合。
因为对需要保护的文件进行违背用户本人意愿的操作,一般是针对需要保护的文件自身进行的操作,在本公开的一个实施例中,图1所示的方法中的特定操作包括如下中的一种或多种:修改文件内容、修改文件名称、删除文件、移动文件、复制文件、打开文件。那么,当监控到有进程在需要保护的文件上执行上述的这些特定操作时,执行与该特定操作对应的处理。下面对执行与该特定操作对应的处理进行详细说明:
(1)当特定操作为打开文件时,执行与该特定操作对应的处理包括:判断是否以系统默认工具打开需要保护的文件;如果是,则不做处理;如果否,则进行报警提示。
例如,打开文件夹“我的文档”中的文件,系统默认工具是microsoft office word,但是当打开该文件夹中的文件的时候用的不是microsoft office word,就进行报警提示,提示用户需要保护的文件正在被非默认工具打开。
(2)当特定操作为修改文件名称、删除文件、移动文件或复制文件时,执行与该特定操作对应的处理包括:进行弹窗提示,并提供“允许”、“阻止”和“回滚”操作选项。这里的修改文件名称的操作,指的是完成文件名称修改并进行保存的操作。
当进行弹窗提示时,提供的每个选项对应不同的处理策略:
当用户选择“允许”操作选项时,不对进程进行任何处理。
当用户选择“阻止”操作选项时,强制停止进程,阻止该进程在本机中再进行删除、复制和修改文件名称的操作。
当用户选择“回滚”操作选项时,回滚进程的操作,将文件恢复到被该进程操作前的状态。当有进程对文件进行操作时,将该进程对文件进行的哪些操作以及何种操作都进行记录。当用户选择“回滚”操作选项时,根据记 录信息,将文件恢复到被该进程操作前的状态。例如,该进程对文件进行了修改文件名称的操作,将“工作文件”改成“abcd”,一旦用户选择“回滚”操作选项,将该文件的名称从“abcd”改回原来的“工作文件”。
(3)当特定操作为修改文件内容时,即完成文件内容的修改并进行保存时,执行与该特定操作对应的处理包括:对文件进行备份,得到备份文件;备份文件获得后,将备份文件保存到特定位置,以便用户可以根据保存的备份文件将被修改的需要保护的文件进行恢复,防止非用户本人利用该被修改的文件索取利益。用于保存备份文件的特定位置可以是系统默认的位置,也可以是用户指定的位置。例如,该特定的位置可以根据本地各磁盘的磁盘剩余空间的大小,选择磁盘剩余空间最大的一个磁盘,在该磁盘上新建一个文件夹;以及将备份文件保存到新建的文件夹中,这样就可以合理地利用本机的存储空间。
需要指出的是,如果在将备份文件保存到文件夹的过程中,发现文件夹所在磁盘的剩余空间不足时,可以提示用户磁盘空间不足。当然,在提示的同时,也可以将备份文件保存到重新选择的磁盘上,或者不保存备份文件而直接拒绝对文件的修改的保存,这样也可以最大程度上保证文件不被非法修改。
需要说明的是,这里的修改文件内容的操作,指的是完成文件的内容的修改并进行保存的操作。例如,这里的判断对需要保护的文件是否被修改主要可以通过该需要保护的文件在编辑模式下打开,进行内容的修改后进行了保存的操作,或者该需要保护的文件在编辑模式下打开,进行内容的修改后并关闭时,在被提示“是否需要保存”时,接收到了“是”的指令。也就是说当需要保护的文件被修改后并触发了保存的指令,就对该文件进行备份。
本领域的技术人员应可了解,若文件仅仅是在编辑模式下打开,或者在编辑模式下打开且被修改,只要未保存该修改,就不会进行备份。更近一步,此处的备份并非备份修改后的文件,而是备份修改之前的原文件,这样才能够在后续过程中恢复被修改的文件。
为了防止备份文件也被非法修改,进一步地,将备份文件保存到特定位置包括:对备份文件进行加密处理,得到加密文件;以备份文件的文件名、原始路径和原始大小的组合作为备份文件的索引;备份文件的文件名为需要 保护的文件的内容的MD5值或sha-1值;将备份文件的索引和加密文件对应保存到特定位置。
对备份文件进行加密处理可以通过预先配置的加密算法进行,同时获取该备份文件的索引,以便用户可以通过索引,根据索引中的信息,找到被修改的文件,并利用备份文件将原文件恢复到原来的状态。
具体地,上述的加密算法可以是MD5(Message-Digest Algorithm 5)加密算法,将需要保护的原文件的内容进行MD5计算,然后仅以需要保护的文件的MD5值作为相应的备份文件的文件名,这样备份文件的文件名是没有后缀的。例如,将word文档进行备份后,备份文件的文件名只是一个MD5值,没有“.doc”的后缀。
具体地,上述的加密算法可以是sha(Secure Hash Algorithm,安全散列)加密算法。例如,sha-1加密算法,将原文件的内容进行sha-1加密计算,然后仅以需要保护的文件的内容的sha-1值作为相应的备份文件的文件名,同MD5加密类似,这样备份文件的文件名是没有后缀的。
又或者,使用DES加密算法或者RSA加密算法,在本实施例中,加密算法不做具体限定,本方案可提供多种加密算法工具,用户可根据自身需求进行自行选择。
下面将特定操作为修改文件内容的情况作为本公开的优选实施例进行详细说明。
通常情况下,不法分子为达到索取更多非法利益的目的,对需要保护的文件进行非法操作一般是修改需要保护的文件的内容,且是对需要保护的文件进行大面积的删除或者修改。所以,在本公开的一个优选实施例中,为了进一步确定对需要保护的文件进行的修改是违背用户本人意愿的非法修改,当特定操作为修改文件内容时,执行与该特定操作对应的处理包括:
记录该进程对需要保护的文件进行的修改的操作,当有程序对文件进行修改时,对该文件进行备份,且将该程序对文件进行的哪些操作以及何种操作都进行记录;当该进程的文件修改操作满足如下条件中的一种或多种时,进行报警提示:
(1)当该进程所修改的文件数量超过第一预设值,且修改数据量与文件总数据量的比值达到第二预设值时,进行报警提示。只有上述两个条件均满 足的情况下,才确定对需要保护的文件进行的修改是非法修改。例如,第一预设值为50%,第二预设值为80%,在一个较短的时间内,对本机中的文本文档的个数已经超过了本机存储的总文本文档个数的50%,并且对每一个文本文档进行的修改的字数已经超过该文本文档总字数的80%,那么就确定该程序的修改为非法修改,需要对本机用户进行报警提示,以便可以采取相应的措施,保护本机的文件。如果,对本机中的文本文档的个数只是本机存储的总文本文档个数的10%,并且对每一个文本文档进行的修改的字数只占该文本文档总字数的20%,那么就确定该程序的修改不是非法修改。
(2)在预定时间内修改的文件数量超过阈值。例如,预设阈值为50%,在1h的时间内,对本机中的文本文档的数量已经超过了本机存储的总文本文档数量的50%,就进行报警提示。该预设时间可自定义,在这里不做限制。
(3)对一个文件的内容的修改比例超过阈值。这里可以通过字数进行判断,例如,预设阈值为80%,对每一个文本文档进行的修改的字数已经超过该文本文档总字数的80%,就进行报警提示。
(4)所修改的相同类型文件的数量超过阈值。例如,对相同类型文件的修改的数量超过该相同文件类型的总数量的50%,就进行报警提示。
(5)对相同类型文件的修改数据量超过阈值。例如,对相同类型文件的修改的数据量(例如字数)超过该相同文件类型的总数据量(例如同种类型所有文件的总字数)的50%,就进行报警提示。
需要说明的是,判断该进程的文件修改操作是否满足条件时,可以使用上述的任意一个条件,也可以使用上述条件的任意组合。在另一实施例中,也可以通过以下方式判断对需要保护的文件进行的修改是非法修改:当需要保护的文件被修改时,判断是否以系统默认工具修改该需要保护的文件,若否,则可以判断该修改是非法修改。
具体地,上述的进行报警提示包括:进行弹窗提示,并提供“允许”、“阻止”和“回滚”三个操作选项;每个操作选项对应不同的处理策略:
当用户选择“允许”操作选项时,不对进程进行任何处理;
当用户选择“阻止”操作选项时,强制停止进程,阻止该进程在本机中再进行修改的操作。
当用户选择“回滚”操作选项时,根据所记录的文件修改操作和备份文 件,回滚进程的修改操作,将文件恢复到被该进程修改前的状态。因为如上文,当文件被修改时,对文件进行备份,得到备份文件,将备份文件获得后,将备份文件保存到特定位置;且已经记录了该进程的文件修改操作,当用户选择“回滚”操作时,就可以利用备份文件以及记录的该进程的文件修改操作,回滚该进程的操作,对被修改的文件进行恢复,达到保护文件的效果,防止因文件被非法操作导致的不可用的情况出现。
另外,对需要保护的文件进行修改后,还可能将文件进行加密处理。为保证将加密的文件可以进行恢复,在本公开的另一个优选实施例中,当特定操作为修改文件内容时,执行与该特定操作对应的处理包括:
对于进行文件修改操作的进程,判断该进程是否使用指定加密算法对文件进行加密处理。
当对需要保护的文件进行非法修改的时候,通常会利用相应的可执行程序exe进行,当检测到有程序在进行文件的修改时,就判断对文件进行修改操作的进程中是否使用指定的加密算法进行加密处理。这里的指定加密算法一般是现有技术中已经存在的加密算法,可以预知,在通常情况下,为了减少时间成本,对文件进行非法加密时,通常会使用现有的加密算法。例如,DES加密算法。所以,在本优选实施例中,会预先配置一些指定的加密算法,在判断该进程是否使用指定加密算法对文件进行加密处理的时候,可以利用加密算法的特征码进行匹配,如果可以匹配,则说明该进程确实在使用指定加密算法对文件进行加密处理。
如果该进程使用指定加密算法对文件进行加密处理,则利用钩子函数导出指定加密算法所使用的密钥并保存。
另外,也可以判断这些程序是否调用系统DLL进行加密,若是,则可以通过钩取(HOOK)系统DLL的导出函数来获取密钥并保存。
经过判断后,如果确定该进程是在使用指定加密算法对文件进行加密处理,就通过插入钩子函数的方式,将指定加密算法当前使用的密钥导出并保存起来。另外,当判断这些程序是调用系统DLL进行加密时,也可以通过钩取(HOOK)系统DLL的导出函数来获取密钥并保存。这里密钥的存储位置可以系统默认的,也可以是用户指定的,当存储的时候,为了便于查找和解密,可以将被加密的文件名和对应的密钥一起保存或者以被加密的文件的文 件名、原始路径的组合作为密钥的索引,将该密钥的索引和加密文件对应保存到一个特定位置,以便用户可以获知哪些文件被加密,并且利用索引中的信息和密钥对加密的文件进行解密。
当需要时,根据指定加密算法和所保存密钥对被加密处理的文件进行解密处理。
当用户使用已经被加密的文件时,发现该文件已经被加密,那么用户就可以直接利用已经保存的密钥对加密的文件进行解密,无需通过使用该可执行程序exe的不法分子,就可以将该文件解密。
可见,本公开可以实现在文件被非法加密后,利用导出的密钥将加密的文件进行解密,以恢复加密的文件,有效的保护文件,维护用户自身的利益,提高用户体验。
如上文说明,在判断该进程是否使用指定加密算法对文件进行加密处理的时候,可以利用加密算法的特征码;而且,通常进行文件修改操作的进程使用的指定加密算法是使用第三方加解密库进行加密算法的调用,或者在该进程本身代码中包含有加密算法的执行程序。那么,进一步地,上述的判断该进程是否使用指定加密算法对文件进行加密处理包括:
在该进程中注入预先指定的动态链接库DLL,由该DLL扫描并判断该进程所调用的第三方加解密库中和/或该进程本身的代码中是否包含指定加密算法的特征码。动态链接库DLL提供了一种方法,使进程可以调用不属于其可执行代码的函数。本实施例中,在该进程中注入动态链接库DLL,判断该进程所调用的第三方加解密库中和/或该进程本身的代码中是否包含指定加密算法的特征码。
如果该进程所调用的第三方加解密库中包含指定加密算法的特征码,和/或,该进程本身的代码中包含指定加密算法的特征码,则确定该进程使用指定加密算法对文件进行加密处理。例如,如果调用的第三方加解密库中包含DES加密算法的特征码,或者该exe进程本身的代码中包含DES加密算法的特征码,则确定该进程使用DES加密算法对文件进行加密处理。
针对上述的包含指定加密算法的特征码的位置的不同,导出指定加密算法所使用的密钥的方式也不同。详见下文说明:
(1)如果该进程所调用的第三方加解密库中包含指定加密算法的特征 码,则利用钩子函数导出指定加密算法所使用的密钥包括:利用钩子函数HOOK第三方加解密库的导出接口以拦截到指定加密算法所使用的密钥。
钩子函数可以捕捉系统中所有进程将发生的事件消息,当一个事件发生时,如果安装了一个钩子函数,进程中的钩子函数将被调用。在本实施例中,当确定该进程使用指定加密算法对文件进行加密处理的事件发生时,就会调用预先安装的钩子函数,HOOK第三方加解密库的导出接口以拦截到指定加密算法所使用的密钥。HOOK这里可以理解为“钩住”,即利用钩子函数通过第三方加解密库的导出接口拦截指定加密算法所使用的密钥。
(2)如果该进程本身的代码中包含指定加密算法的特征码,则用钩子函数导出指定加密算法所使用的密钥包括:在指定加密算法的特征码所在位置处设置硬件执行断点或INT3断点,当该进程执行到所设置的断点处时触发异常,进而由处理异常的钩子函数从CPU寄存器和/或堆栈中的上下文信息中找出指定加密算法所使用的密钥。
当该进程本身的代码中包含指定加密算法的特征码,则确定该进程使用指定加密算法对文件进行加密处理,加密处理的密钥信息会在CPU寄存器和/或堆栈中的上下文信息中。因为在指定加密算法的特征码所在的位置处设置了硬件执行断点或INT3断点,当程序执行到指定加密算法的特征码所在的位置处时,就会触发硬件执行断点或INT3断点的指定,触发一个异常,调试器或CPU就会捕捉这个异常从而停在断点处,然后从断点处调用钩子函数,从CPU寄存器和/或堆栈中的上下文信息中找出指定加密算法所使用的密钥。
这样当通过钩子函数获取到指定加密算法所使用的密钥并保存,当需要对加密的文件进行解密时,就可以利用保存的密钥进行。
在本公开的一个实施例中,图1所示的方法中指定加密算法为对称加密算法。在对称加密算法中,数据发信方将明文(原始数据)和加密密钥一起经过特殊加密算法处理后,使其变成复杂的加密密文发送出去。收信方收到密文后,若想解读原文,则需要使用加密用过的密钥及相同算法的逆算法对密文进行解密,才能使其恢复成可读明文。也就是说,在对称加密算法中,使用的密钥只有一个,发收信双方都使用这个密钥对数据进行加密和解密。如果进行文件修改操作的进程使用对称加密算法对文件进行加密处理,当已 经利用钩子函数获取到加密算法所使用的密钥后,就可以对文件进行解密。
本公开提供的保护文件的方法的前提是非用户本人对文件进行了非法修改操作,如果只是用户本人正常的修改就不需要执行本方案。那么,为了进一步确定对文件的修改是非法修改。在本公开的一个实施例中,对于进行文件修改操作的进程,在判断该进程是否使用指定加密算法对文件进行加密处理之前,该方法进一步包括:判断该进程的文件修改操作是否满足如下条件中的一种或多种:在预定时间内修改的文件数量超过阈值、对一个文件的内容的修改比例超过阈值、所修改的相同类型文件的数量超过阈值、对相同类型文件的修改数据量超过阈值。如果判断为是,再执行判断该进程是否使用指定加密算法对文件进行加密处理的步骤;如果判断为否,则不执行判断该进程是否使用指定加密算法对文件进行加密处理的步骤。也就是说当该进程的文件修改操作满足如上文所述的进行报警提示的条件中的一种或多种时,再执行判断该进程是否使用指定加密算法对文件进行加密处理的步骤。
需要说明的是,判断该进程的文件修改操作是否满足条件时,可以使用上文所述的进行报警提示的条件中的任意一个条件,也可以使用上文所述的进行报警提示的条件的任意组合。在另一实施例中,也可以通过以下方式判断对需要保护的文件进行的修改是非法修改:当需要保护的文件被修改时,判断是否以系统默认工具修改该需要保护的文件,若否,则可以判断该修改是非法修改。
本方案可以只针对一些特定的文件,对于用户来讲,终端设备中存储的文件并非都是重要的,有一些文件可能都已经是无用的文件,为了避免在执行本方案时系统资源的非必要消耗,可是预先指定一些需要保护的默认文件,或者用户自定义一些需要保护的文件,只有这些需要保护的文件被进行加密处理时,才执行本方案。所以,在本公开的一个实施例中,对于进行文件修改操作的进程,在判断该进程是否使用指定加密算法对文件进行加密处理之前,该方法进一步包括:判断该进程修改的文件是否包括预先被指定为需要保护的文件。如果包括,再执行判断该进程是否使用指定加密算法对文件进行加密处理的步骤;如果不包括,则不执行判断该进程是否使用指定加密算法对文件进行加密处理的步骤。
具体地,这里需要保护的文件与上文所述的需要保护的文件种类相同,在此不再赘述。进一步地,该方法进一步包括:当需要时,根据指定加密算法和所保存密钥对被加密处理的文件进行解密处理。当用户使用已经被加密的文件时,发现该文件已经被加密,那么用户就可以直接利用已经保存的密钥对加密的文件进行解密,无需通过使用该可执行程序exe的不法分子,就可以将该文件解密。这样也可以有效的保护文件,维护用户自身的利益,提高用户体验。
图2示出了根据本公开一个实施例的一种实现文件保护的装置的结构示意图。如图2所示,该实现文件保护的装置200包括:
文件确定单元210,适于确定需要保护的文件。
需要保护的文件可以是默认的或者用户自定义的一个或者多个类型的文件,也可以是用户选定的一个或多个文件,也可以是一些容易受到非法修改的文件。本实施例中,对需要保护的文件不做具体的限定,默认的文件、用户指定的文件,均可以作为需要保护的文件;或者仅仅是用户根据自身选择的文件。
文件保护单元220,适于监控需要保护的文件上执行的操作,当监控到有进程在需要保护的文件上执行特定操作时,执行与该特定操作对应的处理。
因为对需要保护的文件进行违背用户本人意愿的操作,一般是针对需要保护的文件自身进行的操作,例如,修改文件、删除文件、移动文件、加密文件等。所以,当需要保护的文件确定后,实时监控需要保护的文件上执行的操作,需要保护的文件上是否执行了特定操作。
这里可以预先指定一些特定的操作,例如,修改文件、删除文件、复制文件、加密文件等。当监控到有进程在需要保护的文件上执行特定操作时,就确定该需要保护的文件可能是被非法操作,那么就对该进程执行与该特定操作对应的处理。例如,该特定操作为对需要保护的文件进行修改,且修改的结果被保存时,则针对该修改文件操作,可以将该需要保护的文件进行备份处理,并将备份文件存储至特定位置。该特定位置可以是系统默认的位置,也可以是用户指定的位置。需要说明的是,此处的备份并非备份修改后的文件,而是备份修改之前的原文件,这样才能够在后续过程中恢复被修改的文件。
这样,如果是在违背用户本人意愿下,对需要保护的文件进行修改,就可以执行本方案,以达到对需要保护的文件进行保护的效果,防止因文件被非法操作导致的不可用的情况出现,同时也维护了用户的自身利益,有助于提升用户体验。
在本公开的一个实施例中,文件确定单元210,适于根据如下中的一种或多种方式确定需要保护的文件:
(1)将指定的一个或多个类型的文件作为默认需要保护文件。例如,指定图片文件、文本文件作为需要保护的文件,将终端设备中的这些文件设定为默认需要保护的文件。
(2)接收用户的指令,根据用户的指令确定需要保护的文件。例如可以提供用户自定义接口,通过该用户自定义接口接收用户的指令,根据用户的指令确定需要保护的文件。除了在(1)中的默认文件,用户还可以自定义需要保护的文件,以根据用户的自定义确定需要保护的文件,例如,视频、音频等。此外用户还可以指定一个或多个文件夹,该一个或多个文件夹中的文件是需要保护的文件,不管文件类型为何种。
(3)扫描本机上存储的文件,将本机上存储的各类文件的类型信息展示给用户供其进行选择,将用户选择的类型对应的文件确定为需要保护的文件。为了方便用户选择,预先扫描本机上已经存储的文件的类型,并展示给用户,用户在了解了本机上的文件的类型后,根据自身需求进行选择需要保护的文件类型,提高用户体验。在另一实施例中,也可以列出本机上存储的所有文件,以供用户选择特定文件进行保护。
(4)将易受攻击的各类文件的类型信息展示给用户供其进行选择,将用户选择的类型对应的文件确定为需要保护的文件。为了进一步的方便用户选择,还可以只给用户展示比较容易受攻击的文件的类型,以便用户选择。例如文档类的文件比较容易受到篡改攻击,因此将此类文件的类型信息(如word、PDF等)展示给用户供用户进行勾选。
需要说明的是,本实施例中的需要保护的文件可以是上述的任意一种,也可以是上述的任意组合。
因为对需要保护的文件进行违背用户本人意愿的操作,一般是针对需要保护的文件自身进行的操作,在本公开的一个实施例中,上述的特定操作包 括如下中的一种或多种:修改文件内容、修改文件名称、删除文件、移动文件、复制文件、打开文件。那么,当监控到有进程在需要保护的文件上执行上述的这些特定操作时,执行与该特定操作对应的处理。下面对文件保护单元220执行与该特定操作对应的处理进行详细说明:
(1)文件保护单元220,适于当特定操作为打开文件时,判断是否以系统默认工具打开需要保护的文件;如果是,则不做处理;如果否,则进行报警提示。
例如,打开文件夹“我的文档”中的文件,系统默认工具是microsoft office word,但是当打开该文件夹中的文件的时候用的不是microsoft office word,就进行报警提示,提示用户需要保护的文件正在被非默认工具打开。
(2)文件保护单元220,适于当特定操作为修改文件名称、删除文件、移动文件或复制文件时,进行弹窗提示,并提供“允许”、“阻止”和“回滚”操作选项。这里的修改文件名称的操作,指的是完成文件名称修改并进行保存的操作。当进行弹窗提示时,提供的每个操作选项对应不同的处理策略:当用户选择“允许”操作选项时,不对进程进行任何处理。当用户选择“阻止”操作选项时,强制停止进程,阻止该进程在本机中再进行删除、复制和修改文件名称的操作。当用户选择“回滚”操作选项时,回滚进程的操作,将文件恢复到被该进程操作前的状态。当有进程对文件进行操作时,将该进程对文件进行的哪些操作以及何种操作都进行记录。当用户选择“回滚”操作选项时,根据记录信息,将文件恢复到被该进程操作前的状态。例如,该进程对文件进行了修改文件名称的操作,将“工作文件”改成“abcd”,一旦用户选择“回滚”操作选项,将该文件的名称从“abcd”改回原来的“工作文件”。
(3)文件保护单元220,适于当特定操作为修改文件内容时,即完成文件内容的修改并进行保存时,对文件进行备份,得到备份文件,备份文件获得后,并将备份文件保存到特定位置,以便用户可以根据保存的备份文件将被修改的需要保护的文件进行恢复,防止非用户本人利用该被修改的文件索取利益。用于保存备份文件的特定位置可以是系统默认的位置,也可以是用户指定的位置。例如,该特定的位置可以根据本地各磁盘的磁盘剩余空间的大小,选择磁盘剩余空间最大的一个磁盘,在该磁盘上新建一个文件夹;以 及将备份文件保存到新建的文件夹中,这样就可以合理地利用本机的存储空间。
需要指出的是,如果在将备份文件保存到文件夹的过程中,发现文件夹所在磁盘的剩余空间不足时,可以提示用户磁盘空间不足。当然,在提示的同时,也可以将备份文件保存到重新选择的磁盘上,或者不保存备份文件而直接拒绝对文件的修改的保存,这样也可以最大程度上保证文件不被非法修改。
需要说明的是,这里的修改文件内容的操作,指的是完成文件的内容的修改并进行保存的操作。例如,这里的判断对需要保护的文件是否被修改主要可以通过该需要保护的文件在编辑模式下打开,进行内容的修改后进行了保存的操作,或者该需要保护的文件在编辑模式下打开,进行内容的修改后并关闭时,在被提示“是否需要保存”时,接收到了“是”的指令。也就是说当需要保护的文件被修改后并触发了保存的指令,就对该文件进行备份。
本领域的技术人员应可了解,若文件仅仅是在编辑模式下打开,或者在编辑模式下打开且被修改,只要未保存该修改,就不会进行备份。更近一步,此处的备份并非备份修改后的文件,而是备份修改之前的原文件,这样才能够在后续过程中恢复被修改的文件。
为了防止备份文件也被非法修改,进一步地,文件保护单元220,适于对备份文件进行加密处理,得到加密文件;以备份文件的文件名、原始路径和原始大小的组合作为备份文件的索引,其中,备份文件的文件名为需要保护的文件的内容的MD5值或者sha-1值;将备份文件的索引和加密文件对应保存到特定位置。
对备份文件进行加密处理可以通过预先配置的加密算法进行,同时获取该备份文件的索引,以便用户可以通过索引,根据索引中的信息,找到被修改的文件,并利用备份文件将原文件恢复到原来的状态。
具体地,上述的加密算法可以是MD5(Message-Digest Algorithm 5)加密算法,将需要保护的原文件的内容进行MD5计算,然后仅以需要保护的文件的MD5值作为相应的备份文件的文件名,这样备份文件的文件名是没有后缀的。例如,将word文档进行备份后,备份文件的文件名只是一个MD5值,没有“.doc”的后缀。
具体地,上述的加密算法可以是sha(Secure Hash Algorithm,安全散列)加密算法。例如,sha-1加密算法,将原文件的内容进行sha-1加密计算,然后仅以需要保护的文件的内容的sha-1值作为相应的备份文件的文件名,同MD5加密类似,这样备份文件的文件名是没有后缀的。
又或者,使用DES加密算法或者RSA加密算法,在本实施例中,加密算法不做具体限定,本方案可提供多种加密算法工具,用户可根据自身需求进行自行选择。
下面将特定操作为修改文件内容的情况作为本公开的优选实施例进行详细说明。
通常情况下,不法分子为达到索取更多非法利益的目的,对需要保护的文件进行非法操作一般是修改需要保护的文件的内容,且是对需要保护的文件进行大面积的删除或者修改。所以,在本公开的一个优选实施例中,为了进一步确定对需要保护的文件进行的修改是违背用户本人意愿的非法修改,文件保护单元220,适于当特定操作为修改文件内容时,记录该进程对需要保护的文件进行的修改的操作,当有程序对文件进行修改时,对该文件进行备份,且将该程序对文件进行的哪些操作以及何种操作都进行记录;当该进程的文件修改操作满足如下条件中的一种或多种时,进行报警提示:
(1)当该进程所修改的文件数量超过第一预设值,且修改数据量与文件总数据量的比值达到第二预设值时,进行报警提示。只有上述两个条件均满足的情况下,才确定对需要保护的文件进行的修改是非法修改。例如,第一预设值为50%,第二预设值为80%,在一个较短的时间内,对本机中的文本文档的个数已经超过了本机存储的总文本文档个数的50%,并且对每一个文本文档进行的修改的字数已经超过该文本文档总字数的80%,那么就确定该程序的修改为非法修改,需要对本机用户进行报警提示,以便可以采取相应的措施,保护本机的文件。如果,对本机中的文本文档的个数只是本机存储的总文本文档个数的10%,并且对每一个文本文档进行的修改的字数只占该文本文档总字数的20%,那么就确定该程序的修改不是非法修改。
(2)在预定时间内修改的文件数量超过阈值。例如,预设阈值为50%,在1h的时间内,对本机中的文本文档的数量已经超过了本机存储的总文本文档数量的50%,就进行报警提示。该预设时间可自定义,在这里不做限制。
(3)对一个文件的内容的修改比例超过阈值。这里可以通过字数进行判断,例如,预设阈值为80%,对每一个文本文档进行的修改的字数已经超过该文本文档总字数的80%,就进行报警提示。
(4)所修改的相同类型文件的数量超过阈值。例如,对相同类型文件的修改的数量超过该相同文件类型的总数量的50%,就进行报警提示。
(5)对相同类型文件的修改数据量超过阈值。例如,对相同类型文件的修改的数据量(例如字数)超过该相同文件类型的总数据量(例如同种类型所有文件的总字数)的50%,就进行报警提示。
需要说明的是,判断该进程的文件修改操作是否满足条件时,可以使用上述的任意一个条件,也可以使用上述条件的任意组合。在另一实施例中,也可以通过以下方式判断对需要保护的文件进行的修改是非法修改:当需要保护的文件被修改时,判断是否以系统默认工具修改该需要保护的文件,若否,则可以判断该修改是非法修改。
具体地,文件保护单元220,适于进行弹窗提示,并提供“允许”、“阻止”和“回滚”三个操作选项。每个操作选项对应不同的处理策略:当用户选择“允许”操作选项时,不对进程进行任何处理。当用户选择“阻止”操作选项时,强制停止进程,阻止该进程在本机中再进行修改的操作。当用户选择“回滚”操作选项时,根据所记录的文件修改操作和备份文件,回滚进程的修改操作,将文件恢复到被该进程修改前的状态。因为如上文,当文件被修改时,对文件进行备份,得到备份文件,将备份文件获得后,将备份文件保存到特定位置;且已经记录了该进程的文件修改操作,当用户选择“回滚”操作时,就可以利用备份文件以及记录的该进程的文件修改操作,回滚该进程的操作,对被修改的文件进行恢复,达到保护文件的效果,防止因文件被非法操作导致的不可用的情况出现。
图3示出了根据本公开另一个实施例的一种实现文件保护的装置的结构示意图。如图3所示,该实现文件保护的装置300包括:文件确定单元310,文件保护单元320、加密判断单元330、密钥获取单元340和文件解密单元350。其中,文件确定单元310,文件保护单元320和图2所示的文件确定单 元210,文件保护单元220具有对应相同的功能,相同的部分在此不再赘述。
加密判断单元330,适于当特定操作为修改文件内容时,判断该进程是否使用指定加密算法对文件进行加密处理。
当对终端设备中存储的文件进行非法修改的时候,通常会利用相应的可执行程序exe进行,当检测到有程序在进行文件的修改时,就判断对文件进行修改操作的进程中是否使用指定的加密算法进行加密处理。这里的指定加密算法一般是现有技术中已经存在的加密算法,可以预知,在通常情况下,为了减少时间成本,对文件进行非法加密时,通常会使用现有的加密算法。例如,DES加密算法。所以,在本实施例中,会预先配置一些指定的加密算法,在判断该进程是否使用指定加密算法对文件进行加密处理的时候,可以利用加密算法的特征码进行匹配,如果可以匹配,则说明该进程确实在使用指定加密算法对文件进行加密处理。另外,也可以判断这些程序是否调用系统DLL进行加密。
密钥获取单元340,适于当加密判断单元330判断出该进程使用指定加密算法对文件进行加密处理时,利用钩子函数导出指定加密算法所使用的密钥并保存。
经过判断后,如果确定该进程是在使用指定加密算法对文件进行加密处理,就通过插入钩子函数的方式,将指定加密算法当前使用的密钥导出并保存起来。另外,当判断这些程序是调用系统DLL进行加密时,也可以通过钩取(HOOK)系统DLL的导出函数来获取密钥并保存。这里密钥的存储位置可以系统默认的,也可以是用户指定的,当存储的时候,为了便于查找和解密,可以将被加密的文件名和对应的密钥一起保存或者以被加密的文件的文件名、原始路径的组合作为密钥的索引,将该密钥的索引和加密文件对应保存到一个特定位置,以便用户可以获知哪些文件被加密,并且利用索引中的信息和密钥对加密的文件进行解密。
文件解密单元350,适于当需要时,根据指定加密算法和所保存密钥对被加密处理的文件进行解密处理。
当用户使用已经被加密的文件时,发现该文件已经被加密,那么用户就可以直接利用已经保存的密钥对加密的文件进行解密,无需通过使用该可执 行程序exe的不法分子,就可以将该文件解密。本公开可以实现在文件被非法加密后,利用导出的密钥将加密的文件进行解密,以恢复加密的文件,可以有效的保护文件,维护用户自身的利益,提高用户体验。
如上文说明,在判断该进程是否使用指定加密算法对文件进行加密处理的时候,可以利用加密算法的特征码;而且,通常进行文件修改操作的进程使用的指定加密算法是使用第三方加解密库进行加密算法的调用,或者在该进程本身代码中包含有加密算法的执行程序。那么,在本公开的一个实施例中,加密判断单元330,适于在该进程中注入预先指定的动态链接库DLL,由该DLL扫描并判断该进程所调用的第三方加解密库中和/或该进程本身的代码中是否包含指定加密算法的特征码。动态链接库DLL提供了一种方法,使进程可以调用不属于其可执行代码的函数。本实施例中,在该进程中注入动态链接库DLL,扫描并判断该进程所调用的第三方加解密库中和/或该进程本身的代码中是否包含指定加密算法的特征码。
如果该进程所调用的第三方加解密库中包含指定加密算法的特征码,和/或,该进程本身的代码中包含指定加密算法的特征码,则确定该进程使用指定加密算法对文件进行加密处理。例如,如果调用的第三方加解密库中包含DES加密算法的特征码,和/或该exe进程本身的代码中包含DES加密算法的特征码,则确定该进程使用DES加密算法对文件进行加密处理。
动态链接库DLL提供了一种方法,使进程可以调用不属于其可执行代码的函数。本实施例中,在该进程中注入动态链接库DLL,判断该进程所调用的第三方加解密库中和/或该进程本身的代码中是否包含指定加密算法的特征码。
针对上述的包含指定加密算法的特征码的位置的不同,导出指定加密算法所使用的密钥的方式也不同。详见下文说明:
(1)密钥获取单元340,适于当该进程所调用的第三方加解密库中包含指定加密算法的特征码时,利用钩子函数HOOK第三方加解密库的导出接口以拦截到指定加密算法所使用的密钥。
钩子函数可以捕捉系统中所有进程将发生的事件消息,当一个事件发生时,如果安装了一个钩子函数,进程中的钩子函数将被调用。在本实施例中,当确定该进程使用指定加密算法对文件进行加密处理的事件发生时,就会调 用预先安装的钩子函数,HOOK第三方加解密库的导出接口以拦截到指定加密算法所使用的密钥。HOOK这里可以理解为“钩住”,即利用钩子函数通过第三方加解密库的导出接口拦截指定加密算法所使用的密钥。
(2)密钥获取单元340,适于当该进程本身的代码中包含指定加密算法的特征码时,在指定加密算法的特征码所在位置处设置硬件执行断点或INT3断点,当该进程执行到所设置的断点处时触发异常,进而由处理异常的钩子函数从CPU寄存器和/或堆栈中的上下文信息中找出指定加密算法所使用的密钥。
当该进程本身的代码中包含指定加密算法的特征码,则确定该进程使用指定加密算法对文件进行加密处理,加密处理的密钥信息会在CPU寄存器和/或堆栈中的上下文信息中。因为在指定加密算法的特征码所在的位置处设置了硬件执行断点或INT3断点,当程序执行到指定加密算法的特征码所在的位置处时,就会触发硬件执行断点或INT3断点的指定,触发一个异常,调试器或CPU就会捕捉这个异常从而停在断点处,然后从断点处调用钩子函数,从CPU寄存器和/或堆栈中的上下文信息中找出指定加密算法所使用的密钥。
这样当通过钩子函数获取到指定加密算法所使用的密钥并保存,当需要对加密的文件进行解密时,就可以利用保存的密钥进行。
在本公开的一个实施例中,指定加密算法为对称加密算法。在对称加密算法中,数据发信方将明文(原始数据)和加密密钥一起经过特殊加密算法处理后,使其变成复杂的加密密文发送出去。收信方收到密文后,若想解读原文,则需要使用加密用过的密钥及相同算法的逆算法对密文进行解密,才能使其恢复成可读明文。也就是说,在对称加密算法中,使用的密钥只有一个,发收信双方都使用这个密钥对数据进行加密和解密。如果进行文件修改操作的进程使用对称加密算法对文件进行加密处理,当已经利用钩子函数获取到加密算法所使用的密钥后,就可以对文件进行解密。
本公开提供的保护文件的方案的前提是非用户本人对文件进行了非法修改操作,如果只是用户本人正常的修改就不需要执行本方案。那么,为了进一步确定对文件的修改是非法修改。在本公开的一个实施例中,加密判断单元330,适于对于进行文件修改操作的进程,在判断该进程是否使用指定加 密算法对文件进行加密处理之前,进一步判断该进程的文件修改操作是否满足如下条件中的一种或多种:在预定时间内修改的文件数量超过阈值、对一个文件的内容的修改比例超过阈值、所修改的相同类型文件的数量超过阈值、对相同类型文件的修改数据量超过阈值。如果判断为是,再执行判断该进程是否使用指定加密算法对文件进行加密处理的步骤;如果判断为否,则不执行判断该进程是否使用指定加密算法对文件进行加密处理的步骤。
也就是说,当该进程的文件修改操作满足如上文方法实施例所述的进行报警提示的条件中的一种或多种时,再执行判断该进程是否使用指定加密算法对文件进行加密处理的步骤。
需要说明的是,判断该进程的文件修改操作是否满足条件时,可以使用上文所述的进行报警提示的条件中的任意一个条件,也可以使用上文所述的进行报警提示的条件的任意组合。在另一实施例中,也可以通过以下方式判断对需要保护的文件进行的修改是非法修改:当需要保护的文件被修改时,判断是否以系统默认工具修改该需要保护的文件,若否,则可以判断该修改是非法修改。
本方案可以只针对一些特定的文件,对于用户来讲,终端设备中存储的文件并非都是重要的,有一些文件可能都已经是无用的文件,为了避免在执行本方案时系统资源的非必要消耗,可是预先指定一些需要保护的默认文件,或者用户自定义一些需要保护的文件,只有这些需要保护的文件被进行加密处理时,才执行本方案。所以,在本公开的一个实施例中,对于进行文件修改操作的进程,在判断该进程是否使用指定加密算法对文件进行加密处理之前,该方法进一步包括:判断该进程修改的文件是否包括预先被指定为需要保护的文件。如果包括,再执行判断该进程是否使用指定加密算法对文件进行加密处理的步骤;如果不包括,则不执行判断该进程是否使用指定加密算法对文件进行加密处理的步骤。
具体地,这里需要保护的文件与上文所述的需要保护的文件种类相同,在此不再赘述。
需要说明的是,图2和图3所示的装置的各实施例与图1所示方法的各实施例对应相同,上文已有详细说明,在此不再赘述。
图4示出了可以实现本公开的上述实现文件保护的方法的计算设备。该 计算设备传统上包括处理器410和以存储设备420形式的计算机程序产品或者计算机可读介质。存储设备420可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储设备420具有存储用于执行上述方法中的任何方法步骤的程序代码431的存储空间430。例如,存储程序代码的存储空间430可以包括分别用于实现上面的方法中的各种步骤的各个程序代码431。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘、紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样的计算机程序产品通常为例如图5所示的便携式或者固定存储单元。该存储单元可以具有与图4的计算设备中的存储设备420类似布置的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括用于执行根据本公开的方法步骤的计算机可读代码431',即可以由诸如410之类的处理器读取的代码,当这些代码由计算设备运行时,导致该计算设备执行上面所描述的方法中的各个步骤。
综上所述,根据本公开的技术方案,一旦监控到有进程在需要保护的文件上执行的操作属于特定的操作时,就对该进程进行相应的处理。首先确定需要保护的文件,然后实时监控需要保护的文件上执行的操作,一旦监控到有进程在需要保护的文件上执行特定操作时,就执行与该特定操作对应的处理。例如,当有进程修改需要保护的文件的时候,就可以对该文件进行备份处理。这样,在违背用户本人意愿下,对需要保护的文件进行修改的时候,就可以执行本方案,以达到对需要保护的文件进行保护的效果,防止因文件被非法操作导致的不可用的情况出现,同时也维护了用户的自身利益,有助于提升用户体验。需要说明的是:
在此提供的算法和显示不与任何特定计算机、虚拟装置或者其它设备固有相关。各种通用装置也可以与基于在此的示教一起使用。根据上面的描述,构造这类装置所要求的结构是显而易见的。此外,本公开也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本公开的内容,并且上面对特定语言所做的描述是为了披露本公开的最佳实施方式。
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本公开的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未 详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。
类似地,应当理解,为了精简本公开并帮助理解各个公开方面中的一个或多个,在上面对本公开的示例性实施例的描述中,本公开的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本公开要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,公开方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本公开的单独实施例。
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本公开的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。
本公开的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本公开实施例的实现文件保护的装置和计算设备中的一些或者全部部件的一些或者全部功能。本公开还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本公开的程序可以存储在计算机可读介质上,或者可以具有一个或 者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。
应该注意的是上述实施例对本公开进行说明而不是对本公开进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本公开可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。

Claims (36)

  1. 一种实现文件保护的方法,包括:
    确定需要保护的文件;
    监控需要保护的文件上执行的操作;
    当监控到有进程在需要保护的文件上执行特定操作时,执行与该特定操作对应的处理。
  2. 如权利要求1所述的方法,其中,所述确定需要保护的文件包括如下的一种或多种:
    将指定的一个或多个类型的文件作为默认需要保护文件;
    接收用户的指令,根据用户的指令确定需要保护的文件;
    扫描本机上存储的文件,将本机上存储的各类文件的类型信息展示给用户供其进行选择,将用户选择的类型对应的文件确定为需要保护的文件;
    将易受攻击的各类文件的类型信息展示给用户供其进行选择,将用户选择的类型对应的文件确定为需要保护的文件。
  3. 如权利要求1所述的方法,其中,所述特定操作包括如下中的一种或多种:
    修改文件内容;
    修改文件名称;
    删除文件;
    移动文件;
    复制文件;
    打开文件。
  4. 如权利要求3所述的方法,其中,当所述特定操作为打开文件时,所述执行与该特定操作对应的处理包括:
    判断是否以系统默认工具打开需要保护的文件;
    如果是,则不做处理;
    如果否,则进行报警提示。
  5. 如权利要求3所述的方法,其中,当所述特定操作为修改文件名称、删除文件、移动文件或复制文件时,所述执行与该特定操作对应的处理包括:
    进行弹窗提示,并提供“允许”、“阻止”和“回滚”操作选项;
    当用户选择“允许”操作选项时,不对所述进程进行任何处理;
    当用户选择“阻止”操作选项时,强制停止所述进程;
    当用户选择“回滚”操作选项时,回滚所述进程的操作,将文件恢复到被该进程操作前的状态。
  6. 如权利要求3所述的方法,其中,当所述特定操作为修改文件内容时,所述执行与该特定操作对应的处理包括:
    对文件进行备份,得到备份文件;
    将备份文件保存到特定位置。
  7. 如权利要求6所述的方法,其中,所述将备份文件保存到特定位置包括:
    对所述备份文件进行加密处理,得到加密文件;
    以所述备份文件的文件名、原始路径和原始大小的组合作为备份文件的索引;
    备份文件的文件名为所述需要保护的文件的内容的MD5值;
    将所述备份文件的索引和加密文件对应保存到特定位置。
  8. 如权利要求3所述的方法,其中,当所述特定操作为修改文件内容时,所述执行与该特定操作对应的处理包括:
    记录该进程对所述需要保护的文件进行的修改的操作;
    当该进程对所述需要保护的文件进行的修改操作满足如下条件中的一种或多种时,进行报警提示:
    在预定时间内修改的文件数量超过阈值;
    对一个文件的内容的修改比例超过阈值;
    所修改的相同类型文件的数量超过阈值;
    对相同类型文件的修改数据量超过阈值。
  9. 如权利要求8所述的方法,其中,
    所述进程报警提示包括:进行弹窗提示,并提供“允许”、“阻止”和“回滚”三个操作选项;
    当用户选择“允许”操作选项时,不对所述进程进行任何处理;
    当用户选择“阻止”操作选项时,强制停止所述进程;
    当用户选择“回滚”操作选项时,根据所记录的文件修改操作和备份文件,回滚所述进程的修改操作,将文件恢复到被该进程修改前的状态。
  10. 如权利要求3所述的方法,其中,当所述特定操作为修改文件内容时,所述执行与该特定操作对应的处理包括:
    判断该进程是否使用指定加密算法对文件进行加密处理;
    如果该进程使用指定加密算法对文件进行加密处理,则利用钩子函数导出所述指定加密算法所使用的密钥并保存。
  11. 如权利要求10所述的方法,其中,所述判断该进程是否使用指定加密算法对文件进行加密处理包括:
    在该进程中注入预先指定的动态链接库DLL,由该DLL扫描并判断该进程所调用的第三方加解密库中和/或该进程本身的代码中是否包含所述指定加密算法的特征码;
    如果该进程所调用的第三方加解密库中包含所述指定加密算法的特征码,或者,该进程本身的代码中包含所述指定加密算法的特征码,则确定该进程使用指定加密算法对文件进行加密处理。
  12. 如权利要求11所述的方法,其中,
    如果该进程所调用的第三方加解密库中包含所述指定加密算法的特征码,则所述利用钩子函数导出所述指定加密算法所使用的密钥包括:利用钩子函数HOOK所述第三方加解密库的导出接口以拦截到所述指定加密算法所使用的密钥;
    如果该进程本身的代码中包含所述指定加密算法的特征码,则所述用钩子函数导出所述指定加密算法所使用的密钥包括:在所述指定加密算法的特征码所在位置处设置硬件执行断点或INT3断点,当该进程执行到所设置的断点处时触发异常,进而由处理异常的钩子函数从CPU寄存器和/或堆栈中的上下文信息中找出所述指定加密算法所使用的密钥。
  13. 如权利要求10-12中任一项所述的方法,其中,该方法进一步包括:
    当需要时,根据所述指定加密算法和所保存密钥对被加密处理的文件进行解密处理。
  14. 如权利要求6所述的方法,其中,所述对文件进行备份包括:
    在修改的结果被保存时,对该文件进行备份。
  15. 如权利要求6所述的方法,其中,
    该方法进一步包括:根据本地各磁盘的磁盘剩余空间的大小,选择磁盘剩余空间最大的一个磁盘,在该磁盘上新建一个文件夹;
    所述将备份文件保存到特定位置包括:将备份文件保存到所述新建的文件夹中。
  16. 如权利要求10所述的方法,其中,所述指定加密算法为对称加密算法。
  17. 如权利要求10-12及16中任一项所述的方法,其中,对于进行文件修改操作的进程,在判断该进程是否使用指定加密算法对文件进行加密处理之前,该方法进一步包括:
    判断该进程修改的文件是否包括预先被指定为需要保护的文件;
    如果包括,再执行所述判断该进程是否使用指定加密算法对文件进行加密处理的步骤。
  18. 一种实现文件保护的装置,包括:
    文件确定单元,适于确定需要保护的文件;
    文件保护单元,适于监控需要保护的文件上执行的操作,当监控到有进程在需要保护的文件上执行特定操作时,执行与该特定操作对应的处理。
  19. 如权利要求18所述的装置,其中,所述文件确定单元,适于根据如下中的一种或多种方式确定需要保护的文件:
    将指定的一个或多个类型的文件作为默认需要保护文件;
    接收用户的指令,根据用户的指令确定需要保护的文件;
    扫描本机上存储的文件,将本机上存储的各类文件的类型信息展示给用户供其进行选择,将用户选择的类型对应的文件确定为需要保护的文件;
    将易受攻击的各类文件的类型信息展示给用户供其进行选择,将用户选择的类型对应的文件确定为需要保护的文件。
  20. 如权利要求18所述的装置,其中,所述特定操作包括如下中的一种或多种:
    修改文件内容;
    修改文件名称;
    删除文件;
    移动文件;
    复制文件;
    打开文件。
  21. 如权利要求20所述的装置,其中,
    所述文件保护单元,适于当所述特定操作为打开文件时,判断是否以系统默认工具打开需要保护的文件;如果是,则不做处理;如果否,则进行报警提示。
  22. 如权利要求20所述的装置,其中,
    所述文件保护单元,适于当所述特定操作为修改文件名称、删除文件、移动文件或复制文件时,进行弹窗提示,并提供“允许”、“阻止”和“回滚”操作选项;当用户选择“允许”操作选项时,不对所述进程进行任何处理;当用户选择“阻止”操作选项时,强制停止所述进程;当用户选择“回滚”操作选项时,回滚所述进程的操作,将文件恢复到被该进程操作前的状态。
  23. 如权利要求20所述的装置,其中,
    所述文件保护单元,适于当所述特定操作为修改文件内容时,对文件进行备份,得到备份文件,并将备份文件保存到特定位置。
  24. 如权利要求23所述的装置,其中,
    所述文件保护单元,适于对所述备份文件进行加密处理,得到加密文件;以所述备份文件的文件名、原始路径和原始大小的组合作为备份文件的索引,其中,备份文件的文件名为所述需要保护的文件的内容的MD5值;将所述备份文件的索引和加密文件对应保存到特定位置。
  25. 如权利要求20所述的装置,其中,
    所述文件保护单元,适于当所述特定操作为修改文件内容时,记录该进程对所述需要保护的文件进行的修改的操作;当该进程对所述需要保护的文件进行的修改操作满足如下条件中的一种或多种时,进行报警提示:
    在预定时间内修改的文件数量超过阈值;
    对一个文件的内容的修改比例超过阈值;
    所修改的相同类型文件的数量超过阈值;
    对相同类型文件的修改数据量超过阈值。
  26. 如权利要求25所述的装置,其中,
    所述文件保护单元,适于进行弹窗提示,并提供“允许”、“阻止”和“回滚”三个操作选项;当用户选择“允许”操作选项时,不对所述进程进行任何处理;当用户选择“阻止”操作选项时,强制停止所述进程;当用户选择“回滚”操作选项时,根据所记录的文件修改操作和备份文件,回滚所述进程的修改操作,将文件恢复到被该进程修改前的状态。
  27. 如权利要求20所述的装置,其中,该装置进一步包括:
    加密判断单元,适于当所述特定操作为修改文件内容时,判断该进程是否使用指定加密算法对文件进行加密处理;
    密钥获取单元,适于当加密判断单元判断出该进程使用指定加密算法对文件进行加密处理时,利用钩子函数导出所述指定加密算法所使用的密钥并保存。
  28. 如权利要求27所述的装置,其中,
    所述加密判断单元,适于在该进程中注入预先指定的动态链接库DLL,由该DLL扫描并判断该进程所调用的第三方加解密库中和/或该进程本身的代码中是否包含所述指定加密算法的特征码;如果该进程所调用的第三方加解密库中包含所述指定加密算法的特征码,或者,该进程本身的代码中包含所述指定加密算法的特征码,则确定该进程使用指定加密算法对文件进行加密处理。
  29. 如权利要求28所述的装置,其中,
    所述密钥获取单元,适于当该进程所调用的第三方加解密库中包含所述指定加密算法的特征码时,利用钩子函数HOOK所述第三方加解密库的导出接口以拦截到所述指定加密算法所使用的密钥;以及适于当该进程本身的代码中包含所述指定加密算法的特征码时,在所述指定加密算法的特征码所在位置处设置硬件执行断点或INT3断点,当该进程执行到所设置的断点处时触发异常,进而由处理异常的钩子函数从CPU寄存器和/或堆栈中的上下文信息中找出所述指定加密算法所使用的密钥。
  30. 如权利要求27-29中任一项所述的装置,其中,该装置进一步包括:
    文件解密单元,适于当需要时,根据所述指定加密算法和所保存密钥对被加密处理的文件进行解密处理。
  31. 如权利要求23所述的装置,其中,
    所述文件保护单元,适于在修改的结果被保存时,对该文件进行备份。
  32. 如权利要求23所述的装置,其中,
    所述文件保护单元,进一步适于根据本地各磁盘的磁盘剩余空间的大小,选择磁盘剩余空间最大的一个磁盘,在该磁盘上新建一个文件夹;以及将备份文件保存到所述新建的文件夹中。
  33. 如权利要求27所述的装置,其中,所述指定加密算法为对称加密算法。
  34. 如权利要求27-29及33中任一项所述的装置,其中,所述加密判断单元,适于对于进行文件修改操作的进程,在判断该进程是否使用指定加密算法对文件进行加密处理之前,进一步判断该进程修改的文件是否包括预先被指定为需要保护的文件;如果包括,再执行所述判断该进程是否使用指定加密算法对文件进行加密处理的步骤。
  35. 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行根据权利要求1-17中的任一项所述的实现文件保护的方法。
  36. 一种计算机可读介质,其中存储了如权利要求35所述的计算机程序。
PCT/CN2017/119503 2017-03-24 2017-12-28 实现文件保护的方法、装置和计算设备 WO2018171283A1 (zh)

Applications Claiming Priority (6)

Application Number Priority Date Filing Date Title
CN201710184528.2A CN106789051B (zh) 2017-03-24 2017-03-24 一种保护文件的方法、装置和计算设备
CN201710184527.8 2017-03-24
CN201710186412.2 2017-03-24
CN201710184528.2 2017-03-24
CN201710184527.8A CN106971120B (zh) 2017-03-24 2017-03-24 一种实现文件保护的方法、装置和计算设备
CN201710186412.2A CN106980797A (zh) 2017-03-24 2017-03-24 一种实现文件保护的方法、装置和计算设备

Publications (1)

Publication Number Publication Date
WO2018171283A1 true WO2018171283A1 (zh) 2018-09-27

Family

ID=63586189

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/119503 WO2018171283A1 (zh) 2017-03-24 2017-12-28 实现文件保护的方法、装置和计算设备

Country Status (1)

Country Link
WO (1) WO2018171283A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101414330A (zh) * 2007-10-15 2009-04-22 北京瑞星国际软件有限公司 一种查毒方法和装置
CN101901313A (zh) * 2010-06-10 2010-12-01 中科方德软件有限公司 一种Linux文件保护系统及方法
CN106789051A (zh) * 2017-03-24 2017-05-31 北京奇虎科技有限公司 一种保护文件的方法、装置和计算设备
CN106971120A (zh) * 2017-03-24 2017-07-21 北京奇虎科技有限公司 一种实现文件保护的方法、装置和计算设备
CN106980797A (zh) * 2017-03-24 2017-07-25 北京奇虎科技有限公司 一种实现文件保护的方法、装置和计算设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101414330A (zh) * 2007-10-15 2009-04-22 北京瑞星国际软件有限公司 一种查毒方法和装置
CN101901313A (zh) * 2010-06-10 2010-12-01 中科方德软件有限公司 一种Linux文件保护系统及方法
CN106789051A (zh) * 2017-03-24 2017-05-31 北京奇虎科技有限公司 一种保护文件的方法、装置和计算设备
CN106971120A (zh) * 2017-03-24 2017-07-21 北京奇虎科技有限公司 一种实现文件保护的方法、装置和计算设备
CN106980797A (zh) * 2017-03-24 2017-07-25 北京奇虎科技有限公司 一种实现文件保护的方法、装置和计算设备

Similar Documents

Publication Publication Date Title
US10846425B2 (en) Data protection based on user input during device boot-up, user login, and device shut-down states
US9734352B2 (en) Data protection based on user and gesture recognition
CN106971120B (zh) 一种实现文件保护的方法、装置和计算设备
US9697375B2 (en) Fast data protection using dual file systems
WO2016173264A1 (zh) 电子数据保护方法、装置及终端设备
CN107563192B (zh) 一种勒索软件的防护方法、装置、电子设备及存储介质
CN103488954B (zh) 一种文件加密系统
WO2014194828A1 (zh) 一种文件加/解密方法以及文件加/解密装置
US20090222500A1 (en) Information storage device and method capable of hiding confidential files
US10783041B2 (en) Backup and recovery of data files using hard links
CN106980797A (zh) 一种实现文件保护的方法、装置和计算设备
WO2017107896A1 (zh) 一种文档防护方法及装置
US20150319147A1 (en) System and method for file encrypting and decrypting
CN105303074A (zh) 一种保护Web应用程序安全的方法
EP3080945B1 (en) Obfuscating in memory encryption keys
CN104091119A (zh) 一种移动终端及其数据的保护方法、保护系统
WO2015176531A1 (zh) 终端数据写入、读取的方法及装置
CN109657490B (zh) 一种办公文件透明加解密方法及系统
CN106789051B (zh) 一种保护文件的方法、装置和计算设备
WO2018171283A1 (zh) 实现文件保护的方法、装置和计算设备
JP2019095882A (ja) プログラム及び情報処理装置
JP6885095B2 (ja) 復号分類方法、復号分類装置および復号分類プログラム
Cheng Mobile malware: Threats and prevention
CN102938044B (zh) 一种对文件进行管控的方法及装置
CN103530532A (zh) 一种文件加密方法和系统

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: 17901551

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: 17901551

Country of ref document: EP

Kind code of ref document: A1