Example #1
0
def start():
    onlyfiles = [
        f for f in listdir(fuzzerConfig.path_for_crash_samples)
        if isfile(join(fuzzerConfig.path_for_crash_samples, f))
    ]
    for x in range(len(onlyfiles)):
        #clean tombstones
        adb_android.shell("rm /data/tombstones/*")
        #push file to device
        adb_android.push(fuzzerConfig.path_for_crash_samples + onlyfiles[x],
                         "/data/local/tmp")
        #run the file
        adb_android.shell(fuzzerConfig.target_android_executable +
                          ' /data/local/tmp/' + onlyfiles[x])
        #collect the crash
        result = adb_android.shell(
            "ls -l /data/tombstones/ | grep tombstone_00")

        if (len(result) < 2):
            pass
            #No Tombstones generated , its a false positive
        else:
            adb_android.pull(
                '/data/tombstones/tombstone_00',
                fuzzerConfig.path_for_confirmed_samples + "tombstone_" +
                onlyfiles[x])
Example #2
0
def my_except_hook(exctype, value, traceback):
    if exctype == KeyboardInterrupt:
        print "Handler code goes here"
        m = 0
        while m <= i:
            adb_android.pull("/sdcard/demo{0}.mp4".format(m), ".")
            m = m + 1
            print m
    else:
        sys.__excepthook__(exctype, value, traceback)
Example #3
0
def start():
    onlyfiles = [f for f in listdir(fuzzerConfig.path_for_crash_samples) if isfile(join(fuzzerConfig.path_for_crash_samples, f))]
    for x in range(len(onlyfiles)):
        #clean tombstones
        adb_android.shell("rm /data/tombstones/*")
        #push file to device
        adb_android.push(fuzzerConfig.path_for_crash_samples+onlyfiles[x],"/data/local/tmp")
        #run the file
        adb_android.shell(fuzzerConfig.target_android_executable+' /data/local/tmp/' + onlyfiles[x])
        #collect the crash
        result = adb_android.shell("ls -l /data/tombstones/ | grep tombstone_00")

        if(len(result)<2):
            pass
            #No Tombstones generated , its a false positive
        else:
            adb_android.pull('/data/tombstones/tombstone_00',fuzzerConfig.path_for_confirmed_samples+"tombstone_"+onlyfiles[x])
Example #4
0
def pull_db(args):
    db_to_pull = args.database_path
    if not db_to_pull:
        found_dbs = _find_candidate_dbs()
        if len(found_dbs) == 0:
            print red('=' * 80)
            print red('Could not find any candidate databases.')
            sys.exit(1)
        if len(found_dbs) > 1:
            print red('=' * 80)
            print red('More than one candidate database found!')
            print
            print white(
                'Run `%s find` to see the options, and then come back with a specific path for me.'
                % sys.argv[0])
            sys.exit(1)
        db_to_pull = found_dbs[0]

    # Find a writable location
    temp_dir = _find_nonroot_writable_dir()

    try:
        # Copy the database there first
        print yellow('Copying the DB to a user directory...')
        _su_shell_command('cp %s %s/EnMicroMsg.db' % (db_to_pull, temp_dir))

        print yellow('Pulling the DB to your computer...')
        status_code, output = adb_android.pull('%s/EnMicroMsg.db' % temp_dir,
                                               args.output_file)
    except:
        print
        print red('=' * 80)
        print red('An error occurred.')
        sys.exit(1)
    else:
        print
        print green('=' * 80)
        print green('Success!')
    finally:
        # Make sure to clean up!
        print yellow('Cleaning up...')
        _shell_command('rm -f %s/EnMicroMsg.db' % temp_dir)
Example #5
0
def pull_db(args):
    db_to_pull = args.database_path
    if not db_to_pull:
        found_dbs = _find_candidate_dbs()
        if len(found_dbs) == 0:
            print red('=' * 80)
            print red('Could not find any candidate databases.')
            sys.exit(1)
        if len(found_dbs) > 1:
            print red('=' * 80)
            print red('More than one candidate database found!')
            print
            print white('Run `%s find` to see the options, and then come back with a specific path for me.' % sys.argv[0])
            sys.exit(1)
        db_to_pull = found_dbs[0]

    # Find a writable location
    temp_dir = _find_nonroot_writable_dir()

    try:
        # Copy the database there first
        print yellow('Copying the DB to a user directory...')
        _su_shell_command('cp %s %s/EnMicroMsg.db' % (db_to_pull, temp_dir))

        print yellow('Pulling the DB to your computer...')
        status_code, output = adb_android.pull('%s/EnMicroMsg.db' % temp_dir, args.output_file)
    except:
        print
        print red('=' * 80)
        print red('An error occurred.')
        sys.exit(1)
    else:
        print
        print green('=' * 80)
        print green('Success!')
    finally:
        # Make sure to clean up!
        print yellow('Cleaning up...')
        _shell_command('rm -f %s/EnMicroMsg.db' % temp_dir)
Example #6
0
def start():
    adb_android.pull("/data/local/tmp/logcat.txt",fuzzerConfig.path_to_save_logcat)
    search.process(fuzzerConfig.path_to_save_logcat)
Example #7
0
# Бекапимся
if os.path.isdir(dir_backup):
    print("Директория backup уже есть!")
    exit(1)
if os.path.isfile(dir_backup):
    print("backup это файл. Можно создавать каталог.")
os.mkdir(dir_backup)
real_path = os.getcwd()
os.chdir(dir_backup)

while len(list_block_path) > 0:
    name = list_name_partition.pop()
    block = list_block_path.pop()

    if name == "userdata":
        if not big_partition:
            continue

    if name == "system_a":
        if not big_partition:
            continue

    if name == "system_b":
        if not big_partition:
            continue

    adb_android.pull(block, name)

os.chdir(real_path)
pass