def run(self): """Run Google play unofficial python api the get the google play information @return: list of google play features """ self.key = "googleplay" googleplay = {} if ("file" not in self.task["category"]): return if ("apk" in choose_package( File(self.task["target"]).get_type(), File(self.task["target"]).get_name())): if not os.path.exists(self.file_path): raise CuckooProcessingError( "Sample file doesn't exist: \"%s\"" % self.file_path) android_id = self.options.get("android_id", None) google_login = self.options.get("google_login", None) google_password = self.options.get("google_password", None) #auth_token = self.options.get("auth_token", None) if not (android_id or google_login or google_password): raise CuckooProcessingError( "Google Play Credentials not configured, skip") try: a = apk.APK(self.file_path) if a.is_valid_APK(): package = a.get_package() # Connect api = GooglePlayAPI(android_id) api.login(google_login, google_password, None) # Get the version code and the offer type from the app details app_data = api.details(package) app_detail = app_data.docV2.details.appDetails if (app_detail.installationSize == 0): return googleplay googleplay["title"] = app_detail.title googleplay["app_category"] = app_detail.appCategory._values googleplay["version_code"] = app_detail.versionCode googleplay["app_type"] = app_detail.appType googleplay["content_rating"] = app_detail.contentRating googleplay["developer_email"] = app_detail.developerEmail googleplay["developer_name"] = app_detail.developerName googleplay[ "developer_website"] = app_detail.developerWebsite googleplay[ "installation_size"] = app_detail.installationSize googleplay["num_downloads"] = app_detail.numDownloads googleplay["upload_date"] = app_detail.uploadDate googleplay["permissions"] = app_detail.permission._values except (IOError, OSError, BadZipfile) as e: raise CuckooProcessingError("Error opening file %s" % e) return googleplay
def run(self): """Run Google play unofficial python api the get the google play information @return: list of google play features """ self.key = "googleplay" googleplay = {} if "file" not in self.task["category"]: return if "apk" in choose_package(File(self.task["target"]).get_type(), File(self.task["target"]).get_name()): if not os.path.exists(self.file_path): raise CuckooProcessingError('Sample file doesn\'t exist: "%s"' % self.file_path) android_id = self.options.get("android_id", None) google_login = self.options.get("google_login", None) google_password = self.options.get("google_password", None) # auth_token = self.options.get("auth_token", None) if not (android_id or google_login or google_password): raise CuckooProcessingError("Google Play Credentials not configured, skip") try: a = apk.APK(self.file_path) if a.is_valid_APK(): package = a.get_package() # Connect api = GooglePlayAPI(android_id) api.login(google_login, google_password, None) # Get the version code and the offer type from the app details app_data = api.details(package) app_detail = app_data.docV2.details.appDetails if app_detail.installationSize == 0: return googleplay googleplay["title"] = app_detail.title googleplay["app_category"] = app_detail.appCategory._values googleplay["version_code"] = app_detail.versionCode googleplay["app_type"] = app_detail.appType googleplay["content_rating"] = app_detail.contentRating googleplay["developer_email"] = app_detail.developerEmail googleplay["developer_name"] = app_detail.developerName googleplay["developer_website"] = app_detail.developerWebsite googleplay["installation_size"] = app_detail.installationSize googleplay["num_downloads"] = app_detail.numDownloads googleplay["upload_date"] = app_detail.uploadDate googleplay["permissions"] = app_detail.permission._values except (IOError, OSError, BadZipfile) as e: raise CuckooProcessingError("Error opening file %s" % e) return googleplay
def run(self): """Run androguard to extract static android information @return: list of static features """ self.key = "apkinfo" apkinfo = {} if "file" not in self.task["category"]: return if "apk" in choose_package(File(self.task["target"]).get_type(), File(self.task["target"]).get_name()): if not os.path.exists(self.file_path): raise CuckooProcessingError('Sample file doesn\'t exist: "%s"' % self.file_path) try: a = apk.APK(self.file_path) if a.is_valid_APK(): manifest = {} apkinfo["files"] = a.get_files_with_md5() manifest["package"] = a.get_package() manifest["permissions"] = a.get_details_permissions_new() manifest["main_activity"] = a.get_main_activity() manifest["activities"] = a.get_activities() manifest["services"] = a.get_services() manifest["receivers"] = a.get_receivers() manifest["receivers_actions"] = a.get__extended_receivers() manifest["providers"] = a.get_providers() manifest["libraries"] = a.get_libraries() apkinfo["manifest"] = manifest # apkinfo["certificate"] = a.get_certificate() static_calls = {} if self.check_size(apkinfo["files"]): vm = dvm.DalvikVMFormat(a.get_dex()) vmx = analysis.uVMAnalysis(vm) static_calls["all_methods"] = self.get_methods(vmx) static_calls["is_native_code"] = analysis.is_native_code(vmx) static_calls["is_dynamic_code"] = analysis.is_dyn_code(vmx) static_calls["is_reflection_code"] = analysis.is_reflection_code(vmx) static_calls["dynamic_method_calls"] = analysis.get_show_DynCode(vmx) static_calls["reflection_method_calls"] = analysis.get_show_ReflectionCode(vmx) static_calls["permissions_method_calls"] = analysis.get_show_Permissions(vmx) static_calls["crypto_method_calls"] = analysis.get_show_CryptoCode(vmx) static_calls["native_method_calls"] = analysis.get_show_NativeMethods(vmx) else: log.warning("Dex Size Bigger Then: " + str(self.options.decompilation_threshold)) apkinfo["static_method_calls"] = static_calls except (IOError, OSError, BadZipfile) as e: raise CuckooProcessingError("Error opening file %s" % e) return apkinfo
def run(self): """Run androguard to extract static android information @return: list of static features """ self.key = "apkinfo" apkinfo = {} if ("file" not in self.task["category"]): return if ("apk" in choose_package( File(self.task["target"]).get_type(), File(self.task["target"]).get_name())): if not os.path.exists(self.file_path): raise CuckooProcessingError( "Sample file doesn't exist: \"%s\"" % self.file_path) try: a = apk.APK(self.file_path) if a.is_valid_APK(): manifest = {} apkinfo["files"] = a.get_files_with_md5() manifest["package"] = a.get_package() manifest["permissions"] = a.get_details_permissions_new() manifest["main_activity"] = a.get_main_activity() manifest["activities"] = a.get_activities() manifest["services"] = a.get_services() manifest["receivers"] = a.get_receivers() manifest["receivers_actions"] = a.get__extended_receivers() manifest["providers"] = a.get_providers() manifest["libraries"] = a.get_libraries() apkinfo["manifest"] = manifest #apkinfo["certificate"] = a.get_certificate() static_calls = {} if self.check_size(apkinfo["files"]): vm = dvm.DalvikVMFormat(a.get_dex()) vmx = analysis.uVMAnalysis(vm) static_calls["all_methods"] = self.get_methods(vmx) static_calls[ "is_native_code"] = analysis.is_native_code(vmx) static_calls["is_dynamic_code"] = analysis.is_dyn_code( vmx) static_calls[ "is_reflection_code"] = analysis.is_reflection_code( vmx) static_calls[ "dynamic_method_calls"] = analysis.get_show_DynCode( vmx) static_calls[ "reflection_method_calls"] = analysis.get_show_ReflectionCode( vmx) static_calls[ "permissions_method_calls"] = analysis.get_show_Permissions( vmx) static_calls[ "crypto_method_calls"] = analysis.get_show_CryptoCode( vmx) static_calls[ "native_method_calls"] = analysis.get_show_NativeMethods( vmx) else: log.warning("Dex Size Bigger Then: " + str(self.options.decompilation_threshold)) apkinfo["static_method_calls"] = static_calls except (IOError, OSError, BadZipfile) as e: raise CuckooProcessingError("Error opening file %s" % e) return apkinfo