CN105404583B - The quick detection of APK a kind of and the method for improving unit resource utilization rate - Google Patents

The quick detection of APK a kind of and the method for improving unit resource utilization rate Download PDF

Info

Publication number
CN105404583B
CN105404583B CN201510730835.7A CN201510730835A CN105404583B CN 105404583 B CN105404583 B CN 105404583B CN 201510730835 A CN201510730835 A CN 201510730835A CN 105404583 B CN105404583 B CN 105404583B
Authority
CN
China
Prior art keywords
apk
virtual machine
file
mrow
resource
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510730835.7A
Other languages
Chinese (zh)
Other versions
CN105404583A (en
Inventor
张妍
张茜
王雅哲
陈学刚
高振鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongke Information Security Common Technology National Engineering Research Center Co ltd
Institute of Information Engineering of CAS
Original Assignee
Zhongke Information Security Common Technology National Engineering Research Center Co ltd
Institute of Information Engineering of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongke Information Security Common Technology National Engineering Research Center Co ltd, Institute of Information Engineering of CAS filed Critical Zhongke Information Security Common Technology National Engineering Research Center Co ltd
Priority to CN201510730835.7A priority Critical patent/CN105404583B/en
Publication of CN105404583A publication Critical patent/CN105404583A/en
Application granted granted Critical
Publication of CN105404583B publication Critical patent/CN105404583B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A kind of APK of the present invention quick detection and the method for raising unit resource utilization rate are that the computer of operation virtual machine determines that APK to be detected takes the minimum value Φ of every resources of virtual machine1And determine that current slot is not detected the ratio Φ of APK priority attributes sum and detected APK priority attributes sum2, and using Lagrangian weighting method to Φ1And Φ2It is weighted processing and forms Φ values;Then APK optimal distributing schemes to be detected are determined using genetic algorithm, i.e., by being realized in genetic algorithm by adding fitness P, the fitness P is the Φ sums of all virtual machines, is achieved in paying close attention to the optimal of whole detecting system.The advantage of the invention is that:The present invention is the method for raising APK detection rates and resource utilization based on APK attributes Yu resources of virtual machine relation, is distributed using this method with detecting that faster, resource utilization is more effective for speed during APK.

Description

The quick detection of APK a kind of and the method for improving unit resource utilization rate
Technical field
The invention belongs to field of information security technology, more particularly to a kind of Android mobile applications (Android Application package, APK) quick detection and improve detecting system unit resource utilization rate method.
Background technology
With the high speed development of mobile Internet, the types of applications based on android system is largely developed.It is same with this When, occur in that numerous spam applications, malicious application etc. so that the safety problem that mobile terminal faces also increases therewith, causes out Originator and user benefit are impaired.Therefore need to carry out safety detection to Android application program.
Existing detection method is generally comprised:Static Detection, dynamic detection and Viral diagnosis.Static Detection is in APK Detected before performing;Dynamic detection is detected when APK is run;Viral diagnosis is to carry out Virus Sample knowledge for APK Do not kill virus.The ability of detection rates and consumption detecting system resource needed for different detection methods is not quite similar.
The APK detections of cloud computing are currently based on, its step is mainly:First, APK file to be measured is uploaded;Secondly, according to upper APK precedence is passed, is sequentially allocated in specified virtual machine and is detected.In face of a large amount of different sizes, type, different inspections During the APK to be measured of survey demand, due to not accounting for the detection resource of reasonable distribution system, there will necessarily be certain detection effect Rate is low and the low problem of resource utilization.
Therefore need a kind of quick detection of Android mobile applications and improve detecting system unit resource utilization rate Method solve the problem of prior art is present.
The content of the invention
The purpose of the present invention is in view of the shortcomings of the prior art, to propose a kind of quick inspection of Android mobile applications The method surveyed and improve unit resource utilization rate, this method effectively improves APK detection speed and detection resource utilization.
Technical scheme of the present invention concern be not which APK to be detected is assigned to it is optimal in some virtual machine, and It is how all APK to be detected to be assigned in different virtual machines so that detecting system quick detection in an optimal manner APK。
The technical thought of technical scheme of the present invention is:It is every that the computer of operation virtual machine determines that APK to be detected takes The minimum value Φ of platform resources of virtual machine1And determine that current slot is not detected APK priority attributes sum and detected APK The ratio Φ of priority attribute sum2, and using Lagrangian weighting method to Φ1And Φ2It is weighted processing and forms Φ values;So Determine APK optimal distributing schemes to be detected using genetic algorithm afterwards, i.e., by genetic algorithm by adding fitness P come real Existing, the fitness P is the Φ sums of all virtual machines, is achieved in paying close attention to the optimal of whole detecting system;In addition, in this hair In the bright genetic algorithm used, realized by operations such as intersection, selections and optimum allocation is realized to whole detecting system, so as to reach Detection resource utilization is improved to realize quick detection APK purpose.
Realize the specific as follows of technique effect of the present invention:
The quick detection of APK a kind of and the method for improving unit resource utilization rate:
Include the computer of an operation virtual machine;
The computer of the operation virtual machine obtains APK to be detected in batches from detection queue;
The computer of the operation virtual machine obtains APK attributes to be detected and resources of virtual machine attribute;
The COMPUTER DETECTION of the operation virtual machine simultaneously determines APK property values to be detected and resources of virtual machine property value;
The computer of the operation virtual machine determines the weight of the corresponding resources of virtual machine of APK attribute, and the weight is used In influence degree of the attribute to resources of virtual machine for identifying APK;
The computer of the operation virtual machine is set up and calculates APK property values to be detected and resources of virtual machine property value letter Number;
The computer of the operation virtual machine determines optimal APK allocative decisions using genetic algorithm;
APK to be detected is distributed to virtual machine by the computer of the operation virtual machine according to optimal APK allocative decisions.
Further, the APK attributes include:Code is answered in the size of APK file, the size of DEX file, APK file Resource file complexity and APK detection priority in miscellaneous degree, APK file median surface complexity, APK file, wherein,
The size of the APK file refers to that APK file takes the size of memory space in itself, and unit is Mb;
The size of the DEX file refers to the size of the entitled .dex files of extension in APK file, unit Mb;
Code complexity refers to the relation of the directories deep of code and number of files in dex files, code in the APK file It is (1,100) that complexity, which sets scope, APK file directories deep for (1,10], more than 10 in terms of 10, APK number of files (1, 1000], more than 1000 in terms of 1000;
APK file median surface complexity refers to the interface numbers of APK in the process of running and control used in interface Relation, it is (1,100) that interface complexity, which refers to setting scope, APK interfaces sum for (1,100], it is single more than 100 in terms of 100 Individual interface control sum (1,10], more than 10 in terms of 10;
Resource file complexity refers in APK the level of catalogue and following catalogue and text under res catalogues in the APK file Relation between number of packages, it is (1,100) that the complexity of the resource file, which sets scope, directories deep for (1,5], every grade of maximum Catalogue number (1,10], the maximum number of files of each catalogue (1,100];
The APK detections priority refers to the APK detection time starteds the latest to be met, maximum number of required resource etc. Condition, including but not limited to above-mentioned condition, can dynamically be adjusted according to actual conditions;
The resources of virtual machine attribute includes CPU indexes, memory index and thread index, wherein,
The CPU indexes refer to the ratio for the original usable resource of resource and CPU that CPU can currently be used;
The memory index refers to the ratio of internal memory current idle resource and the original usable resource of internal memory,
The thread index refers to the idle number of current hyperthread thread and original line number of passes.
Further, the APK property values include the size attribute value, the size attribute value of DEX file, APK of APK file Resource file complexity attributes in code complexity attributes value, APK file median surface complexity attributes value, APK file in file Value and APK detect priority attribute value, wherein,
The ratio between the size attribute value of APK file, specially APK actual sizes and detectable APK file maximum are multiplied by 100;
DEX actual size and detectable DEX file in the size attribute value of DEX file, specially APK in APK file The ratio between maximum be multiplied by 100;
Code complexity attributes value in APK file, specially the directories deep of code is multiplied by detectable DEX in DEX file After the maximum 30 of file divided by maximum directories deep 10 and it is multiplied by plus total number of files in DEX file after 70 divided by file is maximum Number 1000 is obtained;
Total interface number of APK file median surface complexity attributes value, specially APK file is multiplied by single interface control most Most divided by setting interface maximum number and the product of the maximum number of control in interface, then obtain APK file median surface multiplied by 100 Complexity attributes value;
Resource file complexity attributes value in APK file, specially in APK file under Res files physical directory depth with Directories deep maximum under the product of the maximum number of physical directory maximum number and physical directory file divided by the Res files of setting with The product of maximum number of files in catalogue number maximum and catalogue, then obtains resource file complexity category in PK files multiplied by with 100 Property value;
APK detects priority attribute value, and specially the time to be checked 10 is subtracted after setting detection time divided by 10 the latest the latest It is multiplied by 100 determinations;
The resources of virtual machine property value includes CPU exponential quantities, memory index value and thread exponential quantity, wherein,
The CPU exponential quantities are specially the product that CPU core calculation is not used by rate with CPU frequency and current CPU;
The memory index value is specially the product that CPU memory sizes and current memory are not used by rate;
The thread exponential quantity is specially the product that Thread Count and current thread are not used by rate.
The weight determination mode of the corresponding resources of virtual machine of the APK attributes is:
Each APK has some attributes, and each virtual machine possesses limited resource, and APK attribute determines it in void Allocation result in plan machine;
If influenceing the attribute of APK distribution as follows:
X1, X2..., Xt..., XT
The surplus resources species of each virtual machine is as follows:
R1, R2..., Rt..., RT
Because certain resource of virtual machine and APK some attributes are associated, so that the APK method of salary distribution is determined, it is described The expression formula of association is:
RS=us1X1+us2X2+…+ustXt…+usTXT
Wherein,
S=1,2,3,4,5,6
T=1,2,3,4,5,6
ustRelation between resource s and attribute t is represented, 0≤u need to be met simultaneouslyst≤ 1 and us1+us2+…+ust=1 two bar Part;RsRepresent that some APK is assigned to virtual machine S class resources shared after virtual machine.
The computer of the operation virtual machine is set up and calculates APK property values to be detected and resources of virtual machine attribute value function Mode be:
By N number of APK (APKn| 1≤n≤N) it is assigned to M virtual machine (Vm| 1≤m≤M) on, i.e., N number of APK is divided into M Cluster, each candidate cluster is designated as C 'm;It meets following constraints:
Resource sum needed for the APK being put into each virtual machine is not more than the resource that the virtual machine is actually possessed, and is:
Xt∈{X1, X2..., XTAnd ust≠0
Need to meet thereon:
Optimization aim one:The resource of every virtual machine is taken most possibly
Xt∈{X1, X2..., XTAnd ust≠ 0,
Wherein:M represents virtual machine number, and s represents resource category
Optimization aim two:For priority attribute, the higher APK of property value is preferentially distributed
Wherein:I represents not selected APK, the selected APK of j tables
Two above optimization aim is subjected to Lagrangian weighting, integrated objective function as follows can be obtained:
Φ=δ Φ1+(1-δ)Φ2, wherein, (0≤δ≤1).
The computer of the operation virtual machine determines concretely comprising the following steps for optimal APK allocative decisions using genetic algorithm:
Step one:Individual UVR exposure is generated
Using binary coding, a special coded identification "×" is introduced in addition and represents to forbid gene, forbids gene institute Corresponding virtual machine is mismatched with the APK performances or virtual machine is in busy condition, it is impossible to which receive an assignment distribution;In initialization When, forbid gene to be allocated coding "×", and all without change in genetic manipulation below, i.e., do not consider that distribution is corresponding APK gives the virtual machine;Therefore, the gene on chromosome has " 0 ", " 1 ", three kinds of codings of "×", if the gene of μ rows τ row isThen significance of which is as follows:
Step 2:The generation of initial population
Because genetic algorithm is operated to colony, the data of initial population are determined;
Rapid three:Carry out fitness calculating
The quality of whole allocative decision is evaluated with the fitness size of all virtual machine sums in genetic algorithm, so that certainly The size of fixed heredity chance;
The fitness is used(i represents the number of virtual machine) measures,More big selected probability It is bigger;
Step 4:It is specifically chosen
Constitute follow-on individual using roulette method choice, any individual selected probability be equal to its adaptive value with The ratio of all chromosome adaptive value sums, in this selection course, elite retention strategy is used, to ensure the optimal of acquisition Individual is not destroyed by further genetic manipulation, so as to more likely converge to globally optimal solution;In operations such as intersection, variations Afterwards, if the adaptive value of optimum individual is less than the adaptive value of optimum individual in previous generation in a new generation, previous generation's is optimal Individual is replicated, and replaces the worst individual in a new generation;
Step 5:Cross selection
In order to ensure filial generation dyeing always meets constraints, make the feasible solution of child chromosome always problem, two fathers A row or column in generation dyeing volume matrix is with certain crossover probability PcExchanged, need to be in father's chromosome P after the completion of intersection1、P2 With new chromosome C1、C2Between selected, adaptive value it is higher enter of future generation, be specially:
O1=max { fitne ss(P1), fitne ss(C1), Q2=max { fitness(P2), fitness(C2)}
Step 6:Variation
Mutation operator is that the genic value on some or certain some genes to individual is changed by a certain less probability Become, it is also a kind of operating method for producing new individual.We use the method that position makes a variation in this model, i.e., from N rows, in M row Randomly generate two random numbers p and q, then when following two condition is met, the gene that pth row q is arrangedIt is changed into 1 from 0 Or it is changed into 0 from 1, and following two conditions need to be met:Condition 1 is geneIt is not to forbid gene, condition 2 is Above-mentioned two condition is met simultaneously just can enter row variation.
The advantage of the invention is that:The present invention is the raising APK detection rates based on APK attributes Yu resources of virtual machine relation With the method for resource utilization, when detecting APK using this method, we are only needed to APK attributes to be detected and resources of virtual machine Model attributes, calculate the relation function of APK attributes and resources of virtual machine attribute, then by genetic algorithm, calculate APK dispatching party Case, distributes to virtual machine by APK according to scheduling scheme and is detected.Due to the issue in current APK and renewal speed faster, institute To be distributed using this method with detecting that faster, resource utilization is more effective for speed during APK.
Brief description of the drawings
The initial population body surface schematic diagram data that genetic algorithm is operated to colony in Fig. 1 technical schemes of the present invention;
A line (or row) in Fig. 2 technical schemes of the present invention in two parent chromosome matrixes of genetic algorithm is with one Determine crossover probability PcBy exchange schematic diagram;
Embodiment
For the object, technical solutions and advantages of the present invention are more clearly understood, hereafter technical solution of the present invention is made into One step is described in detail.It should be noted that in the case where not conflicting, feature in embodiments herein and embodiment can be with Arbitrarily it is mutually combined.
The APK attributes that the present invention is referred to describe in detail as follows:
(1) for the size of APK file, X is used1Represent
The size of APK file refers to that file takes the size of memory space in itself, and unit is Mb.
Common, the composition of APK file includes:META-INF, the certificate signature of its essential record file;Res, its lead It is used for the catalogue for depositing resource file;AndroidManifest.xml, it is mainly used in program global configuration file; Classes.dex, it is mainly used in depositing Dalvik bytecodes;Resources.arsc, it is mainly used in after storage compiling Binary Resources file.
Current detectable APK file size between (0,300) Mb, and major part APK size (5,50) Mb it Between.Test result shows that file is bigger, and required detection resource is bigger.
X1Value be equal to APK actual sizes divided by detectable APK file maximum 300 multiplied by with 100, retain two small Number, formula is as follows:
Example:APK actual size is 34.5Mb, is specifically calculated as follows:
X1=34.5 300 × 100=11.5 of ÷
(2) for the size of dex files in APK file, X is used2Represent
The size of Dex files refers to the size of the entitled .dex files of extension in APK file, unit Mb.
The size of Dex files between (0,30Mb), and major part dex files size between (1,10Mb), .dex file is bigger, illustrates that size of code is bigger, service logic is more complicated.
X2Value be equal to Dex actual sizes divided by detectable Dex files in APK maximum 30 multiplied by with 100, retain two Position decimal, formula is as follows:
Example:Dex actual size is 4.5Mb, is specifically calculated as follows:
X2=4.5 30 × 100=15 of ÷
(3) code complexity in APK file, uses X3Represent
Code complexity refers to the relation of the directories deep of code and number of files in dex files.
Code complexity set scope be (1,100), directories deep for (1,10], more than 10 in terms of 10, the file of class Number (1,1000], more than 1000 in terms of 1000.
X3The depth value of the bag such as value be multiplied by 30 except 10 again plus the sum of class is multiplied by 70 and removes 1000, retain two-decimal, it is public Formula is as follows:
Example:The depth of bag is 7, and the sum of class is 452, substitutes into formula specific as follows:
X3The ÷ 1000=62.64 of=7 × 30 ÷ 10+452 × 70
(4) APK file median surface complexity, uses X4Represent
Interface complexity refers to the relation of the interface numbers of APK in the process of running and control used in interface.
Interface complexity refer to setting scope be (1,100), interface sum for (1,100], it is single more than 100 in terms of 100 Interface control sum (1,10], more than 10 in terms of 10.
The interface number of the bag such as value be multiplied by the interface maximum number 100 of the most most of single interface control divided by setting, interface The product of the maximum number 10 of middle control, multiplied by 100, retains two-decimal, formula is as follows:
Example:The interface number of bag is 36, in interface control at most be 8, substitute into formula specific as follows:
X4=36 × 8 ÷ (100 × 10) × 100=28.8
(5) resource file complexity in APK file, uses X5Represent
Resource file complexity is referred in APK under res catalogues between the level of catalogue and following catalogue and number of files Relation.
It is (1,100) that the complexity of resource file, which sets scope, directories deep for (1,5], every grade of maximum catalogue number (1, 10], each catalogue maximum number of files (1,100].(according to circumstances sustained improvement)
Value be equal to APK in Res physical directories depth, physical directory maximum number, the product of the maximum number of physical directory file Divided by the Res directories deep maximum 5 of setting, catalogue number maximum 10, catalogue maximum number of files 100 product, multiplied by with 100 retain two-decimal, and formula is as follows:
Example:Res physical directory depth is 3, and maximum catalogue number is 8, and maximum number of files is 30, is specifically calculated as follows:
X5=(3 × 8 × 20) ÷ (5 × 10 × 100) × 100=9.6
(6) APK detects priority, uses X6Represent
Priority refers to the APK detection time starteds the latest to be met, the condition such as maximum number of required resource, including But it is not limited to above-mentioned condition.
The scope (1,100) set at present, the time detected the latest in units of hour, retains two small multiplied by with 100 Number, formula is as follows:
Example:The latest detection time be 8 hours 30 points, be specifically calculated as follows:
X6=((10-8) × 60-30) ÷ (10 × 60) × 100=15
The source attribute values for the virtual machine that the present invention is referred to are specific as follows:
(1) CPU indexes, with representing
CPU indexes refer to the ratio for the original usable resource of resource and CPU that CPU can currently be used, calculation formula CPU core calculation × CPU frequency × (the currently used rates of 1-CPU).
(2) memory index, with representing
Memory index refers to the ratio of internal memory current idle resource and the original usable resource of internal memory, calculation formula CPU Memory size × (the currently used rate of 1- internal memories).
(3) thread index, with representing
Thread index refers to the idle number of current hyperthread thread and original line number of passes, calculation formula Thread Count × (1- The currently used rate of thread).
Attribute according to the APK of above-mentioned analysis obtains detecting the unit of account of resource needed for one, further according to detection resource Corresponding attribute itself, passes through following algorithm a to value.
Each APK has some attributes, and each virtual machine possesses limited resource, and APK attribute determines it in void Allocation result in plan machine;
If influenceing the attribute of APK distribution as follows:
X1, X2..., Xt..., XT
The surplus resources species of each virtual machine is as follows:
R1, R2..., Rt..., RT
Because certain resource of virtual machine may be associated with APK some attributes, so that the APK method of salary distribution is determined, This association is expressed as follows by we with mathematical form:
Rs=us1X1+us2X2+…+ustXT…+usTXT
Wherein, the implication of each parameter is:
S=1,2 ..., S
T=1,2 ..., T
ustRelation between resource s and attribute t is represented, 0≤u need to be met simultaneouslyst≤ 1 and us1+us2+…+ust=1 two bar Part;RsRepresent that some APK is assigned to virtual machine S class resources shared after virtual machine.
APK attributes are analyzed as follows with the concrete example that associates of resources of virtual machine:
Certain APK will carry out Static Detection, and APK each attribute description is as follows:
File size is 25.7Mb;
Wherein dex file sizes are 1.3Mb;
Maximum directories deep is 7 grades in dex files, and total files are 358;
Possessed interface number is 26, most in interface to be integrated with 9 controls;
Maximum directories deep is that most catalogue numbers under 4 grades, single catalogue is 7 in source file catalogue, under single catalogue Most number of files is 84;
According to above-mentioned attribute description, attribute is substituted into Rs=us1X1+us2X2+…+ustXt…+usTXTFollowing public affairs can be obtained Formula:
R1=u11X1+u12X2+u13X3+u14X4+u15X5
APK attributes and result of calculation:
X1=8.6, X2=4.3, X3=46, X4=23.4, X5=47
APK attributes and resources of virtual machine incidence relation:
u11=0.15, u12=0.35, u13=0.35, u14=0.05, u15=0.1
Each result above is substituted into formula and obtains following result:
R1=0.15 × 8.6+0.35 × 4.3+0.35 × 46+0.05 × 23.4+0.1 × 47=24.76.
Now by N number of APK { APKn| 1≤n≤N } it is assigned to M virtual machine { Vm| 1≤m≤M } on, i.e., N number of APK is divided into M Individual cluster, each candidate cluster is designated as C 'm;It meets following constraints:
Resource sum needed for the APK being put into each virtual machine is not more than the resource that the virtual machine is actually possessed, and is:
Xi∈{X1, X2..., XTAnd ust≠0
Need to meet thereon:
Optimization aim one:The resource of every virtual machine is taken most possibly
Xt∈{X1, X2..., XTAnd ust≠ 0,
Wherein:M represents virtual machine number, and s represents resource category
Optimization aim two:For priority attribute, the higher APK of property value is preferentially distributed
Wherein:I represents not selected APK, the selected APK of j tables
Two above optimization aim is subjected to Lagrangian weighting, integrated objective function as follows can be obtained:
Φ=δ Φ1+(1-δ)Φ2, wherein, (0≤δ≤1).
Based on above-mentioned analysis, optimal distributing scheme is found using genetic algorithm, following steps are specifically included:
Step one:Individual UVR exposure is generated
Using binary coding, a special coded identification "×" is introduced in addition and represents to forbid gene, forbids gene institute Corresponding virtual machine is mismatched with the APK performances or virtual machine is in busy condition, it is impossible to which receive an assignment distribution.In initialization When, forbid gene to be allocated coding "×", and all without change in genetic manipulation below, it is meant that do not consider distribution pair The APK answered gives the virtual machine.Therefore, the gene on chromosome has " 0 ", " 1 ", three kinds of codings of "×", if the gene of row row For then significance of which is as follows:
Step 2:The generation of initial population
As described in Figure 1, genetic algorithm is operated to colony, its data given initial population;
Step 3:Carry out fitness calculating
The quality of whole allocative decision is evaluated with the fitness size of all virtual machine sums in genetic algorithm, so that certainly The size of fixed heredity chance;Fitness is used in this model(i represents the number of virtual machine) measures,More Selected probability is bigger greatly;
Step 4:It is specifically chosen
Constitute follow-on individual using roulette method choice, any individual selected probability be equal to its adaptive value with The ratio of all chromosome adaptive value sums;In this selection course, elite retention strategy is used, to ensure the optimal of acquisition Individual is not destroyed by further genetic manipulation, so as to more likely converge to globally optimal solution;In operations such as intersection, variations Afterwards, if the adaptive value of optimum individual is less than the adaptive value of optimum individual in previous generation in a new generation, previous generation's is optimal Individual is replicated, and replaces the worst individual in a new generation;For example, set parent chromosome population as:
P={ A1, X2..., Ai... Aj... As}
And the new population obtained after intersecting, making a variation is:
Q={ B1, B2... Bm... Bn... Bs}
Wherein, AiAnd Aj,BmAnd BnIt is the optimal and worst individual in parent population and new population respectively, if adaptive value fitness(Bm) < fitness(Ai), then sub- population recruitment of future generation is as follows:
O={ B1, B2... Bm... Ai... Bs}
Step 5:Cross selection
As shown in Fig. 2 in order to ensure filial generation dyeing always meets constraints, making the feasible of child chromosome always problem A line (or row) in solution, two parent chromosome matrixes is with certain crossover probability PcExchanged;
, need to be in father's chromosome P after the completion of intersection1、P2With new chromosome C1、C2Between selected, adaptive value is higher to be entered Enter the next generation:
Q1=max { fitness(P1), fitness(C1), Q2=max { fitness(P2), fitness(C2)}
Step 6:Variation
Mutation operator is that the genic value on some or certain some genes to individual is changed by a certain less probability Become, it is also a kind of operating method for producing new individual.We use the method that position makes a variation in this model, i.e., from N rows, in M row Randomly generate two random numbers p and q, then when following two condition is met, the gene that pth row q is arrangedIt is changed into from 0 1 or it is changed into 0 from 1, and following two conditions need to be met:Condition 1 is geneIt is not to forbid gene, condition 2 is Above-mentioned two condition is met simultaneously just can enter row variation.
The present invention is described in detail above, used herein principle and embodiment of the embodiment to the application It is set forth, the explanation of above example is only intended to help and understands the present processes and its core concept;Simultaneously for Those of ordinary skill in the art, according to the thought of the application, have change in specific embodiments and applications Place, in summary, this specification content should not be construed as the limitation to the application.

Claims (4)

1. the quick detection of APK a kind of and the method for improving unit resource utilization rate:
Include the computer of an operation virtual machine;
The computer of the operation virtual machine obtains APK to be detected in batches from detection queue;
The computer of the operation virtual machine obtains APK attributes to be detected and resources of virtual machine attribute;
The COMPUTER DETECTION of the operation virtual machine simultaneously determines APK property values to be detected and resources of virtual machine property value;
The computer of the operation virtual machine determines the weight of the corresponding resources of virtual machine of APK attribute, and the weight is used to mark Know APK influence degree of the attribute to resources of virtual machine;
The computer of the operation virtual machine is set up and calculates APK property values to be detected and resources of virtual machine attribute value function, has Body mode is:
By N number of APK { APKn| 1≤n≤N } it is assigned to M virtual machine { Vm| 1≤m≤M } on, i.e., N number of APK is divided into M cluster, often Individual candidate cluster is designated as C'm;It meets following constraints:
Resource sum needed for the APK being put into each virtual machine is not more than the money that the virtual machine is actually possessed, and is:
Xt∈{X1,X2,…,XTAnd ust≠ 0,
Need to meet thereon:
Optimization aim one:The resource of every virtual machine is taken most possibly
Xt∈{X1,X2,…,XTAnd ust≠ 0,
<mrow> <msub> <mi>&amp;Phi;</mi> <mn>1</mn> </msub> <mo>=</mo> <munderover> <mo>&amp;Sigma;</mo> <mrow> <mi>m</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi>M</mi> </munderover> <munderover> <mo>&amp;Sigma;</mo> <mrow> <mi>t</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi>T</mi> </munderover> <msub> <mi>&amp;alpha;</mi> <mi>t</mi> </msub> <mo>|</mo> <mo>|</mo> <msubsup> <mi>R</mi> <mi>s</mi> <msub> <mi>V</mi> <mi>m</mi> </msub> </msubsup> <mo>-</mo> <munderover> <mo>&amp;Sigma;</mo> <mrow> <mi>i</mi> <mo>=</mo> <mn>1</mn> </mrow> <mrow> <mo>|</mo> <mo>|</mo> <msubsup> <mi>C</mi> <mi>m</mi> <mo>&amp;prime;</mo> </msubsup> <mo>|</mo> <mo>|</mo> </mrow> </munderover> <msubsup> <mi>X</mi> <mi>t</mi> <mrow> <msub> <mi>APK</mi> <mrow> <mi>m</mi> <mi>i</mi> </mrow> </msub> </mrow> </msubsup> <mo>|</mo> <mo>|</mo> <mo>&amp;RightArrow;</mo> <mi>m</mi> <mi>i</mi> <mi>n</mi> </mrow>
Wherein:M represents virtual machine number, and s represents resource category
Optimization aim two:For priority attribute, the higher APK of property value is preferentially distributed;
<mrow> <msub> <mi>&amp;Phi;</mi> <mn>2</mn> </msub> <mo>=</mo> <mfrac> <mrow> <munder> <mo>&amp;Sigma;</mo> <mi>i</mi> </munder> <msubsup> <mi>X</mi> <mi>p</mi> <mrow> <msub> <mi>APK</mi> <mrow> <mi>m</mi> <mi>i</mi> </mrow> </msub> </mrow> </msubsup> </mrow> <mrow> <munder> <mo>&amp;Sigma;</mo> <mi>j</mi> </munder> <msubsup> <mi>X</mi> <mi>p</mi> <mrow> <msub> <mi>APK</mi> <mrow> <mi>m</mi> <mi>j</mi> </mrow> </msub> </mrow> </msubsup> </mrow> </mfrac> <mo>&amp;RightArrow;</mo> <mi>m</mi> <mi>i</mi> <mi>n</mi> </mrow>
Wherein:I represents not selected APK, the selected APK of j tables
Two above optimization aim is subjected to Lagrangian weighting, integrated objective function as follows can be obtained:
Φ=δ Φ1+(1-δ)Φ2Wherein, (0≤δ≤1);
The computer of the operation virtual machine determines optimal APK allocative decisions using genetic algorithm, specific optimal APK allocative decisions The step of be:
Step one:Individual UVR exposure is generated
Using binary coding, a special coded identification "×" is introduced in addition and represents to forbid gene, is forbidden corresponding to gene Virtual machine and the APK performances mismatch or virtual machine is in busy condition, it is impossible to receive an assignment distribution;
In initialization, gene is forbidden to be allocated coding "×", and do not examined all without change in genetic manipulation below The corresponding APK of distribution is considered to the virtual machine;Therefore, the gene on chromosome has " 0 ", " 1 ", three kinds of codings of "×", if theμRowτ The gene of row isThen significance of which is as follows:
Step 2:The generation of initial population
Because genetic algorithm is operated to colony, the data of initial population are determined;
Rapid three:Carry out fitness calculating
The quality of whole allocative decision is evaluated with the fitness size of all virtual machine sums in genetic algorithm, so as to determine to lose Pass the size of chance;
The fitness is usedMeasurement,More big selected probability is bigger, and wherein i represents virtual machine Number;
Step 4:It is specifically chosen
Follow-on individual is constituted using roulette method choice, any individual selected probability is equal to its adaptive value with owning The ratio of chromosome adaptive value sum, in this selection course, elite retention strategy is used, to ensure the optimum individual obtained Do not destroyed by further genetic manipulation, so as to more likely converge to globally optimal solution;In operations such as intersection, variations Afterwards, if the adaptive value of optimum individual is less than the adaptive value of optimum individual in previous generation, optimal of previous generation in a new generation Body is replicated, and replaces the worst individual in a new generation;
Step 5:Cross selection
In order to ensure filial generation dyeing always meets constraints, make the feasible solution of child chromosome always problem, two parents dyes A row or column in colour solid matrix is with certain crossover probability PcExchanged, need to be in father's chromosome P1, P2 and new after the completion of intersection Selected between chromosome C1, C2, the higher entrance of adaptive value is of future generation, is specially:
O1=max { fitness(P1),fitness(C1)}
O2=max { fitness(P2),fitness(C2)};
Step 6:Variation
From N rows, two random numbers p and q are randomly generated in M row, then when following two condition is met, pth row q is arranged GeneIt is changed into 1 from 0 or is changed into 0 from 1, and following two conditions need to be met:Condition 1 is geneIt is not to forbid gene, bar Part 2 isAbove-mentioned two condition is met simultaneously just can enter row variation;
APK to be detected is distributed to virtual machine by the computer of the operation virtual machine according to optimal APK allocative decisions.
2. a kind of APK as claimed in claim 1 quick detection and the method for improving unit resource utilization rate, its feature exist In:The APK attributes include:In the size of APK file, the size of DEX file, APK file in code complexity, APK file Resource file complexity and APK detection priority in interface complexity, APK file, wherein,
The size of the APK file refers to that APK file takes the size of memory space in itself, and unit is Mb;
The size of the DEX file refers to the size of the entitled .dex files of extension in APK file, unit Mb;
Code complexity refers to the relation of the directories deep of code and number of files in dex files in the APK file, and code is complicated It is (1,100) that degree, which sets scope, APK file directories deep for (1,10], more than 10 in terms of 10, APK number of files (1, 1000], more than 1000 in terms of 1000;
APK file median surface complexity refers to the pass of the interface numbers of APK in the process of running and control used in interface System, interface complexity refer to setting scope be (1,100), APK interfaces sum for (1,100], more than 100 in terms of 100, single boundary Face control sum (1,10], more than 10 in terms of 10;
Resource file complexity refers in APK the level of catalogue and following catalogue and number of files under res catalogues in the APK file Between relation, it is (1,100) that the complexity of the resource file, which sets scope, directories deep for (1,5], every grade of maximum catalogue Number (1,10], the maximum number of files of each catalogue (1,100];
APK detection priority refers to the APK detection time starteds the latest to be met, the bar such as maximum number of required resource Part, including but not limited to above-mentioned condition, can dynamically be adjusted according to actual conditions;
The resources of virtual machine attribute includes CPU indexes, memory index and thread index, wherein,
The CPU indexes refer to the ratio for the original usable resource of resource and CPU that CPU can currently be used;
The memory index refers to the ratio of internal memory current idle resource and the original usable resource of internal memory,
The thread index refers to the idle number of current hyperthread thread and original line number of passes.
3. a kind of APK as claimed in claim 1 quick detection and the method for improving unit resource utilization rate, its feature exist In:Code is complicated in size attribute value of the APK property values including APK file, the size attribute value of DEX file, APK file Spend resource file complexity attributes value and APK detections in property value, APK file median surface complexity attributes value, APK file preferential Level property value, wherein,
The ratio between the size attribute value of APK file, specially APK actual sizes and detectable APK file maximum are multiplied by 100;
DEX actual size and detectable DEX file be most in the size attribute value of DEX file, specially APK in APK file The ratio between big value is multiplied by 100;
Code complexity attributes value in APK file, specially the directories deep of code is multiplied by detectable DEX file in DEX file Maximum 30 after divided by maximum directories deep 10 and be multiplied by plus total number of files in DEX file after 70 divided by file maximum number 1000 obtain;
Total interface number of APK file median surface complexity attributes value, specially APK file is multiplied by the most most of single interface control Divided by the product of the interface maximum number of setting and the maximum number of control in interface, then obtain APK file median surface multiplied by 100 complicated Spend property value;
Resource file complexity attributes value in APK file, physical directory depth and reality under Res files specially in APK file The product of the maximum number of catalogue maximum number and physical directory file divided by directories deep maximum and catalogue under the Res files of setting The product of maximum number of files, then obtains resource file complexity attributes value in PK files multiplied by with 100 in number maximum and catalogue;
APK detect priority attribute value, be specially the latest the time to be checked 10 subtract the latest setting detection time divided by 10 after be multiplied by 100 determine;
The resources of virtual machine property value includes CPU exponential quantities, memory index value and thread exponential quantity, wherein,
The CPU exponential quantities are specially the product that CPU core calculation is not used by rate with CPU frequency and current CPU;
The memory index value is specially the product that CPU memory sizes and current memory are not used by rate;
The thread exponential quantity is specially the product that Thread Count and current thread are not used by rate.
4. a kind of APK as claimed in claim 1 quick detection and the method for improving unit resource utilization rate, its feature exist In:The weight determination mode of the corresponding resources of virtual machine of the APK attributes is:
Each APK has some attributes, and each virtual machine possesses limited resource, and APK attribute determines it in virtual machine In allocation result;
If influenceing the attribute of APK distribution as follows:
X1,X2,…,Xt,…,XT
The surplus resources species of each virtual machine is as follows:
R1,R2,…,Rs,…,RS
Because certain resource of virtual machine and APK some attributes are associated, so that the APK method of salary distribution is determined, the association Expression formula be:
Rs=us1X1+us2X2+…+ustXt+…+usTXT
Wherein,
S=1,2,3,4,5,6
T=1,2,3,4,5,6
ustRelation between resource s and attribute t is represented, 0≤u need to be met simultaneouslyst≤ 1 and us1+us2+…+ust=1 two condition;
RsRepresent that some APK is assigned to virtual machine S class resources shared after virtual machine.
CN201510730835.7A 2015-12-04 2015-12-04 The quick detection of APK a kind of and the method for improving unit resource utilization rate Active CN105404583B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510730835.7A CN105404583B (en) 2015-12-04 2015-12-04 The quick detection of APK a kind of and the method for improving unit resource utilization rate

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510730835.7A CN105404583B (en) 2015-12-04 2015-12-04 The quick detection of APK a kind of and the method for improving unit resource utilization rate

Publications (2)

Publication Number Publication Date
CN105404583A CN105404583A (en) 2016-03-16
CN105404583B true CN105404583B (en) 2017-10-20

Family

ID=55470081

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510730835.7A Active CN105404583B (en) 2015-12-04 2015-12-04 The quick detection of APK a kind of and the method for improving unit resource utilization rate

Country Status (1)

Country Link
CN (1) CN105404583B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106293981A (en) * 2016-07-29 2017-01-04 浪潮电子信息产业股份有限公司 A kind of detection method of server CPU Hyper-Threading

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110239291A1 (en) * 2010-03-26 2011-09-29 Barracuda Networks, Inc. Detecting and Thwarting Browser-Based Network Intrusion Attacks For Intellectual Property Misappropriation System and Method
US20120030731A1 (en) * 2010-07-28 2012-02-02 Rishi Bhargava System and Method for Local Protection Against Malicious Software
CN102945347A (en) * 2012-09-29 2013-02-27 中兴通讯股份有限公司 Method, system and device for detecting Android malicious software
CN104268473A (en) * 2014-09-23 2015-01-07 龙芯中科技术有限公司 Method and device for detecting application programs
CN104933366A (en) * 2015-07-17 2015-09-23 成都布林特信息技术有限公司 Mobile terminal application program processing method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110239291A1 (en) * 2010-03-26 2011-09-29 Barracuda Networks, Inc. Detecting and Thwarting Browser-Based Network Intrusion Attacks For Intellectual Property Misappropriation System and Method
US20120030731A1 (en) * 2010-07-28 2012-02-02 Rishi Bhargava System and Method for Local Protection Against Malicious Software
CN102945347A (en) * 2012-09-29 2013-02-27 中兴通讯股份有限公司 Method, system and device for detecting Android malicious software
CN104268473A (en) * 2014-09-23 2015-01-07 龙芯中科技术有限公司 Method and device for detecting application programs
CN104933366A (en) * 2015-07-17 2015-09-23 成都布林特信息技术有限公司 Mobile terminal application program processing method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种恶意软件分析中检测虚拟环境的方法;吴发伟、方勇、刘亮;《信息与电子工程》;20100630;第8卷(第3期);第364-367页 *

Also Published As

Publication number Publication date
CN105404583A (en) 2016-03-16

Similar Documents

Publication Publication Date Title
Leaché et al. The spectre of too many species
Amir et al. Deblur rapidly resolves single-nucleotide community sequence patterns
US11562293B2 (en) Adaptation of machine learning algorithms
Münkemüller et al. From diversity indices to community assembly processes: a test with simulated data
Kuo et al. Application of particle swarm optimization to association rule mining
Coomes et al. Identifying aggregation and association in fully mapped spatial data
US20210150416A1 (en) Interoperation of machine learning algorithms
Liu et al. Gene transposon based clone selection algorithm for automatic clustering
CN111311409A (en) Target object determination method and device, electronic equipment and storage medium
CN107944460A (en) One kind is applied to class imbalance sorting technique in bioinformatics
CN108647800A (en) A kind of online social network user missing attribute forecast method based on node insertion
CN104461739B (en) A kind of virtual machine batch dispositions method based on cloudsim platforms
CN105404583B (en) The quick detection of APK a kind of and the method for improving unit resource utilization rate
CN105872082B (en) Fine granularity resource response system based on container cluster load-balancing algorithm
Ke et al. Development of a machine‐learning model to identify the impacts of pesticides characteristics on soil microbial communities from high‐throughput sequencing data
Kumari et al. A hybrid approach of genetic algorithm and multi objective PSO task scheduling in cloud computing
CN105760136A (en) Multi-dimensional controllable algorithm based on pseudo random numbers
Penna et al. Design methodology for workload‐aware loop scheduling strategies based on genetic algorithm and simulation
CN110175172A (en) Very big two points of groups parallel enumerating method based on sparse bipartite graph
CN111400050B (en) Method and device for allocating resources to execute tasks
CN114840857A (en) Intelligent contract fuzzy testing method and system based on deep reinforcement learning and multi-level coverage strategy
CN108595669A (en) A kind of unordered classified variable processing method and processing device
Jin et al. A simple 2D non-parametric resampling statistical approach to assess confidence in species identification in DNA barcoding—an alternative to Likelihood and Bayesian approaches
CN108846577B (en) Group task allocation method based on context analysis
CN111143833B (en) Illegal application program category identification method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant