Skip to content

Commit

Permalink
adapted starting modules to new objects FCG, PDG in module graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Gascon committed Jan 27, 2015
1 parent 79ee69c commit b7e0b7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
17 changes: 6 additions & 11 deletions adagio.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
sys.path.insert(0, os.path.abspath("modules/androguard"))

import argparse

from adagio.core.FCG import FCGGenerator
from adagio.core.PDG import PDGGenerator

from adagio.core.graphs import process_dir

def print_logo():
print("""
Expand Down Expand Up @@ -62,20 +59,18 @@ def exit():
args = parser.parse_args()
path_conf = os.path.realpath(args.conf)

generator = ""
mode = ""
if args.fcgraphs:
args.out = os.path.realpath(args.out)
generator = FCGGenerator(args.dir, args.out)
mode='FCG'

elif args.pdgraphs:
args.out = os.path.realpath(args.out)
generator = PDGGenerator(args.dir, args.out)
# print "Not implemented yet!"
# sys.exit()
mode ='PDG'

if generator:
if type:
print_logo()
generator.process()
process_dir(args.dir, args.out, mode)

else:
exit()
6 changes: 3 additions & 3 deletions adagio/core/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def call_in_bb(self, bb, idx):
return bb.get_start() <= idx <= bb.get_end()


def process_dir(read_dir, out_dir, type='FCG'):
def process_dir(read_dir, out_dir, mode='FCG'):
""" Convert a series of APK into graph objects. Load all
APKs in a dir subtree and create graph objects that are pickled
for later processing and learning.
Expand Down Expand Up @@ -215,9 +215,9 @@ def process_dir(read_dir, out_dir, type='FCG'):
f = os.path.realpath(f)
print '[] Loading {0}'.format(f)
try:
if type is 'FCG':
if mode is 'FCG':
g = FCG(f)
elif type is 'PDG':
elif mode is 'PDG':
g = PDG(f)

# if an exception happens, save the .apk in the corresponding dir
Expand Down

0 comments on commit b7e0b7b

Please sign in to comment.