CN106155729B - Lua script hot updating method, device and system - Google Patents

Lua script hot updating method, device and system Download PDF

Info

Publication number
CN106155729B
CN106155729B CN201510190903.5A CN201510190903A CN106155729B CN 106155729 B CN106155729 B CN 106155729B CN 201510190903 A CN201510190903 A CN 201510190903A CN 106155729 B CN106155729 B CN 106155729B
Authority
CN
China
Prior art keywords
script
data block
lua
updating
new
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201510190903.5A
Other languages
Chinese (zh)
Other versions
CN106155729A (en
Inventor
吴瑶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
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
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201510190903.5A priority Critical patent/CN106155729B/en
Publication of CN106155729A publication Critical patent/CN106155729A/en
Application granted granted Critical
Publication of CN106155729B publication Critical patent/CN106155729B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the application discloses a Lua script hot updating method, device and system. Decomposing and encrypting the new Lua script data block in the server and then combining the new Lua script data block into a script updating data block, thereby ensuring the stability and safety of the Lua script; and when the Lua script hot-update program in the client detects that the Lua script needs to be updated, downloading the script update data block from the server, restoring the script update data block into a new Lua script data block, assembling the new Lua script data block into a new Lua script data block in the memory, and replacing the Lua script data block to be updated with the new Lua script data block. The Lua script hot updating program replaces the script data block to be updated in the memory without restarting the local process, so that the stability, the safety and the efficiency of the Lua script hot updating are improved.

Description

Lua script hot updating method, device and system
Technical Field
The invention relates to the technical field of software, in particular to a Lua script hot updating method, device and system.
Background
Lua is a lightweight scripting language developed 1993 by a research group at heaven university in Hot Neilou, Brazil, designed to be embedded in an application program and provide flexible extension and customization functions for the application program, and is written in standard C language (ANSI C) and can be compiled in almost all operating systems and platforms. Since Lua is implemented by ANSI, and ANSI C does not contain a thread (thread) implementation, Lua uses processes local to the operating system when adding thread support.
An application creates a native process at runtime. Generally, when the Lua script in the application program needs to be updated, the currently working local process needs to be closed first, the old Lua script is replaced by the new Lua script, then the local process corresponding to the application program is restarted, and the new Lua script is loaded by the local process, so that the Lua script can normally work. However, the restart process of the local process has unpredictable instability and insecurity, which not only affects the stability and safety of the system and the Lua script, but also needs a long-time gray scale release process (gray scale release refers to a release mode capable of smoothly transitioning between black and white, and a problem can be found and adjusted at the time of initial gray scale so as to ensure the stability of the whole system, such as an a/B test) in order to observe the stability of the restart process of the local process, thereby greatly affecting the update efficiency of the Lua script.
Disclosure of Invention
In order to solve the problem that the local process needs to be restarted when the Lua script is updated in the related technology, the application provides a Lua script hot updating method, device and system.
According to a first aspect of the embodiments of the present application, there is provided a Lua script hot update method, applied to a server, including:
decomposing the new Lua script data block to obtain script decomposition data;
encrypting the script decomposition data to obtain script encrypted data;
and combining the script encrypted data to generate a script updating data block.
Optionally, the method for hot updating of a Lua script, after merging the script encrypted data, further includes: and encrypting the integrated script encrypted data to generate a script updating data block.
Optionally, the Lua script hot update method further includes: and adding a digital watermark to the script updating data block.
According to a second aspect of the embodiments of the present application, there is provided a Lua script hot update method, applied to a client, including:
when detecting that the Lua script needs to be updated, downloading a script updating data block from a server;
restoring the script updating data block to obtain a new Lua script data block;
analyzing the new Lua script data block;
and if the analysis is successful, loading the new Lua script data block to the memory, pausing Lua scripts in other memories, and starting Lua scripts in other memories after replacing the Lua script data block to be updated in the memory with the new Lua script data block.
Optionally, the restoring the script update data block to obtain a new Lua script data block includes:
deconstructing the script updating data block to obtain script encrypted data;
decrypting the script encrypted data to obtain script decomposition data;
and combining the script decomposition data to obtain a new Lua script data block.
Optionally, the restoring the script update data block to obtain a new Lua script data block, and before deconstructing the script update data block, the method further includes: and removing the digital watermark of the script updating data block.
Optionally, the restoring the script update data block to obtain a new Lua script data block includes:
if the script updating data block is obtained by integrally re-encrypting the combined script encrypted data, decrypting the script updating data block to obtain the combined integral script encrypted data, and then deconstructing the combined integral script encrypted data to obtain script encrypted data, otherwise, directly deconstructing the script updating data block to obtain script encrypted data;
decrypting the script encrypted data to obtain script decomposition data;
and combining the script decomposition data to obtain a new Lua script data block.
According to a third aspect of the embodiments of the present application, there is provided another Lua script hot update method, applied to a client, including:
when detecting that the Lua script needs to be updated, downloading a new Lua script data block from the server;
analyzing the new Lua script data block;
and if the analysis is successful, loading the new Lua script data block to the memory, pausing Lua scripts in other memories, and starting Lua scripts in other memories after replacing the Lua script data block to be updated in the memory with the new Lua script data block.
In accordance with a fourth aspect of the embodiments of the present application, corresponding to the first aspect of the embodiments of the present application, there is provided a Lua script hot-updating apparatus, applied to a server, including:
the script decomposition unit is used for decomposing the new Lua script data block to obtain script decomposition data;
the script encryption unit is used for encrypting the script decomposition data to obtain script encryption data;
and the merging unit is used for merging the script encrypted data to generate a script updating data block.
Optionally, the Lua script hot update apparatus further includes:
and the secondary encryption unit is used for encrypting the whole combined script encrypted data to form a script updating data block.
Optionally, the Lua script hot update apparatus further includes:
and the watermark adding unit is used for adding a digital watermark to the script updating data block.
Corresponding to the second aspect of the embodiments of the present application, according to a fifth aspect of the embodiments of the present application, there is provided a Lua script hot-updating apparatus, applied to a client, including:
the first updating and downloading unit is used for downloading the script updating data block from the server when the fact that the Lua script needs to be updated is detected;
the first script restoring unit is used for restoring the script updating data block to obtain a new Lua script data block;
the first analysis unit is used for analyzing the new Lua script data block;
and the first updating unit is used for loading the new Lua script data block to the memory if the analysis is successful, pausing Lua scripts in other memories, and starting Lua scripts in other memories after replacing the Lua script data block to be updated in the memory with the new Lua script data block.
Optionally, the first script reduction unit includes:
the deconstruction subunit is used for deconstructing the script updating data block to obtain script encrypted data;
the first decryption subunit is used for decrypting the script encrypted data to obtain script decomposition data;
and the combination subunit is used for combining the script decomposition data to obtain a new Lua script data block.
Optionally, the first script reducing unit further includes:
and the watermark removing subunit is used for removing the digital watermark of the script updating data block.
Optionally, the first script reducing unit further includes: the second decryption subunit is used for decrypting the script updating data block to obtain the integrated script encrypted data after the script updating data block is obtained by integrating and encrypting the script encrypted data after the script updating data block is combined; and the deconstruction subunit is used for deconstructing the combined whole script encrypted data to obtain script encrypted data.
In accordance with a sixth aspect of the embodiments of the present application, there is provided another Lua script hot-updating apparatus, applied to a client, including:
the second updating and downloading unit is used for downloading a new Lua script data block from the script server when the fact that the Lua script needs to be updated is detected;
the second analysis unit is used for analyzing the new Lua script data block;
and the second updating unit is used for loading the new Lua script data block to the memory if the analysis is successful, pausing Lua scripts in other memories, and starting Lua scripts in other memories after replacing the Lua script data block to be updated in the memory with the new Lua script data block.
According to a seventh aspect of the embodiments of the present application, a server is provided, which includes the Lua script hot-updating apparatus provided in the fourth aspect of the embodiments of the present application.
According to an eighth aspect of the embodiments of the present application, there is provided a client including the Lua script hot-updating apparatus provided by the fifth aspect of the embodiments of the present application.
According to a ninth aspect of the embodiment of the present application, there is provided a Lua script hot update system, which includes the server provided in the seventh aspect of the embodiment of the present application, and the client provided in the eighth aspect of the embodiment of the present application.
The technical scheme provided by the embodiment of the application can have the following beneficial effects: the new Lua script data block is decomposed and encrypted in the server and then combined into a script updating data block, so that the Lua script file is prevented from being mistakenly killed by security software and hijacked and damaged by malicious software, and the stability and the safety of the Lua script are ensured; and when the Lua script hot-update program in the client detects that the Lua script needs to be updated, downloading the script update data block from the server, restoring the script update data block into a new Lua script data block, and replacing the Lua script data block to be updated with the new Lua script data block in the memory to complete the hot update of the Lua script. The Lua script hot updating program is operated as an executable program when the application program is operated, and the script data block needing to be updated is replaced in the memory, so that the local process is not required to be restarted for hot updating of the Lua script, and the stability, the safety and the efficiency of the Lua script hot updating process are further improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
Fig. 1 is a flowchart illustrating a Lua script hot update method applied to a server according to an exemplary embodiment of the present application.
Fig. 2 is a flowchart illustrating a Lua script hot update method applied to a server according to another exemplary embodiment of the present application.
Fig. 3 is a flowchart illustrating a Lua script hot update method applied to a client according to an exemplary embodiment of the present application.
Fig. 4 is a flowchart illustrating a Lua script hot update method applied to a client according to another exemplary embodiment of the present application.
Fig. 5 is a flowchart illustrating another Lua script hot updating method applied to a client according to an exemplary embodiment of the present application.
Fig. 6 is a block diagram illustrating a Lua script hot-updating apparatus applied to a server according to an exemplary embodiment of the present application.
Fig. 7 is a block diagram illustrating a Lua script hot-updating apparatus applied to a server according to another exemplary embodiment of the present application.
Fig. 8 is a block diagram illustrating a Lua script hot-updating apparatus applied to a client according to an exemplary embodiment of the present application.
Fig. 9 is a block diagram illustrating a Lua script hot-updating apparatus applied to a client according to another exemplary embodiment of the present application.
FIG. 10 is a block diagram illustrating a Lua script hot update system according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the present application, but it will be appreciated by those skilled in the art that the present application may be practiced without these specific details. In other instances, well-known methods, procedures, components, and devices have not been described in detail as not to unnecessarily obscure the embodiments.
For ease of understanding the present application, a brief description of hot-refresh is provided. The hot update (hot update or hot fix) is to change the system without shutdown, so that the user obtains the change of the resource and the code, for example, during the operation of the server, it is found that a certain service processing function logic has Bug, and the code is updated in time without shutdown for repair. For the Lua script in the application program, the hot update is to update the Lua script without closing the application program, namely, without closing the local process of the application program.
Fig. 1 is a flowchart illustrating a Lua script hot update method of an application server according to an exemplary embodiment of the present application, where as shown in fig. 1, the method includes:
step S101, decomposing a new Lua script data block to obtain script decomposition data;
step S102, encrypting the script decomposition data to obtain script encrypted data;
and step S103, merging the script encrypted data to generate a script updating data block.
After the new Lua script data block is uploaded to the server, the new Lua script data block is decomposed according to a preset rule, for example, according to bytes or code units, or other code decomposition algorithms, and each part obtained by decomposition is marked to facilitate subsequent reduction. The script file is decomposed into script decomposed data, and the script decomposed data, i.e. each decomposed part, is encrypted, for example, after a new Lua script data block is decomposed according to bytes, each byte is subjected to XOR encryption (exclusive or encryption) by using an RC4 algorithm (a stream encryption algorithm cluster with a variable key length designed by Ron Rivest in 1987), and the script encrypted data is obtained after encryption. The script encrypted data in the decomposed state is combined, and the combination can be a data module in which the script encrypted data is simply arranged in a marked sequence as a whole, or the script encrypted data can be arranged in a specific sequence according to the marks of the script encrypted data, for example, the script encrypted data is arranged in a staggered manner according to the marks, or other data combining methods are used for combining the script encrypted data into a whole data module.
The script is decomposed and then encrypted, so that the safety and the stability of the script are enhanced, the phenomenon that the subsequent updating process is influenced by the script in error is prevented, the local process is influenced, the phenomenon that the script is mistaken when the Lua script is subsequently processed and updated is prevented, and the Lua script is prevented from being hijacked and modified by malicious software or being mistakenly killed by third-party safety software.
Fig. 2 is a flowchart illustrating an application server Lua script hot update method according to an exemplary embodiment of the present application, and as shown in fig. 2, the method includes:
step S201, decomposing the new Lua script data block to obtain script decomposition data;
step S202, encrypting the script decomposition data to obtain script encrypted data;
step S203, merging the script encrypted data;
step S204, the combined script encrypted data is integrally encrypted to generate a script updating data block;
and step S205, adding a digital watermark to the script updating data block.
After the script encrypted data are combined, the obtained whole script encrypted data are encrypted again, for example, the obtained whole script encrypted data are encrypted again by using an aes (advanced Encryption standard) algorithm, preferably, a symmetric Encryption method is used during Encryption again, so that the subsequent decryption by using the same key is facilitated, and the Encryption again is favorable for further ensuring the security and stability of the script data in the downloading and loading processes. And after the whole script encrypted data is encrypted again, a script updating data block is obtained. In step S205, a digital watermark is added to the script update data block, for example, the digital watermark is added to the script update data block by using the Hash algorithm, and the digital watermark helps to better protect the script from being damaged and modified by other programs.
In a possible implementation manner, an MD5(Message-Digest Algorithm 5) check code may be further added to the script update data block, so that the client performs MD5 check after downloading the script update data block, and the integrity of the script update data block is ensured.
Fig. 3 is a flowchart illustrating a Lua script hot update method of an application client according to an exemplary embodiment of the present application, where as shown in fig. 3, the method includes:
step S301, when detecting that the Lua script needs to be updated, downloading the script update data block from the server.
The Lua script hot-updating program compares the version information of the Lua script data in the current client application program with the version information of the Lua script data in the server, when a new Lua script data version is detected in the server, the Lua script updating is detected to be needed, or when the server receives an uploaded new Lua script data block and processes (for example, decomposes, encrypts and combines) the new Lua script data block, the server sends an updating message to the Lua script hot-updating program in the client, and the Lua script hot-updating program receives the updating message, namely, the Lua script updating is detected to be needed. When the Lua script needs to be updated, the Lua script hot updating program downloads a script updating data block to be used for updating from the server.
And S302, restoring the script updating data block to obtain a new Lua script data block.
Step S302 may include:
a1, deconstructing the script updating data block to obtain script encrypted data;
a2, decrypting the script encrypted data to obtain script decomposition data;
a3, combining the script decomposition data to obtain a new Lua script data block.
The script encryption data are separated according to the mark sequence if the script encryption data are combined according to an overlap-and-merge algorithm, that is, a part of each script encryption data is overlapped with a part of another script encryption data and then combined (the mode can better protect the security of the script encryption data), and each script encryption data are separated according to the inverse method of the overlap-and-merge algorithm. And then, decrypting the script encrypted data obtained after deconstruction by using a decryption method corresponding to the encryption method of the decomposed new Lua script data block to obtain the decomposed new Lua script data block, namely the script decomposed data. And combining the script decomposition data with each script decomposition data according to a combination method corresponding to the decomposition method to obtain a new Lua script data block, for example, if the new Lua script data block is decomposed according to bytes, combining the script decomposition data according to the original byte sequence, and marking each script decomposition data when the new Lua script data block is decomposed, so that the position of each script decomposition data can be determined according to the mark of each script decomposition data.
Step S303, analyzing the new Lua script data block;
and step S304, if the analysis is successful, loading the new Lua script data block to the memory, pausing Lua scripts in other memories, and starting Lua scripts in other memories after replacing the Lua script data block to be updated in the memory with the new Lua script data block.
After the new Lua script data block is obtained, the new Lua script data block is analyzed, wherein the analysis comprises Lua script data analysis such as lexical analysis and the like, and the lexical analysis is performed through an analysis interface provided by the Lua, for example, a dobuffer interface, so as to determine whether the Lua script data block is legal and executable. And if the analysis is successful, namely the Lua script data block is legal and executable, loading the new Lua script data block into the memory, and replacing the Lua script data block to be updated in the memory with the new Lua script data block.
After the new Lua script data block is obtained, in order to prevent unpredictable abnormal conditions caused by other Lua scripts in the memory in the replacement process or unpredictable abnormal conditions caused by Lua scripts in other memories, other running Lua scripts in the memory are suspended, the new Lua script data block in the memory is used for replacing the Lua script data block to be updated, the hot update of the Lua script is completed, and then other suspended Lua scripts in the memory are started.
The Lua script hot updating program completing steps S301 to S304 directly replaces the script data block to be updated in the memory, so that the hot updating of the Lua script does not need to restart the local process to load the script data block, that is, the updating of the Lua script can be completed without closing the application program, and the stability, the security and the efficiency of the Lua script updating process are improved.
If the new Lua script data block is not successfully analyzed, namely the new Lua script data block is illegal or not executable, an update error message can be sent out to prompt the user to process.
In Lua, the script data block can be directly executed after being loaded.
Fig. 4 is a flowchart illustrating a method for hot updating an application client Lua script according to another exemplary embodiment of the present application, where as shown in fig. 4, the method includes:
step S401, when detecting that the Lua script needs to be updated, downloading the script updating data block from the server.
Step S402, removing the digital watermark of the script updating data block;
step S403, the script updating data block is obtained by wholly re-encrypting the combined script encrypted data, and the script updating data block is decrypted to obtain the combined whole script encrypted data;
s404, deconstructing the combined whole script encrypted data to obtain script encrypted data;
step S405, decrypting the script encrypted data to obtain script decomposition data;
and step S406, combining the script decomposition data to obtain a new Lua script data block.
If the downloaded script updating data block is added with the watermark, the digital watermark of the script updating data block is removed by using a watermark removing algorithm corresponding to the watermark algorithm, for example, the digital watermark is added to the script updating data block by using the Hash algorithm, and the Hash algorithm is calculated again to remove the digital watermark. And the script updating data block is obtained by combining the script encrypted data and then encrypting the combined script encrypted data, the combined script encrypted data is decrypted by using a corresponding decryption algorithm to obtain a combined script encrypted data whole, and then the steps S404 to S406 are executed, wherein the steps S404 to S406 are respectively the same as the steps a1 to a 3.
If the script update data block is added with an MD5 check code, the step S402 may further include performing an MD5 check on the script update data block to check the integrity of the script update data block.
Step S407, analyzing the new Lua script data block;
and step S408, if the analysis is successful, loading the new Lua script data block to the memory, pausing Lua scripts in other memories, and starting Lua scripts in other memories after replacing the Lua script data block to be updated in the memory with the new Lua script data block.
Step S401 is the same as step S301. Steps S407 and S408 are the same as steps S303 and S304, respectively.
Fig. 5 is a flowchart illustrating another method for hot updating an application client Lua script according to an exemplary embodiment of the present application, where as shown in fig. 5, the method includes:
step S501, when detecting that the Lua script needs to be updated, downloading a new Lua script data block from a server;
step S502, analyzing the new Lua script data block;
and S503, if the analysis is successful, loading the new Lua script data block into the memory, pausing other Lua scripts, replacing the Lua script data block to be updated in the memory with the new Lua script data block, and starting other Lua scripts.
Step S502 and step S503 are the same as step S303 and step S304, respectively. If the application program is simple, other application programs running in the system are few, and the application program is less interfered, the new Lua script data block can be combined without decomposition and encryption, namely the new Lua script data block is directly stored in the server, and when the client detects that the Lua script needs to be updated, the original new Lua script data block is downloaded from the server. In this case, however, because the new Lua script data block does not take protection measures such as decomposition and encryption, the new Lua script data block has poor security and stability, and is easily damaged by being hijacked by a malicious program, but in this case, the protection processing of the new Lua script data block by the server is omitted, the client does not need to perform corresponding steps such as decryption combination, and the like, and the Lua script hot update process is simpler and faster.
Through the above description of the method embodiments, those skilled in the art can clearly understand that the present application can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation manner in many cases. Based on such understanding, the technical solutions of the present application, which essentially or partially contribute to the prior art, may be embodied in the form of software products and stored in a storage medium, and include instructions for causing an intelligent device to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media that can store data and program codes, such as Read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, etc.
Fig. 6 is a block diagram illustrating a Lua script hot-updating apparatus of an application server according to an exemplary embodiment of the present application. As shown in fig. 6, the apparatus includes:
the script decomposition unit U601 is used for decomposing the new Lua script data block to obtain script decomposition data;
the script encryption unit U602 is configured to encrypt the script decomposition data to obtain script encryption data;
and a merging unit U603 configured to merge the script encrypted data to generate a script update data block.
Fig. 7 is a block diagram illustrating a Lua script hot-updating apparatus of an application server according to another exemplary embodiment of the present application. As shown in fig. 7, the apparatus includes:
the script decomposition unit U701 is used for decomposing the new Lua script data block to obtain script decomposition data;
the script encryption unit U702 is used for encrypting the script decomposition data to obtain script encryption data;
a merging unit U703 for merging the script encrypted data;
the secondary encryption unit U704 is used for encrypting the integrated script encryption data to form a script updating data block;
and the watermark adding unit U705 is used for adding a digital watermark to the script updating data block.
The Lua script hot updating device applied to the server may further include an MD5 check code adding unit, configured to add an MD5 check code to the script update data block.
Fig. 8 is a block diagram illustrating a Lua script hot-updating apparatus of an application client according to an exemplary embodiment of the present application. As shown in fig. 8, the apparatus includes:
the first update downloading unit U801 is used for downloading the script update data block from the server when detecting that the Lua script needs to be updated;
the first script restoring unit U802 is configured to restore the script update data block to obtain a new Lua script data block;
a first parsing unit U803, configured to parse the new Lua script data block;
and the first updating unit U804 is configured to, if the parsing is successful, load the new Lua script data block to the memory, suspend the Lua scripts in the other memories, and start the Lua scripts in the other memories after replacing the to-be-updated Lua script data block in the memory with the new Lua script data block.
Wherein, the first script reduction unit, in a possible implementation manner, may include:
the deconstruction subunit is used for deconstructing the script updating data block to obtain script encrypted data;
the first decryption subunit is used for decrypting the script encrypted data to obtain script decomposition data;
and the combination subunit is used for combining the script decomposition data to obtain a new Lua script data block.
In another possible embodiment, the first script reduction unit may include:
and the watermark removing subunit is used for removing the digital watermark of the script updating data block.
The second decryption subunit is used for decrypting the script updating data block to obtain the combined whole script encrypted data if the script updating data block is obtained by integrally encrypting the combined script encrypted data;
the deconstruction subunit is used for deconstructing the combined whole script encrypted data to obtain script encrypted data;
the first decryption subunit is used for decrypting the script encrypted data to obtain script decomposition data;
and the combination subunit is used for combining the script decomposition data to obtain a new Lua script data block.
Fig. 9 is a block diagram illustrating a Lua script hot-updating apparatus of an application client according to another exemplary embodiment of the present application. As shown in fig. 9, the apparatus includes:
a second update downloading unit U901, configured to download a new Lua script data block from the script server when it is detected that the Lua script needs to be updated;
a second parsing unit U902, configured to parse the new Lua script data block;
and the second updating unit U903 is configured to, if the parsing is successful, load the new Lua script data block to the memory, suspend the Lua scripts in the other memories, and start the Lua scripts in the other memories after replacing the to-be-updated Lua script data block in the memory with the new Lua script data block.
FIG. 10 is a block diagram illustrating a Lua script hot update system according to an exemplary embodiment of the present application. The system comprises a server U1001 and a client U1002, wherein the server comprises a Lua script hot-updating device applied to the server as shown in FIG. 6 or FIG. 7, and the client comprises a Lua script hot-updating device applied to the client as shown in FIG. 8.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for apparatus or system embodiments, since they are substantially similar to method embodiments, they are described in relative terms, as long as they are described in partial descriptions of method embodiments. The above-described embodiments of the apparatus and system are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
It is noted that, in this document, relational terms such as "first" and "second," and the like, are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, or device that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, apparatus, or device. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, apparatus or device that comprises the element.
The above description is merely exemplary of the present application and is presented to enable those skilled in the art to understand and practice the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (12)

1. A Lua script hot updating method is applied to a client and is characterized by comprising the following steps:
when detecting that the Lua script needs to be updated, downloading a script updating data block from a server;
restoring the script updating data block to obtain a new Lua script data block;
analyzing the new Lua script data block;
and if the analysis is successful, loading the new Lua script data block into the memory, pausing other Lua scripts in the memory, replacing the Lua script data block to be updated in the memory with the new Lua script data block, and starting other Lua scripts in the memory.
2. The Lua script hot-update method of claim 1, wherein the restoring the script update data block to a new Lua script data block comprises:
deconstructing the script updating data block to obtain script encrypted data;
decrypting the script encrypted data to obtain script decomposition data;
and combining the script decomposition data to obtain a new Lua script data block.
3. The Lua script hot-update method of claim 2, wherein the restoring the script update data block to obtain a new Lua script data block, further comprises, before deconstructing the script update data block: and removing the digital watermark of the script updating data block.
4. The Lua script hot-update method of claim 2 or 3, wherein the restoring the script update data block to obtain a new Lua script data block comprises:
if the script updating data block is obtained by integrally re-encrypting the combined script encrypted data, decrypting the script updating data block to obtain the combined integral script encrypted data, and then deconstructing the combined integral script encrypted data to obtain script encrypted data, otherwise, directly deconstructing the script updating data block to obtain script encrypted data;
decrypting the script encrypted data to obtain script decomposition data;
and combining the script decomposition data to obtain a new Lua script data block.
5. A Lua script hot updating method is applied to a client and is characterized by comprising the following steps:
when detecting that the Lua script needs to be updated, downloading a new Lua script data block from the server;
analyzing the new Lua script data block;
and if the analysis is successful, loading the new Lua script data block into the memory, pausing other Lua scripts in the memory, replacing the Lua script data block to be updated in the memory with the new Lua script data block, and starting other Lua scripts in the memory.
6. A Lua script hot updating device is applied to a client and is characterized by comprising:
the first updating and downloading unit is used for downloading the script updating data block from the server when the fact that the Lua script needs to be updated is detected;
the first script restoring unit is used for restoring the script updating data block to obtain a new Lua script data block;
the first analysis unit is used for analyzing the new Lua script data block;
and the first updating unit is used for loading the new Lua script data block to the memory if the analysis is successful, pausing other Lua scripts in the memory, and starting other Lua scripts in the memory after replacing the Lua script data block to be updated in the memory with the new Lua script data block.
7. The Lua script thermal updating apparatus of claim 6, wherein the first script recovery unit comprises:
the deconstruction subunit is used for deconstructing the script updating data block to obtain script encrypted data;
the first decryption subunit is used for decrypting the script encrypted data to obtain script decomposition data;
and the combination subunit is used for combining the script decomposition data to obtain a new Lua script data block.
8. The Lua script thermal updating apparatus of claim 7, wherein the first script reduction unit further comprises:
and the watermark removing subunit is used for removing the digital watermark of the script updating data block.
9. The Lua script thermal updating apparatus of claim 7 or 8, wherein the first script reduction unit further comprises:
the second decryption subunit is used for decrypting the script updating data block to obtain the integrated script encrypted data after the script updating data block is obtained by integrating and encrypting the script encrypted data after the script updating data block is combined; and the deconstruction subunit is used for deconstructing the combined whole script encrypted data to obtain script encrypted data.
10. A Lua script hot updating device is applied to a client and is characterized by comprising:
the second updating and downloading unit is used for downloading a new Lua script data block from the script server when the fact that the Lua script needs to be updated is detected;
the second analysis unit is used for analyzing the new Lua script data block;
and the second updating unit is used for loading the new Lua script data block to the memory if the analysis is successful, pausing other Lua scripts in the memory, and starting other Lua scripts in the memory after replacing the Lua script data block to be updated in the memory with the new Lua script data block.
11. A client, characterized by comprising the Lua script hot-updating apparatus as claimed in any one of claims 6 to 9.
12. A Lua script hot update system comprising the client of claim 11.
CN201510190903.5A 2015-04-21 2015-04-21 Lua script hot updating method, device and system Active CN106155729B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510190903.5A CN106155729B (en) 2015-04-21 2015-04-21 Lua script hot updating method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510190903.5A CN106155729B (en) 2015-04-21 2015-04-21 Lua script hot updating method, device and system

Publications (2)

Publication Number Publication Date
CN106155729A CN106155729A (en) 2016-11-23
CN106155729B true CN106155729B (en) 2020-02-14

Family

ID=58058814

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510190903.5A Active CN106155729B (en) 2015-04-21 2015-04-21 Lua script hot updating method, device and system

Country Status (1)

Country Link
CN (1) CN106155729B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106997299A (en) * 2017-03-24 2017-08-01 长沙趣动文化科技有限公司 Encryption and hot update method, device
CN107169317A (en) * 2017-03-31 2017-09-15 武汉斗鱼网络科技有限公司 A kind of method and device that LUA scripts are encrypted
CN108334360A (en) * 2017-07-12 2018-07-27 深圳市小牛在线互联网信息咨询有限公司 Method, apparatus, storage medium and the computer equipment of application program dynamic load
CN107451259A (en) * 2017-07-31 2017-12-08 北京微影时代科技有限公司 A kind of data dictionary dynamic updating method and device
CN109992987B (en) * 2017-12-29 2021-04-27 港融科技有限公司 Script file protection method and device based on Nginx and terminal equipment
CN108509215B (en) * 2018-03-22 2022-03-29 广州视源电子科技股份有限公司 System software replacing method and device, terminal equipment and storage medium
CN108737899A (en) * 2018-03-30 2018-11-02 上海极链网络科技有限公司 Video interactive system dynamic update scheme
CN109814915B (en) * 2018-12-29 2022-07-22 天津字节跳动科技有限公司 Parameter configuration method, device, medium and electronic equipment based on lua
CN110278115B (en) 2019-06-20 2022-11-08 京东方科技集团股份有限公司 Hot update method and device
CN110908694A (en) * 2019-11-18 2020-03-24 政采云有限公司 Hot updating system and method for electronic bidding client application
CN111143224A (en) * 2019-12-30 2020-05-12 广州酷狗计算机科技有限公司 Pile service implementation method, device, equipment and computer storage medium
CN112802591A (en) * 2021-01-26 2021-05-14 创业慧康科技股份有限公司 LUA-based thermal updating method for medical instrument data acquisition equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102207879A (en) * 2011-06-14 2011-10-05 贵阳朗玛信息技术股份有限公司 Hot-updating method and hot-updating system of Lua script
CN103353845A (en) * 2013-06-28 2013-10-16 贵阳朗玛信息技术股份有限公司 Method and device for uploading and pushing script
CN103984582A (en) * 2014-06-04 2014-08-13 网易(杭州)网络有限公司 Method and device for hot updating
CN104111855A (en) * 2014-07-29 2014-10-22 广东能龙教育股份有限公司 Method for dynamic update of iOS (Iphone Operation System) client based on Lua

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102207879A (en) * 2011-06-14 2011-10-05 贵阳朗玛信息技术股份有限公司 Hot-updating method and hot-updating system of Lua script
CN103353845A (en) * 2013-06-28 2013-10-16 贵阳朗玛信息技术股份有限公司 Method and device for uploading and pushing script
CN103984582A (en) * 2014-06-04 2014-08-13 网易(杭州)网络有限公司 Method and device for hot updating
CN104111855A (en) * 2014-07-29 2014-10-22 广东能龙教育股份有限公司 Method for dynamic update of iOS (Iphone Operation System) client based on Lua

Also Published As

Publication number Publication date
CN106155729A (en) 2016-11-23

Similar Documents

Publication Publication Date Title
CN106155729B (en) Lua script hot updating method, device and system
CN104166565B (en) A kind of intelligent display terminal firmware upgrade method
KR101471589B1 (en) Method for Providing Security for Common Intermediate Language Program
EP2854070A1 (en) Method and apparatus of creating application package, method and apparatus of executing application package, and recording medium storing application package
US20170270319A1 (en) Method and device for providing verifying application integrity
CN102509047A (en) Method and system for verifying program code in set-top box
CN108399319B (en) Source code protection method, application server and computer readable storage medium
CN104166564B (en) A kind of display terminal method for updating program
CN102236757A (en) Software protection method and system applicable to Android system
CN104573490A (en) Method for protecting installed software on Android platform
US20120144208A1 (en) Indexed table based code encrypting/decrypting device and method thereof
CN104239757A (en) Application program reversing-preventing method and device and operation method and terminal
CN107430650B (en) Securing computer programs against reverse engineering
CN109284585B (en) Script encryption method, script decryption operation method and related device
KR101805310B1 (en) User apparatus based on trusted platform module and firmware updating method using the same
US20180204004A1 (en) Authentication method and apparatus for reinforced software
US20180067777A1 (en) Application protection method, server, and terminal
CN108595198A (en) A kind of safe firmware update
CN103473488B (en) The method and system that a kind of android application program is anti-piracy
CN108170461B (en) Differential upgrade package generation method, differential upgrade method and device
CN107257282B (en) Code full-package encryption method based on RC4 algorithm
US20180013551A1 (en) Apparatus for obfuscating and restoring program execution code and method thereof
CN109992974B (en) Method and device for protecting byte code file of virtual machine and readable storage medium
US20200233676A1 (en) Bios management device, bios management system, bios management method, and bios management program-stored recording medium
CN110135154A (en) The injection attack detection system and method for application program

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant