Exemplo n.º 1
0
def extraction(apk_path, file):
    t = "<sep>"
    apkf = APK(apk_path)
    f = open("train.csv", 'a')
    f.write(file + t)
    f.write(str(apkf.cert_text) + t)
    f.write(str(apkf.file_md5) + t)
    f.write(str(apkf.cert_md5) + t)
    f.write(str(apkf.file_size) + t)
    f.write(str(apkf.androidversion) + t)
    f.write(str(apkf.package) + t)
    f.write(str(apkf.get_android_manifest_xml()) + t)
    f.write(str(apkf.get_android_manifest_axml()) + t)
    f.write(str(apkf.is_valid_APK()) + t)
    f.write(str(apkf.get_filename()) + t)
    f.write(str(apkf.get_package()) + t)
    f.write(str(apkf.get_androidversion_code()) + t)
    f.write(str(apkf.get_androidversion_name()) + t)
    f.write(str(apkf.get_max_sdk_version()) + t)
    f.write(str(apkf.get_min_sdk_version()) + t)
    f.write(str(apkf.get_target_sdk_version()) + t)
    f.write(str(apkf.get_libraries()) + t)
    f.write(str(apkf.get_files()) + t)
    f.write(str(apkf.get_files_types()) + t)
    f.write(str(apkf.get_main_activity()) + t)
    f.write(str(apkf.get_activities()) + t)
    f.write(str(apkf.get_services()) + t)
    f.write(str(apkf.get_receivers()) + t)
    f.write(str(apkf.get_providers()) + t)
    f.write(str(apkf.get_permissions()))
    f.write("<new>")
Exemplo n.º 2
0
def get_feature(apk_path):
    try:
        apkf = APK(apk_path)
        x_feature = ""
        x_feature = x_feature + str(apkf.file_size) + sep
        x_feature = x_feature + str(apkf.get_max_sdk_version()) + sep
        x_feature = x_feature + str(apkf.get_min_sdk_version()) + sep
        x_feature = x_feature + str(apkf.get_target_sdk_version()) + sep
        x_feature = x_feature + str(apkf.androidversion) + sep
        x_feature = x_feature + str(apkf.get_activities()) + sep
        x_feature = x_feature + str(apkf.get_services()) + sep
        x_feature = x_feature + str(apkf.get_receivers()) + sep
        x_feature = x_feature + str(apkf.get_providers()) + sep
        x_feature = x_feature + str(apkf.get_permissions()) + "\n"
        f.write(x_feature)
    except:
        pass
Exemplo n.º 3
0
def test():
    if len(sys.argv) == 1:
        print('Usage: %s app.apk' % sys.argv[0])
        sys.exit(1)

    apk_path = sys.argv[1]
    apkf = APK(apk_path)
    print(apkf.cert_text)
    print(apkf.cert_pem)
    print(apkf.file_md5)
    print(apkf.cert_md5)
    print(apkf.file_size)
    print(apkf.androidversion)
    print(apkf.package)
    print(apkf.get_android_manifest_xml())
    print(apkf.get_android_manifest_axml())
    print(apkf.is_valid_APK())
    print(apkf.get_filename())
    print(apkf.get_package())
    print(apkf.get_androidversion_code())
    print(apkf.get_androidversion_name())
    print(apkf.get_max_sdk_version())
    print(apkf.get_min_sdk_version())
    print(apkf.get_target_sdk_version())
    print(apkf.get_libraries())
    print(apkf.get_files())
    # pip install python-magic
    print(apkf.get_files_types())
    # print(apkf.get_dex())
    print(apkf.get_main_activity())
    print(apkf.get_activities())
    print(apkf.get_services())
    print(apkf.get_receivers())
    print(apkf.get_providers())
    print(apkf.get_permissions())
    print(binascii.hexlify(apkf.get_signature()))
    print(apkf.get_signature_name())

    print apkf.show()