From f6193dc1b64e3d1df954d79c3dba31c2e55c172f Mon Sep 17 00:00:00 2001 From: Ayushman Chhabra <14110965+ayushmanchhabra@users.noreply.github.com> Date: Sat, 21 Sep 2024 02:43:07 +0530 Subject: [PATCH] Check for internet before attempting to download APK (#2422) * Check for internet before attempting to download APK --- mobsf/MobSF/views/apk_downloader.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mobsf/MobSF/views/apk_downloader.py b/mobsf/MobSF/views/apk_downloader.py index 923fafd14a..871cd2d1cb 100644 --- a/mobsf/MobSF/views/apk_downloader.py +++ b/mobsf/MobSF/views/apk_downloader.py @@ -16,6 +16,7 @@ handle_uploaded_file, ) from mobsf.MobSF.utils import ( + is_internet_available, is_path_traversal, is_zip_magic, strict_package_check, @@ -133,6 +134,9 @@ def apk_download(package): downloaded_file = None data = None try: + if not is_internet_available(): + logger.warning('Internet Not Available. Unable to download APK') + return None if not strict_package_check(package) or is_path_traversal(package): return None logger.info('Attempting to download: %s', package)