diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 45d0b03a..ca6335de 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -32,7 +32,7 @@ jobs: VERSION=${GITHUB_REF#refs/tags/v} TAG="${DOCKER_IMAGE}:v${VERSION}" fi - echo ::set-output name=tag::${TAG} + echo "tag=${TAG}" >> $GITHUB_OUTPUT - name: Build and push release id: docker_build diff --git a/LICENSES/apksigner.txt b/LICENSES/apksigner.txt new file mode 100644 index 00000000..d252f9e7 --- /dev/null +++ b/LICENSES/apksigner.txt @@ -0,0 +1,15 @@ +# Copyright (C) 2016 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Set up prog to be the path of this script, including following symlinks, +# and set up progdir to be the fully-qualified pathname of its directory. \ No newline at end of file diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.serializer-2.7.2.txt b/LICENSES/vd2svg.txt similarity index 99% rename from mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.serializer-2.7.2.txt rename to LICENSES/vd2svg.txt index 261eeb9e..657f862e 100644 --- a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.serializer-2.7.2.txt +++ b/LICENSES/vd2svg.txt @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2017 Andrius Semionovas Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +198,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. \ No newline at end of file diff --git a/mobsf/DynamicAnalyzer/views/android/dynamic_analyzer.py b/mobsf/DynamicAnalyzer/views/android/dynamic_analyzer.py index 8ffa0034..8ecc46ef 100755 --- a/mobsf/DynamicAnalyzer/views/android/dynamic_analyzer.py +++ b/mobsf/DynamicAnalyzer/views/android/dynamic_analyzer.py @@ -57,7 +57,7 @@ def dynamic_analysis(request, api=False): logcat = Path(settings.UPLD_DIR) / apk.MD5 / 'logcat.txt' temp_dict = { - 'ICON_FOUND': apk.ICON_FOUND, + 'ICON_PATH': apk.ICON_PATH, 'MD5': apk.MD5, 'APP_NAME': apk.APP_NAME, 'VERSION_NAME': apk.VERSION_NAME, @@ -238,8 +238,7 @@ def httptools_start(request): else: project = '' url = f'{httptools_url}/dashboard/{project}' - return HttpResponseRedirect( - url) # lgtm [py/reflective-xss] lgtm [py/url-redirection] + return HttpResponseRedirect(url) except Exception: logger.exception('Starting httptools Web UI') err = 'Error Starting httptools UI' @@ -320,10 +319,7 @@ def trigger_static_analysis(request, checksum): 'file_name': f'{package}.apk', } add_to_recent_scan(data) - return HttpResponseRedirect( - f'/static_analyzer/?name=' # lgtm [py/url-redirection] - f'{package}.apk&checksum={checksum}' - f'&type=apk') + return HttpResponseRedirect(f'/static_analyzer/{checksum}/') except Exception: msg = 'On device APK Static Analysis' logger.exception(msg) diff --git a/mobsf/MobSF/init.py b/mobsf/MobSF/init.py index be45f04e..09a38b8b 100644 --- a/mobsf/MobSF/init.py +++ b/mobsf/MobSF/init.py @@ -10,7 +10,7 @@ from mobsf.install.windows.setup import windows_config_local logger = logging.getLogger(__name__) -VERSION = '3.7.7' +VERSION = '3.7.8' BANNER = """ __ __ _ ____ _____ _____ _____ | \/ | ___ | |__/ ___|| ___|_ _|___ /|___ | diff --git a/mobsf/MobSF/settings.py b/mobsf/MobSF/settings.py index ee212fde..4c10e0a4 100644 --- a/mobsf/MobSF/settings.py +++ b/mobsf/MobSF/settings.py @@ -65,6 +65,7 @@ SECRET_KEY = first_run(SECRET_FILE, BASE_DIR, MobSF_HOME) ALLOWED_EXTENSIONS = { '.txt': 'text/plain', '.png': 'image/png', + '.svg': 'image/svg+xml', '.zip': 'application/zip', '.tar': 'application/x-tar', '.apk': 'application/octet-stream', diff --git a/mobsf/MobSF/urls.py b/mobsf/MobSF/urls.py index 57e3e311..87fa2913 100755 --- a/mobsf/MobSF/urls.py +++ b/mobsf/MobSF/urls.py @@ -78,14 +78,16 @@ if settings.API_ONLY == '0': # General re_path(r'^$', home.index, name='home'), re_path(r'^upload/$', home.Upload.as_view), - re_path(r'^download/', home.download), - re_path(r'^download_scan/', home.download_apk), - re_path(r'^generate_downloads/$', home.generate_download), + re_path(r'^download/', home.download, name='download'), + re_path(r'^download_scan/', home.download_apk, name='download_scan'), + re_path(r'^generate_downloads/$', + home.generate_download, + name='generate_downloads'), re_path(r'^about$', home.about, name='about'), re_path(r'^donate$', home.donate, name='donate'), re_path(r'^api_docs$', home.api_docs, name='api_docs'), re_path(r'^recent_scans/$', home.recent_scans, name='recent'), - re_path(r'^delete_scan/$', home.delete_scan), + re_path(r'^delete_scan/$', home.delete_scan, name='delete_scan'), re_path(r'^search$', home.search), re_path(r'^error/$', home.error, name='error'), re_path(r'^not_found/$', home.not_found), @@ -93,19 +95,29 @@ if settings.API_ONLY == '0': # Static Analysis # Android - re_path(r'^static_analyzer/$', android_sa.static_analyzer), + re_path(r'^static_analyzer/(?P[0-9a-f]{32})/$', + android_sa.static_analyzer, + name='static_analyzer'), # Remove this is version 4/5 re_path(r'^source_code/$', source_tree.run, name='tree_view'), re_path(r'^view_file/$', view_source.run, name='view_source'), re_path(r'^find/$', find.run, name='find_files'), - re_path(r'^manifest_view/$', manifest_view.run), + re_path(r'^manifest_view/(?P[0-9a-f]{32})/$', + manifest_view.run, + name='manifest_view'), # IOS - re_path(r'^static_analyzer_ios/$', ios_sa.static_analyzer_ios), - re_path(r'^view_file_ios/$', io_view_source.run), + re_path(r'^static_analyzer_ios/(?P[0-9a-f]{32})/$', + ios_sa.static_analyzer_ios, + name='static_analyzer_ios'), + re_path(r'^view_file_ios/$', + io_view_source.run, + name='view_file_ios'), # Windows - re_path(r'^static_analyzer_windows/$', windows.staticanalyzer_windows), + re_path(r'^static_analyzer_windows/(?P[0-9a-f]{32})/$', + windows.staticanalyzer_windows, + name='static_analyzer_windows'), # Shared - re_path(r'^pdf/$', pdf.pdf), + re_path(r'^pdf/(?P[0-9a-f]{32})/$', pdf.pdf, name='pdf'), re_path(r'^appsec_dashboard/(?P[0-9a-f]{32})/$', appsec.appsec_dashboard, name='appsec_dashboard'), @@ -142,7 +154,7 @@ if settings.API_ONLY == '0': name='static_scan'), # Android Operations re_path(r'^run_apk/$', operations.run_apk), - re_path(r'^mobsfy/$', operations.mobsfy), + re_path(r'^mobsfy/$', operations.mobsfy, name='mobsfy'), re_path(r'^screenshot/$', operations.take_screenshot), re_path(r'^execute_adb/$', operations.execute_adb), re_path(r'^screen_cast/$', operations.screen_cast), @@ -152,21 +164,30 @@ if settings.API_ONLY == '0': re_path(r'^global_proxy/$', operations.global_proxy), # Dynamic Tests re_path(r'^activity_tester/$', tests_common.activity_tester), - re_path(r'^start_activity/$', tests_common.start_activity), + re_path(r'^start_activity/$', + tests_common.start_activity, + name='start_activity'), re_path(r'^download_data/$', tests_common.download_data), re_path(r'^collect_logs/$', tests_common.collect_logs), re_path(r'^tls_tests/$', tests_common.tls_tests), # Frida re_path(r'^frida_instrument/$', tests_frida.instrument), - re_path(r'^live_api/$', tests_frida.live_api), - re_path(r'^frida_logs/$', tests_frida.frida_logs), + re_path(r'^live_api/$', + tests_frida.live_api, + name='live_api'), + re_path(r'^frida_logs/$', + tests_frida.frida_logs, + name='frida_logs'), re_path(r'^list_frida_scripts/$', tests_frida.list_frida_scripts), re_path(r'^get_script/$', tests_frida.get_script), re_path(r'^get_dependencies/$', tests_frida.get_runtime_dependencies), # Report re_path(r'^dynamic_report/(?P[0-9a-f]{32})$', - report.view_report), - re_path(r'^dynamic_view_file/$', report.view_file), + report.view_report, + name='dynamic_report'), + re_path(r'^dynamic_view_file/$', + report.view_file, + name='dynamic_view_file'), # Test re_path(r'^tests/$', tests.start_test), ]) diff --git a/mobsf/MobSF/views/api/api_static_analysis.py b/mobsf/MobSF/views/api/api_static_analysis.py index 00cbf877..e61cebf3 100755 --- a/mobsf/MobSF/views/api/api_static_analysis.py +++ b/mobsf/MobSF/views/api/api_static_analysis.py @@ -64,30 +64,25 @@ def api_scan(request): return make_api_response( {'error': 'The file is not uploaded/available'}, 500) scan_type = robj[0].SCAN_TYPE - request.POST._mutable = True - request.POST['scan_type'] = scan_type - request.POST['file_name'] = robj[0].FILE_NAME # APK, Source Code (Android/iOS) ZIP, SO, JAR, AAR if scan_type in {'xapk', 'apk', 'apks', 'zip', 'so', 'jar', 'aar'}: - resp = static_analyzer(request, True) + resp = static_analyzer(request, checksum, True) if 'type' in resp: - # For now it's only ios_zip - request.POST['scan_type'] = 'ios' - resp = static_analyzer_ios(request, True) + resp = static_analyzer_ios(request, checksum, True) if 'error' in resp: response = make_api_response(resp, 500) else: response = make_api_response(resp, 200) # IPA elif scan_type in {'ipa', 'dylib', 'a'}: - resp = static_analyzer_ios(request, True) + resp = static_analyzer_ios(request, checksum, True) if 'error' in resp: response = make_api_response(resp, 500) else: response = make_api_response(resp, 200) # APPX elif scan_type == 'appx': - resp = windows.staticanalyzer_windows(request, True) + resp = windows.staticanalyzer_windows(request, checksum, True) if 'error' in resp: response = make_api_response(resp, 500) else: @@ -117,7 +112,10 @@ def api_pdf_report(request): if 'hash' not in request.POST: return make_api_response( {'error': 'Missing Parameters'}, 422) - resp = pdf(request, api=True) + resp = pdf( + request, + request.POST['hash'], + api=True) if 'error' in resp: if resp.get('error') == 'Invalid scan hash': response = make_api_response(resp, 400) @@ -142,7 +140,11 @@ def api_json_report(request): if 'hash' not in request.POST: return make_api_response( {'error': 'Missing Parameters'}, 422) - resp = pdf(request, api=True, jsonres=True) + resp = pdf( + request, + request.POST['hash'], + api=True, + jsonres=True) if 'error' in resp: if resp.get('error') == 'Invalid scan hash': response = make_api_response(resp, 400) diff --git a/mobsf/MobSF/views/home.py b/mobsf/MobSF/views/home.py index a51c5835..2cb603d1 100755 --- a/mobsf/MobSF/views/home.py +++ b/mobsf/MobSF/views/home.py @@ -225,14 +225,20 @@ def recent_scans(request): entries = [] db_obj = RecentScansDB.objects.all().order_by('-TIMESTAMP').values() android = StaticAnalyzerAndroid.objects.all() + ios = StaticAnalyzerIOS.objects.all() + icon_mapping = {} package_mapping = {} for item in android: package_mapping[item.MD5] = item.PACKAGE_NAME + icon_mapping[item.MD5] = item.ICON_PATH + for item in ios: + icon_mapping[item.MD5] = item.ICON_PATH for entry in db_obj: if entry['MD5'] in package_mapping.keys(): entry['PACKAGE'] = package_mapping[entry['MD5']] else: entry['PACKAGE'] = '' + entry['ICON_PATH'] = icon_mapping.get(entry['MD5'], '') logcat = Path(settings.UPLD_DIR) / entry['MD5'] / 'logcat.txt' entry['DYNAMIC_REPORT_EXISTS'] = logcat.exists() entries.append(entry) @@ -271,8 +277,7 @@ def search(request): db_obj = RecentScansDB.objects.filter(MD5=md5) if db_obj.exists(): e = db_obj[0] - url = (f'/{e.ANALYZER }/?name={e.FILE_NAME}&' - f'checksum={e.MD5}&type={e.SCAN_TYPE}') + url = f'/{e.ANALYZER }/{e.MD5}/' return HttpResponseRedirect(url) else: return HttpResponseRedirect('/not_found/') diff --git a/mobsf/StaticAnalyzer/models.py b/mobsf/StaticAnalyzer/models.py index 785c48fa..21ccaf9b 100755 --- a/mobsf/StaticAnalyzer/models.py +++ b/mobsf/StaticAnalyzer/models.py @@ -37,8 +37,7 @@ class StaticAnalyzerAndroid(models.Model): MIN_SDK = models.CharField(max_length=50, default='') VERSION_NAME = models.CharField(max_length=100, default='') VERSION_CODE = models.CharField(max_length=50, default='') - ICON_HIDDEN = models.BooleanField(default=False) - ICON_FOUND = models.BooleanField(default=False) + ICON_PATH = models.TextField(default='') PERMISSIONS = models.TextField(default={}) CERTIFICATE_ANALYSIS = models.TextField(default={}) MANIFEST_ANALYSIS = models.TextField(default=[]) @@ -78,7 +77,7 @@ class StaticAnalyzerIOS(models.Model): BUNDLE_ID = models.TextField(default='') BUNDLE_URL_TYPES = models.TextField(default=[]) BUNDLE_SUPPORTED_PLATFORMS = models.CharField(max_length=50, default=[]) - ICON_FOUND = models.BooleanField(default=False) + ICON_PATH = models.TextField(default='') INFO_PLIST = models.TextField(default='') BINARY_INFO = models.TextField(default={}) PERMISSIONS = models.TextField(default={}) @@ -86,6 +85,7 @@ class StaticAnalyzerIOS(models.Model): BINARY_ANALYSIS = models.TextField(default=[]) MACHO_ANALYSIS = models.TextField(default={}) DYLIB_ANALYSIS = models.TextField(default=[]) + FRAMEWORK_ANALYSIS = models.TextField(default=[]) IOS_API = models.TextField(default={}) CODE_ANALYSIS = models.TextField(default={}) FILE_ANALYSIS = models.TextField(default=[]) diff --git a/mobsf/StaticAnalyzer/tests.py b/mobsf/StaticAnalyzer/tests.py index 5fe1b54f..9d644331 100755 --- a/mobsf/StaticAnalyzer/tests.py +++ b/mobsf/StaticAnalyzer/tests.py @@ -55,11 +55,11 @@ def static_analysis_test(): logger.info('[OK] Completed Upload test') logger.info('Running Static Analysis Test') for upl in uploaded: - scan_url = '/{}/?name={}&checksum={}&type={}'.format( - upl['analyzer'], upl['file_name'], - upl['hash'], upl['scan_type']) + scan_url = '/{}/{}/'.format( + upl['analyzer'], + upl['hash']) if RESCAN: - scan_url = scan_url + '&rescan=1' + scan_url = scan_url + '?rescan=1' resp = http_client.get(scan_url, follow=True) if resp.status_code == 200: logger.info('[OK] Static Analysis Complete: %s', scan_url) @@ -70,22 +70,22 @@ def static_analysis_test(): logger.info('Running PDF Generation Test') if platform.system() in ['Darwin', 'Linux']: pdfs = [ - '/pdf/?md5=02e7989c457ab67eb514a8328779f256', - '/pdf/?md5=3a552566097a8de588b8184b059b0158', - '/pdf/?md5=6c23c2970551be15f32bbab0b5db0c71', - '/pdf/?md5=52c50ae824e329ba8b5b7a0f523efffe', - '/pdf/?md5=57bb5be0ea44a755ada4a93885c3825e', - '/pdf/?md5=8179b557433835827a70510584f3143e', - '/pdf/?md5=7b0a23bffc80bac05739ea1af898daad', + '/pdf/02e7989c457ab67eb514a8328779f256/', + '/pdf/3a552566097a8de588b8184b059b0158/', + '/pdf/6c23c2970551be15f32bbab0b5db0c71/', + '/pdf/52c50ae824e329ba8b5b7a0f523efffe/', + '/pdf/57bb5be0ea44a755ada4a93885c3825e/', + '/pdf/8179b557433835827a70510584f3143e/', + '/pdf/7b0a23bffc80bac05739ea1af898daad/', ] else: pdfs = [ - '/pdf/?md5=02e7989c457ab67eb514a8328779f256', - '/pdf/?md5=3a552566097a8de588b8184b059b0158', - '/pdf/?md5=52c50ae824e329ba8b5b7a0f523efffe', - '/pdf/?md5=57bb5be0ea44a755ada4a93885c3825e', - '/pdf/?md5=8179b557433835827a70510584f3143e', - '/pdf/?md5=7b0a23bffc80bac05739ea1af898daad', + '/pdf/02e7989c457ab67eb514a8328779f256/', + '/pdf/3a552566097a8de588b8184b059b0158/', + '/pdf/52c50ae824e329ba8b5b7a0f523efffe/', + '/pdf/57bb5be0ea44a755ada4a93885c3825e/', + '/pdf/8179b557433835827a70510584f3143e/', + '/pdf/7b0a23bffc80bac05739ea1af898daad/', ] for pdf in pdfs: diff --git a/mobsf/StaticAnalyzer/tools/batik/batik-rasterizer-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/batik-rasterizer-1.15.jar deleted file mode 100644 index c3f16c8d..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/batik-rasterizer-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/extensions/README.txt b/mobsf/StaticAnalyzer/tools/batik/extensions/README.txt deleted file mode 100644 index c256cf90..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/extensions/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -The Jar files in this directory start the same application as in the -parent directory, except they include the Batik Extensions on the jar -file class path. This means that that the Batik Extensions will work -with the applications started by these jar files. - -Great care should be used when using the Batik Extensions as these are -not part of the SVG standard. If you write content that uses these -extensions you must be aware that this is not conformant SVG content -and other SVG renderers will not render these documents. These -extensions should only be used in content used in closed systems. - -The primary purpose of these extensions is demonstrative and to -generate feedback to the development of the SVG standard. diff --git a/mobsf/StaticAnalyzer/tools/batik/extensions/batik-rasterizer-ext-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/extensions/batik-rasterizer-ext-1.15.jar deleted file mode 100644 index 30e0a666..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/extensions/batik-rasterizer-ext-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/extensions/batik-squiggle-ext-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/extensions/batik-squiggle-ext-1.15.jar deleted file mode 100644 index b87482f6..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/extensions/batik-squiggle-ext-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.dom-documentation.txt b/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.dom-documentation.txt deleted file mode 100644 index ca81f2ff..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.dom-documentation.txt +++ /dev/null @@ -1,86 +0,0 @@ -xml-commons/java/external/LICENSE.dom-documentation.txt $Id: LICENSE.dom-documentation.txt 1733420 2016-03-03 07:41:59Z gadams $ - - -This license came from: http://www.w3.org/Consortium/Legal/copyright-documents-19990405 - - -W3C® DOCUMENT NOTICE AND LICENSE -Copyright © 1994-2001 World -Wide Web Consortium, World -Wide Web Consortium, (Massachusetts Institute of -Technology, Institut National de -Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. -http://www.w3.org/Consortium/Legal/ - -Public documents on the W3C site are provided by the copyright -holders under the following license. The software or Document Type -Definitions (DTDs) associated with W3C specifications are governed -by the Software Notice. By using and/or copying this document, or the -W3C document from which this statement is linked, you (the -licensee) agree that you have read, understood, and will comply -with the following terms and conditions: - -Permission to use, copy, and distribute the contents of this -document, or the W3C document from which this statement is linked, -in any medium for any purpose and without fee or royalty is hereby -granted, provided that you include the following on ALL -copies of the document, or portions thereof, that you use: - -A link or URL to the original W3C document. - -The pre-existing copyright notice of the original author, or if -it doesn't exist, a notice of the form: "Copyright © [$date-of-document] World Wide Web -Consortium, (Massachusetts -Institute of Technology, Institut National de Recherche en Informatique et en -Automatique, Keio -University). All Rights Reserved. -http://www.w3.org/Consortium/Legal/" (Hypertext is preferred, but a -textual representation is permitted.) - -If it exists, the STATUS of the W3C document. - -When space permits, inclusion of the full text of this NOTICE -should be provided. We request that authorship -attribution be provided in any software, documents, or other items -or products that you create pursuant to the implementation of the -contents of this document, or any portion thereof. - -No right to create modifications or derivatives of W3C documents -is granted pursuant to this license. However, if additional -requirements (documented in the Copyright -FAQ) are satisfied, the right to create modifications or -derivatives is sometimes granted by the W3C to individuals -complying with those requirements. - -THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO -REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT -NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS -OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE -IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY -PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. -COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, -SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE -DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS -THEREOF. - -The name and trademarks of copyright holders may NOT be used in -advertising or publicity pertaining to this document or its -contents without specific, written prior permission. Title to -copyright in this document will at all times remain with copyright -holders. - ----------------------------------------------------------------------------- -This formulation of W3C's notice and license became active on -April 05 1999 so as to account for the treatment of DTDs, schema's and -bindings. See the older formulation for the policy prior to this date. -Please see -our Copyright FAQ for common questions -about using materials from our site, including specific terms and -conditions for packages like libwww, Amaya, and Jigsaw. -Other questions about this notice can be directed to site-policy@w3.org. - -webmaster -(last updated by reagle on 1999/04/99.) \ No newline at end of file diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.dom-software.txt b/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.dom-software.txt deleted file mode 100644 index c29fec5d..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.dom-software.txt +++ /dev/null @@ -1,74 +0,0 @@ -xml-commons/java/external/LICENSE.dom-software.txt $Id: LICENSE.dom-software.txt 1733420 2016-03-03 07:41:59Z gadams $ - - -This license came from: http://www.w3.org/Consortium/Legal/copyright-software-19980720 - - -W3C® SOFTWARE NOTICE AND LICENSE -Copyright © 1994-2001 World -Wide Web Consortium, World -Wide Web Consortium, (Massachusetts Institute of -Technology, Institut National de -Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. -http://www.w3.org/Consortium/Legal/ - -This W3C work (including software, documents, or other related -items) is being provided by the copyright holders under the -following license. By obtaining, using and/or copying this work, -you (the licensee) agree that you have read, understood, and will -comply with the following terms and conditions: -Permission to use, copy, modify, and distribute this software -and its documentation, with or without modification,  for any -purpose and without fee or royalty is hereby granted, provided that -you include the following on ALL copies of the software and -documentation or portions thereof, including modifications, that -you make: - -The full text of this NOTICE in a location viewable to users of -the redistributed or derivative work. - -Any pre-existing intellectual property disclaimers, notices, or -terms and conditions. If none exist, a short notice of the -following form (hypertext is preferred, text is permitted) should -be used within the body of any redistributed or derivative code: -"Copyright © [$date-of-software] World Wide Web Consortium, (Massachusetts Institute of -Technology, Institut National de -Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. -http://www.w3.org/Consortium/Legal/" - -Notice of any changes or modifications to the W3C files, -including the date changes were made. (We recommend you provide -URIs to the location from which the code is derived.) - -THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND -COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF -MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE -USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD -PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. -COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, -SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE -SOFTWARE OR DOCUMENTATION. - -The name and trademarks of copyright holders may NOT be used in -advertising or publicity pertaining to the software without -specific, written prior permission. Title to copyright in this -software and any associated documentation will at all times remain -with copyright holders. -____________________________________ -This formulation of W3C's notice and license became active on -August 14 1998 so as to improve compatibility with GPL. This -version ensures that W3C software licensing terms are no more -restrictive than GPL and consequently W3C software may be -distributed in GPL packages. See the older formulation for the -policy prior to this date. Please see our Copyright FAQ for common -questions about using materials from -our site, including specific terms and conditions for packages like -libwww, Amaya, and Jigsaw. -Other questions about this notice can be -directed to site-policy@w3.org. - -webmaster -(last updated $Date: 2002-12-09 09:15:21 -0700 (Mon, 09 Dec 2002) $) \ No newline at end of file diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.fop-transcoder-allinone-2.7.txt b/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.fop-transcoder-allinone-2.7.txt deleted file mode 100644 index 4772d9c4..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.fop-transcoder-allinone-2.7.txt +++ /dev/null @@ -1,2 +0,0 @@ -The fop-transcoder-allinone-2.7.jar file is licensed under the Apache License 2.0, which -can be found in the distribution root directory in the LICENSE file. diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.rhino-1.7.7.txt b/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.rhino-1.7.7.txt deleted file mode 100644 index c0e7c21f..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.rhino-1.7.7.txt +++ /dev/null @@ -1,375 +0,0 @@ -The majority of Rhino is licensed under the MPL 2.0: - -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.sax.txt b/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.sax.txt deleted file mode 100644 index abeda6f5..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.sax.txt +++ /dev/null @@ -1,23 +0,0 @@ -xml-commons/java/external/LICENSE.sax.txt $Id: LICENSE.sax.txt 1733420 2016-03-03 07:41:59Z gadams $ - - -This license came from: http://www.megginson.com/SAX/copying.html - However please note future versions of SAX may be covered - under http://saxproject.org/?selected=pd - - -This page is now out of date -- see the new SAX site at -http://www.saxproject.org/ for more up-to-date -releases and other information. Please change your bookmarks. - - -SAX2 is Free! - -I hereby abandon any property rights to SAX 2.0 (the Simple API for -XML), and release all of the SAX 2.0 source code, compiled code, and -documentation contained in this distribution into the Public Domain. -SAX comes with NO WARRANTY or guarantee of fitness for any -purpose. - -David Megginson, david@megginson.com -2000-05-05 \ No newline at end of file diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.xmlgraphics-commons-2.7.txt b/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.xmlgraphics-commons-2.7.txt deleted file mode 100644 index d6456956..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/LICENSE.xmlgraphics-commons-2.7.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/NOTICE.serializer-2.7.2.txt b/mobsf/StaticAnalyzer/tools/batik/lib/NOTICE.serializer-2.7.2.txt deleted file mode 100644 index c4458581..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/NOTICE.serializer-2.7.2.txt +++ /dev/null @@ -1,18 +0,0 @@ - ========================================================================= - == NOTICE file corresponding to section 4(d) of the Apache License, == - == Version 2.0, in this case for the Apache Xalan Java distribution. == - ========================================================================= - - Apache Xalan (Xalan serializer) - Copyright 1999-2006 The Apache Software Foundation - - This product includes software developed at - The Apache Software Foundation (http://www.apache.org/). - - Portions of this software was originally based on the following: - - software copyright (c) 1999-2002, Lotus Development Corporation., - http://www.lotus.com. - - software copyright (c) 2001-2002, Sun Microsystems., - http://www.sun.com. - - software copyright (c) 2003, IBM Corporation., - http://www.ibm.com. diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/NOTICE.xmlgraphics-commons-2.7.txt b/mobsf/StaticAnalyzer/tools/batik/lib/NOTICE.xmlgraphics-commons-2.7.txt deleted file mode 100644 index c93ae11c..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/NOTICE.xmlgraphics-commons-2.7.txt +++ /dev/null @@ -1,5 +0,0 @@ -Apache XML Graphics Commons -Copyright 2006-2022 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/README.fop-transcoder-allinone-2.7.txt b/mobsf/StaticAnalyzer/tools/batik/lib/README.fop-transcoder-allinone-2.7.txt deleted file mode 100644 index ac0c018d..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/README.fop-transcoder-allinone-2.7.txt +++ /dev/null @@ -1,8 +0,0 @@ -The fop-transcoder-allinone-svn-trunk.jar file is built from the Apache FOP project -(http://xmlgraphics.apache.org/fop), version 2.7. - -This is only needed if you want to transcode to PDF, otherwise it can -be removed. - -The pdf-transcoder.jar file is licensed under the Apache License 2.0, which -can be found in the distribution root directory in the LICENSE file. diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/README.rhino-1.7.7.txt b/mobsf/StaticAnalyzer/tools/batik/lib/README.rhino-1.7.7.txt deleted file mode 100644 index 32f03aa7..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/README.rhino-1.7.7.txt +++ /dev/null @@ -1,3 +0,0 @@ -This distribution includes a binary distribution of Mozilla Rhino 1.7.7 release. - -Rhino is licensed under both the MPL (Mozilla Public License) 2.0, which is in the LICENSE.rhino-1.7.7.txt file. diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/README.xml-apis-1.4.01.txt b/mobsf/StaticAnalyzer/tools/batik/lib/README.xml-apis-1.4.01.txt deleted file mode 100644 index 76a571b7..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/README.xml-apis-1.4.01.txt +++ /dev/null @@ -1,30 +0,0 @@ -This distribution includes xml-apis.jar from the XML Commons External -1.4.01 binary distribution, which can also be obtained from: - - http://xml.apache.org/mirrors.cgi - -Source code is available from the XML Commons web site: - - http://xml.apache.org/commons/ - -xml-apis.jar contains: - - - DOM Level 2 Events - - DOM Level 2 HTML - - DOM Level 2 Style - - DOM Level 2 Traversal and Range - - DOM Level 2 Views - - DOM Level 3 Core - - DOM Level 3 Load and Save - - DOM Level 3 XPath - - JAXP 1.3 (JSR 206) - - SAX - -All DOM code is licensed under the W3C Software License, and DOM documentation -under the W3C Document License. See LICENSE.dom-software.txt and -LICENSE.dom-documentation.txt. - -The JAXP 1.3 code is licensed under the Apache Software License 2.0, which is -in the LICENSE in the root directory of this distribution. - -SAX is public domain. See LICENSE.sax.txt. diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/README.xml-apis-ext-1.3.04.txt b/mobsf/StaticAnalyzer/tools/batik/lib/README.xml-apis-ext-1.3.04.txt deleted file mode 100644 index 03a0a1ea..00000000 --- a/mobsf/StaticAnalyzer/tools/batik/lib/README.xml-apis-ext-1.3.04.txt +++ /dev/null @@ -1,19 +0,0 @@ -This distribution includes xml-apis-ext.jar from the XML Commons External -1.3.04 binary distribution, which can also be obtained from: - - http://xml.apache.org/mirrors.cgi - -Source code is available from the XML Commons web site: - - http://xml.apache.org/commons/ - -xml-apis-ext.jar contains: - - - SAC 1.3 - - SMIL Java bindings - - SVG 1.1 Java bindings - -SAC 1.3, the SMIL Java bindings and the SVG 1.1 Java bindings are licensed -under the W3C Software License. Related documentation is licensed under the -W3C Document License. See LICENSE.dom-software.txt and -LICENSE.dom-documentation.txt. diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/Squiggle.icns b/mobsf/StaticAnalyzer/tools/batik/lib/Squiggle.icns deleted file mode 100644 index b4875d6c..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/Squiggle.icns and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-all-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-all-1.15.jar deleted file mode 100644 index 9bc6ad17..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-all-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-anim-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-anim-1.15.jar deleted file mode 100644 index e7e7ee71..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-anim-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-awt-util-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-awt-util-1.15.jar deleted file mode 100644 index 55079f26..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-awt-util-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-bridge-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-bridge-1.15.jar deleted file mode 100644 index 4cb6f00f..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-bridge-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-codec-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-codec-1.15.jar deleted file mode 100644 index ab762179..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-codec-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-constants-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-constants-1.15.jar deleted file mode 100644 index cc507f36..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-constants-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-css-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-css-1.15.jar deleted file mode 100644 index 0ab24df2..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-css-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-dom-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-dom-1.15.jar deleted file mode 100644 index 300572d4..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-dom-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-ext-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-ext-1.15.jar deleted file mode 100644 index 866c4d97..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-ext-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-extension-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-extension-1.15.jar deleted file mode 100644 index ff62527f..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-extension-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-gui-util-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-gui-util-1.15.jar deleted file mode 100644 index b8173790..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-gui-util-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-gvt-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-gvt-1.15.jar deleted file mode 100644 index dda79a86..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-gvt-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-i18n-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-i18n-1.15.jar deleted file mode 100644 index 3055a02e..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-i18n-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-parser-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-parser-1.15.jar deleted file mode 100644 index bba57f97..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-parser-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-script-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-script-1.15.jar deleted file mode 100644 index 42348f8b..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-script-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-shared-resources-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-shared-resources-1.15.jar deleted file mode 100644 index ba571ffa..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-shared-resources-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-svg-dom-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-svg-dom-1.15.jar deleted file mode 100644 index 06a0315e..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-svg-dom-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-svgbrowser-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-svgbrowser-1.15.jar deleted file mode 100644 index f2773738..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-svgbrowser-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-svggen-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-svggen-1.15.jar deleted file mode 100644 index e9cef53f..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-svggen-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-svgrasterizer-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-svgrasterizer-1.15.jar deleted file mode 100644 index 48f5f72e..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-svgrasterizer-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-swing-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-swing-1.15.jar deleted file mode 100644 index aa38e52d..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-swing-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-1.15.jar deleted file mode 100644 index f98aae9f..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-old-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-old-1.15.jar deleted file mode 100644 index 33ba0304..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-old-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-svg-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-svg-1.15.jar deleted file mode 100644 index 4681473a..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-svg-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-swing-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-swing-1.15.jar deleted file mode 100644 index 2ed233fa..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-test-swing-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-transcoder-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-transcoder-1.15.jar deleted file mode 100644 index bebd76af..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-transcoder-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-util-1.15-tests.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-util-1.15-tests.jar deleted file mode 100644 index fd059464..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-util-1.15-tests.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-util-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-util-1.15.jar deleted file mode 100644 index 02060b27..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-util-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/batik-xml-1.15.jar b/mobsf/StaticAnalyzer/tools/batik/lib/batik-xml-1.15.jar deleted file mode 100644 index 4d74d8f7..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/batik-xml-1.15.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/fop-transcoder-allinone-2.7.jar b/mobsf/StaticAnalyzer/tools/batik/lib/fop-transcoder-allinone-2.7.jar deleted file mode 100644 index 2da440e8..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/fop-transcoder-allinone-2.7.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/rhino-1.7.7.jar b/mobsf/StaticAnalyzer/tools/batik/lib/rhino-1.7.7.jar deleted file mode 100644 index 7aca2839..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/rhino-1.7.7.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/serializer-2.7.2.jar b/mobsf/StaticAnalyzer/tools/batik/lib/serializer-2.7.2.jar deleted file mode 100644 index 10c881c1..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/serializer-2.7.2.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/xml-apis-1.4.01.jar b/mobsf/StaticAnalyzer/tools/batik/lib/xml-apis-1.4.01.jar deleted file mode 100644 index 46733464..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/xml-apis-1.4.01.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/xml-apis-ext-1.3.04.jar b/mobsf/StaticAnalyzer/tools/batik/lib/xml-apis-ext-1.3.04.jar deleted file mode 100644 index a7869d68..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/xml-apis-ext-1.3.04.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/tools/batik/lib/xmlgraphics-commons-2.7.jar b/mobsf/StaticAnalyzer/tools/batik/lib/xmlgraphics-commons-2.7.jar deleted file mode 100644 index 7396f130..00000000 Binary files a/mobsf/StaticAnalyzer/tools/batik/lib/xmlgraphics-commons-2.7.jar and /dev/null differ diff --git a/mobsf/StaticAnalyzer/views/android/cert_analysis.py b/mobsf/StaticAnalyzer/views/android/cert_analysis.py index a49d45d7..b4c50d5e 100755 --- a/mobsf/StaticAnalyzer/views/android/cert_analysis.py +++ b/mobsf/StaticAnalyzer/views/android/cert_analysis.py @@ -91,14 +91,17 @@ def get_pub_key_details(data): return certlist -def get_signature_versions(app_path, tools_dir): +def get_signature_versions(app_path, tools_dir, signed): """Get signature versions using apksigner.""" v1, v2, v3, v4 = False, False, False, False try: + if not signed: + return v1, v2, v3, v4 logger.info('Getting Signature Versions') apksigner = Path(tools_dir) / 'apksigner.jar' args = [find_java_binary(), '-Xmx1024M', - '-Djava.library.path=', '-jar', apksigner, + '-Djava.library.path=', '-jar', + apksigner.as_posix(), 'verify', '--verbose', app_path] out = subprocess.check_output( args, stderr=subprocess.STDOUT) @@ -124,8 +127,6 @@ def apksigtool_cert(apk_path, tools_dir): signed = False certs_no = 0 min_sdk = None - v1, v2, v3, v4 = get_signature_versions( - apk_path, tools_dir) try: from apksigtool import ( APKSignatureSchemeBlock, @@ -155,6 +156,7 @@ def apksigtool_cert(apk_path, tools_dir): certlist.append('Binary is signed') else: certlist.append('Binary is not signed') + v1, v2, v3, v4 = get_signature_versions(apk_path, tools_dir, signed) certlist.append(f'v1 signature: {v1}') certlist.append(f'v2 signature: {v2}') certlist.append(f'v3 signature: {v3}') @@ -180,14 +182,13 @@ def get_cert_data(a, app_path, tools_dir): """Get Human readable certificate.""" certlist = [] signed = False - v1, v2, v3, v4 = get_signature_versions( - app_path, tools_dir) if a.is_signed(): signed = True certlist.append('Binary is signed') else: certlist.append('Binary is not signed') certlist.append('Missing certificate') + v1, v2, v3, v4 = get_signature_versions(app_path, tools_dir, signed) certlist.append(f'v1 signature: {v1}') certlist.append(f'v2 signature: {v2}') certlist.append(f'v3 signature: {v3}') diff --git a/mobsf/StaticAnalyzer/views/android/db_interaction.py b/mobsf/StaticAnalyzer/views/android/db_interaction.py index dce14adc..fccf9658 100755 --- a/mobsf/StaticAnalyzer/views/android/db_interaction.py +++ b/mobsf/StaticAnalyzer/views/android/db_interaction.py @@ -55,8 +55,7 @@ def get_context_from_db_entry(db_entry: QuerySet) -> dict: 'min_sdk': db_entry[0].MIN_SDK, 'version_name': db_entry[0].VERSION_NAME, 'version_code': db_entry[0].VERSION_CODE, - 'icon_hidden': db_entry[0].ICON_HIDDEN, - 'icon_found': db_entry[0].ICON_FOUND, + 'icon_path': db_entry[0].ICON_PATH, 'permissions': python_dict(db_entry[0].PERMISSIONS), 'certificate_analysis': python_dict( db_entry[0].CERTIFICATE_ANALYSIS), @@ -127,8 +126,7 @@ def get_context_from_analysis(app_dic, 'min_sdk': man_data_dic['min_sdk'], 'version_name': man_data_dic['androvername'], 'version_code': man_data_dic['androver'], - 'icon_hidden': app_dic['icon_hidden'], - 'icon_found': app_dic['icon_found'], + 'icon_path': app_dic['icon_path'], 'certificate_analysis': cert_dic, 'permissions': man_an_dic['permissions'], 'manifest_analysis': manifest_analysis, @@ -190,8 +188,7 @@ def save_or_update(update_type, 'MIN_SDK': man_data_dic['min_sdk'], 'VERSION_NAME': man_data_dic['androvername'], 'VERSION_CODE': man_data_dic['androver'], - 'ICON_HIDDEN': app_dic['icon_hidden'], - 'ICON_FOUND': app_dic['icon_found'], + 'ICON_PATH': app_dic['icon_path'], 'CERTIFICATE_ANALYSIS': cert_dic, 'PERMISSIONS': man_an_dic['permissions'], 'MANIFEST_ANALYSIS': man_an_dic['manifest_anal'], diff --git a/mobsf/StaticAnalyzer/views/android/icon_analysis.py b/mobsf/StaticAnalyzer/views/android/icon_analysis.py index a82408d0..3c58b2be 100755 --- a/mobsf/StaticAnalyzer/views/android/icon_analysis.py +++ b/mobsf/StaticAnalyzer/views/android/icon_analysis.py @@ -76,6 +76,25 @@ def guess_icon_path(res_dir): return '' +def get_icon_from_src(app_dic, icon_from_mfst): + res_path = '' + eclipse = Path(app_dic['app_dir']) / 'res' + studio = Path(app_dic['app_dir']) / 'app' / 'src' / 'main' / 'res' + if eclipse.exists(): + res_path = eclipse.as_posix() + elif studio.exists(): + res_path = studio.as_posix() + if not res_path: + return + + icon_file = find_icon_path_zip(res_path, icon_from_mfst) + if icon_file and Path(icon_file).exists(): + dwd = Path(settings.DWD_DIR) + out = dwd / (app_dic['md5'] + '-icon' + Path(icon_file).suffix) + copy2(icon_file, out) + app_dic['icon_path'] = out.name + + def find_icon_path_zip(res_dir, icon_paths_from_manifest): """ Find icon. @@ -173,6 +192,9 @@ def get_icon_src(a, app_dic, res_dir): else: # We found png icon, the easy path icon_src = (app_dir / icon_name).as_posix() + if icon_src.endswith('.xml'): + logger.warning('Cannot find icon file from xml') + icon_src = '' return icon_src except Exception: logger.exception('Fetching icon function') @@ -181,9 +203,7 @@ def get_icon_src(a, app_dic, res_dir): def get_icon_apk(apk, app_dic): """Get/Guess icon from APK binary.""" app_dir = Path(app_dic['app_dir']) - app_dic['icon_path'] = '' - app_dic['icon_found'] = False - app_dic['icon_hidden'] = True + icon_file = '' res_path = app_dir / 'res' if not res_path.exists(): @@ -196,25 +216,35 @@ def get_icon_apk(apk, app_dic): copytree(apk_tool_res, res_path) except Exception: pass - # Set app_dic with icon details if res_path.exists(): # Icon lookup in res directory - app_dic['icon_path'] = get_icon_src( + icon_file = get_icon_src( apk, app_dic, res_path.as_posix()) - app_dic['icon_found'] = bool(app_dic['icon_path']) - app_dic['icon_hidden'] = not app_dic['icon_found'] - if app_dic['icon_path']: - src = Path(app_dic['icon_path']) - # Convert SVG icon to PNG - if src.as_posix().endswith('.svg'): - src = convert_svg_to_png(src, app_dic['tools_dir']) - # Copy PNG to Downloads - out = Path(settings.DWD_DIR) / (app_dic['md5'] + '-icon.png') + if icon_file: + src = Path(icon_file) + # Copy PNG/SVG to Downloads + out = Path(settings.DWD_DIR) / (app_dic['md5'] + '-icon' + src.suffix) if src and src.exists() and src.is_file(): copy2(src.as_posix(), out.as_posix()) + app_dic['icon_path'] = out.name + + +def transform_svg(fpath, bpath, output): + """Transform SVG from foreground and background.""" + try: + import svgutils.transform as sg + background = sg.fromfile(bpath) + logo = sg.fromfile(fpath) + root = logo.getroot() + root.moveto(1, 1) + background.append([root]) + background.save(output) + return output.as_posix() + except Exception: + return None def get_icon_svg_from_xml(app_dir, icon_xml_file): @@ -242,17 +272,30 @@ def get_icon_svg_from_xml(app_dir, icon_xml_file): if fpath and bpath: break # To not break existing users - import svgutils.transform as sg - background = sg.fromfile(bpath) - logo = sg.fromfile(fpath) - root = logo.getroot() - root.moveto(1, 1) - background.append([root]) output = icon_xml.parent / f'{icon_xml.stem}.svg' - background.save(output) - return output.as_posix() + return transform_svg(fpath, bpath, output) except Exception: - return None + try: + fsvg, bsvg = None, None + search_loc = app_dir / 'apktool_out' / 'res' / 'drawable' + if not search_loc.exists(): + return None + rand_icon = '' + for f in search_loc.rglob('*.svg'): + rand_icon = f.as_posix() + if 'ic_launcher_foreground.svg' in f.name: + fsvg = f + if 'ic_launcher_background.svg' in f.name: + bsvg = f + if fsvg and bsvg: + break + if fsvg and bsvg: + output = search_loc / 'ic_launcher.svg' + return transform_svg(fsvg, bsvg, output) + else: + return rand_icon + except Exception: + logger.exception('Guessing icon svg') def convert_axml_to_xml(app_dir, icon_file): @@ -265,9 +308,9 @@ def convert_axml_to_xml(app_dir, icon_file): icon_bin_xml.read_bytes()).get_xml_obj() xml_txt = etree.tostring( aobj, pretty_print=True, encoding='utf-8') + out_xml.write_bytes(xml_txt) if b' PNG, Mac only # https://iphonedevwiki.net/index.php/CgBI_file_format try: @@ -41,16 +44,17 @@ def get_icon(md5, bin_dir, binary): # PNG looks normal raise ValueError('PNG is not CgBI') except Exception: - shutil.copy2(icon_file, outfile) + shutil.copy2(icon_file, outfile.as_posix()) else: - shutil.copy2(icon_file, outfile) - return True + shutil.copy2(icon_file, outfile.as_posix()) + app_dict['icon_path'] = outfile.name except Exception: logger.exception('Error Fetching icon') - return False -def get_icon_source(md5, src_dir): +def get_icon_source(app_dict): + md5 = app_dict['md5_hash'] + src_dir = app_dict['app_dir'] """Get app icon from iOS ZIP.""" logger.info('Fetching icon path') try: @@ -63,11 +67,10 @@ def get_icon_source(md5, src_dir): if '.appiconset' in full_path and img.endswith('.png'): appiconset.append(full_path) if not appiconset: - return False + return icon_file = appiconset[0] - outfile = os.path.join(settings.DWD_DIR, md5 + '-icon.png') - shutil.copy2(icon_file, outfile) - return True + outfile = Path(settings.DWD_DIR) / f'{md5}-icon.png' + shutil.copy2(icon_file, outfile.as_posix()) + app_dict['icon_path'] = outfile.name except Exception: logger.exception('Error Fetching icon') - return False diff --git a/mobsf/StaticAnalyzer/views/ios/static_analyzer.py b/mobsf/StaticAnalyzer/views/ios/static_analyzer.py index 9c6568a5..5c9f918f 100755 --- a/mobsf/StaticAnalyzer/views/ios/static_analyzer.py +++ b/mobsf/StaticAnalyzer/views/ios/static_analyzer.py @@ -14,7 +14,10 @@ from mobsf.MobSF.utils import ( file_size, print_n_send_error_response, ) -from mobsf.StaticAnalyzer.models import StaticAnalyzerIOS +from mobsf.StaticAnalyzer.models import ( + RecentScansDB, + StaticAnalyzerIOS, +) from mobsf.StaticAnalyzer.views.ios.appstore import app_search from mobsf.StaticAnalyzer.views.ios.binary_analysis import ( binary_analysis, @@ -30,7 +33,7 @@ from mobsf.StaticAnalyzer.views.ios.db_interaction import ( from mobsf.StaticAnalyzer.views.ios.dylib import dylib_analysis from mobsf.StaticAnalyzer.views.ios.file_analysis import ios_list_files from mobsf.StaticAnalyzer.views.ios.icon_analysis import ( - get_icon, + get_icon_from_ipa, get_icon_source, ) from mobsf.StaticAnalyzer.views.ios.plist_analysis import ( @@ -64,216 +67,217 @@ logger = logging.getLogger(__name__) ############################################################## -def static_analyzer_ios(request, api=False): +def static_analyzer_ios(request, checksum, api=False): """Module that performs iOS IPA/ZIP Static Analysis.""" try: rescan = False if api: - file_type = request.POST['scan_type'] - checksum = request.POST['hash'] re_scan = request.POST.get('re_scan', 0) - filename = request.POST['file_name'] else: - file_type = request.GET['type'] - checksum = request.GET['checksum'] re_scan = request.GET.get('rescan', 0) - filename = request.GET['name'] if re_scan == '1': rescan = True - md5_match = re.match('^[0-9a-f]{32}$', checksum) app_dict = {} + if not re.match('^[0-9a-f]{32}$', checksum): + msg = 'Invalid checksum' + return print_n_send_error_response(request, msg, api) + robj = RecentScansDB.objects.filter(MD5=checksum) + if not robj.exists(): + msg = 'The file is not uploaded/available' + return print_n_send_error_response(request, msg, api) + file_type = robj[0].SCAN_TYPE + filename = robj[0].FILE_NAME allowed_exts = ('ios', '.ipa', '.zip', '.dylib', '.a') allowed_typ = [i.replace('.', '') for i in allowed_exts] - if (md5_match - and filename.lower().endswith(allowed_exts) - and file_type in allowed_typ): - app_dict['directory'] = Path(settings.BASE_DIR) # BASE DIR - app_dict['file_name'] = filename # APP ORIGINAL NAME - app_dict['md5_hash'] = checksum # MD5 - app_dir = Path(settings.UPLD_DIR) / checksum - app_dict['app_dir'] = app_dir.as_posix() + '/' - tools_dir = app_dict[ - 'directory'] / 'StaticAnalyzer' / 'tools' / 'ios' - app_dict['tools_dir'] = tools_dir.as_posix() - if file_type == 'ipa': + if (not filename.lower().endswith(allowed_exts) + or file_type not in allowed_typ): + msg = 'Invalid file extension or file type' + return print_n_send_error_response(request, msg, api) + + app_dict['directory'] = Path(settings.BASE_DIR) # BASE DIR + app_dict['file_name'] = filename # APP ORIGINAL NAME + app_dict['md5_hash'] = checksum # MD5 + app_dir = Path(settings.UPLD_DIR) / checksum + app_dict['app_dir'] = app_dir.as_posix() + '/' + tools_dir = app_dict[ + 'directory'] / 'StaticAnalyzer' / 'tools' / 'ios' + app_dict['tools_dir'] = tools_dir.as_posix() + app_dict['icon_path'] = '' + if file_type == 'ipa': + app_dict['app_file'] = app_dict[ + 'md5_hash'] + '.ipa' # NEW FILENAME + app_dict['app_path'] = app_dir / app_dict['app_file'] + app_dict['app_path'] = app_dict['app_path'].as_posix() + # DB + ipa_db = StaticAnalyzerIOS.objects.filter( + MD5=app_dict['md5_hash']) + if ipa_db.exists() and not rescan: + context = get_context_from_db_entry(ipa_db) + else: + logger.info('iOS Binary (IPA) Analysis Started') + app_dict['size'] = str( + file_size(app_dict['app_path'])) + 'MB' # FILE SIZE + app_dict['sha1'], app_dict['sha256'] = hash_gen( + app_dict['app_path']) # SHA1 & SHA256 HASHES + logger.info('Extracting IPA') + # EXTRACT IPA + unzip(app_dict['app_path'], app_dict['app_dir']) + # Identify Payload directory + dirs = app_dir.glob('**/*') + for _dir in dirs: + if 'payload' in _dir.as_posix().lower(): + app_dict['bin_dir'] = app_dict['app_dir'] / _dir + break + else: + msg = ('IPA is malformed! ' + 'MobSF cannot find Payload directory') + return print_n_send_error_response( + request, + msg, + api) + app_dict['bin_dir'] = app_dict['bin_dir'].as_posix() + '/' + # Get Files + all_files = ios_list_files( + app_dict['bin_dir'], app_dict['md5_hash'], True, 'ipa') + # Plist files are converted to xml/readable + infoplist_dict = plist_analysis(app_dict['bin_dir'], False) + app_dict['appstore'] = app_search(infoplist_dict.get('id')) + app_dict['secrets'] = get_plist_secrets( + app_dict['bin_dir']) + bin_dict = binary_analysis( + app_dict['bin_dir'], + app_dict['tools_dir'], + app_dict['app_dir'], + infoplist_dict.get('bin')) + # Analyze dylibs and frameworks + lb = library_analysis(app_dict['bin_dir'], 'macho') + bin_dict['dylib_analysis'] = lb['macho_analysis'] + bin_dict['framework_analysis'] = lb['framework_analysis'] + # Get Icon + get_icon_from_ipa( + app_dict, + infoplist_dict.get('bin')) + # Extract String metadata + code_dict = get_strings_metadata( + app_dict, + bin_dict, + all_files, + lb['macho_strings']) + + # Domain Extraction and Malware Check + logger.info('Performing Malware Check on ' + 'extracted Domains') + code_dict['domains'] = MalwareDomainCheck().scan( + code_dict['urls_list']) + logger.info('Finished URL and Email Extraction') + + # Extract Trackers from Domains + trk = Trackers.Trackers( + None, app_dict['tools_dir']) + trackers = trk.get_trackers_domains_or_deps( + code_dict['domains'], []) + + code_dict['api'] = {} + code_dict['code_anal'] = {} + code_dict['firebase'] = firebase_analysis( + code_dict['urls_list']) + code_dict['trackers'] = trackers + context = save_get_ctx( + app_dict, + infoplist_dict, + code_dict, + bin_dict, + all_files, + rescan) + context['virus_total'] = None + if settings.VT_ENABLED: + vt = VirusTotal.VirusTotal() + context['virus_total'] = vt.get_result( + app_dict['app_path'], + app_dict['md5_hash']) + context['appsec'] = get_ios_dashboard(context, True) + context['average_cvss'] = get_avg_cvss( + context['binary_analysis']) + template = 'static_analysis/ios_binary_analysis.html' + if api: + return context + else: + return render(request, template, context) + elif file_type == 'dylib': + return dylib_analysis(request, app_dict, rescan, api) + elif file_type == 'a': + return a_analysis(request, app_dict, rescan, api) + elif file_type in ('ios', 'zip'): + ios_zip_db = StaticAnalyzerIOS.objects.filter( + MD5=app_dict['md5_hash']) + if ios_zip_db.exists() and not rescan: + context = get_context_from_db_entry(ios_zip_db) + else: + logger.info('iOS Source Code Analysis Started') app_dict['app_file'] = app_dict[ - 'md5_hash'] + '.ipa' # NEW FILENAME + 'md5_hash'] + '.zip' # NEW FILENAME app_dict['app_path'] = app_dir / app_dict['app_file'] app_dict['app_path'] = app_dict['app_path'].as_posix() - # DB - ipa_db = StaticAnalyzerIOS.objects.filter( - MD5=app_dict['md5_hash']) - if ipa_db.exists() and not rescan: - context = get_context_from_db_entry(ipa_db) - else: - logger.info('iOS Binary (IPA) Analysis Started') - app_dict['size'] = str( - file_size(app_dict['app_path'])) + 'MB' # FILE SIZE - app_dict['sha1'], app_dict['sha256'] = hash_gen( - app_dict['app_path']) # SHA1 & SHA256 HASHES - logger.info('Extracting IPA') - # EXTRACT IPA - unzip(app_dict['app_path'], app_dict['app_dir']) - # Identify Payload directory - dirs = app_dir.glob('**/*') - for _dir in dirs: - if 'payload' in _dir.as_posix().lower(): - app_dict['bin_dir'] = app_dict['app_dir'] / _dir - break - else: - msg = ('IPA is malformed! ' - 'MobSF cannot find Payload directory') - return print_n_send_error_response( - request, - msg, - api) - app_dict['bin_dir'] = app_dict['bin_dir'].as_posix() + '/' - # Get Files - all_files = ios_list_files( - app_dict['bin_dir'], app_dict['md5_hash'], True, 'ipa') - # Plist files are converted to xml/readable - infoplist_dict = plist_analysis(app_dict['bin_dir'], False) - app_dict['appstore'] = app_search(infoplist_dict.get('id')) - app_dict['secrets'] = get_plist_secrets( - app_dict['bin_dir']) - bin_dict = binary_analysis( - app_dict['bin_dir'], - app_dict['tools_dir'], - app_dict['app_dir'], - infoplist_dict.get('bin')) - # Analyze dylibs - dy = library_analysis(app_dict['bin_dir'], 'macho') - bin_dict['dylib_analysis'] = dy['macho_analysis'] - # Get Icon - app_dict['icon_found'] = get_icon( - app_dict['md5_hash'], - app_dict['bin_dir'], - infoplist_dict.get('bin')) - # Extract String metadata - code_dict = get_strings_metadata( - app_dict, - bin_dict, - all_files, - dy['macho_strings']) - - # Domain Extraction and Malware Check - logger.info('Performing Malware Check on ' - 'extracted Domains') - code_dict['domains'] = MalwareDomainCheck().scan( - code_dict['urls_list']) - logger.info('Finished URL and Email Extraction') - - # Extract Trackers from Domains - trk = Trackers.Trackers( - None, app_dict['tools_dir']) - trackers = trk.get_trackers_domains_or_deps( - code_dict['domains'], []) - - code_dict['api'] = {} - code_dict['code_anal'] = {} - code_dict['firebase'] = firebase_analysis( - code_dict['urls_list']) - code_dict['trackers'] = trackers - context = save_get_ctx( - app_dict, - infoplist_dict, - code_dict, - bin_dict, - all_files, - rescan) - context['virus_total'] = None - if settings.VT_ENABLED: - vt = VirusTotal.VirusTotal() - context['virus_total'] = vt.get_result( - app_dict['app_path'], - app_dict['md5_hash']) - context['appsec'] = get_ios_dashboard(context, True) - context['average_cvss'] = get_avg_cvss( - context['binary_analysis']) - template = 'static_analysis/ios_binary_analysis.html' - if api: - return context - else: - return render(request, template, context) - elif file_type == 'dylib': - return dylib_analysis(request, app_dict, rescan, api) - elif file_type == 'a': - return a_analysis(request, app_dict, rescan, api) - elif file_type == 'ios': - ios_zip_db = StaticAnalyzerIOS.objects.filter( - MD5=app_dict['md5_hash']) - if ios_zip_db.exists() and not rescan: - context = get_context_from_db_entry(ios_zip_db) - else: - logger.info('iOS Source Code Analysis Started') - app_dict['app_file'] = app_dict[ - 'md5_hash'] + '.zip' # NEW FILENAME - app_dict['app_path'] = app_dir / app_dict['app_file'] - app_dict['app_path'] = app_dict['app_path'].as_posix() - # ANALYSIS BEGINS - Already Unzipped - app_dict['size'] = str( - file_size(app_dict['app_path'])) + 'MB' # FILE SIZE - app_dict['sha1'], app_dict['sha256'] = hash_gen( - app_dict['app_path']) # SHA1 & SHA256 HASHES - all_files = ios_list_files( - app_dict['app_dir'], - app_dict['md5_hash'], - False, - 'ios') - infoplist_dict = plist_analysis(app_dict['app_dir'], True) - app_dict['appstore'] = app_search(infoplist_dict.get('id')) - app_dict['secrets'] = get_plist_secrets( - app_dict['app_dir']) - code_analysis_dic = ios_source_analysis( - app_dict['app_dir']) - ios_strs = strings_and_entropies( - Path(app_dict['app_dir']), - ['.swift', '.m', '.h', '.plist']) - if ios_strs['secrets']: - app_dict['secrets'].extend(list(ios_strs['secrets'])) - # Get App Icon - app_dict['icon_found'] = get_icon_source( - app_dict['md5_hash'], - app_dict['app_dir']) - # Firebase DB Check - code_analysis_dic['firebase'] = firebase_analysis( - list(set(code_analysis_dic['urls_list']))) - # Extract Trackers from Domains - trk = Trackers.Trackers( - None, app_dict['tools_dir']) - trackers = trk.get_trackers_domains_or_deps( - code_analysis_dic['domains'], []) - code_analysis_dic['trackers'] = trackers - fake_bin_dict = { - 'checksec': {}, - 'libraries': [], - 'bin_code_analysis': {}, - 'strings': list(ios_strs['strings']), - 'bin_info': {}, - 'bin_type': code_analysis_dic['source_type'], - 'dylib_analysis': {}, - } - context = save_get_ctx( - app_dict, - infoplist_dict, - code_analysis_dic, - fake_bin_dict, - all_files, - rescan) - context['appsec'] = get_ios_dashboard(context, True) - context['average_cvss'] = get_avg_cvss( - context['code_analysis']) - template = 'static_analysis/ios_source_analysis.html' - if api: - return context - else: - return render(request, template, context) + # ANALYSIS BEGINS - Already Unzipped + app_dict['size'] = str( + file_size(app_dict['app_path'])) + 'MB' # FILE SIZE + app_dict['sha1'], app_dict['sha256'] = hash_gen( + app_dict['app_path']) # SHA1 & SHA256 HASHES + all_files = ios_list_files( + app_dict['app_dir'], + app_dict['md5_hash'], + False, + 'ios') + infoplist_dict = plist_analysis(app_dict['app_dir'], True) + app_dict['appstore'] = app_search(infoplist_dict.get('id')) + app_dict['secrets'] = get_plist_secrets( + app_dict['app_dir']) + code_analysis_dic = ios_source_analysis( + app_dict['app_dir']) + ios_strs = strings_and_entropies( + Path(app_dict['app_dir']), + ['.swift', '.m', '.h', '.plist']) + if ios_strs['secrets']: + app_dict['secrets'].extend(list(ios_strs['secrets'])) + # Get App Icon + get_icon_source(app_dict) + # Firebase DB Check + code_analysis_dic['firebase'] = firebase_analysis( + list(set(code_analysis_dic['urls_list']))) + # Extract Trackers from Domains + trk = Trackers.Trackers( + None, app_dict['tools_dir']) + trackers = trk.get_trackers_domains_or_deps( + code_analysis_dic['domains'], []) + code_analysis_dic['trackers'] = trackers + fake_bin_dict = { + 'checksec': {}, + 'libraries': [], + 'bin_code_analysis': {}, + 'strings': list(ios_strs['strings']), + 'bin_info': {}, + 'bin_type': code_analysis_dic['source_type'], + 'dylib_analysis': {}, + 'framework_analysis': {}, + } + context = save_get_ctx( + app_dict, + infoplist_dict, + code_analysis_dic, + fake_bin_dict, + all_files, + rescan) + context['appsec'] = get_ios_dashboard(context, True) + context['average_cvss'] = get_avg_cvss( + context['code_analysis']) + template = 'static_analysis/ios_source_analysis.html' + if api: + return context else: - msg = ('File Type not supported, ' - 'Only IPA, A and DYLIB files are supported') - return print_n_send_error_response(request, msg, api) + return render(request, template, context) else: - msg = 'Hash match failed or Invalid file extension or file type' + msg = ('File Type not supported, ' + 'Only IPA, A, DYLIB and ZIP are supported') return print_n_send_error_response(request, msg, api) except Exception as exp: logger.exception('Error Performing Static Analysis') diff --git a/mobsf/StaticAnalyzer/views/ios/strings.py b/mobsf/StaticAnalyzer/views/ios/strings.py index 28196805..408fdf2b 100644 --- a/mobsf/StaticAnalyzer/views/ios/strings.py +++ b/mobsf/StaticAnalyzer/views/ios/strings.py @@ -93,7 +93,7 @@ def get_strings_metadata(app_dict, bin_dict, all_files, dy_list): emails_n_files = str_meta['emailnfile'] if dy_list: - # DYLIB (.dylib) by file + # DYLIB (.dylib)/Framework by file dy_strings = [] for dy in dy_list: for dy_file, s in dy.items(): diff --git a/mobsf/StaticAnalyzer/views/windows/windows.py b/mobsf/StaticAnalyzer/views/windows/windows.py index 7e4051fc..9d4f0510 100755 --- a/mobsf/StaticAnalyzer/views/windows/windows.py +++ b/mobsf/StaticAnalyzer/views/windows/windows.py @@ -29,7 +29,10 @@ from mobsf.MobSF.utils import ( ) from mobsf.MobSF.views.home import update_scan_timestamp import mobsf.MalwareAnalyzer.views.VirusTotal as VirusTotal -from mobsf.StaticAnalyzer.models import StaticAnalyzerWindows +from mobsf.StaticAnalyzer.models import ( + RecentScansDB, + StaticAnalyzerWindows, +) from mobsf.StaticAnalyzer.tools.strings import strings_util from mobsf.StaticAnalyzer.views.common.shared_func import ( hash_gen, @@ -54,7 +57,7 @@ config = None # Windows Support Functions -def staticanalyzer_windows(request, api=False): +def staticanalyzer_windows(request, checksum, api=False): """Analyse a windows app.""" try: # Input validation @@ -62,101 +65,90 @@ def staticanalyzer_windows(request, api=False): rescan = False app_dic = {} # Dict to store the binary attributes if api: - typ = request.POST['scan_type'] re_scan = request.POST.get('re_scan', 0) - checksum = request.POST['hash'] - filename = request.POST['file_name'] else: - typ = request.GET['type'] re_scan = request.GET.get('rescan', 0) - checksum = request.GET['checksum'] - filename = request.GET['name'] if re_scan == '1': rescan = True - md5_regex = re.match('^[0-9a-f]{32}$', checksum) - if (md5_regex) and (typ in ['appx']): - app_dic['app_name'] = filename # APP ORIGINAL NAME - app_dic['md5'] = checksum - app_dic['app_dir'] = os.path.join( - settings.UPLD_DIR, app_dic['md5'] + '/') - app_dic['tools_dir'] = os.path.join( - settings.BASE_DIR, 'StaticAnalyzer/tools/windows/') - if typ == 'appx': - # DB - db_entry = StaticAnalyzerWindows.objects.filter( - MD5=app_dic['md5'], - ) - if db_entry.exists() and not rescan: - logger.info( - 'Analysis is already Done.' - ' Fetching data from the DB...') - context = get_context_from_db_entry(db_entry) - else: - logger.info('Windows Binary Analysis Started') - app_dic['app_path'] = os.path.join( - app_dic['app_dir'], app_dic['md5'] + '.appx') - # ANALYSIS BEGINS - app_dic['size'] = str( - file_size(app_dic['app_path'])) + 'MB' - # Generate hashes - app_dic['sha1'], app_dic[ - 'sha256'] = hash_gen(app_dic['app_path']) - # EXTRACT APPX - logger.info('Extracting APPX') - app_dic['files'] = unzip( - app_dic['app_path'], app_dic['app_dir']) - xml_dic = _parse_xml(app_dic['app_dir']) - bin_an_dic = _binary_analysis(app_dic) - # Saving to db - logger.info('Connecting to DB') - if rescan: - logger.info('Updating Database...') - save_or_update('update', - app_dic, - xml_dic, - bin_an_dic) - update_scan_timestamp(app_dic['md5']) - else: - logger.info('Saving to Database') - save_or_update('save', - app_dic, - xml_dic, - bin_an_dic) - context = get_context_from_analysis(app_dic, - xml_dic, - bin_an_dic) - context['virus_total'] = None - if settings.VT_ENABLED: - vt = VirusTotal.VirusTotal() - context['virus_total'] = vt.get_result( - os.path.join(app_dic['app_dir'], app_dic[ - 'md5']) + '.appx', - app_dic['md5']) - template = 'static_analysis/windows_binary_analysis.html' - if api: - return context - else: - return render(request, template, context) - else: - msg = 'File type not supported' - if api: - return print_n_send_error_response(request, msg, True) - else: - return print_n_send_error_response(request, msg, False) + if not re.match('^[0-9a-f]{32}$', checksum): + msg = 'Invalid checksum' + return print_n_send_error_response(request, msg, api) + robj = RecentScansDB.objects.filter(MD5=checksum) + if not robj.exists(): + msg = 'The file is not uploaded/available' + return print_n_send_error_response(request, msg, api) + typ = robj[0].SCAN_TYPE + filename = robj[0].FILE_NAME + if typ != 'appx': + msg = 'File type not supported' + return print_n_send_error_response(request, msg, api) + + app_dic['app_name'] = filename # APP ORIGINAL NAME + app_dic['md5'] = checksum + app_dic['app_dir'] = os.path.join( + settings.UPLD_DIR, app_dic['md5'] + '/') + app_dic['tools_dir'] = os.path.join( + settings.BASE_DIR, 'StaticAnalyzer/tools/windows/') + # DB + db_entry = StaticAnalyzerWindows.objects.filter( + MD5=app_dic['md5'], + ) + if db_entry.exists() and not rescan: + logger.info( + 'Analysis is already Done.' + ' Fetching data from the DB...') + context = get_context_from_db_entry(db_entry) else: - msg = 'Hash match failed or Invalid file extension' - if api: - return print_n_send_error_response(request, msg, True) + logger.info('Windows Binary Analysis Started') + app_dic['app_path'] = os.path.join( + app_dic['app_dir'], app_dic['md5'] + '.appx') + # ANALYSIS BEGINS + app_dic['size'] = str( + file_size(app_dic['app_path'])) + 'MB' + # Generate hashes + app_dic['sha1'], app_dic[ + 'sha256'] = hash_gen(app_dic['app_path']) + # EXTRACT APPX + logger.info('Extracting APPX') + app_dic['files'] = unzip( + app_dic['app_path'], app_dic['app_dir']) + xml_dic = _parse_xml(app_dic['app_dir']) + bin_an_dic = _binary_analysis(app_dic) + # Saving to db + logger.info('Connecting to DB') + if rescan: + logger.info('Updating Database...') + save_or_update('update', + app_dic, + xml_dic, + bin_an_dic) + update_scan_timestamp(app_dic['md5']) else: - return print_n_send_error_response(request, msg, False) + logger.info('Saving to Database') + save_or_update('save', + app_dic, + xml_dic, + bin_an_dic) + context = get_context_from_analysis(app_dic, + xml_dic, + bin_an_dic) + context['virus_total'] = None + template = 'static_analysis/windows_binary_analysis.html' + context['virus_total'] = None + if settings.VT_ENABLED: + vt = VirusTotal.VirusTotal() + context['virus_total'] = vt.get_result( + os.path.join(app_dic['app_dir'], app_dic['md5']) + '.appx', + app_dic['md5']) + if api: + return context + else: + return render(request, template, context) except Exception as exception: logger.exception('Error Performing Static Analysis') msg = str(exception) exp_doc = exception.__doc__ - if api: - return print_n_send_error_response(request, msg, True, exp_doc) - else: - return print_n_send_error_response(request, msg, False, exp_doc) + return print_n_send_error_response(request, msg, api, exp_doc) def _get_token(): diff --git a/mobsf/templates/dynamic_analysis/android/dynamic_analyzer.html b/mobsf/templates/dynamic_analysis/android/dynamic_analyzer.html index 178c0005..f7b70cb5 100644 --- a/mobsf/templates/dynamic_analysis/android/dynamic_analyzer.html +++ b/mobsf/templates/dynamic_analysis/android/dynamic_analyzer.html @@ -97,7 +97,7 @@ {% endif %} Take a Screenshot Logcat Stream - + Generate Report @@ -119,7 +119,7 @@
- +
@@ -892,7 +892,7 @@ $("#proxy").click(function() { }); function start_activity(activity){ - action('../start_activity/', {hash: '{{ hash }}', 'activity': activity}, function(json) { + action('{% url "start_activity" %}', {hash: '{{ hash }}', 'activity': activity}, function(json) { if (json.status === "ok") print_status("Activity Started"); else diff --git a/mobsf/templates/dynamic_analysis/android/dynamic_report.html b/mobsf/templates/dynamic_analysis/android/dynamic_report.html index c3d6e3ae..e93720fd 100644 --- a/mobsf/templates/dynamic_analysis/android/dynamic_report.html +++ b/mobsf/templates/dynamic_analysis/android/dynamic_report.html @@ -260,28 +260,28 @@ @@ -463,7 +463,7 @@ {% for img, desc in exported_activity_tester.items %} - {{desc}} + {{desc}} {{ desc }} {% endfor %} @@ -500,7 +500,7 @@ {% for img, desc in activity_tester.items %} - {{desc}} + {{desc}} {{ desc }} {% endfor %} @@ -527,7 +527,7 @@

{% for i in screenshots %} - Screenshot + Screenshot {% endfor %}
@@ -862,7 +862,7 @@ {% for file in sqlite %} - {{file|key:"file"}} + {{file|key:"file"}} {% endfor %} @@ -894,7 +894,7 @@ {% for file in xml %} - {{file|key:"file"}} + {{file|key:"file"}} {% endfor %} @@ -926,7 +926,7 @@ {% for file in others %} - {{file|key:"file"}} + {{file|key:"file"}} {% endfor %} diff --git a/mobsf/templates/dynamic_analysis/dynamic_analysis.html b/mobsf/templates/dynamic_analysis/dynamic_analysis.html index c4b2a3e9..624b97f8 100644 --- a/mobsf/templates/dynamic_analysis/dynamic_analysis.html +++ b/mobsf/templates/dynamic_analysis/dynamic_analysis.html @@ -155,7 +155,7 @@ textarea:focus { {% for e in apps %} - +
{{ e.APP_NAME }} - {{ e.VERSION_NAME }} @@ -166,13 +166,13 @@ textarea:focus {

- Start Dynamic Analysis + Start Dynamic Analysis

- Start Dynamic Analysis (without Re-install) + Start Dynamic Analysis (without Re-install)

- View Report + View Report

@@ -203,13 +203,13 @@ textarea:focus {

- Start Dynamic Analysis + Start Dynamic Analysis

- Pull & Static Analysis + Pull & Static Analysis

- View Report + View Report

@@ -288,7 +288,7 @@ function dynamic_loader(){ $("#mobsfy").one( "click", function() { $('#stat').append("\nMobSFying Android Runtime\n"); $.ajax({ - url : "../mobsfy/", + url : "{% url 'mobsfy' %}", type : "POST", dataType: "json", data : { diff --git a/mobsf/templates/general/apidocs.html b/mobsf/templates/general/apidocs.html index 2b43c490..e902a898 100644 --- a/mobsf/templates/general/apidocs.html +++ b/mobsf/templates/general/apidocs.html @@ -1231,7 +1231,6 @@ Content: { "apks": [ { - "ICON_FOUND": true, "MD5": "3a552566097a8de588b8184b059b0158", "APP_NAME": "HelloWorld", "VERSION_NAME": "1.0", @@ -1239,7 +1238,6 @@ "PACKAGE_NAME": "opensecurity.helloworld" }, { - "ICON_FOUND": true, "MD5": "6825bb9fde2fc671322df005976755a1", "APP_NAME": "Wikipedia", "VERSION_NAME": "2.7.277-r-2019-12-11", diff --git a/mobsf/templates/general/home.html b/mobsf/templates/general/home.html index 717869bd..09204302 100644 --- a/mobsf/templates/general/home.html +++ b/mobsf/templates/general/home.html @@ -134,7 +134,7 @@ _("status").innerText = 'Trying to download ...'; show_loader(); $.ajax({ - url : '../download_scan/', + url : '{% url "download_scan" %}', type : "POST", dataType: "json", data : { @@ -156,7 +156,7 @@ } }, 2000); - url = json.analyzer + '/?name=' + encodeURIComponent(json.file_name) + '&checksum=' + json.hash + '&type=' + json.scan_type + url = json.analyzer + '/' + json.hash + '/'; load_result(url); } else { hide_loader(); @@ -199,10 +199,7 @@ i = 1; } }, 2000); - var url = json.analyzer + '/'; - if (json.hash){ - url += '?name=' + encodeURIComponent(json.file_name) + '&checksum=' + json.hash + '&type=' + json.scan_type - } + var url = json.analyzer + '/' + json.hash + '/'; load_result(url); } } diff --git a/mobsf/templates/general/recent.html b/mobsf/templates/general/recent.html index 7d640e8e..b48e34e8 100644 --- a/mobsf/templates/general/recent.html +++ b/mobsf/templates/general/recent.html @@ -54,20 +54,22 @@ {% for e in entries %} - + {% if e.PACKAGE_NAME or e.APP_NAME %}
{{ e.APP_NAME }} {% if e.VERSION_NAME %} - {{ e.VERSION_NAME }} {% endif %}
{{ e.PACKAGE_NAME }} {% if e.FILE_NAME|slice:"-6:" != '.dylib' %} + {% if e.FILE_NAME|slice:"-5:" != '.appx' %} {% if e.FILE_NAME|slice:"-3:" != '.so' %} {% if e.FILE_NAME|slice:"-2:" != '.a' %} -

MobSF Scorecard

+

MobSF Scorecard

{% endif %} {% endif %} + {% endif %} {% endif %} -

Static Report +

Static Report {% if '.apk' == e.FILE_NAME|slice:"-4:" or '.xapk' == e.FILE_NAME|slice:"-5:" or '.apks' == e.FILE_NAME|slice:"-5:"%} - Dynamic Report + Dynamic Report {% endif %}

{% else %} @@ -93,8 +95,8 @@ {{ e.MD5 }} {{ e.TIMESTAMP }}

- - + +

{% if '.apk' == e.FILE_NAME|slice:"-4:" or '.xapk' == e.FILE_NAME|slice:"-5:" or '.apks' == e.FILE_NAME|slice:"-5:"%}

Diff or Compare @@ -222,7 +224,7 @@ if (result.value) { var md5_hash = item.id; $.ajax({ - url: '../delete_scan/', + url: '{% url "delete_scan" %}', type : 'POST', dataType: 'json', data : { diff --git a/mobsf/templates/general/search.html b/mobsf/templates/general/search.html deleted file mode 100644 index 74914912..00000000 --- a/mobsf/templates/general/search.html +++ /dev/null @@ -1,35 +0,0 @@ -{% extends "base/base_layout.html" %} - {% block sidebar_option %} - sidebar-collapse -{% endblock %} -{% block content %} -

-
-
-
-
-
-
-
-

You 've searched for: {{ term }}. Found in {{ found }} files.

-
- - - - {% for m in matches %} - - - - {% endfor %} - -
- {{ m }} -
-
-
-
-
-
-
-
-{% endblock %} diff --git a/mobsf/templates/pdf/android_report.html b/mobsf/templates/pdf/android_report.html index bf8e0a35..3a56e7a9 100755 --- a/mobsf/templates/pdf/android_report.html +++ b/mobsf/templates/pdf/android_report.html @@ -44,7 +44,7 @@


- app_icon + app_icon

{% if app_name %} {{ app_name }} {% else %} {{ file_name }} {% endif %} {% if version_name %} ({{version_name}}) {% endif %}

diff --git a/mobsf/templates/pdf/ios_report.html b/mobsf/templates/pdf/ios_report.html index 4de0d4ac..29f50d00 100644 --- a/mobsf/templates/pdf/ios_report.html +++ b/mobsf/templates/pdf/ios_report.html @@ -46,7 +46,7 @@
{% if app_type not in 'Dylib,A' %} - app_icon + app_icon {% else %} app_icon {% endif %} @@ -572,6 +572,61 @@ {% endif %} + {% if framework_analysis and app_type not in 'A' %} +

FRAMEWORK BINARY ANALYSIS

+ + + + + + + + + + + + + + + + {% for frm in framework_analysis %} + + + + + + + + + + + + {% endfor %} + +
NOFRAMEWORKNXSTACK CANARYARCRPATHCODE SIGNATUREENCRYPTEDSYMBOLS STRIPPED
{{ forloop.counter }}{{frm.name}}{{frm.nx.has_nx}} +
+ {{frm.nx.severity}}
+
{{frm.nx.description}}
{{frm.stack_canary.has_canary}} +
+ {{frm.stack_canary.severity}}
+
{{frm.stack_canary.description}}
{{frm.arc.has_arc}} +
+ {{frm.arc.severity}}
+
{{frm.arc.description}}
{{frm.rpath.has_rpath}} +
+ {{frm.rpath.severity}}
+
{{frm.rpath.description}}
{{frm.code_signature.has_code_signature}} +
+ {{frm.code_signature.severity}}
+
{{frm.code_signature.description}}
{{frm.encrypted.is_encrypted}} +
+ {{frm.encrypted.severity}}
+
{{frm.encrypted.description}}
{{frm.symbol.is_stripped}} +
+ {{frm.symbol.severity}}
+
{{frm.symbol.description}}
+ {% endif %} + {% if app_type in 'A' %}

STATIC LIBRARY BINARY ANALYSIS

diff --git a/mobsf/templates/static_analysis/android_binary_analysis.html b/mobsf/templates/static_analysis/android_binary_analysis.html index fc4c1122..e65ae891 100755 --- a/mobsf/templates/static_analysis/android_binary_analysis.html +++ b/mobsf/templates/static_analysis/android_binary_analysis.html @@ -322,7 +322,7 @@ {% endif %} {% if dynamic_analysis_done %}
@@ -686,7 +683,7 @@

{% if app_type not in 'jar' %} - View AndroidManifest.xml + View AndroidManifest.xml {% endif %} View Source {% if app_type not in 'jar,aar' %} @@ -694,11 +691,11 @@ {% endif %}

- Download Java Code + Download Java Code {% if app_type not in 'jar,aar' %} - Download Smali Code + Download Smali Code {% endif %} - Download {{ app_type | upper}} + Download {{ app_type | upper}} {% if app_type in 'jar,aar' %}

@@ -2322,6 +2319,9 @@