-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathScore_TriFlow.py
97 lines (71 loc) · 3.56 KB
/
Score_TriFlow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# ************************ General Information ************************
'''
VERSION:
-------
Version (by release date): 2019-11-08
DEVELOPER INFORMATION:
---------------------
Name: Omid Mirzaei
Laboratory: Computer Security Lab (COSEC)
University: Universidad Carlos III de Madrid
Website: https://cosec.inf.uc3m.es/~omid-mirzaei/
PUBLICATION:
-----------
TriFlow: Triaging Android Applications using Speculative Information Flows
O. Mirzaei, G. Suarez-Tangil, J. E. Tapiador, J. M. de Fuentes
ACM Asia Conference on Computer and Communications Security (ASIACCS), Abu Dhabi, UAE (April 2017)
COPYRIGHT NOTICE:
----------------
All rights reserved for the above developer and research center.
Please, take a look at the "License.txt" file for more detailed information regarding the usage and distribution of these source codes.
ACKNOWLEDGEMENT:
---------------
This work was supported by the MINECO grant TIN2013-46469-R (SPINY: Security and Privacy in the Internet of You);
by the CAM grant S2013/ICE-3095 (CIBER- DINE: Cybersecurity, Data, and Risks), and
by the MINECO grant TIN2016-79095-C2-2-R (SMOG-DEV - Security Mechanisms for Fog Computing: Advanced Security for Devices)
'''
# ************************ End of General Information ************************
# ************************ Module Information ************************
'''
MAIN FUNCTIONALITY:
------------------
This module scores applications based on the probabilities of information flows and their weights
ARGUMENTS:
---------
-a: Directory of applications to be scored (.apk files)
-t: Directory of probability and weight tables
-o: Directory of applications' scores and the contributions of flows in the total scores
USAGE:
-----
python Score_TriFlow.py -a '/Directory/of/Applications' -t '/Directory/of/ProbabilityAndWeightTables' -o '/Directory/of/Scores'
'''
# ************************ End of Module Information ************************
# ************************ Importing Modules ************************
import os
import shutil
import subprocess
import sys
# ************************ End of Importing Modules ************************
# ************************ Initialization ************************
arguments = sys.argv
if '-a' not in arguments or '-t' not in arguments or '-o' not in arguments:
raise NameError('Error: input options are not provided')
else:
# Directory of applications to be scored
Apps_Dir = arguments[arguments.index('-a') + 1]
# Directory of probability and weight tables
Tables_Dir = arguments[arguments.index('-t') + 1]
# Directory of applications' scores
Output_Dir = arguments[arguments.index('-o') + 1]
Home_Dir = os.path.curdir # Home directory
# ********************* End of Initialization *********************
# ********************* Main Body *********************
print('Scoring process started...')
#os.mkdir(os.path.join(Home_Dir,'Total_Flows_Apps'))
print('Extracting total information flows from applications...')
subprocess.call([sys.executable, os.path.join(Home_Dir,'Extract_Total_IFs.py'), '-i', Apps_Dir, '-o', os.path.join(Home_Dir,'Total_Flows_Apps')])
print('Scoring applications and preparing a detailed report...')
subprocess.call([sys.executable, os.path.join(Home_Dir,'Score.py'), '-f', os.path.join(Home_Dir,'Total_Flows_Apps/Flows'), '-t', Tables_Dir, '-o', Output_Dir])
# subprocess.call([sys.executable, os.path.join(Home_Dir,'Score_Normalized.py'), '-f', os.path.join(Home_Dir,'Total_Flows_Apps/Flows'), '-t', Tables_Dir, '-o', Output_Dir])
print('End of scoring!')
# ********************* End of Main Body *********************