Method and device for protecting virus sample in test case code
By encrypting and compressing virus Trojan samples, the problem of virus Trojan samples being detected and killed in multi-person collaborative test case code writing scenarios is solved, ensuring the integrity of test case code and the smooth execution of test cases.
Patent Information
- Application Number
- CN202411369739.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2024-12-31
AI Technical Summary
In the automated test case code writing scenario with multiple people collaboratively, virus Trojan samples are easily detected, resulting in the writing and execution of test case code being affected.
By encrypting and compressing the virus Trojan samples and carrying them in the generated test case code, we ensure that it cannot be detected even in an environment where antivirus software exists until it is decrypted and decompressed in a sandbox environment for testing .
It effectively avoids the mistaken deletion of virus Trojan samples during transmission and storage, ensuring the integrity of test case code and the smooth execution of tests.
Smart Images

Figure CN119226168A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a method and device for protecting virus samples in test case codes. Background Art
[0002] When testing the host security performance (virus protection function), it is often necessary to upload virus and Trojan samples to the tested host during the writing of automated test case codes to test whether the current host can detect the existence of the virus and Trojan samples.
[0003] At present, in order to improve the efficiency of writing test case codes, test case codes are usually written in a multi-person collaborative manner; in the scenario of multi-person collaborative automated test case code writing, after a developer adds virus and Trojan horse samples to the current test case code, when other developers pull the test case code to their local servers, once there is software with antivirus function on the local servers of other developers, the virus and Trojan horse samples may be detected and killed, resulting in the loss of virus and Trojan horse samples in the test case code, affecting the subsequent test case code writing and execution.
[0004] Therefore, how to prevent virus and Trojan samples from being detected and killed in the scenario of multi-person collaborative automated test case code writing has become an urgent problem to be solved. Summary of the invention
[0005] In view of this, an embodiment of the present application provides a method and device for protecting virus samples in test case codes, which can prevent virus and Trojan samples from being detected and killed in a scenario of automated test case code writing with multi-person collaboration.
[0006] In a first aspect, an embodiment of the present application provides a method for protecting virus samples in test case codes, including:
[0007] Receive a first test case code uploaded by a first developer; the first test case code carries a target virus Trojan sample; the target virus Trojan sample is obtained by encrypting and compressing an initial virus Trojan sample;
[0008] Generate a first version of test case code based on the first test case code;
[0009] receiving a pull instruction from a second developer for the first version of the test case code;
[0010] In response to the pull instruction, the first version of the test case code is sent to the server corresponding to the second developer to receive the second test case code uploaded by the second developer, wherein the second test case code is obtained by the second developer based on the first test case code; the second test case code carries the target virus Trojan sample.
[0011] As an optional implementation of the embodiment of the present application, after generating the first version of the test case code based on the first test case code, the method further includes:
[0012] The first version of the test case code is deployed to a target sandbox environment to test the first version of the test case code.
[0013] As an optional implementation of the embodiment of the present application, the deploying the first version of the test case code to the target sandbox environment to test the first version of the test case code includes:
[0014] Obtain the target virus Trojan sample in the first version of the test case code;
[0015] Decrypting and decompressing the target virus Trojan horse sample to obtain the initial virus Trojan horse sample;
[0016] The first version of the test case code is tested in combination with the initial virus Trojan sample.
[0017] As an optional implementation of the embodiment of the present application, the method further includes:
[0018] In the target sandbox environment, a target whitelist is configured for the local antivirus software; the target whitelist includes the initial virus Trojan sample and the first version test case code.
[0019] As an optional implementation of the embodiment of the present application, the method further includes:
[0020] After the test of the first version of the test case code is completed, the initial virus Trojan horse sample and the first version of the test case code in the target whitelist are cleared.
[0021] As an optional implementation of the embodiment of the present application, in response to the pull instruction, the first version of the test case code is sent to the server corresponding to the second developer to receive the second test case code uploaded by the second developer, and the method further includes:
[0022] After receiving the second test case code uploaded by the second developer, a second version of the test case code is generated based on the second test case code.
[0023] In a second aspect, an embodiment of the present application provides a virus sample protection device for a test case code, including:
[0024] A receiving unit, configured to receive a first test case code uploaded by a first developer; the first test case code carries a target virus Trojan sample; the target virus Trojan sample is obtained by encrypting and compressing an initial virus Trojan sample;
[0025] A generating unit, configured to generate a first version of a test case code based on the first test case code;
[0026] A pulling unit, configured to receive a pulling instruction from a second developer for the first version of the test case code;
[0027] A processing unit is used to send the first version of the test case code to the server corresponding to the second developer in response to the pull instruction, so as to receive the second test case code uploaded by the second developer, wherein the second test case code is obtained by the second developer based on the first test case code; the second test case code carries the target virus Trojan sample.
[0028] As an optional implementation of the embodiment of the present application, the device also includes: a testing unit, used to deploy the first version of the test case code to the target sandbox environment to test the first version of the test case code.
[0029] As an optional implementation of an embodiment of the present application, the testing unit is specifically used to obtain the target virus Trojan sample in the first version of the test case code; decrypt and decompress the target virus Trojan sample to obtain the initial virus Trojan sample; and test the first version of the test case code in combination with the initial virus Trojan sample.
[0030] As an optional implementation of the embodiment of the present application, the testing unit is also used to configure a target whitelist for the local antivirus software in the target sandbox environment; the target whitelist includes the initial virus Trojan sample and the first version test case code.
[0031] As an optional implementation of the embodiment of the present application, the testing unit is also used to clear the initial virus Trojan sample and the first version of the test case code in the target whitelist after the test of the first version of the test case code is completed.
[0032] As an optional implementation of the embodiment of the present application, the generating unit is further used to generate a second version of the test case code based on the second test case code after receiving the second test case code uploaded by the second developer.
[0033] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to enable the electronic device to implement the virus sample protection method in the test case code described in any of the above embodiments when executing the computer program.
[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a computing device, the computing device implements the virus sample protection method in the test case code described in any of the above embodiments.
[0035] The virus sample protection method provided in the embodiment of the present application is specifically as follows: receiving a first test case code uploaded by a first developer; the first test case code carries a target virus Trojan sample; the target virus Trojan sample is obtained by encrypting and compressing the initial virus Trojan sample; generating a first version of the test case code based on the first test case code; receiving a pull instruction for the first version of the test case code from a second developer; in response to the pull instruction, sending the first version of the test case code to a server corresponding to the second developer to receive a second test case code uploaded by the second developer, the second test case code being obtained by the second developer based on the first test case code; the second test case code carries the target virus Trojan sample. In the present application, when the first version of the test case code is generated based on the first test case code, since the target virus Trojan sample in the first test case code is obtained by encrypting and compressing the initial virus Trojan sample; then after other developers pull the first version of the test case code to their own servers, since the target virus Trojan sample is compressed and encrypted, even if there is antivirus software on the servers of other developers, the target virus Trojan sample cannot be detected and killed, thereby ensuring the integrity of the target virus Trojan sample, avoiding affecting the writing of subsequent test case codes, and further ensuring the smooth execution of the test. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0038] Figure 1 One of the step flow charts of the method for protecting virus samples in test case codes provided in an embodiment of the present application;
[0039] Figure 2 One of the process framework diagrams of the virus sample protection method in the test case code provided in the embodiment of the present application;
[0040] Figure 3 The second step flow chart of the method for protecting virus samples in test case codes provided in the embodiment of the present application;
[0041] Figure 4 A schematic diagram of the structure of a virus sample protection device in a test case code provided in an embodiment of the present application;
[0042] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0044] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0045] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. In addition, in the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more.
[0046] It should be noted that, in this article, the term "comprises" or any other variant thereof is 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 includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0047] At present, in the scenario of multi-person collaborative automated test case code writing, in order to test the host security (virus protection function), the host protection client is installed on the host. During the test, the virus and Trojan horse samples need to be uploaded to the protected host to test whether the host can detect the existence of the virus and Trojan horse samples; when the virus and Trojan horse samples are submitted to the Master branch of the version control, and then pulled to the corresponding server by other code writers, they may be automatically detected and killed by the local antivirus software, resulting in the loss of virus and Trojan horse samples, affecting the subsequent test case code writing and execution.
[0048] Therefore, in order to prevent virus and Trojan horse samples from being detected and killed in the scenario of multi-person collaborative automated test case code writing, the present application provides a method for protecting virus samples in the test case code. The specific embodiments are as follows:
[0049] The present application embodiment provides a method for protecting virus samples in test case codes. Figure 1 As shown, the virus sample protection method in the test case code includes the following steps S101-S104:
[0050] S101. Receive a first test case code uploaded by a first developer.
[0051] Among them, the first test case code carries a target virus Trojan sample; the target virus Trojan sample is obtained by encrypting and compressing the initial virus Trojan sample.
[0052] The virus sample protection method in the test case code provided in the embodiment of the present application is mainly aimed at the automated test case code writing scenario of multiple people working together. In the automated test case code writing scenario of multiple people working together, each team member creates a functional branch or a test branch in his or her own local environment and starts writing the test case code. When the first developer finishes writing, the first test case code can be obtained, and then the first developer uploads the first test case code to the main branch, which is then available for other team members to pull the first test case code from the main branch.
[0053] Specifically, the main branch Master of the Git distributed version control system can be used to receive the first test case code uploaded by the first developer. Specifically, the first developer can write the test case code locally on his server to generate the first test case code, and add the target virus Trojan sample to the first test case code so that the first test case code carries the target virus Trojan sample. After the main branch Master receives the first test case code uploaded by the first developer, it will generate the first version of the test case code based on the first test case code.
[0054] Specifically, the initial virus Trojan horse sample is a binary executable file. In Windows system, executable file is a common carrier format of virus Trojan horse. The file extension of the virus Trojan horse sample on Windows is .exe, which supports Windows and Linux operating systems. Therefore, when the initial virus Trojan horse sample is encrypted and compressed, it can be completed by common file compression software and file encryption software.
[0055] It should be noted that in order to ensure the uniqueness and accuracy of the test results when testing a certain version of the test case code, the initial virus Trojan sample only includes one virus Trojan to avoid mutual influence between multiple virus Trojans during testing, resulting in inaccurate test results.
[0056] S102. Generate a first version of test case code based on the first test case code.
[0057] For example, when a test case code is written by 5 developers, and each developer writes the test case code locally on his own server, then when developer A finishes writing the part he is responsible for and submits it to the main branch Master of the Git distributed version control system, the Git distributed version control system will generate a new version of the test case code based on the test case code written by developer A, for example, the first version of the test case code; at this time, other developers can pull the first version of the test case code from the main branch Master of the Git distributed version control system for review or continue to write based on the first version of the test case code.
[0058] Therefore, in the above embodiment, when the first version of the test case code includes the target virus Trojan sample, once other developers pull the first version of the test case code to their local servers, since the target virus Trojan sample carried in the first version of the test case code is compressed and encrypted, if other developers do not actively decompress and decrypt the target virus Trojan sample, the local antivirus software on the server of other developers cannot detect the target virus Trojan sample, and thus cannot detect and kill the target virus Trojan sample. The target virus Trojan sample carried in the first version of the test case code can be protected, so that in the scenario of multi-person collaborative automated test case code writing, the developer's local server can be prevented from accidentally deleting the target virus Trojan sample, affecting the execution of subsequent tests.
[0059] S103: Receive a pull instruction from a second developer for the first version of the test case code.
[0060] Specifically, every time a developer uploads the written test case code to the Master branch of the version control system, a test case code with the corresponding version number will be generated. Other developers can pull the test case code with the corresponding version number from the Master branch of the version control system according to work needs.
[0061] S104. In response to the pull instruction, the first version of the test case code is sent to a server corresponding to the second developer to receive the second test case code uploaded by the second developer.
[0062] The second test case code is obtained by the second developer based on the first test case code; the second test case code carries the target virus Trojan sample.
[0063] For example, refer to Figure 2 , is a schematic diagram of a process framework for virus sample protection in a test case code provided by an embodiment of the present application, such as Figure 2As shown, after developer A submits the first test case code from the local branch to the Master main branch 21 of the version control system, a first version of the test case code will be generated based on the first test case code, and then other developers can pull the first version of the test case code from the Master main branch 21 of the version control system as needed; specifically, when developer A is writing the test case code, he adds the encrypted and compressed target virus Trojan sample to the test case code, and uploads it to the Master main branch of the version control system, and then generates the test case code 2.0 (version number 2.0); then after developer B pulls the test case code 2.0 from the Master main branch of the version control system, since the test case code 2.0 includes the encrypted and compressed virus Trojan sample, the local server of developer B will not detect and kill the virus Trojan sample, thereby ensuring the integrity of the virus Trojan sample and avoiding affecting subsequent tests.
[0064] It should be noted that, after sending the first version of the test case code to the server corresponding to the second developer in response to the pull instruction to receive the second test case code uploaded by the second developer, the method further includes:
[0065] After receiving the second test case code uploaded by the second developer, a second version of the test case code is generated based on the second test case code.
[0066] Exemplarily, developer B pulls the first version of the test case code from the Master main branch to the local server, reviews and modifies it, or continues to write it on the local server, and then obtains new test case code based on the first version of the test case code, which is then uploaded by developer B to the Master main branch 21 of the version control system, and then a new version of the test case code is generated.
[0067] The virus sample protection method provided in the embodiment of the present application is specifically as follows: receiving a first test case code uploaded by a first developer; the first test case code carries a target virus Trojan sample; the target virus Trojan sample is obtained by encrypting and compressing the initial virus Trojan sample; generating a first version of the test case code based on the first test case code; receiving a pull instruction for the first version of the test case code from a second developer; in response to the pull instruction, sending the first version of the test case code to a server corresponding to the second developer to receive a second test case code uploaded by the second developer, the second test case code being obtained by the second developer based on the first test case code; the second test case code carries the target virus Trojan sample. In the present application, when the first version of the test case code is generated based on the first test case code, since the target virus Trojan sample in the first test case code is obtained by encrypting and compressing the initial virus Trojan sample; then after other developers pull the first version of the test case code to their own servers, since the target virus Trojan sample is compressed and encrypted, even if there is antivirus software on the servers of other developers, the target virus Trojan sample cannot be detected and killed, thereby ensuring the integrity of the target virus Trojan sample, avoiding affecting the writing of subsequent test case codes, and further ensuring the smooth execution of the test.
[0068] As an extension and refinement of the above embodiment, after generating the first version of the test case code based on the first test case code, the method for protecting virus samples in the test case code further includes the following steps:
[0069] The first version of the test case code is deployed to a target sandbox environment to test the first version of the test case code.
[0070] In some embodiments, developers can complete the writing and testing of automated tests based on the pytest test framework (a test framework for implementing automated case writing), and then create the sandbox environment in the pytest test framework, so that after generating a new version of the test case, the first version of the test case code can be directly pulled from the Master main branch of the version control system to the sandbox environment for execution to complete the test. Specifically, multiple versions of test case code will be stored in the Master main branch of the version control system, such as the first version of the test case code mentioned above, and the first version of the test case code will be pulled to the sandbox environment for testing.
[0071] In an embodiment of the present application, the target sandbox environment will be created in advance to test the first version of the test case code in the target sandbox environment; wherein the sandbox environment is also called a test environment and a development environment, which is an environment provided to developers for development and testing. It is a security mechanism in the field of computer security, providing an isolated environment for running programs. It is usually used as an experiment for some programs whose sources are unreliable, destructive, or whose program intent cannot be determined. For example, in the software development process, for example, a new browser plug-in can be developed, which can be tested in a sandbox to ensure that the plug-in does not affect the stability and security of the browser.
[0072] Specifically, the creation of a sandbox environment can be achieved by running a virtual operating system on a real system and running the program in a virtual machine, which can achieve isolation and restriction of the program. Virtual machines can provide a high degree of isolation and security, but also require higher system resources and performance overhead. The sandbox environment is an important security technology that can provide isolation and restriction for the operation of programs to prevent damage to the real system. It has a wide range of applications in software development, malware analysis, safe browsing and other fields.
[0073] Since the sandbox environment isolates the test case code running inside from the operating system and other programs, the test case code running in the sandbox can only access the resources inside the sandbox and cannot directly access the key parts of the real system, such as system files and registry, which can effectively prevent malicious programs from damaging the system. Even if the program has problems in the sandbox, it will not affect the stability and security of the system. Therefore, refer to Figure 3 As shown, in the embodiment of the present application, when the first version of the test case code is deployed to the target sandbox environment to test the first version of the test case code, the following steps S301 to S303 need to be performed:
[0074] S301. Obtain the target virus Trojan sample in the first version of the test case code.
[0075] In some embodiments, after the first version of the test case code is deployed to the target sandbox environment, in order to play a role in the target virus Trojan sample, it is necessary to first obtain the target virus Trojan sample from the first version of the test case code, and then execute the following S302 to obtain the initial virus Trojan sample.
[0076] S302: Decrypt and decompress the target virus Trojan sample to obtain the initial virus Trojan sample.
[0077] In some embodiments, the target virus Trojan horse sample can be decrypted and decompressed by any decompression and decryption method, and the present application does not impose any limitation on this, and the initial virus Trojan horse sample can be obtained from the target virus Trojan horse sample.
[0078] S303: Test the first version of the test case code in combination with the initial virus Trojan sample.
[0079] Specifically, when testing the host security performance in a sandbox environment, the first version of the test case code is deployed into the sandbox environment, and the initial virus Trojan sample is obtained through the target virus Trojan sample carried in the first version of the test case code. After obtaining the initial virus Trojan sample, the initial virus Trojan sample will be executed. If the initial virus Trojan sample is found by the host, a security alarm event of the initial virus Trojan will be reported. The initial virus Trojan file can be found based on information such as the virus Trojan file path in the security alarm event details, indicating that the current host can identify the initial virus Trojan sample and has a certain degree of security for the initial virus Trojan sample; if the initial virus Trojan sample is not found by the host, it means that the current host cannot identify the initial virus Trojan sample, and the developer needs to further enhance the host's ability to identify the initial virus Trojan sample to improve the host's security performance.
[0080] In some embodiments, corresponding anti-virus software may be configured in the sandbox environment. Therefore, in order to further prevent the anti-virus software in the sandbox environment from detecting and killing the initial virus Trojan horse sample that has been decompressed and decrypted, the embodiment of the present application will also perform the following steps:
[0081] In the target sandbox environment, a target whitelist is configured for the local antivirus software.
[0082] The target whitelist includes the initial virus Trojan horse sample and the first version test case code.
[0083] Specifically, a corresponding whitelist is configured for the antivirus software in the sandbox environment. During each test, the corresponding test case code and the name of the initial virus Trojan sample carried in the test case code are added to the target whitelist to prevent the antivirus software in the sandbox environment from detecting and killing the initial virus Trojan sample that has been decompressed and decrypted, thereby further ensuring the smooth execution of the test.
[0084] When testing a certain version of the test case code (which contains encrypted and compressed virus and Trojan samples) through a sandbox environment, a whitelist is set up and the test case code and virus and Trojan samples are added to the whitelist to avoid detecting and killing the test case code and virus and Trojans in the sandbox environment, thereby ensuring the smooth execution of the test case code.
[0085] It should be noted that during the testing process, the initial virus and Trojan samples used for testing may be changed at any time, and the version of the test case code may also be updated at any time. Therefore, every time a test is completed in the sandbox environment, the whitelist corresponding to the antivirus software needs to be cleared, and before the next test, the corresponding initial virus and Trojan samples and the version of the test case code need to be re-added to the whitelist.
[0086] Based on the above, the virus sample protection method provided by the present application further includes the following steps:
[0087] After the test of the first version of the test case code is completed, the initial virus Trojan horse sample and the first version of the test case code in the target whitelist are cleared.
[0088] Based on the same inventive concept, as an implementation of the above method, the embodiment of the present application also provides a virus sample protection device in the test case code. This embodiment corresponds to the aforementioned method embodiment. For ease of reading, this embodiment will no longer repeat the details of the aforementioned method embodiment one by one, but it should be clear that a virus sample protection device in the test case code in this embodiment can correspond to the implementation of all the contents in the aforementioned method embodiment.
[0089] The present application embodiment provides a device for protecting virus samples in test case codes. Figure 4 FIG. 1 is a schematic diagram of the structure of the virus sample protection device in the test case code, as shown in FIG. Figure 4 As shown, the virus sample protection device 400 for the test case code includes:
[0090] The receiving unit 401 is used to receive a first test case code uploaded by a first developer; the first test case code carries a target virus Trojan sample; the target virus Trojan sample is obtained by encrypting and compressing the initial virus Trojan sample;
[0091] A generating unit 402, configured to generate a first version of a test case code based on the first test case code;
[0092] A pulling unit 403 is used to receive a pulling instruction from a second developer for the first version of the test case code;
[0093] Processing unit 404 is used to send the first version of the test case code to the server corresponding to the second developer in response to the pull instruction, so as to receive the second test case code uploaded by the second developer, where the second test case code is obtained by the second developer based on the first test case code; the second test case code carries the target virus Trojan sample.
[0094] As an optional implementation of the embodiment of the present application, the virus sample protection device in the test case code also includes: a testing unit 405, which is used to deploy the first version of the test case code to the target sandbox environment to test the first version of the test case code.
[0095] As an optional implementation of the embodiment of the present application, the test unit 405 is specifically used to obtain the target virus Trojan sample in the first version of the test case code; decrypt and decompress the target virus Trojan sample to obtain the initial virus Trojan sample; and test the first version of the test case code in combination with the initial virus Trojan sample.
[0096] As an optional implementation of the embodiment of the present application, the testing unit 405 is also used to configure a target whitelist for the local antivirus software in the target sandbox environment; the target whitelist includes the initial virus Trojan sample and the first version test case code.
[0097] As an optional implementation of the embodiment of the present application, the testing unit 405 is also used to clear the initial virus Trojan sample and the first version of the test case code in the target whitelist after the test of the first version of the test case code is completed.
[0098] As an optional implementation of the embodiment of the present application, the generating unit 402 is further used to generate a second version of the test case code based on the second test case code after receiving the second test case code uploaded by the second developer.
[0099] Based on the same inventive concept, an embodiment of the present disclosure also provides an electronic device. Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure, such as Figure 5 As shown, the electronic device provided in this embodiment includes: a memory 501 and a processor 502, wherein the memory 501 is used to store a computer program; and the processor 502 is used to execute the audio data processing method provided in the above embodiment when executing the computer program.
[0100] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the computing device implements the virus sample protection method for the test case code provided in the above embodiment.
[0101] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media that include computer-usable program code.
[0102] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0103] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0104] Computer readable media include permanent and non-permanent, removable and non-removable storage media. Storage media can be implemented by any method or technology to store information, and the information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0105] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for protecting virus samples in test case codes, characterized in that: include: receiving a first test case code uploaded by a first developer; The first test case code carries a target virus Trojan sample; The target virus Trojan horse sample is obtained by encrypting and compressing the initial virus Trojan horse sample; Generate a first version of test case code based on the first test case code; receiving a pull instruction from a second developer for the first version of the test case code; In response to the pull instruction, the first version of the test case code is sent to the server corresponding to the second developer to receive the second test case code uploaded by the second developer, wherein the second test case code is obtained by the second developer based on the first test case code; the second test case code carries the target virus Trojan sample.
2. The method according to claim 1, characterized in that: After generating the first version of the test case code based on the first test case code, the method further includes: The first version of the test case code is deployed to a target sandbox environment to test the first version of the test case code.
3. The method according to claim 2, characterized in that The step of deploying the first version of the test case code to a target sandbox environment to test the first version of the test case code includes: Obtain the target virus Trojan sample in the first version of the test case code; Decrypting and decompressing the target virus Trojan horse sample to obtain the initial virus Trojan horse sample; The first version of the test case code is tested in combination with the initial virus Trojan sample.
4. The method according to any one of claims 2 to 3, characterized in that: The method further comprises: In the target sandbox environment, a target whitelist is configured for the local antivirus software; the target whitelist includes the initial virus Trojan sample and the first version test case code.
5. The method according to claim 4, characterized in that The method further comprises: After the test of the first version of the test case code is completed, the initial virus Trojan horse sample and the first version of the test case code in the target whitelist are cleared.
6. The method according to claim 1, characterized in that In response to the pull instruction, the first version of the test case code is sent to a server corresponding to the second developer to receive the second test case code uploaded by the second developer, and the method further includes: After receiving the second test case code uploaded by the second developer, a second version of the test case code is generated based on the second test case code.
7. A method and device for protecting virus samples in test case codes, characterized in that: include: A receiving unit, configured to receive a first test case code uploaded by a first developer; The first test case code carries a target virus Trojan sample; The target virus Trojan horse sample is obtained by encrypting and compressing the initial virus Trojan horse sample; A generating unit, configured to generate a first version of a test case code based on the first test case code; A pulling unit, configured to receive a pulling instruction from a second developer for the first version of the test case code; A processing unit is used to send the first version of the test case code to the server corresponding to the second developer in response to the pull instruction, so as to receive the second test case code uploaded by the second developer, wherein the second test case code is obtained by the second developer based on the first test case code; the second test case code carries the target virus Trojan sample.
8. The device according to claim 7, characterized in that The device also includes: The testing unit is used to deploy the first version of the test case code to a target sandbox environment to test the first version of the test case code.
9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store a computer program; and the processor is used to enable the electronic device to implement the virus sample protection method for the test case code as described in any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a computing device, the computing device implements the virus sample protection method in the test case code according to any one of claims 1 to 6.
