def main(): global kill_flag parser = argparse.ArgumentParser(description='Recording websites') parser.add_argument('permission_type', nargs=1, help='Type of permissions to use. Possible values ' 'are: normal, dangerous, systemlevel') setConfig(parser.parse_args()) print("Recording POI searches starts\n") lf.start_logging_procedure() # We need to perform searches before the first actual event trigger to enable # the automated detection of side channel candidates thread = Thread(target=init_maps) thread.start() lf.wait_for_logcat(lf.LOGCAT_INIT_DONE) kill_flag = True print("Init of APIHarvester done") lf.kill_app(GOOGLE_MAPS) time.sleep(2) if not CHECK_CONFIGURATION: randomized_record.acquire_data_randomized( POI_SEARCH_QUERIES, config.RECORDS_PER_POI_SEARCH, record_maps_poi_search) # else: # check_config() lf.stop_logging_app()
def start_stop_activity(activity_target): package_name = activity_target.split("/")[0] print("Package name of " + activity_target + ": " + package_name) lf.trigger_new_event(activity_target) launch_activity(activity_target) time.sleep(config.DELAY_AFTER_LAUNCH) lf.kill_app(package_name) time.sleep(config.DELAY_AFTER_KILL)
def init_websites(): global kill_flag while not kill_flag: start_website(config.TARGET_WEBSITES[0], trigger_event=False) time.sleep(5) if kill_flag: break start_website(config.TARGET_WEBSITES[1], trigger_event=False) time.sleep(4) if kill_flag: break lf.kill_app(BROWSER)
def init_maps(): global kill_flag while not kill_flag: start_google_maps_poi_search(POI_SEARCH_QUERIES[0], trigger_event=False) time.sleep(3) if kill_flag: break start_google_maps_poi_search(POI_SEARCH_QUERIES[1], trigger_event=False) time.sleep(3) if kill_flag: break lf.kill_app(GOOGLE_MAPS)
def do_resume_sequence(package_name, records_per_app): # Do not trigger event at first launch since this is a cold start lf.launch_app(package_name, trigger_event=False) time.sleep(config.DELAY_AFTER_LAUNCH) lf.return_to_home_screen() time.sleep(config.DELAY_AFTER_LAUNCH) for cnt in range(1, records_per_app + 1): print('\nResume Launch ' + str(cnt) + ': ' + package_name) lf.launch_app(package_name, trigger_event=True) time.sleep(config.DELAY_AFTER_LAUNCH) lf.return_to_home_screen() time.sleep(config.DELAY_AFTER_KILL) lf.kill_app(package_name) time.sleep(config.DELAY_AFTER_KILL)
def main(): for action_code in SOFT_KEYBOARD_ACTIONS.keys(): SOFT_KEYBOARD_ACTIONS_LIST.append(action_code) print("Record tap gestures:", SOFT_KEYBOARD_ACTIONS_LIST, "\n") lf.kill_app(lf.LOGGING_APP) lf.adb("am start -n " + SOFT_KEYBOARD_ACTIVITY) time.sleep(1.0) lf.start_logging_app(clean_start=False) # First round without adb event trigger to enable automated detection of candidate side channels for gesture in SOFT_KEYBOARD_ACTIONS_LIST: do_tap_gesture(gesture, trigger_event=False) time.sleep(0.5) randomized_record.acquire_data_randomized(SOFT_KEYBOARD_ACTIONS_LIST, RECORDS_PER_GESTURE, do_tap_gesture) lf.stop_logging_app()
def main(): global kill_flag parser = argparse.ArgumentParser(description='Recording websites') parser.add_argument('permission_type', nargs=1, help='Type of permissions to use. Possible values ' 'are: normal, dangerous, systemlevel') parser.add_argument('browser', nargs=1, help='Browser name. Possible values ' 'are: fennec, firefox, klar, chromium, chrome') setConfig(parser.parse_args()) print("Record website starts\n") lf.start_logging_procedure() # We need to perform website launches before the first actual event trigger to enable # the automated detection of side channel candidates thread = Thread(target=init_websites) thread.start() lf.wait_for_logcat(lf.LOGCAT_INIT_DONE) kill_flag = True print("Init of APIHarvester done") lf.kill_app(BROWSER) time.sleep(2) if not CHECK_CONFIGURATION: assert len(config.TARGET_WEBSITES) == 20 randomized_record.acquire_data_randomized(config.TARGET_WEBSITES, config.RECORDS_PER_WEBSITE, record_website) else: check_config() lf.stop_logging_app()
def record_website(url): start_website(url) time.sleep(config.DELAY_AFTER_LAUNCH) lf.kill_app(BROWSER) time.sleep(config.DELAY_AFTER_KILL)
def start_stop_target_app(package_name, trigger_event=True): lf.launch_app(package_name, trigger_event) time.sleep(config.DELAY_AFTER_LAUNCH) lf.kill_app(package_name) time.sleep(config.DELAY_AFTER_KILL)
def record_maps_poi_search(search_query): start_google_maps_poi_search(search_query) time.sleep(config.DELAY_AFTER_LAUNCH) lf.kill_app(GOOGLE_MAPS) time.sleep(config.DELAY_AFTER_KILL)