Android simulator detection method based on data enhancement

Through data augmentation and adaptive completion algorithms, multiple classification and regression trees are integrated, which solves the accuracy and compatibility problems of Android simulator detection when the sample data is small, and realizes high accuracy and robustness detection Effect.

CN119003339APending Publication Date: 2024-11-22UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411010616.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

In the case of small sample data, how to accurately and effectively detect Android emulators is insufficient in the existing technology, and it is difficult to meet the needs of actual scenarios.

Method used

Using data augmentation detection method, the training samples are expanded through data augmentation technology, the data loss is processed using an adaptive completion algorithm, and multiple classifications and regression trees are integrated to build a strong classifier to improve the generalization ability and interpretability of the model.

Benefits of technology

It realizes high accuracy simulator detection in small samples, improves the universality and robustness of the method, can effectively resist attackers' modification of features, and has good interpretability and compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003339A_ABST
    Figure CN119003339A_ABST
Patent Text Reader

Abstract

The invention relates to the field of software security, and provides an Android simulator detection method based on data enhancement. The method aims at solving the problem of how to accurately and effectively detect the Android simulator under the condition that the sample data volume is small. According to the main scheme, the method comprises the steps of obtaining original data of a simulator and a real machine, performing preprocessing and normalization, labeling the data, and dividing the data into a training set and a test set according to a proportion; then, expanding a training set by using a data enhancement model, and putting a sample vector generated by the data enhancement model and an original sample vector into a classifier model for training; and finally, converting a to-be-detected environment sample into a sample vector, and inputting the sample vector into the trained classifier model to realize simulator detection. The Android simulator detection method is suitable for Android simulator detection, and the accuracy and robustness of detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of software security, and in particular relates to an Android simulator detection method based on data enhancement. Background Art

[0002] Android emulator is a kind of software running on PC. It simulates Android system by virtualizing the underlying hardware, so that users can run Android applications on PC. Android emulator detection is a very important technology. On the one hand, detecting Android emulator can improve the compatibility of software and ensure the implementation of normal functions; on the other hand, detecting emulator can also prevent malicious software from being used by attackers for illegal profit. Some attackers may use Android emulator to debug and analyze applications to achieve functions such as order brushing, ticket grabbing, and game cheating. Therefore, research on Android emulator detection is very necessary, and many studies have been carried out on Android emulator detection.

[0003] Traditional Android emulator detection technologies include fingerprint-based detection, numerical distribution-based detection, and hardware architecture-based detection, and all have achieved good results. For example, in the paper "Evading Android Runtime Analysis via Sandbox Detection", Vidas et al. proposed a series of fingerprint-based detection methods such as build class and file class. These methods are simple and easy to implement and have good effects, but they have poor robustness and are easy to be bypassed; in the paper "Evading Android Runtime Analysis Through Detecting Programmed Interactions", Diao et al. used the difference between the screen track automatically generated by human contact and monkey trigger to detect emulators. This method has high accuracy and has a certain degree of robustness improvement compared to the former, but the deployment of this method requires the use of statistical learning, and has strict requirements on the number and category of samples; in the paper "Rethinking anti-emulation techniques for large-scale software deployment", Jang et al. detected emulators based on the different cache behaviors of the emulator's underlying virtual software QEMU and the real ARMCPU. This method has extremely high accuracy and robustness, but this method requires the use of inline assembly code and can only run in the native layer of Android app, which reduces the compatibility of this method. At the same time, some researchers have begun to pay attention to the detection method using machine learning. Compared with traditional methods, the Android simulator detection method based on machine learning can use multiple types of features at the same time, and ensures better compatibility and robustness while ensuring that the accuracy is not lower than the original method. For example, in the document "The Droid is in the Details: Environment-aware Evasion of Android Sandboxes", Kondracki et al. used the usage trace features in the target environment to build a machine learning classifier, and proved through experiments that it has good accuracy and robustness. However, most of the data used in this method comes from the information of ordinary users, and the method of constructing this data set requires special authorization, which is difficult. Therefore, how to implement a simulator detection method that meets the comprehensive needs of actual scenarios is a problem that needs to be solved at present. Summary of the invention

[0004] The present invention provides an Android simulator detection method based on data enhancement, aiming to solve the problem of how to accurately and effectively detect Android simulators when the amount of sample data is small. The method expands the training samples through data enhancement technology to improve the generalization ability of the model, and adopts an adaptive completion algorithm to handle data missing to improve the compatibility of the method. By integrating multiple classification and regression trees to build a strong classifier, the present invention has good interpretability while ensuring high accuracy.

[0005] In order to achieve the above object, the present invention provides the following technical solutions:

[0006] A data-enhanced Android simulator detection method, the method comprising:

[0007] Step 1: Get the original data of the simulator and the real machine, preprocess the data, convert the original data into vectors and normalize them;

[0008] Step 2: Label the data and divide the data into training set and test set in proportion to ensure that the proportion of each type of label in the training set and the test set is consistent;

[0009] Step 3: Input the samples of the training set into the data enhancement model for training, and perform data enhancement to generate sample vectors to expand the training set;

[0010] Step 4: Put the sample vectors generated by the data enhancement model and the original sample vectors into the classifier model for training and verify them on the test set to obtain a classification model that can classify the Android simulator sample vectors;

[0011] Step 5: Convert the environmental samples to be detected into sample vectors and input them into the trained classifier model to obtain the simulator detection results.

[0012] In the above scheme, the step 1 specifically includes:

[0013] Step 1.1: Write a test Android app and run it in different simulators and real devices. Collect the build class attributes, files, sensors, package names, and hardware information attributes of the running environment. For different simulators or real devices, get a string of attributes, where Android app represents the developed Android application.

[0014] Step 1.2: Preprocess the obtained attributes and convert them into vectors, and finally convert the data of a simulator or a real machine into a vector;

[0015] The step 1.2 specifically includes:

[0016] If the attribute is a string, a heuristic rule is used to match whether the string is detected by the simulator. If it is, it is converted to 1. If not, the attribute is 0. If the feature acquisition fails, it is set to empty. The heuristic rule here refers to judging whether the build.model attribute of the device is the string sdk. Such an empirical rule can be obtained by analysts in practice.

[0017] If the attribute is a file path or file name, it will be set to 1 if the file or path exists in this device, and 0 if it does not exist. If the path is read, it will be empty.

[0018] If the attribute is a numeric value, the value is read, and if the read fails, it is empty;

[0019] Step 1.3: Normalize the non-empty attributes of the numerical data of the obtained vector;

[0020] Normalize the properties of all simulator and real machine samples collected, calculate the maximum and minimum values ​​of all device properties that are not empty, subtract the minimum value from the value of the current device and divide it by the difference between the maximum and minimum values. If the property value is empty, keep it empty.

[0021] In the above scheme, the step 2 specifically includes:

[0022] If the vector comes from the environment information of the simulator or virtual cloud device, the label is 0; if the vector comes from the environment information of the real device or cloud phone, the label is 1;

[0023] The vector is divided into a training set and a test set in a 1:1 ratio to ensure that the ratio of the two types of labels in the training set and the test set is equal.

[0024] In the above solution, the data enhancement model specifically includes:

[0025] The data enhancement model is a conditional variational autoencoder-generative adversarial network structure, which is used to generate training sample vectors;

[0026] The data augmentation model includes: a generator and a discriminator composed of a variational autoencoder;

[0027] The data augmentation model uses a loss function appropriate to the type of data it generates.

[0028] In the above scheme, the generator of the data augmentation model is a generator composed of a variational autoencoder, and its structure is specifically formulated as follows:

[0029]

[0030] where h 21 Follow h 22Different parameters generate different results. eps represents a random vector, z represents a latent space vector, h0 represents the initial input, h1 represents the first hidden layer after the fully connected layer, ReLU activation and batch normalization, and h 21 、h 22 is the output layer of the fully connected layer, input represents the input sample of the network, con represents the label of this sample, the label is a real machine or a simulator, ReLu(*) represents ReLu nonlinear activation of x, BN(*) represents batch normalization of x, |*| represents the number of dimensions, FC |x|→n (*) indicates a full connection from x to a dimension n, Rand m It means generating a random vector of dimension m, EXP(*) means exponential with natural constant e as base and x as power, Sigmoid(x) means processing x through sigmoid activation function.

[0031] In the above scheme, the data enhancement model loss function is:

[0032] The error generated by the generator and the discriminator uses a binary cross entropy loss;

[0033] The structural error of the generator is defined as a mixture of binary cross entropy loss, mean square error loss function, and KL divergence according to the particularity of the generated data. Its formula is described as:

[0034] L VAE =λ·L BCE +(1-λ)·L MSE +L KLD

[0035] Where L BCE Indicates the loss of 0 or 1 binary variables in the generated data, L MSE Represents the loss of continuous variables between 0 and 1 in the generated data, L KLD represents the KL divergence.

[0036] In the above scheme, the discriminator has a structure that is specifically formulated as follows:

[0037]

[0038] Where input represents the input sample of the network, cond represents the label of this sample, which can be a real machine or a simulator, and the table |input|+|cond| represents the number of dimensions of x, FC |x|→n (*) indicates a full connection from x to a dimension n, Leaky m () means that x is processed by the Leaky activation function with m as the activation threshold.

[0039] In the above scheme, the step 3 specifically includes:

[0040] Step 3.1: Use a fixed value of 0 to fill in the empty values, convert other 0 values ​​into random numbers between 0 and 0.2, and convert other 1 values ​​into random numbers between 0.8 and 1;

[0041] Step 3.2: Train the data augmentation model until the discriminator cannot distinguish between the sample vectors generated by the generator and the original data sample vectors;

[0042] In each training, the entire data set is traversed, the generator uses the encoder to sample the real samples, obtains the intermediate variables, and gives the intermediate variables to the decoder for encoding to generate false samples;

[0043] The false samples and real samples are submitted to the discriminator for calculation, and the discriminator error and the generator generation error are calculated by the discriminator's calculation results and their authenticity labels;

[0044] And calculate the VAE error of the generator, update the parameters of the discriminator through the error of the discriminator, and update the parameters of the Encoder and Decoder through the generation error of the generator and the VAE error;

[0045] Step 3.3: Use the generator to generate a certain number of sample vectors for the corresponding class labels and add them to the original training set to ensure that the proportion of each class label in the training set remains unchanged after generation;

[0046] In the above scheme, the step 4 specifically includes:

[0047] Step 4.1: Put the sample vector generated by the data enhancement model and the original sample vector into the classifier model;

[0048] Step 4.2: Adaptively complete the input samples to fill in the empty values;

[0049] For the recovered vector v and the data set X, the 10 vectors in X that are closest to v are calculated according to the distance calculation function d(v, x);

[0050] Then, for the empty columns of v, the non-empty mean values ​​of the 10 vectors in the column are used as fills for the column of v;

[0051] When the values ​​of this column of the 10 vectors are all empty, this value is still empty and the sparse-aware algorithm will be used to process it, that is, the information gain is calculated for the left subtree and the right subtree respectively during training, and the side with the larger information gain is used as the default direction;

[0052] Step 4.3: Put the completed samples into the classifier for training;

[0053] In each iteration, the prediction residual of each sample is first calculated;

[0054] Build a new weak classifier. During the construction process, traverse each leaf node to find the best information gain.

[0055] If there are missing values, calculate the default segmentation direction, segment the leaf nodes in the direction with the largest information gain, and calculate the output value of each leaf node to finally obtain a new weak classifier. Repeat this process until the required number of iterations is reached;

[0056] Step 4.4: Verify on the original test set;

[0057] Step 4.5: Obtain a classification model that can classify the sample vector of the Android device. The model can determine whether the sample vector comes from a real device or a simulator.

[0058] In the above scheme, the distance calculation function d(v, x) is specifically defined as:

[0059] For vectors with a binary discretization value of 0-1, use the Hamming distance. When both are empty or none of them are empty, the distance is 0, and the rest are 0.

[0060] For the remaining continuous variables in the vector, use the absolute value distance. When they are all empty, the distance is 0;

[0061] When one of the values ​​is empty, the distance is 1, and in other cases it is the absolute value of their difference. ;

[0062] The final distance between two vectors is the sum of the distances in each dimension divided by the number of dimensions.

[0063] In the above scheme, the classifier is structured as multiple classification and regression trees, each CART is a weak classifier, and the residual predicted by the current weak classifier is added to the next CART for training and iterative update. Such multiple weak classifiers together constitute a strong classifier;

[0064] Its objective function is a combination of empirical risk and structural risk and terms related to the number of features;

[0065] The classifier objective function includes three parts: the first part is the empirical risk, which refers to the prediction error of the classifier; the second part is the structural risk, which refers to the model complexity of the classifier; the third part is the item related to the number of features, which is used to describe how many features are not used in the model.

[0066] The present invention has the following beneficial effects compared with the prior art:

[0067] 1. The present invention proposes a framework that can effectively detect simulators. The coupling degree between modules is high, which can meet the requirements of existing simulator detection technology for accuracy, versatility, robustness and compatibility.

[0068] 2. The present invention uses a data enhancement model to expand training samples, so that the generalization performance of the classification model is stronger, which solves the problem that it is difficult to use machine learning methods to build simulator detection classifiers under small samples, and improves the versatility of the method;

[0069] 3. The data enhancement model proposed in the present invention uses an objective function that adapts the simulator data type, which can generate samples with higher quality than other data enhancement methods.

[0070] 4. The classifier module proposed in the present invention adds additional items related to the number of features, which can improve the resistance to potential attacks such as attackers modifying the features and enhance the robustness of the method;

[0071] 5. The classifier model of the present invention is based on an ensemble learning method, which ensures high accuracy and good interpretability.

[0072] 6. The adaptive completion algorithm proposed in this aspect can effectively handle data missing caused by problems such as device data reading failure and model differences, thereby improving the compatibility of the method. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1 It is the overall architecture diagram of the present invention;

[0074] Figure 2 It is a schematic diagram of an embodiment of the present invention. DETAILED DESCRIPTION

[0075] The purpose of the present invention is to provide an Android simulator detection method based on data enhancement. By utilizing a data enhancement model to expand a sample training set, the method can train a high-accuracy simulator detection model when the Android device data sample volume is small. The trained model has good robustness and compatibility after verification, and is therefore more suitable for Android simulator detection in real situations.

[0076] The present invention will be further described below in conjunction with the accompanying drawings and specific implementation methods.

[0077] The present invention provides an Android simulator detection method based on data enhancement, comprising the following steps:

[0078] Step 1: Get the original data of the simulator and the real machine, preprocess the data, convert the original data into vectors and normalize them;

[0079] Step 2: Label the data and divide the data into training set and test set in proportion to ensure that the proportion of each type of label in the training set and the test set is consistent;

[0080] Step 3: Input the samples of the training set into the data enhancement model for training, and perform data enhancement to generate sample vectors to expand the training set;

[0081] Step 4: Put the sample vectors generated by the data enhancement model and the original sample vectors into the classifier model for training and verify them on the test set to obtain a classification model that can classify the Android simulator sample vectors;

[0082] Step 5: Convert the environmental samples to be detected into sample vectors and input them into the trained classifier model to obtain the simulator detection results.

[0083] Further, the step 1 specifically includes:

[0084] Step 1.1: Write a test Android app and run it in different simulators and real devices. Collect the build class attributes, files, sensors, package names, and hardware information attributes of the running environment. For different simulators or real devices, get a string of attributes, where Android app represents the developed Android application.

[0085] Step 1.2: Preprocess the obtained attributes and convert them into vectors, and finally convert the data of a simulator or a real machine into a vector;

[0086] Step 1.3: Normalize the non-empty attributes of the numerical data of the vector;

[0087] Further, the step 1.2 specifically includes:

[0088] If the attribute is a string, a heuristic rule is used to match whether the string is detected by the simulator. If so, it is converted to 1. If not, the attribute is 0. If the feature acquisition fails, it is set to empty. The heuristic rule here refers to the empirical rule obtained by the analyst in the practice process by judging whether the build.model attribute is the string sdk.

[0089] If the attribute is a file path or file name, it will be set to 1 if the file or path exists in this device, and 0 if it does not exist. If the path is read, it will be empty.

[0090] If the attribute is a numeric value, the value is read, otherwise it is empty.

[0091] Further, the step 1.3 specifically includes:

[0092] Then the attribute of all simulator and real machine samples collected will be normalized. The normalization details are as follows: calculate the maximum and minimum values ​​of all device attributes that are not empty, subtract the minimum value from the value of the current device, and then divide it by the difference between the maximum and minimum values. In addition, if this value is empty, it will remain empty.

[0093] Further, the step 2 specifically includes:

[0094] If the vector comes from the environment information of the simulator or virtual cloud device, the label is 0; if the vector comes from the environment information of the real device or cloud phone, the label is 1;

[0095] The vector is divided into a training set and a test set in a 1:1 ratio to ensure that the ratio of the two types of labels in the training set and the test set is equal.

[0096] Further, the step 3 specifically includes:

[0097] The structure of the data augmentation model;

[0098] Loss function of the data augmentation model;

[0099] Perform data augmentation steps for training samples;

[0100] Furthermore, the structure of the data enhancement model specifically includes:

[0101] The data augmentation model specifically includes: a generator and a discriminator composed of a variational autoencoder;

[0102] Furthermore, the generator of the data enhancement model is characterized by:

[0103] The generator is a generator composed of variational autoencoders, and its structure is specifically formulated as:

[0104]

[0105] Where input represents the input sample of the network, cond represents the label of this sample (real machine or simulator), ReLU(x) represents ReLu nonlinear activation of x, BN(x) represents batch normalization of x, table |x| represents the number of dimensions of x, FC |x|→n (x) represents the full connection from x to a dimension n, Rand m It means generating a random vector of dimension m, EXP(x) means exponential with natural constant e as base and x as power, Sigmoid(x) means processing x through sigmoid activation function.

[0106] Furthermore, the structure of the discriminator of the data enhancement model is specifically formulated as follows:

[0107]

[0108] Where input represents the input sample of the network, cond represents the label of this sample (real machine or simulator), table |x| represents the number of dimensions of x, FC |x|→n (x) represents the full connection from x to a dimension n, Leaky m (x) means that x is processed by the Leaky activation function with m as the activation threshold.

[0109] Furthermore, the data enhancement model loss function is characterized by:

[0110] The error generated by the generator and the discriminator uses binary cross entropy loss (BCE)

[0111] The structural error of the generator is defined as a mixture of the binary cross entropy loss, the mean square error loss function (MSE), and the KL divergence (Kul lback-Leibler Divergence) according to the particularity of the generated data. Its formula is described as:

[0112] L VAE =λ·L BCE +(1-λ)·L MSE +L KLD

[0113] Where L BCE Indicates the loss of 0 or 1 binary variables in the generated data, L MSE Represents the loss of continuous variables between 0 and 1 in the generated data, L KLD represents the KL divergence.

[0114] Further, the step 3 specifically includes:

[0115] Step 3.1: Use a fixed value of 0 to fill in the empty values, convert other 0 values ​​into random numbers between 0 and 0.2, and convert other 1 values ​​into random numbers between 0.8 and 1.

[0116] Step 3.2: Train the data augmentation model until the discriminator cannot distinguish between the sample vectors generated by the generator and the original data sample vectors;

[0117] Step 3.3: Use the generator to generate a certain number of sample vectors for this type of label and add them to the original training set to ensure that the proportion of each type of label in the training set remains unchanged after generation.

[0118] Further, the specific process of step 3.2 is as follows:

[0119] In each training, the entire data set is traversed, and the generator uses the encoder to sample the real samples to obtain intermediate variables, and then encodes the intermediate variables to generate fake samples. Then the fake samples and real samples are sent to the discriminator for calculation. At this time, the discriminator's error and the generator's generation error can be calculated by the discriminator's calculation results and their authenticity labels. And calculate the VAE error of the generator. The parameters of the discriminator are updated by the discriminator's error, and the parameters of the encoder and decoder are updated by the generator's generation error and VAE error.

[0120] Further, the step 4 specifically includes:

[0121] Step 4.1: Put the sample vector generated by the data enhancement model and the original sample vector into the classifier model;

[0122] Step 4.2: Adaptively complete the input samples to fill in the empty values

[0123] Step 4.3: Put the completed samples into the classifier for training

[0124] Step 4.4: Verify on the original test set;

[0125] Step 4.5: Obtain a classification model that can classify the sample vector of the Android device. The model can determine whether the sample vector comes from a real device or a simulator.

[0126] Further, the step 4.2 specifically includes:

[0127] For the restored vector v and the dataset X, we calculate the 10 vectors in X that are closest to v based on the distance calculation function d(v, x). Then for the empty columns of v, we use the non-empty mean of these 10 vectors in the column as the fill of this column of v. This also means that when the values ​​of this column of these 10 vectors are all empty, this value is still empty. At this time, we will use the sparse-aware algorithm to process it, that is, during training, we calculate the information gain for the left subtree and the right subtree respectively, and use the side with the larger information gain as the default direction.

[0128] Furthermore, the distance calculation function d(v, x) is specifically defined as:

[0129] For binary discrete vectors with values ​​of 0-1, we use the Hamming distance. When they are all empty or not empty, the distance is 0, and the rest is 0. For the remaining continuous variables in the vector, we use the absolute value distance. When they are all empty, the distance is 0; when one of the values ​​is empty, the distance is 1, and the rest is the absolute value of their difference. The final distance between the two vectors is the sum of the distances of each dimension divided by the number of dimensions.

[0130] Furthermore, the classifier specifically includes:

[0131] Its structure is multiple classification and regression trees (CARTs). Each CART is a weak classifier. The residual predicted by the current weak classifier is added to the next CART for training and iterative update. Such multiple weak classifiers together constitute a strong classifier.

[0132] Its objective function is a combination of empirical risk and structural risk and terms related to the number of features;

[0133] Furthermore, the classifier objective function specifically includes:

[0134] Its objective function consists of three parts: the first part is the empirical risk, which refers to the prediction error of the classifier; the second part is the structural risk, which refers to the model complexity of the classifier; the third part is the term related to the number of features, which is used to describe how many features are not used in the model.

[0135] Further, the step 4.3 specifically includes:

[0136] In each iteration, we first calculate the prediction residual for each sample. Then, we build a new weak classifier. During the construction process, we traverse each leaf node to find the best information gain. If there are missing values, we also calculate the default split direction. The leaf nodes are split in the direction with the largest information gain, and the output value of each leaf node is calculated to finally get a new weak classifier. Repeat the following process until the required number of iterations is reached.

[0137] Further, the step 5 specifically includes:

[0138] The environmental information to be detected is converted into a sample vector to be tested according to step 1;

[0139] Input the sample vector to be tested into the trained classifier model to obtain the detection result.

[0140] Application Examples

[0141] like Figure 2 As shown, the embodiment of the smart contract vulnerability detection method based on artificial intelligence provided by the present invention includes the following steps:

[0142] (1) Obtain cloud devices from Amazon Device Farm and Google Firebase test lab as real devices, and obtain different device images from different simulators as simulators.

[0143] (2) Run the developed app on these devices to obtain the original data of the simulator and the real device

[0144] (3) Preprocess the data, convert the raw data into vectors and normalize them;

[0145] (4) Label the data and divide the data into training set and test set in proportion, ensuring that the ratio of each type of label in the training set and the test set is consistent;

[0146] (5) Input the training set into the data augmentation model. First, perform data processing on the data augmentation model, fill empty values ​​with fixed values, and perturb the input.

[0147] (6) The data augmentation model uses an encoder to encode and sample real samples to generate intermediate representations, and uses a decoder to decode and decode the intermediate representations to finally generate false samples;

[0148] (7) The generated fake samples are input to the discriminator together with the real samples and the error is calculated. The error is used to update the parameters of the encoder and decoder in the discriminator and the generator. This process is repeated until the loss converges.

[0149] (8) Use the trained generator to generate a certain number of samples;

[0150] (9) Input the generated samples and the training set into the classifier, and fill in the missing values ​​in the data according to the adaptive completion algorithm;

[0151] (10) Build a classification and regression tree CART, split the nodes according to the information gain, repeat this process until all leaf nodes are traversed, and finally predict all current samples;

[0152] (11) Use the residual of the previous tree to continue to build CART for prediction, and repeat this process until all CARTs are traversed;

[0153] (12) Use the validation set to verify the model accuracy;

[0154] (13) Use the trained model to perform simulator detection, obtain the vector information of the sample to be detected, input it into the preprocessing module for preprocessing, obtain the data vector, and directly input the vector into the classifier, which will output the detection result of the simulator.

Claims

1. A data-enhanced Android simulator detection method, characterized in that: The method comprises: Step 1: Get the original data of the simulator and the real machine, preprocess the data, convert the original data into vectors and normalize them; Step 2: Label the data and divide the data into training set and test set in proportion to ensure that the proportion of each type of label in the training set and the test set is consistent; Step 3: Input the samples of the training set into the data enhancement model for training, and perform data enhancement to generate sample vectors to expand the training set; Step 4: Put the sample vectors generated by the data enhancement model and the original sample vectors into the classifier model for training and verify them on the test set to obtain a classification model that can classify the Android simulator sample vectors; Step 5: Convert the environmental samples to be detected into sample vectors and input them into the trained classifier model to obtain the simulator detection results.

2. According to the data enhancement-based Android simulator detection method of claim 1, it is characterized in that: The step 1 specifically includes: Step 1.1: Write a test Android app and run it in different simulators and real devices. Collect the build class attributes, files, sensors, package names, and hardware information attributes of the running environment. For different simulators or real devices, get a string of attributes, where Android app represents the developed Android application. Step 1.2: Preprocess the obtained attributes and convert them into vectors, and finally convert the data of a simulator or a real machine into a vector; The step 1.2 specifically includes: If the attribute is a string, it matches whether the string is a heuristic rule for simulator detection. If it is, it is converted to 1. If not, the attribute is 0. If the feature acquisition fails, it is set to null. The heuristic rule here refers to judging whether the device's build.model attribute is a string sdk, etc. Such empirical rules can be obtained by analysts in practice. If the attribute is a file path or file name, it will be set to 1 if the file or path exists in this device, and 0 if it does not exist. If the path is read, it will be empty. If the attribute is a numeric value, the value is read, and if the read fails, it is empty; Step 1.3: Normalize the non-empty attributes of the numerical data of the obtained vector; Normalize the attribute of all collected simulators and real machine samples, calculate the maximum and minimum values ​​of all device attributes that are not empty, subtract the minimum value from the value of the current device and divide it by the difference between the maximum and minimum values. If the attribute value is empty, keep it empty.

3. According to a data enhancement-based Android simulator detection method according to claim 1, it is characterized in that: The step 2 specifically includes: If the vector comes from the environment information of the simulator or virtual cloud device, the label is 0; if the vector comes from the environment information of the real device or cloud phone, the label is 1; The vector is divided into a training set and a test set in a 1:1 ratio to ensure that the ratio of the two types of labels in the training set and the test set is equal.

4. According to the data enhancement-based Android simulator detection method of claim 1, it is characterized in that: The data enhancement model specifically includes: The data enhancement model is a conditional variational autoencoder-generative adversarial network structure, which is used to generate training sample vectors; The data augmentation model includes: a generator and a discriminator composed of a variational autoencoder; The data augmentation model uses a loss function appropriate to the type of data it generates.

5. The method for detecting an Android simulator based on data enhancement according to claim 4, characterized in that: The generator of the data augmentation model is a generator composed of variational autoencoders, and its structure is specifically formulated as follows: Where eps represents a random vector, z represents a latent space vector, h0 represents the initial input, h1 represents the first hidden layer after the fully connected layer, ReLU activation and batch normalization, and h 21 、h 22 is the output layer of the fully connected layer, input represents the input sample of the network, cond represents the label of this sample, the label is a real machine or a simulator, ReLu(*) represents ReLu nonlinear activation of x, BN(*) represents batch normalization of x, |*| represents the number of dimensions, FC | x|→n(*) represents a full connection from x to a dimension n, Rand m It means generating a random vector of dimension m, EXP(*) means exponential with natural constant e as base and x as power, Sigmoid(x) means processing x through sigmoid activation function.

6. The method for detecting an Android simulator based on data enhancement according to claim 5, characterized in that: Data augmentation model loss function: The error generated by the generator and the discriminator uses a binary cross entropy loss; The structural error of the generator is defined as a mixture of binary cross entropy loss, mean square error loss function, and KL divergence according to the particularity of the generated data. Its formula is described as: L VAE =λ·L BCE +(1-λ)·L MSE +L KLD Where L BCE Indicates the loss of 0 or 1 binary variables in the generated data, L MSE Represents the loss of continuous variables between 0 and 1 in the generated data, L KLD represents the KL divergence.

7. The method for detecting an Android simulator based on data enhancement according to claim 4, characterized in that: The discriminator of the data enhancement model has a structure that is specifically formulated as follows: Where input represents the input sample of the network, cond represents the label of this sample, which can be a real machine or a simulator, and the table |input|+|cond| represents the number of dimensions of x, FC |x|→n (*) indicates a full connection from x to a dimension n, Leaky m () means that x is processed by the Leaky activation function with m as the activation threshold.

8. The Android simulator detection method based on data enhancement according to claim 4 is characterized in that: The step 3 specifically includes: Step 3.1: Use a fixed value of 0 to fill in the empty values, convert other 0 values ​​into random numbers between 0 and 0.2, and convert other 1 values ​​into random numbers between 0.8 and 1; Step 3.2: Train the data augmentation model until the discriminator cannot distinguish between the sample vectors generated by the generator and the original data sample vectors; In each training, the entire data set is traversed, the generator uses the encoder to sample the real samples, obtains the intermediate variables, and gives the intermediate variables to the decoder for encoding to generate false samples; The false samples and real samples are submitted to the discriminator for calculation, and the discriminator error and the generator generation error are calculated by the discriminator's calculation results and their authenticity labels; And calculate the VAE error of the generator, update the parameters of the discriminator through the error of the discriminator, and update the parameters of the Encoder and Decoder through the generation error of the generator and the VAE error; Step 3.3: Use the generator to generate a certain number of sample vectors for the corresponding class labels and add them to the original training set to ensure that the proportion of each class label in the training set remains unchanged after generation.

9. The Android simulator detection method based on data enhancement according to claim 1, characterized in that: The step 4 specifically includes: Step 4.1: Put the sample vector generated by the data enhancement model and the original sample vector into the classifier model; Step 4.2: Adaptively complete the input samples to fill in the empty values; For the recovered vector v and the data set X, the 10 vectors in X that are closest to v are calculated according to the distance calculation function d(v, x); Then, for the empty columns of v, the non-empty mean values ​​of the 10 vectors in the column are used as fills for the column of v; When the values ​​of this column of the 10 vectors are all empty, this value is still empty and the sparse-aware algorithm will be used to process it, that is, the information gain is calculated for the left subtree and the right subtree respectively during training, and the side with the larger information gain is used as the default direction; Step 4.3: Put the completed samples into the classifier for training; In each iteration, the prediction residual of each sample is first calculated; Build a new weak classifier. During the construction process, traverse each leaf node to find the best information gain. If there are missing values, calculate the default segmentation direction, segment the leaf nodes in the direction with the largest information gain, and calculate the output value of each leaf node to finally obtain a new weak classifier. Repeat this process until the required number of iterations is reached; Step 4.4: Verify on the original test set; Step 4.5: Obtain a classification model that can classify the sample vector of the Android device. The model can determine whether the sample vector comes from a real device or a simulator.

10. The Android simulator detection method based on data enhancement according to claim 8, characterized in that: The distance calculation function d(v, x) is specifically defined as: For vectors with a binary discretization value of 0-1, use the Hamming distance. When both are empty or none of them are empty, the distance is 0, and the rest are 0. For the remaining continuous variables in the vector, use the absolute value distance. When they are all empty, the distance is 0; When one of the values ​​is empty, the distance is 1, and in other cases it is the absolute value of their difference; Finally, the distance between two vectors is the sum of the distances of each dimension divided by the number of dimensions; The classifier is structured as multiple classification and regression trees, each CART is a weak classifier, and the residual predicted by the current weak classifier is added to the next CART for training and iterative update. Such multiple weak classifiers together constitute a strong classifier; Its objective function is a combination of empirical risk and structural risk and terms related to the number of features; The classifier objective function includes three parts: the first part is the empirical risk, which refers to the prediction error of the classifier; the second part is the structural risk, which refers to the model complexity of the classifier; the third part is the item related to the number of features, which is used to describe how many features are not used in the model.