A method for identifying abnormal APK, electronic device and readable storage medium

By decompiling the APK file and using the TF value and textrank value to filter the target words, storing them in the sample database, and using the LDA model to identify abnormal APKs, the problem that the updated abnormal APKs cannot be identified in the existing technology is solved, and the identification accuracy and accuracy are improved. Completeness of database data.

CN114168155BActive Publication Date: 2024-10-01HANGZHOU YUNSHEN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111090867.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-17
Publication Date
2024-10-01
Estimated Expiration
2041-09-17

AI Technical Summary

Technical Problem

Existing technology is difficult to identify and update abnormal Android installation packages (APKs), leading to user information leakage and security risks. The existing database cannot meet the requirements for updated APK identification.

Method used

By decompiling the APK file, calculating the TF value and textrank value, filtering the target words and storing them in the sample database, the LDA model is used to determine whether the APK is an abnormal APK.

Benefits of technology

It improves the identification accuracy of abnormal APKs, optimizes the adequacy and completeness of database data, and ensures the effective identification of updated APKs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114168155B_ABST
    Figure CN114168155B_ABST
Patent Text Reader

Abstract

This invention discloses a method, electronic device, and readable storage medium for identifying abnormal APKs. The method includes the following steps: obtaining a target APK list; obtaining a first target word list and a second target word list based on files decompiled from the APKs in the target APK list; obtaining a target word list based on the first target keyword list and the second target word list and storing it in a sample database; inputting any target word from the target word list into a third model to obtain an expanded word vector, which is then stored in the sample database; and determining whether the APK to be tested is an abnormal APK based on the sample database. The technical solution of this invention ensures that the data in the sample database is sufficient and complete, which is beneficial to improving the accuracy of identifying abnormal APKs, and also optimizes the data in the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of APK files, and in particular to a method for identifying abnormal APK, an electronic device and a readable storage medium. Background Art

[0002] Currently, there are many types of Android installation packages (Android Package, APK for short) in the Android platform, among which abnormal types of APK may have negative effects on users, for example, leaking user information or inserting abnormal plug-ins.

[0003] In the existing technology, for the APK installed in the device, the number of abnormal APKs counted is limited. On the one hand, this is because the APK is encrypted and cannot be identified. On the other hand, abnormal APKs are constantly updated, and the database cannot meet the requirements for identifying the updated APKs, which has a negative impact on user use and affects user safety. Summary of the invention

[0004] In order to solve the problems of the prior art, by calculating the TF value and textrank value corresponding to the key in the text obtained by decompilation of any APK, and based on the TF value and textrank value, the target word is selected to expand several associated words, and the associated words and target words are stored in the sample database, ensuring that the data in the sample database is sufficient and complete, which is conducive to improving the accuracy of determining abnormal APKs, and also optimizes the data in this database; the embodiment of the present invention provides a method for identifying abnormal APKs, an electronic device, and a readable storage medium. The technical solution is as follows:

[0005] In one aspect, a method for identifying abnormal APKs comprises the following steps:

[0006] S101, obtain target APK list A = (A1, A2, A3, ..., A m ), where A i refers to the i-th target APK, and m is the number of target APKs;

[0007] S103, according to the target file D corresponding to A, obtain the first target list B = (B1, B2, B3, ..., Bλ) and the second target list Where Bx refers to the Xth first target word, x=1...λ, λ is the number of first target words, refers to the yth second target word, y = 1...γ, γ is the number of second target words;

[0008] Wherein, S103 further includes determining D by the following method:

[0009] Decompile Ai to obtain a target code package, which includes: a plurality of target files, each of which refers to a plurality of lines of editing code;

[0010] Take the Chinese corpus extracted from the editing code of any line as the target sentence, insert separators between the target sentences in adjacent lines and insert the same separators between adjacent target files, and obtain Di;

[0011] When D1∪D2∪…∪Dm and the same spacer is inserted into adjacent Di, D is obtained;

[0012] S105, according to B and Obtain a target word list C = (C1, C2, C3, ..., Cn) and store it in the sample database, where Cj refers to the jth sample keyword, j = 1 ... n, n is the number of sample keywords;

[0013] S107, input any Cj into the LDA model, obtain the word vector (Cj1, Cj2, Cj3, ..., Cjk) corresponding to Cj and store it in the sample database, where Cjt refers to the tth associated word corresponding to Cj, t=1...k, k is the number of associated words;

[0014] S109: Determine whether the APK to be tested is an abnormal APK based on the sample database.

[0015] On the other hand, an electronic device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the method for identifying abnormal APK as described in any one of the above items.

[0016] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction or at least one program is stored in the computer-readable storage medium, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the method for identifying abnormal APK as described in any one of the above items.

[0017] The present invention provides a method for identifying abnormal APK, an electronic device, and a readable storage medium, which have the following technical effects:

[0018] The invention obtains a target APK list, integrates target files according to the files after decompilation of the APK in the target APK list, obtains a first target word list and a second target word list according to the target file, obtains a target word list based on the first target word list and the second target word list, and stores it in a sample database; any target word in the target word list is input into a third model to obtain an expanded word vector for the target word and stores it in the sample database; based on the sample database, determines whether the APK to be tested is an abnormal APK; it can be seen that the technical solution of the invention ensures that the data in the sample database is sufficient and complete, which is conducive to improving the accuracy of determining abnormal APKs, and also optimizes the data in this database. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0020] Figure 1 It is a flowchart of a method for identifying abnormal APK provided in Example 1 of the present invention. DETAILED DESCRIPTION

[0021] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0023] according to Figure 1This embodiment provides a method for identifying abnormal APK, the method comprising the following steps:

[0024] S101, obtain target APK list A = (A1, A2, A3, ..., A m ), where A i refers to the i-th target APK, and m is the number of target APKs;

[0025] Specifically, the target APK is an APK with an abnormal flag, wherein A1...A m With the same exception identifier, it is possible to calculate the keywords in the same type of APK, and then expand the sample database through keywords, which is conducive to determining the type of APK to be tested.

[0026] S103, according to the target file D corresponding to A, obtain the first target list B = (B1, B2, B3, ..., Bλ) and the second target list Where Bx refers to the Xth first target word, x=1...λ, λ is the number of first target words, refers to the yth second target word, y = 1...γ, γ is the number of second target words;

[0027] Wherein, S103 further includes determining D by the following method:

[0028] Decompile Ai to obtain a target code package, which includes: a plurality of target files, each of which refers to a plurality of lines of editing code;

[0029] Take the Chinese corpus extracted from the editing code of any line as the target sentence, insert separators between the target sentences in adjacent lines and insert the same separators between adjacent target files, and obtain Di;

[0030] When D1∪D2∪…∪Dm and the same separator is inserted into adjacent Di, D is obtained.

[0031] Specifically, the target sentence includes one or more combinations of single characters, single phrases and a sentence; it can facilitate word segmentation processing, avoid mis-segmentation or missed word segmentation, simplify the process of calculating TF value and textrank value, and also improve the accuracy of calculating TF value and textrank value.

[0032] Preferably, the separator can be any stop word in a stop word library, such as " / ", "\", etc., for example, login / package / ... / involve, etc.

[0033] Specifically, those skilled in the art can use any decompilation software to perform decompilation, and the decompilation process will not be described in detail here.

[0034] Specifically, the S103 further includes the following steps:

[0035] Perform word segmentation and deduplication processing on D to obtain a first keyword list T = (T1, T2, T3, ..., Tp) and a TF value list S = (S1, S2, S3, ..., Sp) corresponding to T, where Tα refers to the αth first keyword and Sα refers to the TF value corresponding to Tα, α = 1 ... p, p is the number of first keywords, where S1 ≥ S2 ≥ S3 ≥ ... ≥ Sp;

[0036] Initialize B = Null and traverse S;

[0037] When α≤the preset sequence number threshold, Tα is inserted into B.

[0038] Specifically, the first keyword refers to the keyword obtained by segmenting the target sentence in Di using the first segmentation method and performing deduplication processing, wherein the first segmentation method refers to a method of traversing the target sentence in Di and performing segmentation using stop words in a stop word library as intervals. Those skilled in the art can know that any segmentation method and deduplication method can be used to obtain the first keyword, which will not be repeated here.

[0039] In a specific embodiment, when α≤the preset sequence number threshold and Sα=Sα+1=Sα+2=… Sα+r>Sα+r+1, the first keyword corresponding to T1 to the first keyword corresponding to Tα+r are all inserted into B; this can avoid missing keywords and ensure that sufficient associated words can be expanded based on the keywords and stored in the sample word database, which is conducive to the determination of abnormal APKs.

[0040] Specifically, λ=α or α+r, r=1...p-1.

[0041] At the same time, the same D is segmented and deduplicated to obtain the second keyword list and Corresponding textrank value list refers to the second keyword of β and means The corresponding textrank value is β=1... q, where q is the number of second keywords,

[0042] initialization And traverse

[0043] When β≤the sequence number threshold, Insert to

[0044] Specifically, the second keyword refers to the keyword obtained by segmenting the target sentence in Di using the second segmentation method and performing deduplication processing, wherein the second segmentation method is consistent with the first segmentation method or the second segmentation method refers to a method of traversing the target sentence in Di and performing segmentation using stop words in other stop word libraries as intervals. Those skilled in the art can know that any segmentation method and deduplication method can be used to obtain the first keyword, which will not be repeated here.

[0045] In a specific embodiment, when β ≤ the preset sequence number threshold and When The corresponding second keyword to The corresponding second keywords are inserted into It can avoid missing keywords and ensure that enough associated words can be expanded based on the keywords and stored in the sample word database, which is conducive to the determination of abnormal APKs.

[0046] Specifically, γ=β or β+g, g=1...q-1.

[0047] S105, according to B and The target word list C = (C1, C2, C3, ..., Cn) is obtained and stored in the sample database, where Cj refers to the jth sample keyword, j = 1 ... n, and n is the number of sample keywords.

[0048] Specifically, the method further comprises determining C by the following method:

[0049] Initialize C = Null and traverse B and

[0050] when When Bx is inserted into C, the keyword list can be obtained through the TF-IDF model and the textrank model, and the intersection of the two keyword lists is selected, which improves the accuracy of word selection and reduces the interference of other words, ensuring the accuracy of determining abnormal APKs.

[0051] S107. Input any Cj into the LDA model, obtain the word vector (Cj1, C2, Cj3, ..., Cjk) corresponding to Cj and store it in the sample database; Cjt refers to the tth associated word corresponding to Cj, t = 1 ... k, k is the number of associated words.

[0052] Specifically, the associated word refers to a word having the same or similar meaning as the target word.

[0053] The above method selects target words in two ways, which can ensure the accuracy of expanding the target words. At the same time, the target words are expanded to obtain word vectors, which increases the data volume in the sample database and the accuracy of determining abnormal APKs.

[0054] S109: Determine whether the APK to be tested is an abnormal APK based on the sample database.

[0055] Specifically, the step S107 further includes the following steps:

[0056] Obtain the text corresponding to the APK to be tested, where the text includes several keywords to be tested;

[0057] Traversing the sample database to obtain abnormal values ​​corresponding to the APK to be tested;

[0058] When the abnormal value is greater than or equal to a preset similarity threshold, the APK to be tested is determined to be an abnormal APK.

[0059] Specifically, the method of determining that the text corresponding to the APK to be tested is the same as the target file is used, which will not be repeated here.

[0060] Specifically, those skilled in the art may adopt any method to obtain an abnormal value for determining whether the APK to be tested is an abnormal APK, which will not be described in detail herein.

[0061] This embodiment provides a method for identifying abnormal APKs. On the one hand, it can ensure that the data in the sample database is sufficient and complete, which is conducive to improving the accuracy of determining abnormal APKs; on the other hand, it avoids missing target words and expands based on the target words, thereby optimizing the data in the sample database.

[0062] An embodiment of the present invention also provides an electronic device, including a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the method for identifying abnormal APK as described above.

[0063] The computer device of the embodiment of the present invention exists in various forms, including but not limited to:

[0064] (1) Mobile communication equipment: This type of equipment is characterized by having mobile communication functions and its main purpose is to provide voice and data communications. This type of terminal includes: smart phones (such as tPhone), multimedia phones, functional phones, and low-end phones.

[0065] (2) Ultra-mobile personal computer devices: These devices belong to the category of personal computers, have computing and processing functions, and generally also have mobile Internet access features. These terminals include: PDA, MtD and UMPC devices, such as tPad.

[0066] (3) Portable entertainment devices: These devices can display and play multimedia content. They include audio and video players (such as tPod), handheld game consoles, e-books, smart toys, and portable car navigation devices.

[0067] (4) Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.

[0068] (5) Other electronic devices with data interaction functions.

[0069] An embodiment of the present invention also provides a computer-readable storage medium, which can be set in an electronic device to store at least one instruction or at least one program related to a virus detection method in a method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the method for identifying abnormal APKs provided in the above method embodiment.

[0070] Optionally, in this embodiment, the storage medium may be located in at least one of the multiple network servers of the computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0071] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for identifying abnormal APK, characterized in that: The method comprises the following steps: S101, obtain target APK list A = (A1, A2, A3, ..., A m ), where A i refers to the i-th target APK, and m is the number of target APKs; S103, according to the target file D corresponding to A, obtain the first target list B = (B1, B2, B3, ..., B λ ) and the second target list Among them, B x refers to the Xth first target word, x=1...λ, λ is the number of first target words, refers to the yth second target word, y = 1...γ, γ is the number of second target words; Wherein, S103 further includes determining D by the following method: A i Decompiling to obtain a target code package, wherein the target code package includes: a plurality of target files, wherein the target files refer to a plurality of lines of editing code; Take the Chinese corpus extracted from the edit code of any line as the target sentence, insert separators between the target sentences of adjacent lines and insert the same separators between adjacent target files, and get D i ; When D1∪D2∪…∪D m When and adjacent to D i Insert the same spacer to get D; S105, according to B and Get the target word list C = (C1, C2, C3, ..., C n ) and stored in the sample database, where C j refers to the jth sample keyword, j = 1...n, n is the number of sample keywords; S107, any C j Input into the LDA model and get C j The corresponding word vector (C j1 , C j2 , C j3 , ..., C jk ) and stored in the sample database, where C jt C j The corresponding t-th associated word, t = 1...k, k is the number of associated words; S109: Determine whether the APK to be tested is an abnormal APK based on the sample database.

2. A method for identifying abnormal APK according to claim 1, characterized in that: The target APK is an APK with an abnormal identification.

3. A method for identifying abnormal APK according to claim 2, characterized in that: A1……A m Have the same exception ID.

4. The method for identifying abnormal APK according to claim 1, characterized in that: The target sentence includes one or more combinations of a single word, a single phrase and a sentence.

5. The method for identifying abnormal APK according to claim 1, characterized in that: The separator can be any stop word in the stop word library.

6. The method for identifying abnormal APK according to claim 1, characterized in that: The method also determines B as follows: Perform word segmentation and deduplication processing on D to obtain a first keyword list T = (T1, T2, T3, ..., Tp) and a TF value list S = (S1, S2, S3, ..., Sp) corresponding to T, where Tα refers to the αth first keyword and Sα refers to the TF value corresponding to Tα, α = 1 ... p, p is the number of first keywords, where S1 ≥ S2 ≥ S3 ≥ ... ≥ Sp; Initialize B = Null and traverse S; When α≤the preset sequence number threshold, Tα is inserted into B.

7. A method for identifying abnormal APK according to claim 1 or 6, characterized in that: The method also includes the following method to determine Perform word segmentation and de-duplication processing on the same D to obtain the second keyword list and Corresponding textrank value list refers to the second keyword of β and means The corresponding textrank value is β=1…q, where q is the number of second keywords. initialization And traverse When β≤the sequence number threshold, Insert to 8. The method for identifying abnormal APK according to claim 1, characterized in that: The method further comprises determining C as follows: Initialize C = Null and traverse B and when , insert Bx into C.

9. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the method for identifying abnormal APK according to any one of claims 1 to 8.

10. A computer-readable storage medium, wherein at least one instruction or at least one program is stored in the computer-readable storage medium, wherein the at least one instruction or the at least one program is loaded and executed by a processor to implement the method for identifying abnormal APK according to any one of claims 1 to 8.