Resource file acquisition method, device, equipment, medium and product

Through collaborative design on the first server and the second server, the file identification comparison and secondary verification mechanism are used to solve the problem of tampering with static resource files, ensuring the integrity and security of resource files.

CN115242775BActive Publication Date: 2024-11-01CHINA UNIONPAY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210780028.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-04
Publication Date
2024-11-01
Estimated Expiration
2042-07-04

AI Technical Summary

Technical Problem

It is difficult for the existing technology to effectively protect static resource files from malicious tampering. After the traditional page dynamic precompilation technology is replaced by the front-end and back-end separation design, how to ensure that the resource files sent to the terminal device are not tampered with has become a new technical challenge.

Method used

By receiving the resource file access request of the terminal device on the first server, obtaining the resource file in the storage path, and comparing it with the file identifier stored in the memory, ensuring that the file identifier is consistent, the resource file is sent, and the second server is introduced Perform secondary verification to ensure the integrity of the file.

Benefits of technology

It realizes the timely detection of tampering before resource files is transferred, ensuring that the resource files sent to the terminal device have not been maliciously tampered with, improving the protection ability and reducing the probability of misjudgment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115242775B_ABST
    Figure CN115242775B_ABST
Patent Text Reader

Abstract

The present application discloses a resource file acquisition method, device, equipment, medium and product. The resource file acquisition method includes receiving a resource file access request sent by a terminal device, wherein the resource file access request includes a first storage path; in response to the resource file access request, obtaining a first resource file stored locally from the first storage path; determining a first file identifier corresponding to the first resource file based on the first resource file; and sending the first resource file to the terminal device when the first file identifier is the same as a target file identifier, wherein the target file identifier is a file identifier corresponding to the first resource file stored in a memory. According to the embodiment of the present application, it can be effectively ensured that the resource file sent to the terminal device is not a resource file that has been maliciously tampered with.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to a resource file acquisition method, device, equipment, medium and product. Background Art

[0002] With the rapid development of Internet technology, WEB technology has been continuously updated and iterated, which has brought a lot of convenience to users while also increasing user needs. As users' requirements for website experience continue to increase, the traditional technology of dynamic pre-compilation of pages has gradually been replaced by the design of front-end and back-end separation, which has improved the system's concurrency capabilities and reduced user request time, but also brought about a new issue of how to effectively protect static resource files from malicious tampering.

[0003] In the existing technology, user or file read and write permission control or timed cycle scanning technology is often used to prevent or identify file tampering. However, due to the relatively simple means and low prevention and control capabilities, it is difficult to meet the protection requirements of large websites, and it is impossible to ensure that the resource files sent to the terminal device are not maliciously tampered resource files. Summary of the invention

[0004] The embodiments of the present application provide a resource file acquisition method, apparatus, device, medium and product, which can effectively ensure that the resource file sent to the terminal device is not a resource file that has been maliciously tampered with.

[0005] In a first aspect, an embodiment of the present application provides a resource file acquisition method, which is applied to a first server, and the method includes:

[0006] Receiving a resource file access request sent by a terminal device, wherein the resource file access request includes a first storage path;

[0007] In response to the resource file access request, obtaining a first resource file stored locally from the first storage path;

[0008] Determine, according to the first resource file, a first file identifier corresponding to the first resource file;

[0009] In the case where the first file identifier is the same as the target file identifier, the first resource file is sent to the terminal device, and the target file identifier is a file identifier corresponding to the first resource file and stored in the memory.

[0010] In a second aspect, an embodiment of the present application provides a resource file acquisition method, which is applied to a second server, and the method includes:

[0011] Receiving a verification request sent by a first server, wherein the verification request includes a first file identifier corresponding to a first resource file, and the first resource file is a resource file stored in the first server;

[0012] In response to the verification request, obtaining a second resource file stored locally;

[0013] Determine, according to the second resource file, a second file identifier corresponding to the second resource file;

[0014] Verifying whether the first file identifier is the same as the second file identifier, and obtaining a first verification result;

[0015] The first verification result is sent to the first server, so that the first server sends the first resource file to the terminal device when the first verification result is that the first file identifier is the same as the second file identifier.

[0016] In a third aspect, an embodiment of the present application provides a resource file acquisition device, which is applied to a first server, and the device includes:

[0017] A request receiving module, used to receive a resource file access request sent by a terminal device, wherein the resource file access request includes a first storage path;

[0018] A first acquisition module, configured to acquire a first resource file stored locally from the first storage path in response to the resource file access request;

[0019] A first determining module, configured to determine a first file identifier corresponding to the first resource file according to the first resource file;

[0020] The file sending module is used to send the first resource file to the terminal device when the first file identifier is the same as the target file identifier, and the target file identifier is a file identifier corresponding to the first resource file stored in the memory.

[0021] In a fourth aspect, an embodiment of the present application provides a resource file acquisition device, which is applied to a second server, and the device includes:

[0022] A request receiving module, configured to receive a verification request sent by a first server, wherein the verification request includes a first file identifier corresponding to a first resource file, and the first resource file is a resource file stored in the first server;

[0023] A second acquisition module, configured to acquire a second resource file stored locally in response to the verification request;

[0024] A second determining module, configured to determine a second file identifier corresponding to the second resource file according to the second resource file;

[0025] A resource verification module, used to verify whether the first file identifier is the same as the second file identifier, and obtain a first verification result;

[0026] The result sending module is used to send the first verification result to the first server, so that the first server sends the first resource file to the terminal device when the first verification result is that the first file identifier is the same as the second file identifier.

[0027] In a fifth aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: a processor and a memory storing computer program instructions;

[0028] When the processor executes the computer program instructions, the steps of the resource file acquisition method described in any one of the embodiments of the first aspect or the second aspect are implemented.

[0029] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the steps of the resource file acquisition method described in any one of the embodiments of the first aspect or the second aspect are implemented.

[0030] In the seventh aspect, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the steps of the resource file acquisition method as described in any embodiment of the first aspect or the second aspect.

[0031] The resource file acquisition method, device, equipment, medium and product in the embodiment of the present application, by setting a first server to process the resource file access request sent by the terminal device, and obtaining the first resource file stored in the first storage path corresponding to the request, the first file identifier corresponding to the first resource file is compared with the file identifier stored in the memory, and if the two are the same, it indicates that the first resource file has not been tampered with, and then the first resource file is sent to the terminal device. In this way, before the terminal device obtains the resource file, it can be timely discovered whether the resource file has been tampered with, thereby effectively ensuring that the resource file sent to the terminal device is not a resource file that has been maliciously tampered with. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0033] Figure 1 This is an architecture diagram applicable to the resource file acquisition method provided by this application;

[0034] Figure 2 It is a flowchart of a method for obtaining resource files provided by an embodiment of the present application;

[0035] Figure 3 is a flowchart of a resource file acquisition method provided by another embodiment of the present application;

[0036] Figure 4 It is a structural diagram of a resource file acquisition device provided by an embodiment of the present application;

[0037] Figure 5 is a structural diagram of a resource file acquisition device provided by another embodiment of the present application;

[0038] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0039] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

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

[0041] As traditional page dynamic precompilation technology in WEB technology is gradually replaced by the front-end and back-end separation design, how to effectively protect static resource files from malicious tampering has become one of the technical problems that need to be solved urgently.

[0042] In related technologies, in order to ensure that the resource files sent to the terminal device are original resource files that have not been maliciously tampered with, resource tamper-proof processing is mainly performed in the following two ways:

[0043] One way is to limit the user's write permission. That is, to limit the terminal device user to only have the read permission of the static resource folder. However, this method has very limited protection against malicious users' tampering operations. Therefore, it cannot guarantee that the resource files sent to the terminal device are original resource files that have not been maliciously tampered with.

[0044] Another method is to use the timed loop scanning technology. That is, the server periodically loops and scans all static resource files on the website to check whether they have been maliciously tampered with by users. However, most websites now have more than thousands of files. Loop scanning not only takes a long time, but also greatly affects server performance. In addition, during the scanning interval, the files are always tampered with, and there is a "blind spot". Therefore, this method cannot guarantee that the resource files sent to the terminal device are original resource files that have not been maliciously tampered with.

[0045] In order to solve the problems of the prior art, the embodiments of the present application provide a resource file acquisition method, device, equipment, medium and product. Among them, the resource file acquisition method provided by the present application can be applied to the scenario of acquiring resource files when a terminal device accesses a website.

[0046] In addition, the resource file acquisition method provided by this application can be applied to Figure 1 In the architecture shown, the specific Figure 1 Provide detailed explanation.

[0047] Figure 1 This is an architecture diagram applicable to the resource file acquisition method provided in this application.

[0048] like Figure 1 As shown, the architecture diagram may include at least one terminal device 11, a first server 12, and a second server 13. The terminal device 11 can directly connect to and exchange information with the first server 12 via the Internet, and the first server 12 and the second server 13 can communicate using a two-way authenticated SSL (Secure Sockets Layer) protocol.

[0049] Here, the first server 12 can be deployed on a machine on the Internet side, which is responsible for processing user requests for resource files on the one hand, and on the other hand, it also assumes the responsibility of preventing users from maliciously tampering with resource files. The second server 13 can be deployed on a machine on the management side, which stores the correct resource files. The second server 13 is not open to the Internet, so that the resource files stored thereon can be effectively prevented from being maliciously tampered with. Even if the resource files stored in the first server 12 are maliciously tampered with, the original version of the resource files will not be lost, so the tampered resource files in the first server 12 can be restored to the correct version at any time.

[0050] Based on the above architecture, the resource file acquisition method provided in the embodiment of the present application is first introduced below.

[0051] Figure 2 is a flow chart of a resource file acquisition method provided by an embodiment of the present application. The resource file acquisition method can be Figure 1 The first server 12 executes.

[0052] like Figure 2 As shown, the resource file acquisition method may specifically include the following steps:

[0053] S210, receiving a resource file access request sent by a terminal device, where the resource file access request includes a first storage path;

[0054] S220, in response to the resource file access request, obtaining a first resource file stored locally from a first storage path;

[0055] S230: Determine, according to the first resource file, a first file identifier corresponding to the first resource file;

[0056] S240: When the first file identifier is the same as the target file identifier, send the first resource file to the terminal device, where the target file identifier is a file identifier corresponding to the first resource file and stored in the memory.

[0057] Therefore, by setting the first server to process the resource file access request sent by the terminal device, and obtaining the first resource file stored in the first storage path corresponding to the request, the first file identifier corresponding to the first resource file is compared with the file identifier stored in the memory. If the two are the same, it means that the first resource file has not been tampered with, and then the first resource file is sent to the terminal device. In this way, before the terminal device obtains the resource file, it can be timely discovered whether the resource file has been tampered with, thereby effectively ensuring that the resource file sent to the terminal device is not a resource file that has been maliciously tampered with.

[0058] The specific implementation methods of the above steps are introduced below.

[0059] In some implementations, in S210 and S220, the resource file access request may be a request for obtaining a resource file stored in the first storage path in the first server, triggered when the user accesses the target web page on the terminal device. The resource files involved in the embodiments of the present application may include resource files corresponding to information such as pictures and texts in the web page.

[0060] The first resource file may be a resource file stored in the first storage path in the current first server. The resource file may be a correct file that has not been maliciously tampered with, or may be a file that has been maliciously tampered with.

[0061] Exemplarily, when a user opens a target web page on a terminal device, an http request for accessing a static resource file, i.e., a resource file access request, may be sent to a first server corresponding to the target web page to obtain the resource file in the target web page. After receiving the resource file access request, the first server may first obtain the first resource file stored locally under the path according to the resource file path carried in the request, i.e., the first storage path.

[0062] In some implementations, in S230, the file identifier may be an identifier that is calculated based on the resource file data and can uniquely represent the resource file. For example, the file identifier may be a hash value of the resource file calculated based on a hash algorithm, and different hash values ​​may be calculated based on data corresponding to different resource files.

[0063] Exemplarily, a hash value may be calculated for the first resource file based on a hash algorithm, so as to obtain a hash value corresponding to the first resource file itself, that is, a first file identifier.

[0064] In some implementations, in S240, the target file identifier may be a file identifier pre-stored in the memory of the first server and corresponding to the resource file to be stored in the first storage path.

[0065] Exemplarily, after calculating the first file identifier, the first file identifier can be compared with the file identifier recorded in the memory of the first server: if the hash value of the current first resource file, that is, the first file identifier, is the same as the hash value of the corresponding record in the memory, it can be determined that the resource file stored under the first storage path has not been maliciously tampered with, that is, the first resource file is the correct resource file, so that the resource file can be exported normally; if the hash value of the current first resource file is different from the hash value of the corresponding record in the memory, it can be determined that the resource file stored under the first storage path has been maliciously tampered with into the first resource file, and the first resource file is an erroneous file after malicious tampering, so the output of the first resource file can be prevented to ensure that the resource file sent to the terminal device is not a resource file that has been maliciously tampered with.

[0066] In addition, in some implementations, the resource file acquisition method provided in the embodiments of the present application may further include:

[0067] In the case where the first file identifier is not the same as the target file identifier, a verification request is sent to the second server, the verification request is used to instruct the second server to verify whether the first file identifier is the same as the second file identifier, and obtain a first verification result, where the second file identifier is a file identifier corresponding to the second resource file stored in the second server;

[0068] Receiving a first verification result returned by the second server;

[0069] When the first verification result is that the first file identifier is the same as the second file identifier, the first resource file is sent to the terminal device.

[0070] Here, the second resource file may be a resource file stored locally in the second server, and the second file identifier may be an identifier that is calculated based on the data of the second resource file and can uniquely represent the second resource file. For example, a hash value may be calculated for the second resource file based on a hash algorithm to obtain a hash value corresponding to the second resource file itself, i.e., the second file identifier. The second server may store the second file identifier, or may temporarily calculate the second file identifier based on the second resource file after receiving the verification request, which is not limited here.

[0071] Exemplarily, if the first file identifier of the current first resource file is different from the target file identifier of the corresponding record in the memory, further judgment can be performed to avoid misjudgment caused by the update of the resource file while the file identifier recorded in the memory is not updated in time. Specifically, the second server can perform a second verification on the file identifier. That is, the first server sends a verification request to the second server to instruct the second server to compare the first file identifier and the file identifier of the local resource file (i.e., the second file identifier of the second resource file) to verify whether the two are the same, and obtain a first verification result. If the first verification result is the same, it means that the first resource file is the same as the second resource file, so it can be considered that it is a misjudgment caused by legal modification, so the first resource file can be normally exported to the outside; otherwise, it means that the first resource file and the second resource file are not the same file, so it can be determined that the first resource file is a tampered file, thereby preventing the output of the first resource file.

[0072] In this way, by performing secondary verification by the second server, the accuracy of determining whether the resource file has been maliciously tampered with can be improved, thereby reducing the probability of misjudgment and ensuring that the correct resource file can be sent to the terminal device.

[0073] In some implementations, the resource file acquisition method provided in the embodiments of the present application may further include:

[0074] When the verification result shows that the first file identifier is different from the second file identifier, sending a resource file update request for the first resource file to the second server;

[0075] Receiving a second resource file returned by the second server based on the resource file update request;

[0076] The second resource file is sent to the terminal device.

[0077] Here, when the verification result returned by the second server indicates that the first file identifier is different from the second file identifier, it can also trigger an update of the first resource file stored in the first server, and return the correct resource file, that is, the second resource file, to the terminal device to ensure that the resource file sent to the terminal device is not a resource file that has been maliciously tampered with.

[0078] In some specific examples, if the second server compares the hash value of the local file with the hash value of the file on the first server and finds that they are inconsistent, the first server can determine that the file has been tampered with based on the verification result returned by the second server, thereby triggering the file recovery step. That is, a request to update the first resource file is sent to the second server, and after receiving the request, the second server sends the local second resource file to the first server, and the first server sends the correct resource file to the terminal device.

[0079] Based on this, in some implementations, after the above step of receiving the second resource file returned by the second server based on the resource file update request, the resource file acquisition method provided in the embodiment of the present application may further include:

[0080] Replace the target file identifier with the second file identifier corresponding to the second resource file;

[0081] The first resource file stored locally is replaced with the second resource file.

[0082] Exemplarily, after the first server receives the second resource file sent by the second server, in addition to feeding back the second resource file to the terminal device, it also updates the file identifier of the file in the local memory, that is, replaces the target file identifier with the second file identifier, and uses the second resource file to replace the locally stored first resource file, thereby effectively preventing users from accessing resource files that have been maliciously tampered with.

[0083] In addition, in order to update the resource files stored in the first server in a timely manner after the second server normally updates the resource files, in some implementations, the resource file acquisition method provided in the embodiment of the present application may further include:

[0084] Receiving a third resource file sent by the second server, where the third resource file is an update file corresponding to the first resource file;

[0085] Replace the target file identifier with the third file identifier corresponding to the third resource file;

[0086] The first resource file stored locally is replaced with the third resource file.

[0087] Here, the third resource file may be a resource file updated by a background administrator on the second server.

[0088] Exemplarily, when the second resource file stored in the second server is updated to a third resource file, the second server can push the updated third resource file to the first server to replace the first resource file stored locally in the first server. In addition, the target file identifier recorded in the memory of the first server can be replaced with the third file identifier corresponding to the updated third resource file. The calculation method of the third file identifier is similar to that of the first file identifier and the second file identifier, and no further examples are given here.

[0089] In this way, by introducing the design of the first server and the second server, the second server is responsible for pushing the resource files maintained by the backend administrator to the first server. This can not only effectively solve the problem of how the backend administrator can update the files conveniently, but also ensure that other users' tampering with the resource files stored locally on the first server will not cause the loss of the original version of the resource files, thereby ensuring that the resource files sent to the terminal device are not maliciously tampered resource files.

[0090] In addition, in order to improve the security of the resource file update process, the step of receiving the third resource file sent by the second server may specifically include:

[0091] Performing identity authentication on the second server to obtain a second authentication result;

[0092] When the second verification result is successful, a third resource file sent by the second server is received.

[0093] Here, during the resource file update process, in order to effectively avoid other illegal devices or servers from pushing resource files to the first server, the first server will verify the identity of the second server to ensure that only specific target applications or services can successfully push the resource files for update to the device where the first server is located. Based on this, if the identity authentication is successful, the resource files pushed by the second server can be received and the corresponding local resource files can be updated.

[0094] In this way, by authenticating the second server, the security of the resource file update process can be effectively improved.

[0095] In addition, in order to further improve the efficiency of the first server in identifying resource files that have been maliciously tampered with, in some implementations, the resource file acquisition method provided in the embodiment of the present application may further include:

[0096] Monitor resource file storage directory;

[0097] When it is determined that the resource file in the resource file storage directory has been tampered with, obtaining a resource file identifier corresponding to the locally stored resource file and a memory file identifier stored in the memory;

[0098] Compare the resource file identifier with the memory file identifier to obtain a comparison result;

[0099] If the comparison result is different, a resource file update request is sent to the second server;

[0100] Receiving a resource file returned by the second server based on the resource file update request;

[0101] Replace the memory file identifier with the file identifier corresponding to the resource file returned by the second server;

[0102] Replace the locally stored resource file with the resource file returned by the second server.

[0103] Here, the resource file storage directory may be a directory in the first server for storing local resource files.

[0104] Exemplarily, in the daily monitoring phase, the monitoring program in the first server will monitor the directory corresponding to the static resource files on the local host, that is, the resource file storage directory. If a file tampering event occurs in the directory, the monitoring program will receive a system notification event. The first server can then compare the file identifier of the local resource file (that is, the resource file identifier) ​​with the file identifier recorded in the memory (that is, the memory file identifier) ​​to see if they are the same. If they are the same, it is considered to be a legal modification; otherwise, it is considered to be an illegal tampering, and a resource file update request can be sent directly to the second server to update the local resource file and the memory file identifier.

[0105] Of course, when the resource file identifier is different from the memory file identifier, a verification request can also be sent to the second server to further compare the resource file identifier and the file identifier of the resource file in the second server to see if they are the same. If they are the same, it is considered to be a legal modification; otherwise, it is considered to be an illegal tampering, and a request is made to the second server to obtain the correct resource file for recovery, and a security alert is issued.

[0106] In this way, by monitoring the directory where the resource file is located, the first server can effectively perceive the tampering of the resource file by a malicious user, thereby restoring the resource file and issuing a security alarm in a timely manner.

[0107] Figure 3 is a flow chart of a resource file acquisition method provided by an embodiment of the present application. The resource file acquisition method can be Figure 1 The second server 13 executes.

[0108] like Figure 3 As shown, the resource file acquisition method may specifically include the following steps:

[0109] S310: Receive a verification request sent by the first server, where the verification request includes a first file identifier corresponding to a first resource file, where the first resource file is a resource file stored in the first server;

[0110] S320: In response to the verification request, obtain a second resource file stored locally;

[0111] S330, determining a second file identifier corresponding to the second resource file according to the second resource file;

[0112] S340, verifying whether the first file identifier is the same as the second file identifier, and obtaining a first verification result;

[0113] S350: Send the first verification result to the first server, so that the first server sends the first resource file to the terminal device when the first verification result is that the first file identifier is the same as the second file identifier.

[0114] Here, the verification request may be a request sent by the first server to the second server to further verify whether the first resource file has been tampered with when the first server determines that the first file identifier is different from the target file identifier recorded in the memory.

[0115] In response to the verification request, the second server can compare the first file identifier carried by it with the second file identifier corresponding to the second resource file stored locally to verify whether the two are the same, and send the obtained first verification result to the first server so that the first server can perform corresponding operations according to the first verification result. For details, please refer to the above-mentioned relevant parts, which will not be repeated here.

[0116] Therefore, by introducing the design of the first server and the second server, the second server is responsible for performing secondary verification on whether the resource file has been tampered with, thereby ensuring that if other users tamper with the resource files stored locally on the first server, the original version of the resource file will not be lost, thereby ensuring that the resource files sent to the terminal device are not maliciously tampered with resource files.

[0117] Based on this, the resource file acquisition method provided in the embodiment of the present application may also include:

[0118] Receiving a resource file update request sent by the first server;

[0119] In response to the resource file update request, the requested resource file is sent to the first server.

[0120] Here, the resource file update request may be a request sent by the first server to obtain a corresponding resource file from the second server. The obtained resource file may be, for example, a second resource file, etc., which is used to update a resource file that has been illegally tampered with in the first server.

[0121] In addition, the resource file acquisition method provided in the embodiment of the present application may also include:

[0122] When the second resource file is updated to the third resource file, the third resource file is sent to the first server so that the first server replaces the stored first resource file with the third resource file, and replaces the target file identifier with the third file identifier corresponding to the third resource file. The target file identifier is the file identifier corresponding to the first resource file stored in the memory of the first server.

[0123] Here, the third resource file can be a resource file after the backend administrator updates and replaces the second resource file. That is, after the resource file stored locally in the second server is updated, the updated resource file can be sent to the first server in a timely manner so that the first server can update its locally stored resource file and file identifier in a timely manner.

[0124] It should be noted that the application scenarios described in the above-mentioned embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0125] Based on the same inventive concept, the present application also provides a resource file acquisition device. Figure 4 and Figure 5 Provide detailed explanation.

[0126] Figure 4 is a schematic diagram of the structure of a resource file acquisition device provided by an embodiment of the present application. The resource file acquisition device 400 can be integrated into Figure 1 In the first server 12.

[0127] like Figure 4 As shown, the resource file acquisition device 400 may include:

[0128] The request receiving module 401 is used to receive a resource file access request sent by a terminal device, wherein the resource file access request includes a first storage path;

[0129] A first acquisition module 402, configured to acquire a first resource file stored locally from the first storage path in response to the resource file access request;

[0130] A first determining module 403, configured to determine a first file identifier corresponding to the first resource file according to the first resource file;

[0131] The file sending module 404 is used to send the first resource file to the terminal device when the first file identifier is the same as the target file identifier, and the target file identifier is a file identifier corresponding to the first resource file stored in the memory.

[0132] The resource file acquisition device 400 is described in detail below, as shown below:

[0133] In some embodiments, the resource file obtaining device 400 further includes:

[0134] A first request module, configured to send a verification request to a second server when the first file identifier is different from the target file identifier, wherein the verification request is configured to instruct the second server to verify whether the first file identifier is the same as the second file identifier, and obtain a first verification result, wherein the second file identifier is a file identifier corresponding to a second resource file stored in the second server;

[0135] A first receiving module, used to receive the first verification result returned by the second server;

[0136] A first sending module is configured to send the first resource file to the terminal device when the first verification result is that the first file identifier is the same as the second file identifier.

[0137] In some embodiments, the resource file obtaining device 400 further includes:

[0138] A second request module, configured to send a resource file update request for the first resource file to the second server when the verification result is that the first file identifier is different from the second file identifier;

[0139] A second receiving module, configured to receive the second resource file returned by the second server based on the resource file update request;

[0140] The second sending module is used to send the second resource file to the terminal device.

[0141] In some embodiments, the resource file obtaining device 400 further includes:

[0142] A first replacement module, configured to replace the target file identifier with the second file identifier corresponding to the second resource file after receiving the second resource file returned by the second server based on the resource file update request;

[0143] The second replacement module is used to replace the first resource file stored locally with the second resource file.

[0144] In some embodiments, the resource file obtaining device 400 further includes:

[0145] A third receiving module, configured to receive a third resource file sent by the second server, wherein the third resource file is an update file corresponding to the first resource file;

[0146] A third replacement module, used to replace the target file identifier with a third file identifier corresponding to the third resource file;

[0147] The fourth replacement module is used to replace the first resource file stored locally with the third resource file.

[0148] In some embodiments, the third receiving module is specifically configured to:

[0149] Authentication of the second server is performed to obtain a second authentication result;

[0150] When the second verification result is successful verification, the third resource file sent by the second server is received.

[0151] In some embodiments, the resource file obtaining device 400 further includes:

[0152] Directory monitoring module, used to monitor resource file storage directories;

[0153] A third acquisition module is used to acquire a resource file identifier corresponding to a locally stored resource file and a memory file identifier stored in a memory when it is determined that the resource file in the resource file storage directory has been tampered with;

[0154] A first comparison module, used for comparing the resource file identifier with the memory file identifier to obtain a comparison result;

[0155] A third request module, configured to send a resource file update request to the second server when the comparison result is different;

[0156] A fourth receiving module, configured to receive a resource file returned by the second server based on the resource file update request;

[0157] A fifth replacement module, used to replace the memory file identifier with a file identifier corresponding to the resource file returned by the second server;

[0158] The sixth replacement module is used to replace the locally stored resource file with the resource file returned by the second server.

[0159] Therefore, by setting the first server to process the resource file access request sent by the terminal device, and obtaining the first resource file stored in the first storage path corresponding to the request, the first file identifier corresponding to the first resource file is compared with the file identifier stored in the memory. If the two are the same, it means that the first resource file has not been tampered with, and then the first resource file is sent to the terminal device. In this way, before the terminal device obtains the resource file, it can be timely discovered whether the resource file has been tampered with, thereby effectively ensuring that the resource file sent to the terminal device is not a resource file that has been maliciously tampered with.

[0160] Figure 5 is a schematic diagram of the structure of a resource file acquisition device provided by another embodiment of the present application. The resource file acquisition device 500 can be integrated into Figure 1 In the second server 13.

[0161] like Figure 5 As shown, the resource file acquisition device 500 may include:

[0162] The request receiving module 501 is used to receive a verification request sent by the first server, wherein the verification request includes a first file identifier corresponding to a first resource file, and the first resource file is a resource file stored in the first server;

[0163] A second acquisition module 502, configured to acquire a second resource file stored locally in response to the verification request;

[0164] A second determining module 503, configured to determine a second file identifier corresponding to the second resource file according to the second resource file;

[0165] A resource verification module 504, used to verify whether the first file identifier is the same as the second file identifier, and obtain a first verification result;

[0166] The result sending module 505 is used to send the first verification result to the first server, so that the first server sends the first resource file to the terminal device when the first verification result is that the first file identifier is the same as the second file identifier.

[0167] The resource file acquisition device 500 is described in detail below, as shown below:

[0168] In some embodiments, the resource file obtaining device 500 further includes:

[0169] A fifth receiving module, configured to receive a resource file update request sent by the first server;

[0170] The third sending module is used to send the requested resource file to the first server in response to the resource file update request.

[0171] In some embodiments, the resource file obtaining device 500 further includes:

[0172] The fourth sending module is used to send the third resource file to the first server when the second resource file is updated to the third resource file, so that the first server replaces the stored first resource file with the third resource file, and replaces the target file identifier with the third file identifier corresponding to the third resource file. The target file identifier is the file identifier corresponding to the first resource file stored in the memory of the first server.

[0173] Therefore, by introducing the design of the first server and the second server, the second server is responsible for performing secondary verification on whether the resource file has been tampered with, thereby ensuring that if other users tamper with the resource files stored locally on the first server, the original version of the resource file will not be lost, thereby ensuring that the resource files sent to the terminal device are not maliciously tampered with resource files.

[0174] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application.

[0175] The electronic device 600 may include a processor 601 and a memory 602 storing computer program instructions.

[0176] Specifically, the processor 601 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0177] The memory 602 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 602 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 602 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 602 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 602 is a non-volatile solid-state memory.

[0178] In certain embodiments, the memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present application.

[0179] The processor 601 implements any one of the resource file acquisition methods in the above embodiments by reading and executing computer program instructions stored in the memory 602 .

[0180] In some examples, the electronic device 600 may further include a communication interface 603 and a bus 610. Figure 6 As shown, the processor 601, the memory 602, and the communication interface 603 are connected via a bus 610 and communicate with each other.

[0181] The communication interface 603 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0182] Bus 610 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus 610 may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 610 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.

[0183] Exemplarily, the electronic device 600 may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA).

[0184] The electronic device 600 can execute the resource file acquisition method in the embodiment of the present application, thereby realizing the combination Figures 2 to 5 The resource file acquisition method and device described.

[0185] In addition, in combination with the resource file acquisition method in the above embodiment, the embodiment of the present application may provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the resource file acquisition methods in the above embodiment is implemented. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as portable disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, etc.

[0186] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0187] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0188] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0189] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.

[0190] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A resource file acquisition method, applied to a first server, characterized in that: include: Receiving a resource file access request sent by a terminal device, wherein the resource file access request includes a first storage path; In response to the resource file access request, obtaining a first resource file stored locally from the first storage path; Determine, according to the first resource file, a first file identifier corresponding to the first resource file; In the case where the first file identifier is the same as the target file identifier, sending the first resource file to the terminal device, the target file identifier being a file identifier corresponding to the first resource file stored in the memory; The method further comprises: In the case that the first file identifier is not the same as the target file identifier, sending a verification request to the second server, the verification request is used to instruct the second server to verify whether the first file identifier is the same as the second file identifier, and obtain a first verification result, where the second file identifier is a file identifier corresponding to the second resource file stored in the second server; Receiving the first verification result returned by the second server; When the first verification result is that the first file identifier is the same as the second file identifier, sending the first resource file to the terminal device; The method further comprises: Authentication of the second server is performed to obtain a second authentication result; When the second verification result is successful, receiving a third resource file sent by the second server, wherein the third resource file is a file obtained by updating the second resource file stored on the second server; Replacing the target file identifier with the third file identifier corresponding to the third resource file; The first resource file stored locally is replaced with the third resource file.

2. The method according to claim 1, characterized in that The method further comprises: When the verification result is that the first file identifier is different from the second file identifier, sending a resource file update request for the first resource file to the second server; Receiving the second resource file returned by the second server based on the resource file update request; Send the second resource file to the terminal device.

3. The method according to claim 2, characterized in that After receiving the second resource file returned by the second server based on the resource file update request, the method further includes: Replacing the target file identifier with the second file identifier corresponding to the second resource file; The first resource file stored locally is replaced with the second resource file.

4. The method according to claim 1, characterized in that: The method further comprises: Monitor resource file storage directory; In the case where it is determined that the resource file in the resource file storage directory has been tampered with, obtaining a resource file identifier corresponding to the locally stored resource file and a memory file identifier stored in the memory; Compare the resource file identifier with the memory file identifier to obtain a comparison result; If the comparison result is different, sending a resource file update request to the second server; Receiving a resource file returned by the second server based on the resource file update request; Replacing the memory file identifier with the file identifier corresponding to the resource file returned by the second server; The locally stored resource file is replaced with the resource file returned by the second server.

5. A resource file acquisition method, applied to a second server, characterized in that: include: Receiving a verification request sent by a first server, wherein the verification request includes a first file identifier corresponding to a first resource file, and the first resource file is a resource file stored in the first server; In response to the verification request, obtaining a second resource file stored locally; Determine, according to the second resource file, a second file identifier corresponding to the second resource file; Verifying whether the first file identifier is the same as the second file identifier, and obtaining a first verification result; Sending the first verification result to the first server, so that the first server sends the first resource file to the terminal device when the first verification result is that the first file identifier is the same as the second file identifier; The method further comprises: In the case where the second resource file is updated to a third resource file, the third resource file is sent to the first server, so that the first server replaces the stored first resource file with the third resource file and replaces the target file identifier with a third file identifier corresponding to the third resource file when the first server authenticates the second server and the authentication is successful, wherein the target file identifier is a file identifier corresponding to the first resource file stored in the memory of the first server; Before receiving the verification request sent by the first server, the method further includes: The first server is used to receive a resource file access request sent by a terminal device, wherein the resource file access request includes a first storage path; in response to the resource file access request, obtain a locally stored first resource file from the first storage path; determine a first file identifier corresponding to the first resource file based on the first resource file; when the first file identifier is the same as a target file identifier, send the first resource file to the terminal device, wherein the target file identifier is a file identifier corresponding to the first resource file stored in a memory; when the first file identifier is different from the target file identifier, send a verification request to a second server.

6. The method according to claim 5, characterized in that The method further comprises: Receiving a resource file update request sent by the first server; In response to the resource file update request, the requested resource file is sent to the first server.

7. A resource file acquisition device, applied to a first server, characterized in that: The device comprises: A request receiving module, used to receive a resource file access request sent by a terminal device, wherein the resource file access request includes a first storage path; A first acquisition module, configured to acquire a first resource file stored locally from the first storage path in response to the resource file access request; A first determining module, configured to determine a first file identifier corresponding to the first resource file according to the first resource file; A file sending module, configured to send the first resource file to the terminal device when the first file identifier is the same as a target file identifier, the target file identifier being a file identifier corresponding to the first resource file stored in a memory; The device also includes: A first request module, configured to send a verification request to a second server when the first file identifier is different from the target file identifier, wherein the verification request is configured to instruct the second server to verify whether the first file identifier is the same as the second file identifier, and obtain a first verification result, wherein the second file identifier is a file identifier corresponding to a second resource file stored in the second server; A first receiving module, used to receive the first verification result returned by the second server; A first sending module, configured to send the first resource file to the terminal device when the first verification result is that the first file identifier is the same as the second file identifier; The device also includes: A third receiving module is used to authenticate the second server and obtain a second verification result; if the second verification result is successful, receive a third resource file sent by the second server, the third resource file being a file obtained by updating the second resource file stored on the second server; A third replacement module, used to replace the target file identifier with a third file identifier corresponding to the third resource file; The fourth replacement module is used to replace the first resource file stored locally with the third resource file.

8. A resource file acquisition device, applied to a second server, characterized in that: The device comprises: A request receiving module, configured to receive a verification request sent by a first server, wherein the verification request includes a first file identifier corresponding to a first resource file, and the first resource file is a resource file stored in the first server; A second acquisition module, configured to acquire a second resource file stored locally in response to the verification request; A second determining module, configured to determine a second file identifier corresponding to the second resource file according to the second resource file; A resource verification module, used to verify whether the first file identifier is the same as the second file identifier, and obtain a first verification result; A result sending module, used for sending the first verification result to the first server, so that the first server sends the first resource file to the terminal device when the first verification result is that the first file identifier is the same as the second file identifier; The device also includes: a fourth sending module, configured to send the third resource file to the first server when the second resource file is updated to the third resource file, so that the first server replaces the stored first resource file with the third resource file and replaces the target file identifier with the third file identifier corresponding to the third resource file when the first server authenticates the second server and the authentication is successful, wherein the target file identifier is a file identifier corresponding to the first resource file stored in the memory of the first server; Before receiving the verification request sent by the first server, the first server is used to receive a resource file access request sent by a terminal device, wherein the resource file access request includes a first storage path; in response to the resource file access request, obtain a locally stored first resource file from the first storage path; determine a first file identifier corresponding to the first resource file based on the first resource file; when the first file identifier is the same as a target file identifier, send the first resource file to the terminal device, wherein the target file identifier is a file identifier corresponding to the first resource file stored in a memory; when the first file identifier is different from the target file identifier, send a verification request to a second server.

9. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the steps of the resource file acquisition method as described in any one of claims 1-4 or 5-6 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the steps of the resource file acquisition method according to any one of claims 1-4 or 5-6 are implemented.

11. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the steps of the resource file acquisition method as described in any one of claims 1-4 or 5-6.