Method, device, electronic device and storage medium for searching characters in a package

Through iterative parsing and static analysis of retrieving compressed packages, a list containing dependent package strings is constructed, which solves the problem that the target string cannot be checked in dependent packages in the existing technology, and improves the accuracy of string retrieval.

CN115185529BActive Publication Date: 2025-04-22PING AN BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210686004.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-16
Publication Date
2025-04-22
Estimated Expiration
2042-06-16

AI Technical Summary

Technical Problem

The prior art cannot check whether the target string exists in the dependency package, resulting in low accuracy of string retrieval.

Method used

By iteratively parsing the compressed package to be retrieved, all Class files, including the Class files in the dependent package, static analysis is performed to build a string list, and determine the existence of the target string based on the list.

Benefits of technology

Improves the accuracy of string retrieval, can effectively check whether the target string exists in the dependent package, and avoids the problem of not being able to check the dependent package when searching in the source code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115185529B_ABST
    Figure CN115185529B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, electronic device and computer-readable storage medium for searching characters in a package. The method for searching characters in a package includes: iteratively parsing a compressed package to be searched until all Class files of the compressed package to be searched are obtained, and all Class files include Class files in the compressed package to be searched and Class files in dependent packages of the compressed package to be searched; constructing a string list of the compressed package to be searched based on all strings obtained by static analysis of all Class files; obtaining a target search character of the compressed package to be searched; and determining whether the target search character exists in the compressed package to be searched based on the string list and the target search character. The present application can improve the accuracy of string search, avoid the problem of searching for the target string in the source code without being able to check whether the target string exists in the dependent package, and thus avoid the problem of low string search accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and computer-readable storage medium for searching characters in a package. Background Art

[0002] When developing applications using the Java language, you first need to write source code with a file extension of .java, and then use a compiler to compile the source code into machine-independent binary bytecode, i.e., a .class file. At run time, the virtual machine (JVM) of various platforms searches for and loads the classes to be executed in the pre-set class loading path, and interprets and executes the bytecode program, thereby achieving the cross-platform feature of "compile once, execute everywhere".

[0003] In the development process of an application project, a large number of class files are usually involved. For the convenience of storage and use, they are usually in the form of Jar packages (the abbreviation of Java Archive). JAR packages are a kind of compressed package of Java, which can also be considered as a collection of a series of class files.

[0004] In the prior art, the target string is detected in the project by searching for the target string in the project source code. However, this method cannot check whether the target string appears in the dependent package without source code, resulting in low string retrieval accuracy. Summary of the invention

[0005] The present application provides a method, device, electronic device and computer-readable storage medium for searching characters in a package, aiming to solve the problem of low string retrieval accuracy caused by failing to check whether the target string exists in a dependent package by searching for the target string in the source code.

[0006] In a first aspect, the present application provides a method for searching characters in a packet, the method comprising:

[0007] Iteratively parse the compressed package to be retrieved until all Class files of the compressed package to be retrieved are obtained, wherein all Class files include Class files in the compressed package to be retrieved and Class files in dependent packages of the compressed package to be retrieved;

[0008] Based on all the strings obtained by static analysis of all the Class files, a string list of the compressed package to be retrieved is constructed, wherein the string list includes a key-value pair of each string in all the strings, and each key-value pair of the string includes each string, the name of the Class to which each string belongs, and the name of the compressed package to which each string belongs;

[0009] Obtaining a target search character of the compressed package to be searched;

[0010] Based on the character string list and the target search character, it is determined whether the compressed package to be searched contains the target search character.

[0011] In a second aspect, the present application provides a device for searching characters in a packet, the device comprising:

[0012] An iterative parsing unit, used for iteratively parsing the compressed package to be searched until all the Class files of the compressed package to be searched are obtained, wherein all the Class files include the Class files in the compressed package to be searched and the Class files in the dependent packages of the compressed package to be searched;

[0013] A static analysis unit, configured to construct a string list of the compressed package to be retrieved based on all the strings obtained by statically analyzing all the Class files, wherein the string list includes a key-value pair of each string in all the strings, and each key-value pair of the string includes each string, a class name of each string, and a compressed package name of each string;

[0014] An acquisition unit, used for acquiring a target search character of the compressed package to be searched;

[0015] The retrieval unit is used to determine whether the compressed package to be searched contains the target retrieval character based on the character string list and the target retrieval character.

[0016] In some embodiments, the iterative parsing unit is specifically used to:

[0017] Parsing the compressed package to be searched to obtain a preliminary parsing result of the compressed package to be searched, wherein the preliminary parsing result includes the Class files in the compressed package to be searched and the target dependent package of the compressed package to be searched;

[0018] Parsing the target dependent package again to obtain a parsing result of the compressed package to be retrieved;

[0019] Until the second parsing result does not contain the dependent package, all Class files of the compressed package to be retrieved are obtained.

[0020] In some embodiments, the static analysis unit is specifically used to:

[0021] Performing static analysis on all the class files to obtain all the strings contained in all the class files, wherein all the strings contain at least one string;

[0022] Combine each of the strings, the name of the class in which each of the strings is located, and the name of the compressed package in which each of the strings is located to obtain a key-value pair for each of the strings;

[0023] Based on the key-value pair of each string, a string list of the compressed package to be retrieved is obtained.

[0024] In some embodiments, the device for searching characters in a packet further includes a decryption unit, which is specifically used to:

[0025] Detecting the encrypted character string among all the character strings;

[0026] Decrypting the encrypted string to obtain a decrypted string;

[0027] In some embodiments, the static analysis unit is specifically used to:

[0028] The decrypted string, the name of the Class where the decrypted string is located, and the name of the compressed package where the decrypted string is located are combined to obtain a key-value pair of the encrypted string.

[0029] In some embodiments, the device for searching characters in a packet further includes an output unit. After determining whether the compressed packet to be searched contains the target search character based on the string list and the target search character, the output unit is specifically used to:

[0030] If the target search character exists in the compressed package to be searched, obtaining key-value pairs of each matching character string of the target search character from the character string list;

[0031] The key-value pairs of the matching character strings are output as search results of the target search characters.

[0032] In some embodiments, the retrieval unit is specifically used to:

[0033] Get the first word vector of each string in the string list;

[0034] Obtaining a second word vector of the target search character;

[0035] Obtaining a characteristic distance between the second word vector and the first word vector of each of the character strings;

[0036] If the characteristic distance is less than or equal to a preset threshold, it is determined that the target search character exists in the compressed package to be searched.

[0037] In some embodiments, the acquisition unit is specifically used to:

[0038] Obtaining the restricted sensitive words of the compressed package to be searched as the target search characters;

[0039] Alternatively, obtaining the name of the project configuration item corresponding to the compressed package to be searched, and using it as the target search character;

[0040] Alternatively, the plain text password information corresponding to the compressed package to be searched is obtained as the target search character.

[0041] In a third aspect, the present application further provides an electronic device, comprising a processor and a memory, wherein the memory stores a computer program, and when the processor calls the computer program in the memory, the processor executes the steps of any one of the in-package character retrieval methods provided in the present application.

[0042] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is loaded by a processor to execute the steps in the method for retrieving characters within a package.

[0043] In the present application, the compressed package to be retrieved is iteratively parsed until all the Class files of the compressed package to be retrieved are obtained; a string list of the compressed package to be retrieved is constructed based on all the strings obtained by static analysis of all the Class files; based on the string list and the target search character of the compressed package to be retrieved, it is determined whether the compressed package to be retrieved has the target search character; since the Class files in the compressed package to be retrieved and in the dependent packages of the compressed package to be retrieved can be parsed, the string list constructed from the Class files in the dependent packages includes the strings in the dependent packages of the compressed package to be retrieved. Therefore, the strings in the dependent packages of the compressed package to be retrieved can be retrieved based on the string list, thereby improving the string retrieval accuracy to a certain extent, avoiding the problem of searching for the target string in the source code and being unable to check whether the target string exists in the dependent package, thereby avoiding the problem of low string retrieval accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] 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 those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0045] Figure 1 It is a schematic diagram of a scenario of a system for searching characters in a package provided by an embodiment of the present application;

[0046] Figure 2 This is a flow chart of a method for searching for characters in a packet provided by an embodiment of the present application;

[0047] Figure 3 This is a schematic diagram of an embodiment of a character search process in a packet provided by an embodiment of the present application;

[0048] Figure 4 is a flowchart of an embodiment of step 201 provided in an embodiment of the present application;

[0049] Figure 5 is a flowchart of an embodiment of step 202 provided in an embodiment of the present application;

[0050] Figure 6 It is a schematic diagram of the structure of an embodiment of a device for searching characters in a packet provided in an embodiment of the present application;

[0051] Figure 7 It is a schematic diagram of the structure of an embodiment of an electronic device provided in the embodiments of the present application. DETAILED DESCRIPTION

[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0053] In the description of the embodiments of the present application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0054] In order to enable any person skilled in the art to implement and use the present application, the following description is provided. In the following description, details are listed for the purpose of explanation. It should be understood that those of ordinary skill in the art can recognize that the present application can also be implemented without using these specific details. In other examples, the known process will not be elaborated in detail to avoid unnecessary details that make the description of the present application embodiment obscure. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest range of principles and features disclosed in accordance with the embodiments of the present application.

[0055] The executor of the in-package character retrieval method of the embodiment of the present application may be the in-package character retrieval device provided in the embodiment of the present application, or different types of electronic devices such as a server device, a physical host or a user equipment (UE) that integrates the in-package character retrieval device, wherein the in-package character retrieval device may be implemented in hardware or software, and the UE may specifically be a terminal device such as a smart phone, a tablet computer, a laptop computer, a PDA, a desktop computer or a personal digital assistant (PDA).

[0056] The electronic device may work in a single operation mode or in a device cluster mode.

[0057] See also Figure 1 , Figure 1 It is a scenario diagram of the in-package character retrieval system provided by an embodiment of the present application. Among them, the in-package character retrieval system may include an electronic device 100, and an in-package character retrieval device is integrated in the electronic device 100. For example, the electronic device can iteratively parse the compressed package to be retrieved until all the Class files of the compressed package to be retrieved are obtained, wherein all the Class files include the Class files in the compressed package to be retrieved and the Class files in the dependent packages of the compressed package to be retrieved; based on all the strings obtained by static analysis of all the Class files, a string list of the compressed package to be retrieved is constructed, wherein the string list includes a key-value pair of each string in all the strings, and each key-value pair of the string includes each string, the name of the Class class where each string is located, and the name of the compressed package where each string is located; obtain the target retrieval character of the compressed package to be retrieved; based on the string list and the target retrieval character, determine whether the compressed package to be retrieved has the target retrieval character.

[0058] In addition, if Figure 1 As shown, the system for searching characters in a package may further include a memory 200 for storing data, such as storing compressed packages (Jar packages, War packages).

[0059] It should be noted that Figure 1 The scenario diagram of the in-package character retrieval system shown is merely an example. The in-package character retrieval system and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. A person of ordinary skill in the art can appreciate that with the evolution of the in-package character retrieval system and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is equally applicable to similar technical problems.

[0060] Next, the character retrieval method in a package provided in an embodiment of the present application is introduced. In the embodiment of the present application, an electronic device is used as an execution subject. For the sake of simplicity and ease of description, the execution subject will be omitted in the subsequent method embodiments.

[0061] Reference Figure 2 and Figure 3 , Figure 2 is a flow chart of a method for searching characters in a packet provided by an embodiment of the present application. Figure 3 FIG. 1 is a schematic diagram of an embodiment of the character search process in a packet provided by an embodiment of the present application. Figure 2 The logical order is shown in the flowcharts shown in the or other figures, but in some cases, the steps shown or described may be performed in a different order than here. The method for searching characters in a packet includes steps 201 to 204, wherein:

[0062] 201. Iteratively parse the compressed package to be searched until all Class files of the compressed package to be searched are obtained.

[0063] Among them, all the Class files include the Class files in the compressed package to be searched and the Class files in the dependent packages of the compressed package to be searched.

[0064] Among them, all Class files specifically refer to all Class files obtained by parsing the compressed package to be retrieved and the dependent packages in the compressed package to be retrieved until the parsing result no longer contains the dependent packages.

[0065] The compressed package to be searched refers to a compressed package containing class files and in which the target search character is to be searched, for example, a Jar package or a War package.

[0066] The dependent package of the compressed package to be retrieved is a compressed package containing class files that the compressed package to be retrieved depends on, such as a Jar package or a War package.

[0067] like Figure 3As shown, before step 201, the user can select one or more compressed packages to be searched from multiple compressed packages as compressed packages to be searched. For example, the user can select two Jar packages as compressed packages to be searched at the same time, so as to quickly search whether the two Jar packages contain the target search character.

[0068] For example, according to the structure definition of the compressed package to be retrieved in Java, the Class files contained in the compressed package to be retrieved and the dependent compressed packages that have been packaged are parsed. These dependent compressed packages are further parsed to obtain the Class files and compressed packages of the dependent compressed packages. Repeated iterations are performed until all Class files are obtained.

[0069] For example, if the compressed package to be retrieved is a Jar package, according to the structure definition of the Jar package to be retrieved in Java, parse out the Class files contained in the Jar package to be retrieved and the dependent Jar packages that have been packaged. Continue to parse these dependent Jar packages to obtain the Class files and Jar packages of the dependent Jar packages. Repeat the iteration until all the Class files are obtained.

[0070] For another example, if the compressed package to be retrieved is a War package, according to the structure definition of the War package to be retrieved in Java, the Class files contained in the War package to be retrieved and the dependent War packages that have been packaged are parsed. These dependent War packages are further parsed to obtain the Class files and War packages of the dependent War packages. Repeat the iteration until all the Class files are obtained.

[0071] In some embodiments, the compressed package to be retrieved does not contain its dependent packages. In this case, step 201 may specifically include: parsing the compressed package to be retrieved according to the structure definition of the compressed package to be retrieved in Java, and directly obtaining all Class files in the compressed package to be retrieved.

[0072] In some embodiments, the compressed package to be retrieved contains its dependent packages. Figure 4 As shown, step 201 may specifically include the following steps 2011 to 2013, wherein:

[0073] 2011. Parse the compressed package to be searched to obtain a preliminary parsing result of the compressed package to be searched.

[0074] The preliminary parsing result includes the Class files in the compressed package to be retrieved and the target dependent package of the compressed package to be retrieved.

[0075] The preliminary parsing result refers to a collection of Class files and dependent packages obtained by parsing the compressed package to be retrieved.

[0076] The target dependent package refers to a compressed package obtained by parsing the compressed package to be retrieved and on which the compressed package to be retrieved depends.

[0077] Exemplarily, according to the structure definition of the compressed package to be retrieved in Java, the compressed package to be retrieved is parsed to obtain the Class files in the compressed package to be retrieved and the dependent packages of the compressed package to be retrieved as the preliminary parsing result of the compressed package to be retrieved. For example, the Jar package to be retrieved is parsed to obtain the Class files of the Jar package to be retrieved and the dependent Jar packages of the Jar package to be retrieved, and the collection of the Class files of the Jar package to be retrieved and the dependent Jar packages of the Jar package to be retrieved is the preliminary parsing result of the Jar package to be retrieved.

[0078] 2012. Parse the target dependent package again to obtain a parsed result of the compressed package to be retrieved.

[0079] Among them, the re-analysis result includes the Class files in the target dependency package.

[0080] The second parsing result refers to a set of Class files and dependent packages obtained by parsing the target dependent package.

[0081] In step 2012, the target dependency package is parsed again in a manner similar to the parsing manner of the compressed package to be retrieved in step 2011. Specifically, according to the structural definition of the target dependency package in Java, the target dependency package is parsed to obtain the Class files in the target dependency package (or, the Class files in the target dependency package and the dependent packages of the target dependency package) as the re-parsing result of the compressed package to be retrieved. For example, in step 2011, the Jar package to be retrieved is parsed to obtain the Class files of the Jar package to be retrieved and the dependent Jar packages of the Jar package to be retrieved; in step 2012, the dependent Jar package is parsed again to obtain the Class files of the dependent Jar package and the dependent Jar packages of the dependent Jar package, and the collection of the Class files of the dependent Jar package and the dependent Jar packages of the dependent Jar package is the re-parsing result of the Jar package to be retrieved.

[0082] 2013. Until the second parsing result does not contain the dependent package, all Class files of the compressed package to be retrieved are obtained.

[0083] When the second parsing result does not contain the dependent package, the Class files parsed in the initial parsing result and the Class files parsed in the second parsing result can be used as all the Class files of the compressed package to be retrieved.

[0084] When the re-parsed result contains a dependent package, that is, when the re-parsed result contains a dependent package of the target dependent package, the dependent package of the target dependent package is parsed again to obtain the parsed result of the dependent package of the target dependent package, and the parsed dependent packages are parsed in a loop until the parsed result of each dependent package no longer contains a dependent package. At this time, the Class files parsed in the preliminary parsing result, the Class files parsed in the re-parsed result, and the Class files parsed in a loop for each parsed dependent package are used as all the Class files of the compressed package to be retrieved.

[0085] Taking the compressed package to be searched as a Jar package to be searched as an example, the iterative parsing process of steps 2011 to 2013 can be as follows: steps 1) to 3):

[0086] 1) Perform the i=1th compressed package analysis. Specifically, the Jar package to be searched is analyzed to obtain the i=1th class set including multiple Class files and a Jar dependency package of the Jar package to be searched.

[0087] 2) Execute the i=2nd to Nth compressed package parsing. Specifically, if the parsing result also contains Jar dependency packages, the parsed Jar dependency packages are parsed again in a loop until after the Nth parsing, when the parsing result of the Jar package to be retrieved does not contain the Jar dependency package; at this time, the i=2nd to Nth class set containing multiple Class files is obtained.

[0088] 3) The multiple Class files contained in each class set in the i=1 to N class sets are used as all the Class files of the Jar package to be retrieved.

[0089] Taking the compressed package to be searched as a War package to be searched as an example, the iterative parsing process of steps 2011 to 2013 can be as follows: Steps ① to ③:

[0090] ① Execute the i=1th compressed package analysis. Specifically, parse the War package to be searched to obtain the i=1th class set containing multiple Class files and a War dependency package of the War package to be searched.

[0091] ② Execute the i=2~Nth compressed package parsing. Specifically, if the parsing result also contains the War dependency package, the parsed War dependency package is parsed again in a loop until after the Nth parsing, when the parsing result of the War package to be retrieved does not contain the War dependency package; at this time, the i=2~Nth class set containing multiple Class files is obtained.

[0092] ③ Take the multiple Class files contained in each class set in the i=1~N class sets as all the Class files of the War package to be retrieved.

[0093] 202. Based on all the character strings obtained by statically analyzing all the Class files, a character string list of the compressed package to be searched is constructed.

[0094] The string list includes a key-value pair of each string in all the strings, and each key-value pair of the string includes each string, the name of the Class to which each string belongs, and the name of the compressed package to which each string belongs.

[0095] The string list refers to the list of all strings in all class files.

[0096] Among them, all the strings of all the class files refer to the set of strings contained in each class file obtained by statically analyzing each class file in all the class files.

[0097] In some embodiments, the string list only contains all the strings of all the Class files. In this case, step 202 may specifically include: first, according to the structure definition of the compiled Class files in Java, each Class file in all the Class files may be statically analyzed to obtain all the strings contained in each Class file in all the Class files, thereby obtaining all the strings of all the Class files. Then, all the strings of all the Class files are summarized to obtain a string list of the compressed package to be retrieved. For example, as shown in Table 1 below, in step 201, according to the structure definition of the original Jar package in Java, the original Jar package is iteratively parsed to obtain all the Class files of the original Jar package as class file 1, class file 2, and class file 3. In step 202, according to the structural definition of the compiled class file 1 in Java, class file 1 is statically analyzed to obtain the string contained in class file 1: "123"; according to the structural definition of the compiled class file 2 in Java, class file 2 is statically analyzed to obtain the string contained in class file 2: "456"; according to the structural definition of the compiled class file 3 in Java, class file 3 is statically analyzed to obtain the string contained in class file 3: "789".

[0098] Table 1

[0099] Serial number String 1 "123” 2 "456” 3 "789”

[0100] In some embodiments, the string list is presented in the form of key-value pairs for each string. Figure 5 As shown, step 202 may specifically include the following steps 2021 to 2023, wherein:

[0101] 2021. Perform static analysis on all the Class files to obtain all the strings contained in all the Class files.

[0102] Wherein, all the character strings contain at least one character string.

[0103] Exemplarily, first, according to the structure definition of the compiled Class file in Java, each Class file in all Class files can be statically analyzed to obtain all the strings contained in each Class file in all Class files, thereby obtaining all the strings of all Class files.

[0104] For example, in step 201, according to the structural definition of the original Jar package in Java, the original Jar package is iteratively parsed to obtain all the Class files of the original Jar package, which are class file 4, class file 5, and class file 6. In step 2021, firstly, according to the structural definition of the compiled class file 4 in Java, class file 4 is statically analyzed to obtain the strings contained in class file 4; secondly, according to the structural definition of the compiled class file 5 in Java, class file 5 is statically analyzed to obtain the strings contained in class file 5; thirdly, according to the structural definition of the compiled class file 6 in Java, class file 6 is statically analyzed to obtain the strings contained in class file 6.

[0105] 2022. Combine each of the character strings, the name of the Class to which each of the character strings belongs, and the name of the compressed package to which each of the character strings belongs, to obtain a key-value pair of each of the character strings.

[0106] The name of the compressed package where each string is located refers to the name of the compressed package where each string is located. For example, if string a is directly parsed from the original compressed package to be retrieved, then the name of the compressed package where string a is located is the name of the compressed package to be retrieved. For another example, if string b is directly parsed from the dependent package of the compressed package to be retrieved, then the name of the compressed package where string b is located is the name of the dependent package of the compressed package to be retrieved.

[0107] The class name of each string refers to the name of the class file that each string is in. For example, if string a is obtained by static analysis of class file 1, then the class name of string a is the name of class file 1.

[0108] For ease of understanding, the example of step 2021 above is continued. For example, in step 201, according to the structural definition of the original Jar package in Java, the original Jar package is iteratively parsed to obtain all the Class files of the original Jar package, namely: class file 4, class file 5, and class file 6; among which, class file 4 is the Class file directly obtained by parsing the original Jar package, class file 5 is the Class file obtained by parsing the first-level dependency package of the original Jar package (i.e., the dependency package of the original Jar package), and class file 6 is the Class file obtained by parsing the second-level dependency package of the original Jar package (i.e., the dependency package of the dependency package of the original Jar package).

[0109] In step 2021, according to the structural definition of the compiled class file 4 in Java, class file 4 is statically analyzed to obtain the strings contained in class file 4: "123", "456"; according to the structural definition of the compiled class file 5 in Java, class file 5 is statically analyzed to obtain the strings contained in class file 5: "789"; according to the structural definition of the compiled class file 6 in Java, class file 6 is statically analyzed to obtain the strings contained in class file 6: "234", "567".

[0110] At this time, as shown in Table 2 below, in step 2022, the string "123", the name of the compressed package where the string "123" is located (i.e., the original Jar package), and the name of the Class where the string "123" is located (i.e., class file 4) are combined to obtain a key-value pair of the string "123".

[0111] By combining the character string "456", the name of the compressed package where the character string "456" is located (ie, the original Jar package), and the name of the Class where the character string "456" is located (ie, class file 4), a key-value pair of the character string "456" can be obtained.

[0112] By combining the string "789", the name of the compressed package where the string "789" is located (i.e., the first-level dependency package), and the name of the Class where the string "789" is located (i.e., class file 5), a key-value pair of the string "789" can be obtained.

[0113] By combining the string "234", the name of the compressed package where the string "234" is located (i.e., the secondary dependency package), and the name of the Class where the string "234" is located (i.e., class file 6), a key-value pair of the string "234" can be obtained.

[0114] By combining the string "567", the name of the compressed package where the string "567" is located (i.e., the secondary dependency package), and the name of the Class where the string "567" is located (i.e., class file 6), we can get the key-value pair of the string "567".

[0115] Table 2

[0116]

[0117]

[0118] Because in some cases, there may be a Class file containing an encrypted string in all the Class files of the compressed package to be retrieved. Furthermore, in order to avoid the subsequent inability to accurately identify whether the compressed package to be retrieved contains the target search character due to the encryption of the string, after obtaining all the strings contained in all the Class files in step 2021, all the strings will be detected to determine whether there is an encrypted string in all the strings; if so, the encrypted string is decrypted and then a key-value pair is constructed for subsequent retrieval of the decrypted string, thereby avoiding the retrieval of the encrypted string and thus avoiding the problem of being unable to accurately retrieve the target string. At this time, before step 2022, it can further include: detecting the encrypted string in all the strings; decrypting the encrypted string to obtain the decrypted string. Step 2022 can specifically include: combining the decrypted string, the Class name of the decrypted string, and the compressed package name of the decrypted string to obtain the key-value pair of the encrypted string.

[0119] 2023. Based on the multiple key-value pairs, obtain a string list of the compressed package to be retrieved.

[0120] For example, as shown in Table 2, first, according to the structure definition of the compiled Class file in Java, each Class file in all Class files can be statically analyzed to obtain all the strings contained in each Class file in all Class files, thereby obtaining all the strings in all Class files. Then, each string obtained by static analysis, the class name of the Class file where each string is located, and the package name of the compressed package where each string is located are combined into a key-value pair of each string; the key-value pairs of each string in all strings are summarized, so that a string list of the compressed package to be retrieved can be constructed.

[0121] 203. Obtain a target search character of the compressed package to be searched.

[0122] The target search character refers to the character that needs to be detected whether it is contained in the compressed package to be searched, for example, the restricted sensitive words of the compressed package to be searched, the name of the project configuration item corresponding to the compressed package to be searched, the unencrypted plain text password of the compressed package to be searched, etc.

[0123] Since the Class files in the dependent packages of the compressed package to be searched can be parsed in steps 201 to 202, and all the strings obtained by static analysis of all the Class files are used to construct a string list, the string list constructed by the Class files in the dependent packages includes the strings in the dependent packages of the compressed package to be searched; by obtaining the restricted sensitive words of the compressed package to be searched as the target search characters, the restricted sensitive words in the dependent packages of the compressed package to be searched can be effectively retrieved from the string list, thereby requiring the restricted sensitive words to be searched in the source code and being unable to check whether the restricted sensitive words exist in the dependent packages.

[0124] By obtaining the name of the project configuration item corresponding to the compressed package to be retrieved as the target search string, the project configuration items in the dependent packages of the compressed package to be retrieved can be effectively retrieved from the string list, thereby solving the problem of being unable to check whether the project configuration items exist in the dependent packages by searching for restricted sensitive words in the source code.

[0125] By obtaining the plaintext password information corresponding to the compressed package to be searched as the target search character, the plaintext password information in the dependent package of the compressed package to be searched can be effectively retrieved from the string list, thereby solving the problem of being unable to check whether the plaintext password information exists in the dependent package by searching for restricted sensitive words in the source code.

[0126] There are many ways to obtain the target search character in step 203, illustratively including:

[0127] (1) Receive a specified character string input by a user as a target search character for a compressed package to be searched.

[0128] (2) In the batch compressed package detection and verification scenario, the pre-set default character is used as the target search character for the compressed package to be searched.

[0129] 204. Based on the character string list and the target search character, determine whether the compressed package to be searched contains the target search character.

[0130] Exemplarily, according to the designated character string input by the user in step 203, the "character string list" is obtained by screening step 202; if the designated character string input by the user matches the character string in the "character string list", then it can be determined that the target search character exists in the character string of the compressed package to be searched. Otherwise, if the designated character string input by the user does not match any character string in the "character string list", then it can be determined that the target search character does not exist in the character string of the compressed package to be searched.

[0131] In order to improve the speed of determining whether the target search character exists in the compressed package to be searched in step 204, it is also possible to preset the characterization of each string in the string list obtained in step 202 to obtain the word vector of each string; in step 204, the characteristic distance between the word vector of the target search character and the word vector of each string in the string list can be quickly calculated; based on the characteristic distance between the word vector of the target search character and the word vector of each string in the string list, it is determined whether the compressed package to be searched contains the target search character. At this time, before step 204, it can further include: obtaining the first word vector of each string in the string list. Step 204 can specifically include: obtaining the second word vector of the target search character; obtaining the characteristic distance between the second word vector and the first word vector of each of the strings; if the characteristic distance is less than or equal to a preset threshold, it is determined that the target search character exists in the compressed package to be searched. If the characteristic distances are all greater than the preset threshold, it is determined that the target search character does not exist in the compressed package to be searched.

[0132] Among them, the first word vector refers to the word vector of each string in the string list.

[0133] The second word vector refers to the word vector of the target search character.

[0134] Specifically, if the characteristic distance between the second word vector and the first word vector of one of the strings in the string list is less than or equal to a preset threshold, it can be determined that the target search character exists in the compressed package to be retrieved; or, if the characteristic distance between the second word vector and the first word vector of each of the two or more strings in the string list is less than or equal to the preset threshold, it can also be determined that the target search character exists in the compressed package to be retrieved. If the characteristic distance between the second word vector and the first word vector of each string in the string list is greater than the preset threshold, it is determined that the target search character does not exist in the compressed package to be retrieved.

[0135] Since the first word vector of each string in the string list is obtained by pre-characterizing the word vector, only the word vector of the target string needs to be characterized in step 204, which can greatly reduce the characterization processing amount of the word vector during real-time retrieval, thereby greatly accelerating the retrieval speed of the target retrieval character. In addition, on the first aspect, since the characteristic distance between the second word vector and the first word vector of one of the strings in the string list is less than or equal to the preset threshold, it can be proved to a certain extent that the target retrieval character matches the one of the strings, so it can be quickly determined that the target retrieval character exists in the compressed package to be retrieved. On the second aspect, since the characteristic distance between the second word vector and the first word vector of each string in the string list is greater than the preset threshold, it can be proved to a certain extent that the target retrieval character does not match each string in the string list, so it can be quickly determined that the target retrieval character does not exist in the compressed package to be retrieved.

[0136] Furthermore, in order to find out all the target search characters in the compressed package to be searched, after step 204, if the target search character exists in the compressed package to be searched, the key-value pairs of each matching string of the target search character are obtained from the string list; the key-value pairs of each matching string are used as the search result of the target search character and output. If the target search character does not exist in the compressed package to be searched, a reminder message that the target search character does not exist in the compressed package to be searched is output. For example, you can refer to the above method, traverse each string in the string list, and compare the feature distance between the second word vector and the first word vector of the currently traversed string. If the feature distance between the second word vector and the first word vector of the currently traversed string is less than or equal to the preset threshold, the currently traversed string is used as the matching string; until the traversal of each string in the traversed string list is completed, the key-value pairs of all matching strings are finally derived and summarized into a matching list, and the entire retrieval process of the compressed package to be searched is completed.

[0137] From the above content, it can be seen that the compressed package to be searched is iteratively parsed until all the Class files of the compressed package to be searched are obtained; a string list of the compressed package to be searched is constructed based on all the strings obtained by static analysis of all the Class files; based on the string list and the target search character of the compressed package to be searched, it is determined whether the compressed package to be searched has the target search character; since the Class files in the compressed package to be searched and in the dependent packages of the compressed package to be searched can be parsed, the string list constructed from the Class files in the dependent packages includes the strings in the dependent packages of the compressed package to be searched. Therefore, the strings in the dependent packages of the compressed package to be searched can be retrieved based on the string list, which improves the string search accuracy to a certain extent, avoids the problem of searching for the target string in the source code and being unable to check whether the target string exists in the dependent package, thereby avoiding the problem of low string search accuracy.

[0138] In order to better implement the above method, the embodiment of the present application also provides a device for searching characters in a packet, which can be integrated into an electronic device, such as a computer device, which can be a terminal, a server, or other device.

[0139] Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a personal computer and other devices; the server can be a single server or a server cluster composed of multiple servers.

[0140] For example, in this embodiment, the method of the embodiment of the present application will be described in detail by taking the in-package character retrieval device being specifically integrated into a computer as an example.

[0141] For example, Figure 6 As shown, the device 600 for searching characters in a packet may include:

[0142] An iterative parsing unit 601 is used to iteratively parse the compressed package to be searched until all the Class files of the compressed package to be searched are obtained, wherein all the Class files include the Class files in the compressed package to be searched and the Class files in the dependent packages of the compressed package to be searched;

[0143] The static analysis unit 602 is used to construct a string list of the compressed package to be retrieved based on all the strings obtained by static analysis of all the Class files, wherein the string list includes a key-value pair of each string in all the strings, and each key-value pair of the string includes each string, the name of the Class to which each string belongs, and the name of the compressed package to which each string belongs;

[0144] An acquisition unit 603 is used to acquire a target search character of the compressed package to be searched;

[0145] The search unit 604 is configured to determine whether the compressed package to be searched contains the target search character based on the character string list and the target search character.

[0146] In some embodiments, the iterative parsing unit 601 is specifically used to:

[0147] Parsing the compressed package to be searched to obtain a preliminary parsing result of the compressed package to be searched, wherein the preliminary parsing result includes the Class files in the compressed package to be searched and the target dependent package of the compressed package to be searched;

[0148] Parsing the target dependent package again to obtain a parsing result of the compressed package to be retrieved;

[0149] Until the second parsing result does not contain the dependent package, all Class files of the compressed package to be retrieved are obtained.

[0150] In some embodiments, the static analysis unit 602 is specifically used to:

[0151] Performing static analysis on all the class files to obtain all the strings contained in all the class files, wherein all the strings contain at least one string;

[0152] Combine each of the strings, the name of the class in which each of the strings is located, and the name of the compressed package in which each of the strings is located to obtain a key-value pair for each of the strings;

[0153] Based on the key-value pair of each string, a string list of the compressed package to be retrieved is obtained.

[0154] In some embodiments, the intra-package character search device 600 further includes a decryption unit (not shown in the figure), which is specifically used to:

[0155] Detecting the encrypted character string among all the character strings;

[0156] Decrypting the encrypted string to obtain a decrypted string;

[0157] In some embodiments, the static analysis unit 602 is specifically used to:

[0158] The decrypted string, the name of the Class where the decrypted string is located, and the name of the compressed package where the decrypted string is located are combined to obtain a key-value pair of the encrypted string.

[0159] In some embodiments, the intra-package character search device 600 further includes an output unit (not shown in the figure), after determining whether the target search character exists in the compressed package to be searched based on the string list and the target search character, the output unit is specifically used to:

[0160] If the target search character exists in the compressed package to be searched, obtaining key-value pairs of each matching character string of the target search character from the character string list;

[0161] The key-value pairs of the matching character strings are output as search results of the target search characters.

[0162] In some embodiments, the retrieval unit 604 is specifically used to:

[0163] Get the first word vector of each string in the string list;

[0164] Obtaining a second word vector of the target search character;

[0165] Obtaining a characteristic distance between the second word vector and the first word vector of each of the character strings;

[0166] If the characteristic distance is less than or equal to a preset threshold, it is determined that the target search character exists in the compressed package to be searched.

[0167] In some embodiments, the acquisition unit 603 is specifically used to:

[0168] Obtaining the restricted sensitive words of the compressed package to be searched as the target search characters;

[0169] Alternatively, obtaining the name of the project configuration item corresponding to the compressed package to be searched, and using it as the target search character;

[0170] Alternatively, the plain text password information corresponding to the compressed package to be searched is obtained as the target search character.

[0171] As can be seen from the above, the intra-package character retrieval device 600 of this embodiment can be composed of an iterative parsing unit 601 to iteratively parse the compressed package to be retrieved until all the Class files of the compressed package to be retrieved are obtained, wherein all the Class files include the Class files in the compressed package to be retrieved and the Class files in the dependent packages of the compressed package to be retrieved; the static analysis unit 602 constructs a string list for the compressed package to be retrieved based on all the strings obtained by statically analyzing all the Class files; the acquisition unit 603 acquires the target retrieval character of the compressed package to be retrieved; and the retrieval unit 604 determines whether the compressed package to be retrieved has the target retrieval character based on the string list and the target retrieval character. Therefore, the in-package character retrieval device 600 provided in the embodiment of the present application can bring about the following technical effects: since the Class files in the compressed package to be retrieved and in the dependent packages of the compressed package to be retrieved can be parsed, the string list constructed by the Class files in the dependent packages includes the strings in the dependent packages of the compressed package to be retrieved. Therefore, based on the string list, the strings in the dependent packages of the compressed package to be retrieved can be retrieved, thereby improving the string retrieval accuracy to a certain extent, avoiding the problem of searching for the target string in the source code and being unable to check whether the target string exists in the dependent package, thereby avoiding the problem of low string retrieval accuracy.

[0172] Accordingly, the embodiment of the present application also provides an electronic device, which may be a terminal, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC, Personal Computer), a personal digital assistant (Personal Digital Assistant, PDA) and other terminal devices. Figure 7 As shown, Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 700 includes a processor 701 having one or more processing cores, a memory 702 having one or more computer-readable storage media, and a computer program stored in the memory 702 and executable on the processor. The processor 701 is electrically connected to the memory 702. Those skilled in the art will appreciate that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or arrange components differently.

[0173] The processor 701 is the control center of the electronic device 700. It uses various interfaces and lines to connect various parts of the entire electronic device 700, executes various functions of the electronic device 700 and processes data by running or loading software programs and / or modules stored in the memory 702, and calling data stored in the memory 702, thereby monitoring the electronic device 700 as a whole.

[0174] In the embodiment of the present application, the processor 701 in the electronic device 700 will load instructions corresponding to the processes of one or more application programs into the memory 702 according to the following steps, and the processor 701 will run the application programs stored in the memory 702 to implement various functions:

[0175] Iteratively parse the compressed package to be retrieved until all Class files of the compressed package to be retrieved are obtained, wherein all Class files include Class files in the compressed package to be retrieved and Class files in dependent packages of the compressed package to be retrieved;

[0176] Based on all the strings obtained by static analysis of all the Class files, a string list of the compressed package to be retrieved is constructed, wherein the string list includes a key-value pair of each string in all the strings, and each key-value pair of the string includes each string, the name of the Class to which each string belongs, and the name of the compressed package to which each string belongs;

[0177] Obtaining a target search character of the compressed package to be searched;

[0178] Based on the character string list and the target search character, it is determined whether the compressed package to be searched contains the target search character.

[0179] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0180] Therefore, the electronic device 700 provided in the embodiment of the present application can bring about the following technical effects: since the Class files in the compressed package to be retrieved and in the dependent package of the compressed package to be retrieved can be parsed, the string list constructed by the Class files in the dependent package includes the strings in the dependent package of the compressed package to be retrieved. Therefore, based on the string list, the strings in the dependent package of the compressed package to be retrieved can be retrieved, thereby improving the string retrieval accuracy to a certain extent, avoiding the problem of searching for the target string in the source code and being unable to check whether the target string exists in the dependent package, thereby avoiding the problem of low string retrieval accuracy.

[0181] Optional, such as Figure 7As shown, the electronic device 700 further includes: a touch screen 703, a radio frequency circuit 704, an audio circuit 705, an input unit 706, and a power supply 707. The processor 701 is electrically connected to the touch screen 703, the radio frequency circuit 704, the audio circuit 705, the input unit 706, and the power supply 707, respectively. Those skilled in the art can understand that Figure 7 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0182] The touch display screen 703 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 703 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device, and these graphical user interfaces may be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light-emitting diode (OLED, Organic Light-Emitting Diode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 701, and can receive the command sent by the processor 701 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 701 to determine the type of touch event, and then the processor 701 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 703 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 703 can also be used as a part of the input unit 706 to realize the input function.

[0183] The radio frequency circuit 704 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other electronic devices through wireless communication, and to send and receive signals between the network device or other electronic devices.

[0184] The audio circuit 705 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 705 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 705 and converted into audio data, and then the audio data is output to the processor 701 for processing, and then sent to another electronic device through the radio frequency circuit 704, or the audio data is output to the memory 702 for further processing. The audio circuit 705 may also include an earplug jack to provide communication between an external headset and an electronic device.

[0185] The input unit 706 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0186] The power supply 707 is used to supply power to various components of the electronic device 700. Optionally, the power supply 707 can be logically connected to the processor 701 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 707 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0187] although Figure 7 Not shown, the electronic device 700 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.

[0188] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0189] From the above, it can be seen that the electronic device provided in this embodiment can bring about the following technical effects: since target indicator information that can be used to indicate the quality of the business order to be evaluated can be automatically extracted from the target image of the business order to be evaluated, and the quality of the business order to be evaluated is evaluated, the quality of the business order can be effectively and quickly evaluated, thereby improving the efficiency of quality evaluation of the business order.

[0190] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0191] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer program can be loaded by a processor to execute the steps in any of the methods for searching for characters in a packet provided in the embodiments of the present application. For example, the computer program can execute the following steps:

[0192] Iteratively parse the compressed package to be retrieved until all Class files of the compressed package to be retrieved are obtained, wherein all Class files include Class files in the compressed package to be retrieved and Class files in dependent packages of the compressed package to be retrieved;

[0193] Based on all the strings obtained by static analysis of all the Class files, a string list of the compressed package to be retrieved is constructed, wherein the string list includes a key-value pair of each string in all the strings, and each key-value pair of the string includes each string, the name of the Class to which each string belongs, and the name of the compressed package to which each string belongs;

[0194] Obtaining a target search character of the compressed package to be searched;

[0195] Based on the character string list and the target search character, it is determined whether the compressed package to be searched contains the target search character.

[0196] It can be seen that the computer program can be loaded by the processor to execute the steps of any one of the in-package character retrieval methods provided in the embodiments of the present application, thereby bringing about the following technical effects: since the Class files in the compressed package to be retrieved and in the dependent packages of the compressed package to be retrieved can be parsed, the string list constructed by the Class files in the dependent packages includes the strings in the dependent packages of the compressed package to be retrieved. Therefore, based on the string list, the strings in the dependent packages of the compressed package to be retrieved can be retrieved, thereby improving the string retrieval accuracy to a certain extent, avoiding the problem of searching for the target string in the source code and being unable to check whether the target string exists in the dependent package, thereby avoiding the problem of low string retrieval accuracy.

[0197] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0198] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0199] Since the computer program stored in the computer-readable storage medium can execute the steps in any one of the methods for searching for characters in a package provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the methods for searching for characters in a package provided in the embodiments of the present application can be achieved. For details, please refer to the previous embodiments and will not be repeated here.

[0200] The above is a detailed introduction to a method, device, electronic device and computer-readable storage medium for searching characters in a package provided by an embodiment of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for searching characters in a packet, characterized in that: The method comprises: Iteratively parse the compressed package to be retrieved until all Class files of the compressed package to be retrieved are obtained, wherein all Class files include Class files in the compressed package to be retrieved and Class files in dependent packages of the compressed package to be retrieved; Based on all the strings obtained by static analysis of all the Class files, a string list of the compressed package to be retrieved is constructed, wherein the string list includes a key-value pair of each string in all the strings, and each key-value pair of the string includes each string, the name of the Class to which each string belongs, and the name of the compressed package to which each string belongs; Obtaining a target search character of the compressed package to be searched; Based on the string list and the target search character, determining whether the target search character exists in the compressed package to be searched; The string list of the compressed package to be retrieved is constructed based on all the strings obtained by static analysis of all the Class files, including: Performing static analysis on all the class files to obtain all the strings contained in all the class files, wherein all the strings contain at least one string; Combine each of the strings, the name of the class in which each of the strings is located, and the name of the compressed package in which each of the strings is located to obtain a key-value pair for each of the strings; Based on the key-value pair of each string, a string list of the compressed package to be retrieved is obtained; Before determining whether the compressed package to be searched contains the target search character based on the string list and the target search character, the method further includes: Get the first word vector of each string in the string list; The step of determining whether the compressed package to be searched contains the target search character based on the string list and the target search character comprises: Obtaining a second word vector of the target search character; Obtaining a characteristic distance between the second word vector and the first word vector of each of the character strings; If the characteristic distance is less than or equal to a preset threshold, it is determined that the target search character exists in the compressed package to be searched.

2. The method for searching for characters in a packet according to claim 1, characterized in that: The iterative parsing of the compressed package to be retrieved until all Class files of the compressed package to be retrieved are obtained includes: Parsing the compressed package to be searched to obtain a preliminary parsing result of the compressed package to be searched, wherein the preliminary parsing result includes the Class files in the compressed package to be searched and the target dependent package of the compressed package to be searched; Parsing the target dependent package again to obtain a parsing result of the compressed package to be retrieved; Until the second parsing result does not contain the dependent package, all Class files of the compressed package to be retrieved are obtained.

3. The method for searching for characters in a packet according to claim 1, characterized in that: Before combining each of the strings, the name of the class to which each of the strings belongs, and the name of the compressed package to which each of the strings belongs to obtain a key-value pair for each of the strings, the following steps are also included: Detecting the encrypted character string among all the character strings; Decrypting the encrypted string to obtain a decrypted string; The step of combining each of the strings, the name of the Class to which each of the strings belongs, and the name of the compressed package to which each of the strings belongs to obtain a key-value pair of each of the strings, including: The decrypted string, the name of the Class where the decrypted string is located, and the name of the compressed package where the decrypted string is located are combined to obtain a key-value pair of the encrypted string.

4. The method for searching for characters in a packet according to claim 3, wherein: After determining whether the compressed package to be searched contains the target search character based on the string list and the target search character, the method further includes: If the target search character exists in the compressed package to be searched, obtaining key-value pairs of each matching character string of the target search character from the character string list; The key-value pairs of the matching character strings are output as search results of the target search characters.

5. The method for searching for characters in a packet according to any one of claims 1 to 4, characterized in that: The step of obtaining a target search character of the compressed package to be searched includes: Obtaining the restricted sensitive words of the compressed package to be searched as the target search characters; Alternatively, obtaining the name of the project configuration item corresponding to the compressed package to be searched, and using it as the target search character; Alternatively, the plain text password information corresponding to the compressed package to be searched is obtained as the target search character.

6. A device for searching characters in a packet, characterized in that: The character retrieval device in the packet comprises: An iterative parsing unit, used for iteratively parsing the compressed package to be searched until all the Class files of the compressed package to be searched are obtained, wherein all the Class files include the Class files in the compressed package to be searched and the Class files in the dependent packages of the compressed package to be searched; A static analysis unit, configured to construct a string list of the compressed package to be retrieved based on all the strings obtained by statically analyzing all the Class files, wherein the string list includes a key-value pair of each string in all the strings, and each key-value pair of the string includes each string, a class name of each string, and a compressed package name of each string; An acquisition unit, used for acquiring a target search character of the compressed package to be searched; A retrieval unit, configured to determine whether the target retrieval character exists in the compressed package to be retrieved based on the character string list and the target retrieval character; The string list of the compressed package to be retrieved is constructed based on all the strings obtained by static analysis of all the Class files, including: Performing static analysis on all the class files to obtain all the strings contained in all the class files, wherein all the strings contain at least one string; Combine each of the strings, the name of the class in which each of the strings is located, and the name of the compressed package in which each of the strings is located to obtain a key-value pair for each of the strings; Based on the key-value pair of each string, a string list of the compressed package to be retrieved is obtained; Before determining whether the compressed package to be searched contains the target search character based on the string list and the target search character, the method further includes: Get the first word vector of each string in the string list; The step of determining whether the compressed package to be searched contains the target search character based on the string list and the target search character comprises: Obtaining a second word vector of the target search character; Obtaining a characteristic distance between the second word vector and the first word vector of each of the character strings; If the characteristic distance is less than or equal to a preset threshold, it is determined that the target search character exists in the compressed package to be searched.

7. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and the processor executes the method for searching characters in a packet as claimed in any one of claims 1 to 5 when calling the computer program in the memory.

8. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the method for retrieving characters in a package as claimed in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Analyzing method, system and terminal for introducing third-party packet into software system

    CN102411509A

  • Method and device for detecting JAR packet collision

    CN105630463A