anadroid package

Subpackages

Submodules

anadroid.Anadroid module

class anadroid.Anadroid.AnaDroid(arg1, results_dir='anadroid_results', profiler=PROFILER.MANAFA, testing_framework=TESTING_FRAMEWORK.MONKEY, device=None, instrumenter=INSTRUMENTER.JINST, analyzer=ANALYZER.OLD_ANADROID_ANALYZER, instrumentation_type=INSTRUMENTATION_TYPE.ANNOTATION, build_system=BUILD_SYSTEM.GRADLE, build_type=BUILD_TYPE.DEBUG, tests_dir=None, rebuild_apps=False, reinstrument=False, recover_from_last_run=False, test_cmd=None, load_projects=True)[source]

Bases: object

Provides a configurable pipeline to benchmark and analyze Android Projects and Applications. This class provides a set of verifications and workflow that allows to automatically perform tasks involved in mobile software analysis. Any class can extend this class to customize its workflow and perform customized benchmarks. .. attribute:: device

device to be used.

type:

Device

app_projects_ut

Android Projects to process.

Type:

list

tests_dir

directory containing app tests (only used with RERAN).

Type:

str

rebuild_apps

optionally rebuild apps from Android Projects already built.

Type:

bool

reinstrument

optionally reinstrument Android Projects previously instrumented.

Type:

bool

apps

list of apps to exercise.

Type:

list

apks

list of apks to exercise.

Type:

list

results_dir

directory where results will be stored.

Type:

str

instrumentation_type

instrumentation type.

Type:

INSTRUMENTATION_TYPE

profiler

profiler to be used.

Type:

AbstractProfiler

analyzer

analyzer to parse and generate results from framework executions.

Type:

AbstractAnalyzer

testing_framework

testing framework to be used.

Type:

AbstractTestingFramework

instrumenter

instrumentation tool to be used.

Type:

AbstractInstrumenter

builder

building system to build apps.

Type:

AbstractBuilder

resources_dir

directory with framework resources.

Type:

str

build_type

type of build to produce in the Android Projects.

Type:

BUILD_TYPE

build_app_project(app_project, build_apks=False)[source]
default_workflow()[source]

performs the basic workflow involved in processing apps straight from the source code. For each app, project or apk provided to pynadroid, performs the required steps to transform such inputs in software ready to be used and tested on the connected device, using the selected testing framework.

do_work(apps)[source]

Executes the testing framework for each app in apps.

exec_command()[source]
get_last_run_file()[source]
get_projs_from_last_run()[source]
init_builder(instr_proj)[source]
just_analyze()[source]

analyze apps obtained from app_projects_ut.

just_build_apps()[source]

builds apps from app_projects_ut.

load_projects()[source]

loads Android Projects from a directory containing one or more projects.

needs_tests_apk()[source]

checks if the selected testing framework requires a tests apk. :returns: True if os a JUnit-based testing framework, False otherwise. :rtype: bool

record_test(tests_dir=None)[source]

records tests that can be replayed later. :param tests_dir: directory to store tests.

anadroid.Config module

anadroid.Config.get_general_config(cfg_type, cfg_file='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/config/general_config.json')[source]
anadroid.Config.set_general_config(cfg_type, cfg_key, cfg_value, cfg_file='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/config/general_config.json')[source]

anadroid.Types module

class anadroid.Types.ANALYZER(value)[source]

Bases: Enum

Enumerates the supported analyzers

MANAFA_ANALYZER = 'Manafa Analyzer'
OLD_ANADROID_ANALYZER = 'Old Anadroid Analyzer'
class anadroid.Types.BUILD_SYSTEM(value)[source]

Bases: Enum

Enumerates the build systems that can be used to build Android apps.

ANT = 'Ant'
GRADLE = 'Gradle'
MAVEN = 'Maven'
UNKNOWN = 'Unknown'
class anadroid.Types.INSTRUMENTER(value)[source]

Bases: Enum

Enumerates sota instrumentation tools.

HUNTER = 'Hunter'
JINST = 'JInst'
NONE = 'None'
class anadroid.Types.PROFILER(value)[source]

Bases: Enum

Enumerates sota energy profilers.

GREENSCALER = 'GreenScaler'
MANAFA = 'E-manafa'
MONSOON = 'Monsoon'
NONE = 'None'
PETRA = 'Petra'
TREPN = 'Trepn'
class anadroid.Types.TESTING_APPROACH(value)[source]

Bases: Enum

Enumerates the 3 testing approaches.

BLACKBOX = 'BlackBox'
GREYBOX = 'GreyBox'
WHITEBOX = 'WhiteBox'
class anadroid.Types.TESTING_FRAMEWORK(value)[source]

Bases: Enum

Enumerates supported testing frameworks

APP_CRAWLER = 'Crawler'
CUSTOM = 'Custom'
DROIDBOT = 'Droidbot'
ESPRESSO = 'Espresso'
JUNIT = 'JUnit'
MONKEY = 'Monkey'
MONKEY_RUNNER = 'Monkeyrunner'
OTHER = 'Other'
RERAN = 'RERAN'
ROBOTIUM = 'Robotium'

anadroid.main module

anadroid.main.init_PyAnaDroid_from_args(args)[source]
anadroid.main.main()[source]
anadroid.main.process_general_config(args_obj)[source]

Module contents