forked from secure-software-engineering/SootFX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
25 lines (21 loc) · 803 Bytes
/
main.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
from py4j.java_gateway import JavaGateway
from IPython.display import display
import converter
# obtaning the API handle
gateway = JavaGateway()
sootFX = gateway.entry_point.sootFX()
# listing all method features
availableFeatures = sootFX.listAllMethodFeatures()
for f in availableFeatures:
print(f.getName())
# extract all method features
sootFX.addClassPath("/path/to/jar")
extracted_features = sootFX.extractAllMethodFeatures()
df = converter.to_dataframe(extracted_features)
# extract selected method features
selected_features = gateway.jvm.java.util.ArrayList()
selected_features.add('MethodAssignStmtCount')
selected_features.add('MethodBranchCount')
extracted_features = sootFX.extractMethodFeaturesInclude(selected_features)
df = converter.to_dataframe(extracted_features)
display(df)