Software development kit identification method and device, equipment, storage medium and product
By decompiling the installation package of mobile applications, the tool pack name is automatically identified and matched with the tool pack library, the problem of lack of automation of SDK identification in the prior art is solved, and the recognition efficiency and the accuracy of information disclosure are improved.
Patent Information
- Application Number
- CN202411710850.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-14
AI Technical Summary
In the prior art, third-party software development toolkits (SDKs) lack automated identification methods in mobile application development, resulting in the risk of negligence and omission when developers manually record SDK information, affecting the efficiency and accuracy of information disclosure.
By decompiling the application's installation package, obtaining the file directory and assembly code file path, determining the tool pack name based on the assembly file path, and matching it with the pre-collected tool pack library, to achieve automated tool pack identification.
The automated toolkit recognition is realized, reducing the dependence on manual recording, and improving the efficiency of toolkit recognition and the accuracy and comprehensiveness of information disclosure.
Smart Images

Figure CN119621075A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a software development toolkit identification method, device, equipment, storage medium and product. Background Art
[0002] In today's mobile Internet era, third-party software development kits (SDKs) have become an indispensable part of mobile application development. SDKs provide applications with a wealth of functions and services, such as advertising, payment, social sharing, etc., which greatly shortens the development cycle and improves application performance. However, with the widespread use of SDKs, the risks of privacy compliance are becoming increasingly prominent. Therefore, disclosing and updating the SDKs integrated in applications has become an important task for mobile application developers and privacy compliance specialists.
[0003] In related technologies, when developing or integrating a third-party SDK, developers usually manually record the relevant SDK information and synchronize this information to the privacy compliance officer through the company's internal process. Finally, the information of these third-party SDKs is disclosed and updated on the product side.
[0004] However, the above method is highly dependent on the conscious record of developers, and there is a great risk of negligence and omission. Developers may forget to record certain SDK information during the busy development process, or errors may occur when recording, resulting in inaccurate or incomplete information. There is a lack of automation in SDK identification, and the efficiency of SDK information disclosure is low. Summary of the invention
[0005] The embodiments of the present application provide a software development toolkit identification method, apparatus, device, storage medium and product, which can improve the toolkit identification efficiency. The technical solution is as follows.
[0006] In one aspect, a method for identifying a software development kit is provided, the method comprising:
[0007] Decompiling the installation package of the application and outputting a file directory, wherein the file directory is used to indicate a file distribution relationship between a plurality of code files obtained by decompilation, wherein the plurality of code files include an assembly code file, and the assembly code file has a corresponding relationship with a toolkit used in the application;
[0008] Traversing the assembly code files in the file directory to obtain an assembly file path, wherein the assembly file path is used to indicate a path for accessing the assembly code files in the file directory;
[0009] Determine a toolkit package name of the toolkit based on the assembly file path;
[0010] The toolkit package name is matched with a plurality of candidate toolkit package names in a toolkit library to obtain a toolkit identification result, wherein the toolkit identification result is used to indicate toolkit information used in the application.
[0011] On the other hand, a software development kit identification device is provided, the device comprising:
[0012] A compiling module, used to decompile the installation package of the application and output a file directory, wherein the file directory is used to indicate the file distribution relationship between multiple code files obtained by decompilation, wherein the multiple code files include an assembly code file, and the assembly code file has a corresponding relationship with the toolkit used in the application;
[0013] A processing module, used for traversing the assembly code files in the file directory to obtain an assembly file path, where the assembly file path is used to indicate a path for accessing the assembly code files in the file directory;
[0014] The processing module is further used to determine the toolkit package name of the toolkit based on the assembly file path;
[0015] The processing module is further used to match the toolkit package name with multiple candidate toolkit package names in a toolkit library to obtain a toolkit identification result, and the toolkit identification result is used to indicate the toolkit information used in the application.
[0016] In some embodiments, the processing module is further configured to:
[0017] Based on the package name similarity between the toolkit package name and the multiple candidate toolkit package names, determining a first package name matching the toolkit package name from the multiple candidate toolkit package names;
[0018] The toolkit information of the first toolkit is acquired from the toolkit library based on the first package name to obtain the toolkit identification result, wherein the toolkit library includes associations between the plurality of candidate toolkit package names and the plurality of candidate toolkit information.
[0019] In some embodiments, the processing module is further configured to:
[0020] Determine, based on character recognition, the character similarities respectively corresponding to the toolkit package name and the plurality of candidate toolkit package names;
[0021] The first package name whose character similarity meets the matching requirement is determined from the multiple candidate toolkit package names.
[0022] In some embodiments, the processing module is further configured to:
[0023] Obtaining a toolkit feature vector corresponding to the toolkit package name and a plurality of candidate feature vectors corresponding to the plurality of candidate toolkit package names;
[0024] Determine vector similarities corresponding to the toolkit feature vector and the plurality of candidate feature vectors;
[0025] The first package name whose vector similarity meets the matching requirement is determined from the multiple candidate toolkit package names.
[0026] In some embodiments, the toolkit package name includes at least two package name fields;
[0027] The processing module is further used for:
[0028] Based on the first number of package name fields in the toolkit package name, screening at least one first candidate toolkit package name including the candidate package name fields of the first number of fields from the multiple candidate toolkit package names, wherein the first candidate toolkit package name includes at least two first candidate package name fields;
[0029] Based on the at least two package name fields and the at least two first candidate package name fields, field matching is performed on the toolkit package name and the at least one first candidate toolkit package name to obtain the first package name matching the toolkit package name.
[0030] In some embodiments, the processing module is further configured to:
[0031] From left to right, perform field matching on the i-th package name field in the toolkit package name and the i-th first candidate package name field in the at least one first candidate toolkit package name to obtain the i-th field matching result, where i is a positive integer;
[0032] When the i-th field matching result satisfies the matching relationship, the i+1-th package name field in the toolkit package name is matched with the i+1-th first candidate package name field in the at least one first candidate toolkit package name to obtain the i+1-th field matching result, until at least two field matching results corresponding to the at least two package name fields both satisfy the matching relationship to obtain the first package name.
[0033] In some embodiments, the processing module is further configured to:
[0034] Traversing the multiple code files in the file directory;
[0035] In response to a first file suffix corresponding to the current code file, an access path of the current code file in the file directory is output to obtain the assembly file path, wherein the first file suffix is used to identify the assembly file path.
[0036] In some embodiments, the plurality of code files include a dynamic link library file, and the dynamic link library file corresponds to a toolkit used in the application;
[0037] The processing module is further used for:
[0038] Traversing the multiple code files in the file directory to obtain the dynamic link library file;
[0039] Printing the content of the dynamic link library file to obtain the file content, wherein the file content includes the toolkit contained in the dynamic link library file;
[0040] Text matching is performed between the multiple candidate toolkit names and the file content to obtain the toolkit identification result.
[0041] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the software development kit identification method as described in any of the above-mentioned embodiments of the present application.
[0042] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, a code set or an instruction set is stored in the storage medium, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the software development kit identification method as described in any of the above-mentioned embodiments of the present application.
[0043] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the software development kit identification method described in any of the above embodiments.
[0044] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0045] By determining the toolkit package name based on the assembly file path according to the location of the assembly file code in the decompiled file directory, the package name of the toolkit used in the application can be automatically and quickly obtained, and the obtained toolkit package name can be matched with the pre-collected toolkit library, so as to obtain the toolkit information according to the toolkit registration, realize automatic toolkit identification, avoid dependence on manual records, improve the efficiency of toolkit identification, and the accuracy and comprehensiveness of toolkit information disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of 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 creative work.
[0047] Figure 1 is a schematic diagram of an identification system provided by an exemplary embodiment of the present application;
[0048] Figure 2 is a flow chart of a method for identifying a software development kit provided by an exemplary embodiment of the present application;
[0049] Figure 3 is a flow chart of a method for identifying a software development kit for a dynamic link library provided by an exemplary embodiment of the present application;
[0050] Figure 4 is a structural block diagram of a software development kit identification device provided by an exemplary embodiment of the present application;
[0051] Figure 5 It is a structural block diagram of a terminal provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0052] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0053] It should be understood that although the terms first, second, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first parameter may also be referred to as the second parameter, and similarly, the second parameter may also be referred to as the first parameter. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0054] In today's mobile Internet era, third-party SDKs have become an indispensable part of mobile application development. SDKs provide applications with rich functions and services, such as advertising, payment, social sharing, etc., which greatly shorten the development cycle and improve application performance. However, with the widespread application of SDKs, the risks of privacy compliance have become increasingly prominent. Therefore, disclosing and updating the SDKs integrated in the application has become an important task for mobile application developers and privacy compliance officers. In related technologies, when developing or integrating third-party SDKs, developers usually manually record relevant SDK information and synchronize this information to privacy compliance officers through the company's internal processes. Finally, the information of these third-party SDKs is disclosed and updated on the product side. However, the above method is highly dependent on the conscious recording of developers, and there is a great risk of negligence and omission. Developers may forget to record certain SDK information during the busy development process, or errors may occur when recording, resulting in inaccurate or incomplete information. There is a lack of automation in SDK identification, and the efficiency of SDK information disclosure is low.
[0055] The software development toolkit identification method provided in the embodiment of the present application can automatically and quickly obtain the package name of the toolkit used in the application by determining the toolkit package name based on the assembly file path according to the location of the assembly file code in the file directory obtained by decompilation, thereby matching the obtained toolkit package name with the toolkit library collected in advance, thereby obtaining toolkit information according to toolkit registration, realizing automated toolkit identification, avoiding dependence on manual records, and improving toolkit identification efficiency, as well as the accuracy and comprehensiveness of toolkit information disclosure.
[0056] First, let's introduce the application identification system. Figure 1 , which shows a schematic diagram of an identification system provided by an exemplary embodiment of the present application, and the identification system includes: a terminal 10.
[0057] In some embodiments, the terminal 10 is used to identify a software development kit in an application and display corresponding kit information.
[0058] Schematically, terminal 10 has a toolkit identification function, which can automatically obtain the installation package of the application installed in terminal 10, decompile the installation package, and output a file directory, where the file directory is used to indicate the file distribution relationship between multiple code files obtained by decompilation, and the multiple code files include assembly code files. There is a corresponding relationship between the assembly code files and the toolkit used in the application; traverse the assembly code files in the file directory to obtain the assembly file path, the assembly file path is used to indicate the path to access the assembly code file in the file directory, and determine the toolkit package name of the toolkit based on the assembly file path; match the toolkit package name with multiple candidate toolkit package names in the toolkit library to obtain a toolkit identification result, and the toolkit identification result is used to indicate the toolkit information used in the application.
[0059] In some embodiments, the identification system further includes a server 20 , and a network connection exists between the server 20 and the terminal 10 , and data communication is performed between the server 20 and the terminal 10 via the network connection.
[0060] The server 20 is a background server corresponding to the toolkit identification function in the terminal 10, and is used to provide the terminal 10 with a toolkit identification service or related data, etc., which is not limited in the embodiment of the present application.
[0061] Schematically, taking the example of the server 20 providing toolkit identification service for the terminal 10, the server 20 pre-stores a toolkit library. The terminal 10 uploads the installation package of the application to be identified by the toolkit to the server 20, and the server 20 decompiles the received installation package and outputs a file directory, which is used to indicate the file distribution relationship between the multiple code files obtained by decompilation, and the multiple code files include assembly code files, and there is a corresponding relationship between the assembly code files and the toolkit used in the application; traverse the assembly code files in the file directory to obtain the assembly file path, which is used to indicate the path to access the assembly code files in the file directory, and determine the toolkit package name of the toolkit based on the assembly file path; match the toolkit package name with multiple candidate toolkit package names in the toolkit library to obtain the toolkit identification result. The server 20 feeds back the toolkit identification result to the terminal 10, and the terminal 10 displays or broadcasts the toolkit identification result.
[0062] The above-mentioned terminal is optional. The terminal can be a desktop computer, a laptop computer, a mobile phone, a tablet computer, an e-book reader, a Moving Picture Experts Group Audio Layer III (MP3) player, a Moving Picture Experts Group Audio Layer IV (MP4) player, a smart TV, a smart car, and other forms of terminal devices, which are not limited to the embodiments of the present application.
[0063] It is worth noting that the above-mentioned servers can be independent physical servers, or they can be server clusters or distributed systems composed of multiple physical servers. They can also be cloud servers that provide basic cloud computing services such as cloud services, cloud security, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0064] Among them, cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing.
[0065] In some embodiments, the above server can also be implemented as a node in a blockchain system.
[0066] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant regions. For example, the operation data and account information involved in this application are all obtained with full authorization.
[0067] To further explain, before collecting relevant data of users (for example, account information, historical operation data, and real-time operation data involved in this application) and during the process of collecting relevant data of users, this application can display a prompt interface, pop-up window, or output voice prompt information. The prompt interface, pop-up window, or voice prompt information is used to prompt the user that its relevant data is currently being collected, so that this application only starts to execute the relevant steps of obtaining relevant data of users after obtaining the confirmation operation issued by the user to the prompt interface or pop-up window, otherwise (that is, when the confirmation operation issued by the user to the prompt interface or pop-up window is not obtained), the relevant steps of obtaining relevant data of users are terminated, that is, the relevant data of users are not obtained. In other words, all user data collected by this application are collected with the consent and authorization of the user, and the collection, use, and processing of relevant user data need to comply with the relevant laws, regulations, and standards of the relevant regions.
[0068] For illustration, please refer to Figure 2 , which shows a flowchart of a software development kit identification method provided by an exemplary embodiment of the present application. The method can be executed by a terminal, or by a server, or by both a terminal and a server. The present application embodiment takes the method executed by a terminal as an example for explanation. Figure 2 As shown, the method comprises the following steps:
[0069] Step 210, decompile the installation package of the application and output a file directory.
[0070] The file directory is used to indicate the file distribution relationship between multiple code files obtained by decompilation. The multiple code files include assembly code files. There is a corresponding relationship between the assembly code files and the toolkit used in the application.
[0071] The above-mentioned application is a program to be identified by the software development kit. Optionally, the application can be any application installed in the terminal, or it can be an application to be installed specified by the terminal based on the program installation software, or it can be an application sent by other terminals or servers. The embodiments of the present application are not limited to this.
[0072] In some embodiments, a toolkit identification program is installed in the terminal, and the toolkit identification program is used to identify a software development kit used in any application.
[0073] Optionally, the toolkit identification program displays multiple applications installed on the terminal, and in response to receiving a selection operation for a first application, obtains the installation package corresponding to the first application from the terminal locally to participate in toolkit identification; alternatively, the toolkit identification program may be a built-in program in the program installation software, used to perform toolkit identification on all installable applications in the program installation software, obtain toolkit identification results, and display the corresponding toolkit identification results in the installation interface corresponding to each application in the program installation software; alternatively, when the terminal receives an application installation package sent by other terminals or servers, the toolkit identification program automatically performs toolkit identification on the installation package and displays the corresponding toolkit identification result.
[0074] It is worth noting that the above toolkit identification scenario is only an illustrative example and is not limited to this in the embodiments of the present application.
[0075] In some embodiments, the installation package is decompiled using a preset decompilation program or decompilation tool to obtain multiple code files.
[0076] Among them, decompilation refers to the process of converting a compiled program (usually machine code or bytecode) back to source code. The decompilation process is the opposite of the compilation process. Compilation refers to the process of converting source code into an executable file.
[0077] According to the file distribution relationship between the multiple code files obtained by decompilation, the multiple code files can be output according to the file distribution relationship to obtain the above-mentioned file directory.
[0078] During the decompilation process, executable files such as Dalvik Executable files, referred to as ".dex" files, are converted into assembly code files, such as Smali files. Smali files are text files that contain assembly language representations of Dalvik bytecodes.
[0079] Step 220, traverse the assembly code files in the file directory to obtain the assembly file path.
[0080] The assembly file path is used to indicate the path to access the assembly code file in the file directory.
[0081] The directory structure corresponding to the assembly code file usually reflects the package name structure of the application. By analyzing the assembly file path (that is, the directory path of the assembly code file), you can find files related to a specific SDK and thus analyze the SDK package name.
[0082] Optionally, the file query function can be used to query and locate the assembly code file, output the access path of the assembly code file, and obtain the assembly file path; or, without the file query function, each code file can be traversed, and when the assembly code file is identified, the corresponding assembly file path can be output. This is not limited to the embodiments of the present application.
[0083] Taking the file query function as an example, you can enter the file suffix of the assembly code file in the file search control, query and jump to the location of the assembly code file, and output the current location to obtain the assembly file path.
[0084] In some embodiments, multiple code files in a file directory are traversed, and in response to a first file suffix corresponding to a current code file, an access path of the current code file in the file directory is output to obtain an assembly file path, where the first file suffix is used to identify the assembly file path.
[0085] Schematically, taking the smali file as an example, multiple code files in the file directory are traversed, and in response to the file suffix corresponding to the current code file being ".smali", the access path of the current code file in the file directory is output, and the assembly file path is obtained as "com / thirdparty / sdk".
[0086] In some embodiments, the assembly code files are uniformly placed in an assembly folder. The assembly folder can be located first, and then the assembly code files in the assembly folder are traversed to obtain the assembly file path.
[0087] Schematically, taking the smali file as an example, the file directory contains a folder named smali, which contains the smali code representation of all DEX files in the application. In order to find the smali file of the SDK, it is necessary to traverse all subfolders and files in the smali folder to obtain the corresponding file path.
[0088] Step 230: determine the toolkit package name of the toolkit based on the assembly file path.
[0089] The assembly file path can indicate the toolkit package name.
[0090] In some embodiments, the toolkit package name is obtained by replacing specific path characters in the assembly file path with specific package name characters.
[0091] Indicatively, assume that the following assembly file path is obtained:
[0092] smali / com / function1 / android / gms;
[0093] smali / com / function2 / function2_sdk;
[0094] smali / com / function3 / function4.
[0095] By converting " / " to ".", you can get the following toolkit package name:
[0096] smali.com.function1.android.gms;
[0097] smali.com.function2.function2_sdk;
[0098] smali.com.function3.function4.
[0099] It is worth noting that the above method is only an illustrative example and is not limited to this embodiment of the present application.
[0100] Step 240 , matching the toolkit package name with a plurality of candidate toolkit package names in the toolkit library to obtain a toolkit identification result.
[0101] The toolkit identification result is used to indicate the toolkit information used in the application.
[0102] The toolkit library is a pre-collected database, which includes toolkit information corresponding to multiple candidate toolkits, including but not limited to package names, version numbers, etc.
[0103] In some embodiments, with full authorization, various public SDK information can be collected from the Internet through means such as web crawlers and stored in a toolkit library, and each SDK corresponds to a package name.
[0104] The above step 240 includes the following two steps:
[0105] In the first step, based on the package name similarity between the toolkit package name and multiple candidate toolkit package names, a first package name matching the toolkit package name is determined from multiple candidate toolkit package names.
[0106] The first package name and the toolkit package name meet the package name matching requirements. Optionally, the package name matching requirements include but are not limited to the package name similarity obtaining a preset similarity, or the contents of designated fields in the package names are the same, or the first package name contains the toolkit package name, or the toolkit package name contains at least one of the first package name.
[0107] Optionally, the method for determining the package name of the first toolkit includes at least one of the following:
[0108] The first method is to determine the character similarities between the toolkit package name and multiple candidate toolkit package names based on character recognition; and determine the first package name whose character similarity meets the matching requirements from the multiple candidate toolkit package names.
[0109] The matching requirement includes that the character similarity reaches a preset similarity.
[0110] Illustratively, the toolkit package name can be string matched with multiple candidate toolkit package names respectively. For example, the minimum number of all possible single-character editing operations between two strings (i.e., the minimum number of operations to convert one string into another string) is calculated using an edit distance algorithm (Levenshtein distance algorithm) to determine the similarity between the two strings.
[0111] The method provided in the embodiment of the present application simplifies the package name matching method by determining the first package name whose character similarity meets the matching requirements from multiple candidate toolkit package names based on the character similarity between the package names. By calculating the character similarity, similar package names can be quickly matched, thereby improving the package name matching efficiency.
[0112] The second method is to obtain a package name feature vector corresponding to a toolkit package name and multiple candidate feature vectors corresponding to multiple candidate toolkit package names; determine the vector similarities corresponding to the package name feature vector and the multiple candidate feature vectors; and determine the first package name whose vector similarity meets the matching requirements from the multiple candidate toolkit package names.
[0113] In some embodiments, a package name feature vector corresponding to a toolkit package name and multiple candidate feature vectors corresponding to multiple candidate toolkit package names can be extracted through a natural language model, and by calculating vector similarity, a first package name whose vector similarity meets the matching requirements is determined from the multiple candidate toolkit package names.
[0114] The matching requirement includes that the vector similarity reaches a preset similarity.
[0115] Optionally, when constructing the toolkit library, multiple candidate feature vectors may be stored to save storage space.
[0116] In some embodiments, clustering can also be performed based on multiple candidate feature vectors in the toolkit library to obtain multiple clusters. For each cluster, the average vector of multiple candidate feature vectors in the cluster is calculated as the cluster label. When matching the package name, the cluster that meets the matching relationship can be determined based on the vector similarity between the package name feature vector and each cluster label, and then the vector similarity between the multiple candidate feature vectors in the cluster and the package name feature vector is calculated to determine the first package name from the cluster.
[0117] The method provided in the embodiment of the present application determines the first package name whose vector similarity meets the matching requirements from multiple candidate toolkit package names based on the vector similarity between the package names. This method can not only save storage space by storing feature vectors, but also cluster the candidate feature vectors and perform distributed matching, thereby reducing the amount of calculation during package name matching and improving the efficiency of package name matching.
[0118] The third type, when the toolkit package name includes at least two package name fields, based on the first field quantity of the package name fields in the toolkit package name, at least one first candidate toolkit package name including the first field quantity of candidate package name fields is screened from multiple candidate toolkit package names, and the first candidate toolkit package name includes at least two first candidate package name fields; based on the at least two package name fields and the at least two first candidate package name fields, the toolkit package name is field-matched with the at least one first candidate toolkit package name to obtain a first package name matching the toolkit package name.
[0119] In some embodiments, the package name may contain at least one field separator, and the package name can be divided into at least two package name fields according to the field separator. Schematically, taking the package name "com.function2.sdk" as an example, it can be divided into three package name fields "com", "function2", and "sdk" according to the field separator ".".
[0120] Illustratively, the number of package name fields may be determined by identifying the number of field separators.
[0121] Optionally, the package name match may include a complete match and a partial match, wherein a complete match means that each package name field in the two package names is exactly the same, and a partial match means that one package name contains part of the package name fields of another package name.
[0122] Taking full match as an example, we can first filter out candidate toolkit package names containing the same number of fields from the package name library according to the number of package name fields of the identified toolkit package names, and then perform package name field matching based on the filtered candidate toolkit package names.
[0123] Optionally, at least two fields may be matched one by one in a complete match, and when all fields match, the first candidate is determined, and when there is a field mismatch, the current candidate toolkit package name is discarded.
[0124] Indicatively, after screening to obtain at least one first candidate toolkit package name, the i-th package name field in the toolkit package name is matched with the i-th first candidate package name field in at least one first candidate toolkit package name in order from left to right to obtain the i-th field matching result, where i is a positive integer; when the i-th field matching result satisfies the matching relationship, the i+1-th package name field in the toolkit package name is matched with the i+1-th first candidate package name field in at least one first candidate toolkit package name to obtain the i+1-th field matching result, until at least two field matching results corresponding to at least two package name fields both meet the matching relationship to obtain the first package name.
[0125] In response to any package name field not matching the corresponding first candidate package name field, the current first candidate toolkit package name is discarded.
[0126] Optionally, the matching result of the package name fields may be determined by calculating at least one field similarity such as character similarity or vector similarity between the package name fields.
[0127] Taking partial matching as an example, it is usually possible to match by package name prefix, that is, in order from left to right, the preceding package name field is matched first.
[0128] Schematically, in order from left to right, the i-th package name field in the toolkit package name is field-matched with the i-th candidate package name field in multiple candidate toolkit package names to obtain the i-th field matching result, where i is a positive integer; when the i-th field matching result satisfies the matching relationship, the i+1-th package name field in the toolkit package name is field-matched with the i+1-th candidate package name field in multiple candidate toolkit package names to obtain the i+1-th field matching result; when the toolkit package name includes a package name fields, the candidate toolkit package name includes b candidate package name fields, a and b are positive integers and a≤b, in response to the a field matching results all satisfying the matching relationship, a first package name is obtained; when the toolkit package name includes a package name fields, the candidate toolkit package name includes b candidate package name fields, a and b are positive integers and a>b, in response to the b field matching results all satisfying the matching relationship, a first package name is obtained.
[0129] The method provided in the embodiment of the present application provides a field-based package name matching method based on package name fields. Among them, for the complete matching method, by first screening the first candidate toolkit package name that matches the number of candidate package name fields to participate in field matching, it can effectively reduce the participation of irrelevant candidate toolkit package names in calculations, reduce the amount of package name matching calculations, and improve package name matching efficiency.
[0130] The method provided in the embodiment of the present application, for a complete matching method, matches the package name fields one by one from left to right on the basis of screening the first candidate toolkit package name that matches the number of candidate package name fields to participate in field matching, and then matches the next field on the basis of matching the previous field. It can promptly discard package names with unmatched fields, reduce invalid calculations, and improve package name matching efficiency.
[0131] The method provided in the embodiment of the present application provides a field-based package name matching method based on package name fields, wherein, for a partial matching method, there is no need to pay attention to the number of fields, and field matching is performed in sequence from left to right, based on a package name with a small number of fields. When each field in the package name matches, the matching relationship can be determined, thereby implementing a matching method based on the package name prefix, which can accurately match package names with the same package name prefix, thereby improving the flexibility of package name matching.
[0132] In the second step, based on the first package name, toolkit information of the first toolkit is obtained from the toolkit library to obtain a toolkit identification result.
[0133] The toolkit library includes association relationships between multiple candidate toolkit names and multiple candidate toolkit information.
[0134] In some embodiments, the toolkit library may be stored in text form, and the toolkit information associated with the specified package name may be obtained by searching for the specified package name.
[0135] Optionally, the toolkit information includes, but is not limited to, the toolkit name, toolkit version number, toolkit source, toolkit release time, toolkit authorization status, and any other relevant information of the toolkit that can be collected under authorization, which is not limited in the embodiments of the present application.
[0136] In summary, the method provided in the embodiment of the present application can automatically and quickly obtain the package name of the toolkit used in the application by determining the toolkit package name based on the assembly file path according to the location of the assembly file code in the file directory obtained by decompilation, thereby matching the obtained toolkit package name with the toolkit library collected in advance, thereby obtaining toolkit information according to toolkit registration, realizing automated toolkit identification, avoiding dependence on manual records, and improving toolkit identification efficiency, as well as the accuracy and comprehensiveness of toolkit information disclosure.
[0137] In some embodiments, the plurality of code files include a dynamic link library file, which includes a toolkit used in an application. The software development toolkit identification method provided in the embodiment of the present application can also be used to identify a toolkit in the form of a dynamic link library file. For example, please refer to Figure 3, which shows a flowchart of a method for identifying a software development kit for a dynamic link library provided by an exemplary embodiment of the present application. The method can be executed by a terminal, or by a server, or by both a terminal and a server. The present application embodiment takes the method executed by a terminal as an example for explanation. Figure 3 As shown, the above step 210 further includes the following steps:
[0138] Step 310, traverse multiple code files in the file directory to obtain a dynamic link library file.
[0139] In some embodiments, the SDK exists in the form of a dynamic link library file (ie, a .so file), and the SDK package name needs to be obtained from the .so file for matching.
[0140] When obtaining a dynamic link library file, the dynamic link library file can be determined by identifying the second file suffix. For example, multiple code files in a file directory are traversed, and in response to the current code file corresponding to the second file suffix, the current code file is obtained as a dynamic link library file. The second file suffix is used to identify the dynamic link library file.
[0141] Indicatively, multiple code files in the directory are traversed. The current folder includes a1.so file, b1.jar file, and c1.smali file. By identifying the .so suffix, the a1.so file is obtained.
[0142] Step 320, print the content of the dynamic link library file to obtain the file content.
[0143] The file contents include the toolkit contained in the dynamic link library file.
[0144] A dynamic link library file usually includes the library name, version information, export functions, symbol table, debugging information, toolkit information, etc. The relevant information in the dynamic link library file, such as the toolkit package name, etc., can be extracted by content printing.
[0145] Schematically, the content of the dynamic link library file is printed through the name list (nm) command to obtain the file content. The nm command can display all symbols in the .so file, including function names and variable names, which may include the toolkit package name used in the application.
[0146] Step 330 , text matching is performed on multiple candidate toolkit names and file contents to obtain a toolkit identification result.
[0147] Optionally, based on multiple candidate toolkit package names, string searches are performed in the file content in turn, and the string found in the file content that matches the candidate toolkit package name is used as the identified first package name. Based on the first package name, toolkit information of the first toolkit is obtained from the toolkit library to obtain a toolkit identification result.
[0148] Illustratively, taking the candidate toolkit package name "com.example.sdk" as an example, the string "com.example.sdk" is searched in the file content. If the string exists in the file content, the first package name is determined based on the string, and the corresponding toolkit information is obtained. If the string does not exist in the file content, the next candidate toolkit package name is obtained for string search.
[0149] To summarize, the method provided in the embodiment of the present application obtains a toolkit identification result by performing text matching on multiple candidate toolkit package names and the file contents of dynamic link library files. It is capable of identifying toolkits in the form of dynamic link library files, further improving the comprehensiveness and accuracy of toolkit identification, and improving identification efficiency.
[0150] In combination with the above embodiments, the software development kit identification method provided in the embodiments of the present application collects as much SDK information as possible through the records of developers and privacy compliance officers and crawler searches of third-party SDKs on the market in the early stage, and saves this information in an XML file to construct a toolkit library for automatic retrieval of subsequent programs. For toolkit identification, software development is carried out. Taking JAVA programs as an example, the Android Application Package (AndroidPackage, APK) tool is introduced into the JAVA program to perform the decompilation task of APK, and all decompiled files are output to the same directory for subsequent retrieval. For the directory decompiled by APK, a deep traversal is performed, and the toolkit package name is determined based on the directory where all smali files are located, and the toolkit package name is matched with the candidate toolkit package name in the toolkit library. If there is a matching candidate toolkit package name in the toolkit library, it is determined that the candidate toolkit is used in the APK.
[0151] The package names that are not matched during the deep traversal process are also recorded. When the toolkit identification results are finally output, the results can include the matched SDK information and the unmatched toolkit package names in the APK. A secondary search can be performed for the unmatched toolkit package names, for example, searching on the Internet, or asking developers, etc., to continuously improve the toolkit library.
[0152] For SDKs in the form of so files, use the m command to print the contents of the so file and normalize the package name. Traverse and match the contents of the so file to determine the SDK in the so file.
[0153] After all SDKs are matched, all decompiled files are deleted to save space, and the toolkit matching results are output in a preset format, for example, to an Excel table.
[0154] After the above JAVA program is developed, it can be packaged into a jar file so that the automatic recognition program can be used in any Linux system and detect the SDK included in the APK.
[0155] Indicatively, for any application, execute the command "java-jar sdkradar.jarapk_path" in the Linux environment, and output an Excel file in the same directory for querying the third-party SDK list.
[0156] In summary, the method provided in the embodiment of the present application can automatically realize the SDK query and collection in the APK, which is conducive to the review of the receiving open platform; with the help of machine programs, it can reduce the mistakes and omissions that may occur during manual recording.
[0157] Figure 4 is a structural block diagram of a software development kit identification device provided by an exemplary embodiment of the present application, such as Figure 4 As shown, the device includes the following parts:
[0158] A compiling module 410, used to decompile the installation package of the application and output a file directory, wherein the file directory is used to indicate the file distribution relationship between multiple code files obtained by decompilation, wherein the multiple code files include an assembly code file, and the assembly code file has a corresponding relationship with the toolkit used in the application;
[0159] A processing module 420 is used to traverse the assembly code files in the file directory to obtain an assembly file path, where the assembly file path is used to indicate a path for accessing the assembly code files in the file directory;
[0160] The processing module 420 is further used to determine the toolkit package name of the toolkit based on the assembly file path;
[0161] The processing module 420 is further used to match the toolkit package name with multiple candidate toolkit package names in the toolkit library to obtain a toolkit identification result, and the toolkit identification result is used to indicate the toolkit information used in the application.
[0162] In some embodiments, the processing module 420 is further configured to:
[0163] Based on the package name similarity between the toolkit package name and the multiple candidate toolkit package names, determining a first package name matching the toolkit package name from the multiple candidate toolkit package names;
[0164] The toolkit information of the first toolkit is acquired from the toolkit library based on the first package name to obtain the toolkit identification result, wherein the toolkit library includes associations between the plurality of candidate toolkit package names and the plurality of candidate toolkit information.
[0165] In some embodiments, the processing module 420 is further configured to:
[0166] Determine, based on character recognition, the character similarities respectively corresponding to the toolkit package name and the plurality of candidate toolkit package names;
[0167] The first package name whose character similarity meets the matching requirement is determined from the multiple candidate toolkit package names.
[0168] In some embodiments, the processing module 420 is further configured to:
[0169] Obtaining a toolkit feature vector corresponding to the toolkit package name and a plurality of candidate feature vectors corresponding to the plurality of candidate toolkit package names;
[0170] Determine vector similarities corresponding to the toolkit feature vector and the plurality of candidate feature vectors;
[0171] The first package name whose vector similarity meets the matching requirement is determined from the multiple candidate toolkit package names.
[0172] In some embodiments, the toolkit package name includes at least two package name fields;
[0173] The processing module 420 is further configured to:
[0174] Based on the first number of package name fields in the toolkit package name, screening at least one first candidate toolkit package name including the candidate package name fields of the first number of fields from the multiple candidate toolkit package names, wherein the first candidate toolkit package name includes at least two first candidate package name fields;
[0175] Based on the at least two package name fields and the at least two first candidate package name fields, field matching is performed on the toolkit package name and the at least one first candidate toolkit package name to obtain the first package name matching the toolkit package name.
[0176] In some embodiments, the processing module 420 is further configured to:
[0177] From left to right, perform field matching on the i-th package name field in the toolkit package name and the i-th first candidate package name field in the at least one first candidate toolkit package name to obtain the i-th field matching result, where i is a positive integer;
[0178] When the i-th field matching result satisfies the matching relationship, the i+1-th package name field in the toolkit package name is matched with the i+1-th first candidate package name field in the at least one first candidate toolkit package name to obtain the i+1-th field matching result, until at least two field matching results corresponding to the at least two package name fields both satisfy the matching relationship to obtain the first package name.
[0179] In some embodiments, the processing module 420 is further configured to:
[0180] Traversing the multiple code files in the file directory;
[0181] In response to a first file suffix corresponding to the current code file, an access path of the current code file in the file directory is output to obtain the assembly file path, wherein the first file suffix is used to identify the assembly file path.
[0182] In some embodiments, the plurality of code files include a dynamic link library file, and the dynamic link library file corresponds to a toolkit used in the application;
[0183] The processing module 420 is further configured to:
[0184] Traversing the multiple code files in the file directory to obtain the dynamic link library file;
[0185] Printing the content of the dynamic link library file to obtain the file content, wherein the file content includes the toolkit contained in the dynamic link library file;
[0186] Text matching is performed between the multiple candidate toolkit names and the file content to obtain the toolkit identification result.
[0187] In summary, the device provided in the embodiment of the present application can automatically and quickly obtain the package name of the toolkit used in the application by determining the toolkit package name based on the assembly file path according to the location of the assembly file code in the file directory obtained by decompilation, thereby matching the obtained toolkit package name with the toolkit library collected in advance, thereby obtaining toolkit information according to toolkit registration, realizing automatic toolkit identification, avoiding dependence on manual records, and improving toolkit identification efficiency, as well as the accuracy and comprehensiveness of toolkit information disclosure.
[0188] It should be noted that the toolkit identification device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0189] Figure 5 The structure block diagram of a terminal 500 provided by an exemplary embodiment of the present application is shown. The terminal 500 may be: a smart phone, a tablet computer, an MP3 player, an MP4 player, a notebook computer or a desktop computer. The terminal 500 may also be called a user equipment, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0190] Typically, the terminal 500 includes a processor 501 and a memory 502 .
[0191] The processor 501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 501 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 501 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 501 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 501 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0192] The memory 502 may include one or more computer-readable storage media, which may be non-transitory. The memory 502 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 502 is used to store at least one instruction, which is used to be executed by the processor 501 to implement the software development kit identification method provided in the method embodiment of the present application.
[0193] In some embodiments, the terminal 500 further includes some other tool kits 503, and the type and quantity of the other tool kits 503 can be selected based on the functional requirements of the terminal 500. Those skilled in the art will appreciate that Figure 5 The structure shown in the figure does not constitute a limitation on the terminal 500, and the terminal 500 may include more or less tool kits than shown in the figure, or combine some tool kits, or adopt a different tool kit arrangement.
[0194] The embodiment of the present application also provides a computer device, which can be implemented as follows: Figure 1 The computer device includes a processor and a memory, wherein at least one instruction, at least one program, code set or instruction set is stored in the memory, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the software development kit identification method provided by the above-mentioned method embodiments.
[0195] An embodiment of the present application also provides a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the software development kit identification method provided by the above-mentioned method embodiments.
[0196] The embodiments of the present application also provide a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the software development kit identification method provided by the above-mentioned method embodiments.
[0197] Optionally, the computer readable storage medium may include: Read Only Memory (ROM), Random Access Memory (RAM), Solid State Drives (SSD) or optical disks, etc. Among them, the random access memory may include resistance random access memory (ReRAM) and dynamic random access memory (DRAM). The serial numbers of the above embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0198] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0199] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for identifying a software development kit, characterized in that: The method comprises: Decompiling the installation package of the application and outputting a file directory, wherein the file directory is used to indicate a file distribution relationship between a plurality of code files obtained by decompilation, wherein the plurality of code files include an assembly code file, and the assembly code file has a corresponding relationship with a toolkit used in the application; Traversing the assembly code files in the file directory to obtain an assembly file path, wherein the assembly file path is used to indicate a path for accessing the assembly code files in the file directory; Determine a toolkit package name of the toolkit based on the assembly file path; The toolkit package name is matched with a plurality of candidate toolkit package names in a toolkit library to obtain a toolkit identification result, wherein the toolkit identification result is used to indicate toolkit information used in the application.
2. The method according to claim 1, characterized in that The toolkit package name is matched with multiple candidate toolkit package names in the toolkit library to obtain a toolkit identification result, including: Based on the package name similarity between the toolkit package name and the multiple candidate toolkit package names, determining a first package name matching the toolkit package name from the multiple candidate toolkit package names; The toolkit information of the first toolkit is acquired from the toolkit library based on the first package name to obtain the toolkit identification result, wherein the toolkit library includes associations between the plurality of candidate toolkit package names and the plurality of candidate toolkit information.
3. The method according to claim 2, characterized in that The determining, based on the package name similarity between the toolkit package name and the plurality of candidate toolkit package names, a first package name matching the toolkit package name from the plurality of candidate toolkit package names comprises: Determine, based on character recognition, the character similarities respectively corresponding to the toolkit package name and the plurality of candidate toolkit package names; The first package name whose character similarity meets the matching requirement is determined from the multiple candidate toolkit package names.
4. The method according to claim 2, characterized in that: The determining, based on the package name similarity between the toolkit package name and the plurality of candidate toolkit package names, a first package name matching the toolkit package name from the plurality of candidate toolkit package names comprises: Obtaining a toolkit feature vector corresponding to the toolkit package name and a plurality of candidate feature vectors corresponding to the plurality of candidate toolkit package names; Determine vector similarities corresponding to the toolkit feature vector and the plurality of candidate feature vectors; The first package name whose vector similarity meets the matching requirement is determined from the multiple candidate toolkit package names.
5. The method according to claim 2, characterized in that: The toolkit package name includes at least two package name fields; The determining, based on the package name similarity between the toolkit package name and the plurality of candidate toolkit package names, a first package name matching the toolkit package name from the plurality of candidate toolkit package names comprises: Based on the first field quantity of the package name fields in the toolkit package name, screening at least one first candidate toolkit package name including the candidate package name fields of the first field quantity from the multiple candidate toolkit package names, wherein the first candidate toolkit package name includes at least two first candidate package name fields; Based on the at least two package name fields and the at least two first candidate package name fields, field matching is performed on the toolkit package name and the at least one first candidate toolkit package name to obtain the first package name matching the toolkit package name.
6. The method according to claim 5, characterized in that The step of performing field matching on the toolkit package name and the at least one first candidate toolkit package name based on the at least two package name fields and the at least two first candidate package name fields to obtain the first package name matching the toolkit package name includes: From left to right, perform field matching on the i-th package name field in the toolkit package name and the i-th first candidate package name field in the at least one first candidate toolkit package name to obtain the i-th field matching result, where i is a positive integer; When the i-th field matching result satisfies the matching relationship, the i+1-th package name field in the toolkit package name is matched with the i+1-th first candidate package name field in the at least one first candidate toolkit package name to obtain the i+1-th field matching result, until at least two field matching results corresponding to the at least two package name fields both satisfy the matching relationship to obtain the first package name.
7. The method according to any one of claims 1 to 6, characterized in that: The traversing the assembly code files in the file directory to obtain the assembly file path includes: Traversing the multiple code files in the file directory; In response to a first file suffix corresponding to the current code file, an access path of the current code file in the file directory is output to obtain the assembly file path, wherein the first file suffix is used to identify the assembly code file.
8. The method according to any one of claims 1 to 6, characterized in that: The plurality of code files include a dynamic link library file, and the dynamic link library file contains a toolkit used in the application program; The method further comprises: Traversing the multiple code files in the file directory to obtain the dynamic link library file; Printing the content of the dynamic link library file to obtain the file content, wherein the file content includes the toolkit contained in the dynamic link library file; Text matching is performed between the multiple candidate toolkit names and the file content to obtain the toolkit identification result.
9. A software development kit identification device, characterized in that: The device comprises: A compiling module, used to decompile the installation package of the application and output a file directory, wherein the file directory is used to indicate the file distribution relationship between multiple code files obtained by decompilation, wherein the multiple code files include an assembly code file, and the assembly code file has a corresponding relationship with the toolkit used in the application; A processing module, used for traversing the assembly code files in the file directory to obtain an assembly file path, where the assembly file path is used to indicate a path for accessing the assembly code files in the file directory; The processing module is further used to determine the toolkit package name of the toolkit based on the assembly file path; The processing module is further used to match the toolkit package name with multiple candidate toolkit package names in a toolkit library to obtain a toolkit identification result, and the toolkit identification result is used to indicate the toolkit information used in the application.
10. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the software development kit identification method as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor to implement the software development kit identification method as described in any one of claims 1 to 8.
12. A computer program product, characterized in that It comprises a computer program, which, when executed by a processor, implements the software development kit identification method as claimed in any one of claims 1 to 8.