Software identification information acquisition method and device, electronic device and storage medium
Patent Information
- Application Number
- CN202211733415.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2042-12-30
AI Technical Summary
[0004]本申请实施例提供了一种软件识别信息获取方法及装置、电子设备和存储介质,旨在解决相关技术中因软件更新而重新计算软件识别信息导致后台维护资源很大的技术问题
[0019] The above technical solution can generate software identification information based on a predetermined number of bytes in a specified code segment. Since the specified code segment remains unchanged when the target software is updated, when the target software is updated, based on the specified code segment The software identification information generated by a predetermined number of bytes is also unchanged. In other words, compared with the technical solution in the related art that recalculates the software identification information due to software update, the technical solution of the present application can keep the software identification information unchanged during the software update, thereby reducing the resources consumed by regenerating the software identification information. It reduces the cost of maintaining software identification information and improves the convenience and security of software identification.
Smart Images

Figure CN116089912B_ABST
Abstract
Description
[Technical field]
[0001] The present application relates to the field of computer technology, and in particular to a method and device for obtaining software identification information, an electronic device, and a storage medium. [Background technology]
[0002] In order to prevent illegal software from running in time, software identification information is set for the software in the related technology. The software can be identified through the software identification information, so as to further determine whether it is software that is identified as illegal. However, the generation of existing software identification information depends on the software program itself. Once the software is updated and the software program changes, it is necessary to recalculate new software identification information for the software, and this calculation consumes a lot of background maintenance resources.
[0003] Therefore, how to reduce the consumption caused by recalculating software identification information due to software updates has become a technical problem that needs to be solved urgently. [Summary of the invention]
[0004] The embodiments of the present application provide a method and device for obtaining software identification information, an electronic device and a storage medium, aiming to solve the technical problem in the related art that recalculating software identification information due to software updates results in a large amount of background maintenance resources.
[0005] In a first aspect, an embodiment of the present application provides a method for obtaining software identification information, comprising: obtaining a dos header of a pe file of a target software; obtaining a pe header of the pe file based on the last byte of the dos header; determining a specified code segment in the main program according to the pe header; extracting a predetermined number of bytes from the specified code segment; determining a hash value of the target software based on the bytes and a predetermined hash value calculation method as the software identification information of the target software.
[0006] In a possible design, before obtaining the DOS header of the PE file of the target software, it also includes: installing the target software and updating the registry and system configuration information based on the installation operation; and obtaining the main program of the target software based on the registry or the system configuration information.
[0007] In a possible design, determining the specified code segment in the main program based on the PE header includes: determining the target operating platform of the target software based on the first byte of the PE header; determining the length of the PE header according to the PE header length determination method corresponding to the target operating platform; offsetting based on the first byte of the PE header and the length of the PE header to obtain multiple section tables of the PE file; determining the target section table where the .text section is located in the multiple section tables, and obtaining the .text section in the target section table as the specified code segment.
[0008] In one possible design, extracting a predetermined number of bytes from the specified code segment includes: extracting a predetermined number of bytes from the specified code segment according to a specified extraction rule.
[0009] In a possible design, determining the hash value of the target software based on the bytes and a predetermined hash value calculation method includes: processing the bytes through an md5 algorithm, a sha1 algorithm, or an sm3 algorithm to obtain the hash value of the target software.
[0010] In a second aspect, an embodiment of the present application provides a software identification method, comprising: in response to a request to run the target software, obtaining software identification information of the target software; if the software identification information matches the specified identification information in a software blacklist, preventing the target software from running, wherein, before obtaining the software identification information of the target software, the software identification information is generated by executing any one of the methods described in the first aspect above.
[0011] In a third aspect, an embodiment of the present application provides a software identification information acquisition device, comprising: a first acquisition unit, used to acquire a dos header of a pe file of a target software; a second acquisition unit, used to acquire a pe header of the pe file based on the last byte of the dos header; a code segment determination unit, used to determine a specified code segment in the main program according to the pe header; a byte extraction unit, used to extract a predetermined number of bytes from the specified code segment; a hash calculation unit, used to determine a hash value of the target software based on the bytes and a predetermined hash value calculation method, as the software identification information of the target software.
[0012] In a possible design, the software identification information acquisition device also includes: a software installation unit, used to install the target software before obtaining the DOS header of the PE file of the target software, and update the registry and system configuration information based on the installation operation; a main program acquisition unit, used to obtain the main program of the target software based on the registry or the system configuration information.
[0013] In one possible design, the code segment determination unit is used to: determine the target operating platform of the target software based on the first byte of the PE header; determine the length of the PE header according to the PE header length determination method corresponding to the target operating platform; offset based on the first byte of the PE header and the length of the PE header to obtain multiple section tables of the PE file; determine the target section table where the .text section is located in the multiple section tables, and obtain the .text section in the target section table as the specified code segment.
[0014] In one possible design, the byte extraction unit is used to extract a predetermined number of bytes from the specified code segment according to a specified extraction rule.
[0015] In a possible design, the hash calculation unit is used to process the bytes using an md5 algorithm, a sha1 algorithm, or an sm3 algorithm to obtain a hash value of the target software.
[0016] In a fourth aspect, an embodiment of the present application provides a software identification device, comprising: a software identification information generation unit, used to generate software identification information based on the software identification information acquisition device described in the third aspect above; an identification information acquisition unit, used to obtain the software identification information of the target software in response to a request to run the target software; and a software identification unit, used to prevent the target software from running if the software identification information matches the specified identification information in a software blacklist.
[0017] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method described in the first aspect above.
[0018] In a sixth aspect, an embodiment of the present application provides a storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the method described in the first aspect above.
[0019] The above technical solution can generate software identification information based on a predetermined number of bytes in a specified code segment. Since the specified code segment remains unchanged when the target software is updated, the software identification information generated based on the predetermined number of bytes in the specified code segment also remains unchanged when the target software is updated. In other words, compared with the technical solution in the related art that recalculates the software identification information due to software update, the technical solution of the present application can keep the software identification information unchanged when the software is updated, thereby reducing the resources consumed by regenerating the software identification information, reducing the cost of maintaining the software identification information, and improving the convenience and security of software identification.
Brief Description of the Drawings
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1A flowchart of a method for obtaining software identification information according to an embodiment of the present application is shown;
[0022] Figure 2 A flowchart showing a method for obtaining software identification information according to another embodiment of the present application is shown;
[0023] Figure 3 A flowchart of a software identification method according to an embodiment of the present application is shown;
[0024] Figure 4 A schematic diagram showing the interaction process between the cloud and the local end according to an embodiment of the present application is shown;
[0025] Figure 5 A block diagram of a device for acquiring software identification information according to an embodiment of the present application is shown;
[0026] Figure 6 A block diagram of an electronic device according to an embodiment of the present application is shown. [Specific implementation method]
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] Figure 1 A flowchart of a method for acquiring software identification information according to an embodiment of the present application is shown.
[0029] like Figure 1 As shown, a method for obtaining software identification information according to an embodiment of the present application includes:
[0030] Step 102, obtaining the DOS header of the PE file of the target software.
[0031] Step 104: based on the last byte of the DOS header, obtain the PE header of the PE file.
[0032] pe files are executable files in Windows systems. Common file suffixes include but are not limited to exe, dll, sys, com, ocx, etc. The format of pe files running on 32-bit Windows systems is pe32, and the format of pe files running on 64-bit Windows systems is pe32+. One of the differences between pe files of different formats is that their pe headers are different.
[0033] The DOS header of a PE file is a piece of binary data, and its last byte is used to reflect the position of the PE header in the PE file, so the PE header of the PE file can be obtained from it.
[0034] Step 106: Determine a specified code segment in the main program according to the PE header.
[0035] The PE header is equivalent to the location reference information of the specified code segment. In other words, the location of the PE header can be used as a condition for determining the location of the specified code segment. The specified code segment often has a feature segment that will not change due to software updates. The software identification information of the software is determined based on the feature segment that will not change due to software updates. When the software is updated, the software identification information of the software can be guaranteed to remain unchanged, thereby avoiding the reset of the software identification information caused by the software update and saving computing resources.
[0036] Specifically, the target operating platform of the target software can be determined based on the first byte of the PE header; the length of the PE header can be determined according to the PE header length determination method corresponding to the target operating platform; an offset is performed based on the first byte of the PE header and the length of the PE header to obtain multiple section tables of the PE file; a target section table where the .text section is located is determined in the multiple section tables, and the .text section in the target section table is obtained as the designated code segment.
[0037] The first byte of the PE header reflects the target operating platform of the target software, which includes but is not limited to 32-bit platforms and 64-bit platforms, and can also be any other platform that can run the target software. The calculation method of the PE header length is different in different operating platforms. Therefore, the length of the PE header can be determined according to the PE header length determination method corresponding to the target operating platform.
[0038] Specifically, the size of the optional PE header is different in different operating platforms. In the 64-bit platform, the PE header is the IMAGE_OPTIONAL_HEADER64 structure. The length of the PE header is obtained by sizeof(IMAGE_OPTIONAL_HEADER64).
[0039] On a 32-bit platform, the PE header is IMAGE_OPTIONAL_HEADER, and sizeof(IMAGE_OPTIONAL_HEADER) is used to get the length of the PE header.
[0040] After determining the length of the PE header, since there are multiple section tables after the PE header, multiple section tables can be obtained by offsetting the first byte of the PE header and the length of the PE header. Each section table is used to describe different functions involved in the software, such as storing initial data, storing calling functions, etc. At the same time, each section table includes multiple list items, or multiple code segments. Further, each section table can be traversed to determine the section table where the .text section is located, and the .text section can be extracted as the specified code segment.
[0041] Step 108: extract a predetermined number of bytes from the specified code segment.
[0042] In one possible design, extracting a predetermined number of bytes from the specified code segment includes: extracting a predetermined number of bytes from the specified code segment according to a specified extraction rule.
[0043] The specified extraction rule may be: extracting a plurality of bytes located at a plurality of specified positions in the specified code segment, where the number of the plurality of specified positions is a predetermined number.
[0044] The specified extraction rule may also be: extracting bytes located at a plurality of specified positions in the specified code segment, wherein the number of bytes extracted at each specified position is a specified plurality.
[0045] Through the above technical solution, the predetermined number of bytes obtained can be made more complex, thereby improving the complexity of the software identification information obtained with the predetermined number of bytes, improving the uniqueness of the software identification information for the target software, and improving software security.
[0046] Optionally, the predetermined number is 60. Of course, the predetermined number may be any number that meets the security requirements for the software identification information, and is not limited to the example of 60.
[0047] Step 110: Determine the hash value of the target software based on the bytes and a predetermined hash value calculation method as software identification information of the target software.
[0048] Finally, the software identification information is generated based on a predetermined number of bytes in the specified code segment. Since the predetermined number of bytes is a characteristic segment in the specified code segment that will not change due to software updates, when the target software is updated, the software identification information generated based on the predetermined number of bytes in the specified code segment will also remain unchanged. In other words, compared with the technical solution in the related art that recalculates the software identification information due to software updates, the technical solution of the present application can keep the software identification information unchanged when the software is updated, thereby reducing the resources consumed by regenerating the software identification information, reducing the cost of maintaining the software identification information, and improving the convenience and security of software identification.
[0049] In a possible design, determining the hash value of the target software based on the bytes and a predetermined hash value calculation method includes: processing the bytes through an md5 algorithm, a sha1 algorithm, or an sm3 algorithm to obtain the hash value of the target software.
[0050] Among them, the md5 algorithm, namely the MD5 message digest algorithm, is a widely used cryptographic hash function that can convert a predetermined number of bytes extracted from the specified code segment into a 128-bit (16-byte) hash value as the software identification information of the target software. The sha1 algorithm is a type of hash algorithm that can process a predetermined number of bytes extracted from the specified code segment in 512-bit groups and output a 160-bit message digest as the software identification information of the target software. The sm3 algorithm is a cryptographic hash function standard that uses a predetermined number of bytes extracted from the specified code segment as the input of the hash function and outputs a message digest as the software identification information of the target software through the hash function.
[0051] It should be noted that the predetermined hash value calculation method in this application includes but is not limited to the md5 algorithm, the sha1 algorithm or the sm3 algorithm, and can also be any calculation method that can convert a predetermined number of bytes extracted from the specified code segment into a shorter ciphertext.
[0052] Figure 2 A flowchart of a method for acquiring software identification information according to another embodiment of the present application is shown.
[0053] like Figure 2 As shown, according to another embodiment of the present application, a method for obtaining software identification information includes:
[0054] Step 202: Install the target software, and update the registry and system configuration information based on the installation operation.
[0055] Step 204: Based on the registry or the system configuration information, obtain the main program of the target software.
[0056] To obtain the software identification information of the target software, it is necessary to obtain its pe file from its main program, and only when the target software is installed can its main program be obtained. Therefore, the target software can be installed and its main program can be retrieved through the registry updated after installation or the system configuration information.
[0057] Step 206, obtaining the DOS header of the PE file of the target software.
[0058] Step 208: Obtain the PE header of the PE file based on the last byte of the DOS header.
[0059] pe files are executable files in Windows systems. Common file suffixes include but are not limited to exe, dll, sys, com, ocx, etc. The format of pe files running on 32-bit Windows systems is pe32, and the format of pe files running on 64-bit Windows systems is pe32+. One of the differences between pe files of different formats is that their pe headers are different.
[0060] The DOS header of a PE file is a piece of binary data, and its last byte is used to reflect the position of the PE header in the PE file, so the PE header of the PE file can be obtained from it.
[0061] Step 210: determine the target operating platform of the target software based on the first byte of the PE header.
[0062] The first byte of the PE header reflects the target operating platform of the target software, which includes but is not limited to 32-bit platforms and 64-bit platforms, and can also be any other platform that can run the target software. The method for determining the length of the PE header is different in different operating platforms. Therefore, the target operating platform on which the target software is installed can be determined first, so that the corresponding method for determining the length of the PE header can be selected for the target operating platform in the subsequent steps.
[0063] Step 212, determining the length of the PE header according to the PE header length determination method corresponding to the target operating platform.
[0064] The size of the optional PE header is different in different operating platforms. In the 64-bit platform, the PE header is the IMAGE_OPTIONAL_HEADER64 structure. The length of the PE header is obtained by sizeof(IMAGE_OPTIONAL_HEADER64).
[0065] On a 32-bit platform, the PE header is IMAGE_OPTIONAL_HEADER, and sizeof(IMAGE_OPTIONAL_HEADER) is used to get the length of the PE header.
[0066] Step 214, performing an offset based on the first byte of the PE header and the length of the PE header to obtain multiple section tables of the PE file.
[0067] Step 216, determining the target section table where the .text section is located in the multiple section tables, and obtaining the .text section in the target section table as the designated code segment.
[0068] After determining the length of the PE header, since there are multiple section tables after the PE header, multiple section tables can be obtained by offsetting the first byte of the PE header and the length of the PE header. Each section table is used to describe different functions involved in the software, such as storing initial data, storing calling functions, etc. At the same time, each section table includes multiple list items, or multiple code segments. Further, each section table can be traversed to determine the section table where the .text section is located, and the .text section can be extracted as the specified code segment.
[0069] Step 218: extract a predetermined number of bytes from the specified code segment.
[0070] Optionally, the predetermined number is 60. Of course, the predetermined number may be any number that meets the security requirements for the software identification information, and is not limited to the example of 60.
[0071] Step 220: Determine the hash value of the target software based on the bytes and a predetermined hash value calculation method as software identification information of the target software.
[0072] Finally, software identification information is generated based on a predetermined number of bytes in a specified code segment. Since the specified code segment remains unchanged when the target software is updated, the software identification information generated based on the predetermined number of bytes in the specified code segment also remains unchanged when the target software is updated.
[0073] Through this technical solution, the software identification information can be kept unchanged when the software is updated, thereby reducing the resources consumed by regenerating the software identification information, reducing the cost of maintaining the software identification information, and improving the convenience and security of software identification.
[0074] Figure 3 A flowchart of a software identification method according to an embodiment of the present application is shown.
[0075] like Figure 3 As shown, a software identification method according to an embodiment of the present application includes:
[0076] Step 302: In response to a request to run the target software, obtain software identification information of the target software.
[0077] Step 304: If the software identification information matches the specified identification information in the software blacklist, the target software is prevented from running.
[0078] The software identification information can be used to identify the identity of the target software. By matching the software identification information of the target software with the specified identification information in the software blacklist, it can be determined whether the target software is a member of the software blacklist. If the target software is a member of the software blacklist, the target software can be prevented from running to protect system security and network security.
[0079] Before step 302, the method further includes: generating software identification information by executing any one of the technical solutions in any of the above embodiments. Therefore, the technical solution has all the above technical effects, which will not be described in detail here.
[0080] It can be known that the process of generating the software identification information can be performed in the cloud or locally.
[0081] Figure 4 FIG. 1 is a schematic diagram showing the interaction process between the cloud and the local end according to an embodiment of the present application. Figure 4 As shown, an automatic download and installation module, an analysis main program module, a hash extraction module and a feature hash database are provided in the cloud, while an external call module is provided on the local side.
[0082] Specifically, in the cloud, the automatic download and installation module installs the target software, and updates the registry and system configuration information based on the installation operation, so as to obtain the main program of the target software based on the registry or the system configuration information.
[0083] The main program analysis module obtains the dos header of the pe file of the target software, and obtains the pe header of the pe file according to the last byte of the dos header. Then, based on the first byte of the pe header, the target operating platform of the target software is determined. Then, according to the pe header length determination method corresponding to the target operating platform, the length of the pe header is determined. Next, based on the first byte of the pe header and the length of the pe header, an offset is performed to obtain multiple section tables of the pe file. At this point, the target section table where the .text section is located is determined in the multiple section tables, and the .text section in the target section table is obtained as the designated code segment.
[0084] Next, the hash extraction module extracts a predetermined number of bytes from the designated code segment, and determines the hash value of the target software based on the bytes and a predetermined hash value calculation method as software identification information of the target software.
[0085] The feature hash database can store the software identification information of the target software generated by the hash extraction module.
[0086] On the local side, in response to the target software's running request, the feature hash database on the cloud is accessed through the external call module to call the software identification information of the target software. If the software identification information matches the specified identification information in the software blacklist, the local side blocks the target software from running, otherwise, the local side allows the target software to run.
[0087] In the present technical solution, software identification information can be used to identify the identity of the target software. By matching the software identification information of the target software with the specified identification information in the software blacklist, it can be determined whether the target software is a member of the software blacklist. Therefore, if the target software is a member of the software blacklist, the target software can be prevented from running to protect system security and network security.
[0088] Figure 5 A block diagram of a software identification information acquisition device according to an embodiment of the present application is shown.
[0089] like Figure 5 As shown, according to an embodiment of the present application, a software identification information acquisition device 500 includes: a first acquisition unit 502, used to acquire a dos header of a pe file of a target software; a second acquisition unit 504, used to acquire a pe header of the pe file based on the last byte of the dos header; a code segment determination unit 506, used to determine a specified code segment in the main program according to the pe header; a byte extraction unit 508, used to extract a predetermined number of bytes from the specified code segment; a hash calculation unit 510, used to determine a hash value of the target software based on the bytes and a predetermined hash value calculation method as the software identification information of the target software.
[0090] In a possible design, the software identification information acquisition device 500 also includes: a software installation unit, which is used to install the target software before the DOS header of the PE file of the target software is obtained, and update the registry and system configuration information based on the installation operation; a main program acquisition unit, which is used to obtain the main program of the target software based on the registry or the system configuration information.
[0091] In one possible design, the code segment determination unit 506 is used to: determine the target operating platform of the target software based on the first byte of the PE header; determine the length of the PE header according to the PE header length determination method corresponding to the target operating platform; offset based on the first byte of the PE header and the length of the PE header to obtain multiple section tables of the PE file; determine the target section table where the .text section is located in the multiple section tables, and obtain the .text section in the target section table as the specified code segment.
[0092] In one possible design, the byte extraction unit 508 is used to extract a predetermined number of bytes from the specified code segment according to a specified extraction rule.
[0093] In a possible design, the hash calculation unit 510 is used to process the bytes using an md5 algorithm, a sha1 algorithm, or an sm3 algorithm to obtain a hash value of the target software.
[0094] The software identification information acquisition device 500 uses any of the solutions in the above embodiments, and therefore has all the above technical effects, which will not be described in detail here.
[0095] In addition, an embodiment of the present application also provides a software identification device, including: a software identification information generation unit, used to generate software identification information based on the software identification information acquisition device 500; an identification information acquisition unit, used to obtain the software identification information of the target software in response to a running request of the target software; a software identification unit, used to prevent the target software from running if the software identification information matches the specified identification information in the software blacklist.
[0096] All technical effects of the software identification information acquisition device 500 used by the software identification device are not described in detail here.
[0097] Figure 6 A block diagram of an electronic device according to an embodiment of the present application is shown.
[0098] like Figure 6 As shown, an electronic device 600 of an embodiment of the present application includes at least one memory 602; and a processor 604 in communication with the at least one memory 602; wherein the memory stores instructions executable by the at least one processor 604, and the instructions are configured to execute the solution described in any of the above embodiments. Therefore, the electronic device 600 has the same technical effects as any of the above embodiments, which will not be described in detail here.
[0099] The electronic devices of the embodiments of the present application exist in various forms, including but not limited to:
[0100] (1) Mobile communication equipment: This type of equipment is characterized by having mobile communication functions and its main purpose is to provide voice and data communications. This type of terminal includes: smart phones, multimedia phones, functional phones, and low-end phones.
[0101] (2) Ultra-mobile personal computer devices: These devices belong to the category of personal computers, have computing and processing functions, and generally also have mobile Internet access features. These terminals include: PDA, MID and UMPC devices, etc.
[0102] (3) Portable entertainment devices: These devices can display and play multimedia content. They include audio and video players, handheld game consoles, e-books, smart toys, and portable car navigation devices.
[0103] (4) Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.
[0104] (5) Other electronic devices with data interaction functions.
[0105] It should be noted that this application is based on the feature extraction of pe files under the Windows system, so it can be applied to various Surface devices.
[0106] In addition, an embodiment of the present application provides a storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the following steps: obtain a dos header of a pe file of a target software; obtain a pe header of the pe file based on the last byte of the dos header; determine a specified code segment in the main program according to the pe header; extract a predetermined number of bytes from the specified code segment; determine a hash value of the target software based on the bytes and a predetermined hash value calculation method as software identification information of the target software.
[0107] It should be noted that the functions or steps that can be implemented by the above-mentioned storage medium or electronic device can refer to the relevant description in the aforementioned method embodiment. In order to avoid repetition, they will not be described one by one here.
[0108] The above describes in detail the technical solution of the present application in combination with the accompanying drawings. Through the technical solution of the present application, the software identification information can be kept unchanged when the software is updated, thereby reducing the resources consumed by regenerating the software identification information, reducing the cost of maintaining the software identification information, and improving the convenience and security of software identification.
[0109] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0110] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0111] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0112] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0113] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0114] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for obtaining software identification information, characterized in that: include: Get the DOS header of the PE file of the target software; Based on the last byte of the DOS header, obtain the PE header of the PE file; According to the PE header, determining a specified code segment in the main program; extracting a predetermined number of bytes from the specified code segment; Based on the bytes and a predetermined hash value calculation method, determining a hash value of the target software as software identification information of the target software; Determining a specified code segment in the main program according to the PE header includes: Determining the target operating platform of the target software based on the first byte of the PE header; Determine the length of the PE header according to the PE header length determination method corresponding to the target operating platform; Based on the first byte of the PE header and the length of the PE header, an offset is performed to obtain multiple section tables of the PE file; A target section table where the .text section is located is determined in the multiple section tables, and the .text section in the target section table is obtained as the designated code segment.
2. The method for obtaining software identification information according to claim 1, characterized in that: Before obtaining the DOS header of the PE file of the target software, it also includes: Install the target software, and update the registry and system configuration information based on the installation operation; Based on the registry or the system configuration information, a main program of the target software is obtained.
3. The method for obtaining software identification information according to claim 1 or 2, characterized in that: The step of extracting a predetermined number of bytes from the specified code segment comprises: A predetermined number of bytes are extracted from the specified code segment according to a specified extraction rule.
4. The method for obtaining software identification information according to claim 1 or 2, characterized in that: The determining the hash value of the target software based on the bytes and a predetermined hash value calculation method includes: The bytes are processed by the md5 algorithm, the sha1 algorithm or the sm3 algorithm to obtain a hash value of the target software.
5. A software identification method, characterized in that: include: In response to a request for executing the target software, obtaining software identification information of the target software; If the software identification information matches the specified identification information in the software blacklist, the target software is prevented from running, wherein, before obtaining the software identification information of the target software, the software identification information is generated by executing the method described in any one of claims 1 to 4.
6. A software identification information acquisition device, characterized in that: include: A first acquisition unit is used to acquire a dos header of a pe file of a target software; A second acquisition unit is used to acquire a PE header of the PE file based on the last byte of the DOS header; A code segment determination unit, used to determine a specified code segment in a main program according to the PE header; a byte extraction unit, configured to extract a predetermined number of bytes from the specified code segment; A hash calculation unit, used to determine the hash value of the target software based on the bytes and a predetermined hash value calculation method as software identification information of the target software; The code segment determination unit is used to: determine the target operating platform of the target software based on the first byte of the PE header; determine the length of the PE header according to the PE header length determination method corresponding to the target operating platform; Based on the first byte of the PE header and the length of the PE header, an offset is performed to obtain multiple section tables of the PE file; a target section table where the .text section is located is determined in the multiple section tables, and the .text section in the target section table is obtained as the designated code segment.
7. A software identification device, characterized in that: include: a software identification information generating unit, configured to generate software identification information based on the software identification information acquiring device according to claim 6; an identification information acquisition unit, configured to acquire the software identification information of the target software in response to a request for executing the target software; The software identification unit is used to prevent the target software from running if the software identification information matches the specified identification information in the software blacklist.
8. An electronic device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method according to any one of claims 1 to 5.
9. A storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to execute the method according to any one of claims 1 to 5.
