3.2.2 Dynamic Analysis 
As expected, an Android application interacts with 
the operating system through system calls. We have 
extracted system calls using dynamic analysis. To 
achieve this, we have made use of the Android 
emulator that is included with Android Studio
14
. Each 
Android application in our dataset has been executed 
in a separate emulator, with the frequency of each 
system call recorded. 
We connect to the emulator instance using the 
Android Debug Bridge (ADB)
15
, which is a command 
line tool found in the Android SDK. The ADB comes 
with a so-called Monkey Runner
16
, which can be used 
to emulate random UI interactions. These events 
include clicks, volume interactions, touches, and so 
on, which trigger system calls. We record the result-
ing system calls using the monitoring tool Strace
17
 
In detail, the emulation and data collection 
consists of the following steps. 
1.  Open the AVD Manager in Android Studio 
and click on Create New Device. This creates 
an emulator instance and runs it. 
2.  After the emulator is running, we open the 
terminal and navigate to the platform tools 
folder of the Android SDK. There we enter 
adb help to verify that the ADB is working 
as expected. 
3. Next, we issue the command adb devices 
which lists the emulator ID that is running. 
4.  Assuming the Android application is named 
ApplicationName.apk, we give the 
command  
adb install ApplicationName.apk  
(via a batch file). At this point, we can verify 
that the application file has been installed in 
the emulator. 
5.  Next, we enter the emulator shell by typing  
adb -s emulator-5646 shell 
at the terminal. 
6. We launch the application and check the 
process ID using the command  
ps <package name>. 
7. The command 
strace -P <ProcessID> -c -o 
<path in emulator>Filename.csv 
<package name> 
begins the recording of system calls.  
                                                            
14
 http://developer.android.com/tools/studio/ 
15
 http://developer.android.com/tools/help/adb.html 
8.  We start Monkey Runner using the command 
adb shell -p <package name> -v 500 -s 42. 
As mentioned above, this generates random 
events through the user interface. Simultaneously, 
Strace will record the frequency count of the sys- 
tem calls that are generated. 
9.  After the Monkey Runner instance stops, we 
ex- tract the log file using the command 
adb pull <path in emulator> 
<path in destination>. 
Of course, the precise sequence of system calls 
generated will vary, depending on the random selec- 
tion made by the Monkey Runner. However, the fre- 
quency of the various system calls is relatively stable 
for a given application. 
The frequency representation of system calls car- 
ries information about the behavior of the applica- 
tion (Burguera, 2011). A particular system call may 
be utilized more in a malicious application than in a 
benign application, and the system call frequency rep- 
resentation is intended to capture such information. 
Let C = (c1, c2, . . . , cn) be the set of possible sys- 
tem calls available in the Android OS. Then element 
i in our system call feature vector contains the count 
for the number of occurrences of system call ci. For 
example, such a system call vector extracted from one 
instantiation of one of our benign applications is 
0,0,0,0,0,0,0,2500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1500,0,0,0,0,0,0,1100, 
0,0,0,0,0,0,0,800,0,0,0,0,1,32,0,0,753,0,0,0,36,0,0,0,0,0,0,0,0,1,0,0,0, 
0,0,60,0,0,0,90,0,0,0,0,0,0,0,1,0,0,0,0,298,0,0,966,0,56,0,0,0,0,0,0,0,0, 
756,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,0,0,0,0,0,0,110,0,0,0,0,0,0,0,0,0, 
0,0,0,1,0,0,0,660,0,0,0,0,0,0,0,0,0,0,0,0,55,0,0,0,0,0,60,0,0,0,0,0,0,0,0, 
0,0,0,1,0,0,0,0,298,0,0,0,87,1,0,0,0,0,0,0,0,0,82,0,0,0,0,0,0,0,0,0,0,0,0, 
0,0,0,1500,0,0,0,0,0,0,1250,0,0,0,0,0,0,0,885,0,0,0,0,65,0,0,0,0,0,0,0,25, 
0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,1,0,0,0,0,298,0,0,0,82,1,0, 
8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2580,0,0,0,0,0,0,1100,0,0,0, 
0,0,0,0,800,0,0,0,0,1,0,0,0,0,0,0,0,00,0,0,0,0,0,0,0,0,1,0,0,0,0,0,60,0,0,0, 
900,0,0,0,0,0,0,0,1,0,0,0,0,0,0,426,0,0,65 
A system call vector from one of the Android 
malware application in our dataset is given by 
0,0,0,0,0,0,0,8400,0,0,0,0,0,110,0,0,0,0,0,0,0,0,0,1500,0,0,0,0,0,0,1100, 
0,0,0,0,0,0,0,800,0,0,0,0,1,32,0,0,6523,0,0,0,368,0,0,0,0,0,0,0,0,1,0,0,0, 
0,0,60,0,0,0,90,0,0,0,0,0,0,0,0,0,0,0,0,298,0,0,966,0,5600,0,0,0,0,0,0,0,0, 
756,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,0,0,0,0,0,0,110,0,0,0,0,0,0,0,0,0,0,0, 
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5865,0,0,0,0,0,600,0,0,0,0,0,0,0,0,0,0,0, 
1,0,0,0,0,298,0,4260,0,0,0,0,0,0,0,0,0,0,0,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 
1500,0,0,0,0,0,0,1250,0,0,0,0,0,0,0,885,0,0,0,0,6500,0,0,0,2238,0,0,0,250, 
0,0,0,0,62,0,0,1,0,0,0,0,0,60,0,0,0,9,0,0,0,0,0,0,0,1,0,0,0,0,298,0,5024,0, 
8785,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1500,0,0,0,0,0,0, 
1100,0,0,0,0,0,0,0,800,0,0,0,0,0,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,0,426,0,0,855 
  
16
 http://developer.android.com/tools/help/monkey.html 
17
 http://linux.die.net/man/1/strace