示例#1
0
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 main():

    print("Check configuration for " + str(len(config.TARGET_APPS)) + " target apps\n")

    lf.start_logging_app()
    time.sleep(1)

    failed_starts = ""
    failed_starts_cnt = 0

    for app in config.TARGET_APPS:
        print("\nAttempt to launch " + app)
        output = lf.launch_app(app, get_output=True)
        print(output)

        if "No activities found to run" in output or "CRASH:" in output:
            failed_starts += "\n" + app + ": " + output
            failed_starts_cnt += 1
        else:
            time.sleep(WAIT_TIME_AFTER_START)

    lf.return_to_home_screen()
    lf.stop_logging_app()

    print("\nThere have been " + str(failed_starts_cnt) + " failed starts")
    print(failed_starts)
def main():

    print("Record activity launches\n")

    lf.start_logging_procedure()

    if not CHECK_CONFIGURATION:
        randomized_record.acquire_data_randomized(TARGET_ACTIVITIES,
                                                  config.records_per_app(),
                                                  start_stop_activity)
    else:
        check_config()

    lf.stop_logging_app()
def main():

    print("Record in mode: " + str(config.RECORD_MODE) + "\n")

    lf.start_logging_procedure()

    # Detect changes in proc files before actually triggering events
    start_stop_target_app("com.android.chrome", trigger_event=False)

    if config.RECORD_MODE == config.RecordMode.MIXED_MODE:
        # The first starts for resume launches do not qualify as actual app resumes
        COLD_START_RECORDS_PER_APP = 7
        RESUME_RECORDS_PER_APP = 9
        randomized_record.acquire_data_randomized(config.TARGET_APPS, COLD_START_RECORDS_PER_APP, start_stop_target_app)
        acquire_resume_data(config.TARGET_APPS, RESUME_RECORDS_PER_APP)
    elif config.RECORD_MODE == config.RecordMode.APP_RESUMES:
        acquire_resume_data(config.TARGET_APPS, config.records_per_app())
    elif config.RECORD_MODE == config.RecordMode.COLD_STARTS:
        randomized_record.acquire_data_randomized(config.TARGET_APPS, config.records_per_app(), start_stop_target_app)

    lf.stop_logging_app()
def main():
    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
    start_website(TARGET_WEBSITES[0], trigger_event=False)
    time.sleep(2)
    start_website(TARGET_WEBSITES[1], trigger_event=False)
    time.sleep(2)
    start_website(TARGET_WEBSITES[2], trigger_event=False)
    time.sleep(2)

    if not CHECK_CONFIGURATION:
        randomized_record.acquire_data_randomized(TARGET_WEBSITES,
                                                  RECORDS_PER_WEBSITE,
                                                  record_website)
    else:
        check_config()

    lf.stop_logging_app()
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()
示例#8
0
def main():
    parser = argparse.ArgumentParser(description='Recording app launches')
    parser.add_argument('permission_type', nargs=1, help='Type of permissions to use. Possible values '
                                                         'are: normal, dangerous, systemlevel')
    setConfig(parser.parse_args())

    print("Record websites manually\n")
    ask_for_user_action("Start exploration phase\n")
    print("Please open different websites on the phone until instructed otherwise")

    lf.start_logging_procedure()
    lf.wait_for_logcat(lf.LOGCAT_INIT_DONE)
    print("Init of APIHarvester done")
    print("Stop opening websites")
    time.sleep(2)

    ask_for_user_action("Start logging procedure\n")
    randomized_record.acquire_data_randomized(config.TARGET_WEBSITES, config.RECORDS_PER_WEBSITE, instruct_manual_launch)
    ask_for_user_action("\nStop logging app")

    destination_folder = lf.stop_logging_app()
def main():
    global kill_flag
    parser = argparse.ArgumentParser(description='Recording app launches')
    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 app launches (', config.TARGET_APPS, ')')
    print("Record in mode: " + str(config.RECORD_MODE) + "\n")

    lf.start_logging_procedure()

    thread = Thread(target=init_websites)
    thread.start()
    lf.wait_for_logcat(lf.LOGCAT_INIT_DONE)
    kill_flag = True
    print("Init of APIHarvester done")

    if config.RECORD_MODE == config.RecordMode.MIXED_MODE:
        # The first starts for resume launches do not qualify as actual app resumes
        COLD_START_RECORDS_PER_APP = 7
        RESUME_RECORDS_PER_APP = 9
        randomized_record.acquire_data_randomized(config.TARGET_APPS,
                                                  COLD_START_RECORDS_PER_APP,
                                                  start_stop_target_app)
        acquire_resume_data(config.TARGET_APPS, RESUME_RECORDS_PER_APP)
    elif config.RECORD_MODE == config.RecordMode.APP_RESUMES:
        acquire_resume_data(config.TARGET_APPS, config.records_per_app())
    elif config.RECORD_MODE == config.RecordMode.COLD_STARTS:
        randomized_record.acquire_data_randomized(config.TARGET_APPS,
                                                  config.records_per_app(),
                                                  start_stop_target_app)

    destination_folder = lf.stop_logging_app()