mirror of
https://github.com/MobSF/Mobile-Security-Framework-MobSF.git
synced 2026-10-11 22:50:09 +00:00
[HOTFIX] iOS Framework Analysis + Multiple Feature QA (#2260)
* iOS Framework Analysis
* Static Analysis URL simplification
* Replace hardcoded urls in template with `{% url %}`
* Code QA
* Remove unwanted template file
* Remove `rescan` query param from url
* Android icon SVG guessing improvements
* Icon analysis refactoring, change icon storage location
* Remove SVG to PNG converter. Support PNG and SVG icon.
* Github docker release action update
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
+2
-2
@@ -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.
|
||||
@@ -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)
|
||||
|
||||
+1
-1
@@ -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 = """
|
||||
__ __ _ ____ _____ _____ _____
|
||||
| \/ | ___ | |__/ ___|| ___|_ _|___ /|___ |
|
||||
|
||||
@@ -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',
|
||||
|
||||
+37
-16
@@ -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<checksum>[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<checksum>[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<checksum>[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<checksum>[0-9a-f]{32})/$',
|
||||
windows.staticanalyzer_windows,
|
||||
name='static_analyzer_windows'),
|
||||
# Shared
|
||||
re_path(r'^pdf/$', pdf.pdf),
|
||||
re_path(r'^pdf/(?P<checksum>[0-9a-f]{32})/$', pdf.pdf, name='pdf'),
|
||||
re_path(r'^appsec_dashboard/(?P<checksum>[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<checksum>[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),
|
||||
])
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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/')
|
||||
|
||||
@@ -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=[])
|
||||
|
||||
@@ -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:
|
||||
|
||||
Binary file not shown.
@@ -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.
|
||||
Binary file not shown.
Binary file not shown.
@@ -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, <a href="http://www.w3.org/">World
|
||||
Wide Web Consortium</a>, (<a href=
|
||||
"http://www.lcs.mit.edu/">Massachusetts Institute of
|
||||
Technology</a>, <a href="http://www.inria.fr/">Institut National de
|
||||
Recherche en Informatique et en Automatique</a>, <a href=
|
||||
"http://www.keio.ac.jp/">Keio University</a>). 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 [email protected].
|
||||
|
||||
webmaster
|
||||
(last updated by reagle on 1999/04/99.)
|
||||
@@ -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, <a href="http://www.w3.org/">World
|
||||
Wide Web Consortium</a>, (<a href=
|
||||
"http://www.lcs.mit.edu/">Massachusetts Institute of
|
||||
Technology</a>, <a href="http://www.inria.fr/">Institut National de
|
||||
Recherche en Informatique et en Automatique</a>, <a href=
|
||||
"http://www.keio.ac.jp/">Keio University</a>). 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 [email protected].
|
||||
|
||||
webmaster
|
||||
(last updated $Date: 2002-12-09 09:15:21 -0700 (Mon, 09 Dec 2002) $)
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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, [email protected]
|
||||
2000-05-05
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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/).
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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}')
|
||||
|
||||
@@ -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'],
|
||||
|
||||
@@ -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'<adaptive-icon' in xml_txt:
|
||||
return False
|
||||
out_xml.write_bytes(xml_txt)
|
||||
return True
|
||||
except Exception:
|
||||
logger.exception('Failed to convert axml to xml')
|
||||
@@ -315,33 +358,3 @@ def convert_vector_to_svg(app_dir, tools_dir, icon_name, apktool_res):
|
||||
timeout=30)
|
||||
except Exception:
|
||||
logger.exception('Android vector to svg conversion failed')
|
||||
|
||||
|
||||
def convert_svg_to_png(svg_file, tools_dir):
|
||||
"""Convert SVG to PNG."""
|
||||
try:
|
||||
fnull = open(os.devnull, 'w')
|
||||
userbin = getattr(settings, 'BATIK_BINARY', '')
|
||||
if userbin and is_file_exists(userbin):
|
||||
batik = userbin
|
||||
else:
|
||||
batik = Path(tools_dir) / 'batik' / 'batik-rasterizer-1.15.jar'
|
||||
out = svg_file.parent / (svg_file.stem + '.png')
|
||||
args = [
|
||||
find_java_binary(),
|
||||
'-jar',
|
||||
batik.as_posix(),
|
||||
svg_file.as_posix(),
|
||||
'-d',
|
||||
out.as_posix(),
|
||||
]
|
||||
logger.info('Converting icon svg to png')
|
||||
subprocess.run(
|
||||
args,
|
||||
stdout=fnull,
|
||||
stderr=subprocess.STDOUT,
|
||||
timeout=30)
|
||||
return out
|
||||
except Exception:
|
||||
logger.exception('Icon conversion from svg to png failed')
|
||||
return None
|
||||
|
||||
@@ -88,8 +88,6 @@ def common_analysis(request, app_dic, rescan, api, analysis_type):
|
||||
app_dic['manifest_file'] = mani_file
|
||||
app_dic['ns'] = ns
|
||||
app_dic['parsed_xml'] = mani_xml
|
||||
app_dic['mani'] = (
|
||||
f'../manifest_view/?md5={app_dic["md5"]}&type=aar')
|
||||
man_data_dic = manifest_data(app_dic['parsed_xml'], ns)
|
||||
man_an_dic = manifest_analysis(
|
||||
app_dic['parsed_xml'],
|
||||
@@ -105,7 +103,6 @@ def common_analysis(request, app_dic, rescan, api, analysis_type):
|
||||
else:
|
||||
app_dic['manifest_file'] = None
|
||||
app_dic['parsed_xml'] = ''
|
||||
app_dic['mani'] = ''
|
||||
man_data_dic = {
|
||||
'services': [],
|
||||
'activities': [],
|
||||
@@ -134,7 +131,6 @@ def common_analysis(request, app_dic, rescan, api, analysis_type):
|
||||
},
|
||||
'browsable_activities': {},
|
||||
'permissions': {},
|
||||
'icon_hidden': True,
|
||||
'network_security': {
|
||||
'network_findings': [],
|
||||
'network_summary': {},
|
||||
@@ -183,8 +179,6 @@ def common_analysis(request, app_dic, rescan, api, analysis_type):
|
||||
code_an_dic['urls_list'])
|
||||
|
||||
app_dic['zipped'] = analysis_type
|
||||
app_dic['icon_hidden'] = True
|
||||
app_dic['icon_found'] = False
|
||||
context = save_get_ctx(
|
||||
app_dic,
|
||||
man_data_dic,
|
||||
|
||||
@@ -86,7 +86,6 @@ def manifest_analysis(mfxml, ns, man_data_dic, src_type, app_dir):
|
||||
exported = []
|
||||
browsable_activities = {}
|
||||
permission_dict = {}
|
||||
icon_hidden = True
|
||||
do_netsec = False
|
||||
debuggable = False
|
||||
# PERMISSION
|
||||
@@ -644,7 +643,6 @@ def manifest_analysis(mfxml, ns, man_data_dic, src_type, app_dir):
|
||||
|
||||
for category in man_data_dic['categories']:
|
||||
if category == 'android.intent.category.LAUNCHER':
|
||||
icon_hidden = False
|
||||
break
|
||||
|
||||
permissions = {}
|
||||
@@ -668,7 +666,6 @@ def manifest_analysis(mfxml, ns, man_data_dic, src_type, app_dir):
|
||||
'exported_cnt': exported_comp,
|
||||
'browsable_activities': browsable_activities,
|
||||
'permissions': permissions,
|
||||
'icon_hidden': icon_hidden,
|
||||
'network_security': network_security.analysis(
|
||||
app_dir,
|
||||
do_netsec,
|
||||
|
||||
@@ -17,19 +17,18 @@ from mobsf.StaticAnalyzer.views.android.manifest_utils import (
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def run(request):
|
||||
def run(request, checksum):
|
||||
"""View the manifest."""
|
||||
try:
|
||||
directory = settings.BASE_DIR # BASE DIR
|
||||
md5 = request.GET['md5'] # MD5
|
||||
typ = request.GET['type'] # APK or SOURCE
|
||||
match = re.match('^[0-9a-f]{32}$', md5)
|
||||
match = re.match('^[0-9a-f]{32}$', checksum)
|
||||
if match and (typ in ['eclipse', 'studio', 'apk', 'aar']):
|
||||
app_dir = os.path.join(
|
||||
settings.UPLD_DIR, md5 + '/') # APP DIRECTORY
|
||||
settings.UPLD_DIR, checksum + '/') # APP DIRECTORY
|
||||
tools_dir = os.path.join(
|
||||
directory, 'StaticAnalyzer/tools/') # TOOLS DIR
|
||||
app_path = os.path.join(app_dir, md5 + '.apk')
|
||||
app_path = os.path.join(app_dir, checksum + '.apk')
|
||||
manifest_file = get_manifest_file(
|
||||
app_dir,
|
||||
app_path,
|
||||
@@ -52,5 +51,6 @@ def run(request):
|
||||
return render(request, template, context)
|
||||
except Exception:
|
||||
logger.exception('Viewing AndroidManifest.xml')
|
||||
return print_n_send_error_response(request,
|
||||
'Error Viewing AndroidManifest.xml')
|
||||
return print_n_send_error_response(
|
||||
request,
|
||||
'Error Viewing AndroidManifest.xml')
|
||||
|
||||
@@ -77,7 +77,6 @@ def so_analysis(request, app_dic, rescan, api):
|
||||
},
|
||||
'browsable_activities': {},
|
||||
'permissions': {},
|
||||
'icon_hidden': True,
|
||||
'network_security': {
|
||||
'network_findings': [],
|
||||
'network_summary': {},
|
||||
@@ -130,8 +129,6 @@ def so_analysis(request, app_dic, rescan, api):
|
||||
code_an_dic['domains'], [])
|
||||
|
||||
app_dic['zipped'] = 'so'
|
||||
app_dic['icon_hidden'] = True
|
||||
app_dic['icon_found'] = False
|
||||
context = save_get_ctx(
|
||||
app_dic,
|
||||
man_data_dic,
|
||||
|
||||
@@ -27,6 +27,7 @@ from mobsf.MobSF.utils import (
|
||||
print_n_send_error_response,
|
||||
)
|
||||
from mobsf.StaticAnalyzer.models import (
|
||||
RecentScansDB,
|
||||
StaticAnalyzerAndroid,
|
||||
StaticAnalyzerIOS,
|
||||
)
|
||||
@@ -51,8 +52,8 @@ from mobsf.StaticAnalyzer.views.android.db_interaction import (
|
||||
save_get_ctx,
|
||||
)
|
||||
from mobsf.StaticAnalyzer.views.android.icon_analysis import (
|
||||
find_icon_path_zip,
|
||||
get_icon_apk,
|
||||
get_icon_from_src,
|
||||
)
|
||||
from mobsf.StaticAnalyzer.views.android.manifest_analysis import (
|
||||
manifest_analysis,
|
||||
@@ -93,105 +94,266 @@ register.filter('key', key)
|
||||
register.filter('android_component', android_component)
|
||||
|
||||
|
||||
def static_analyzer(request, api=False):
|
||||
def static_analyzer(request, checksum, api=False):
|
||||
"""Do static analysis on an request and save to db."""
|
||||
try:
|
||||
rescan = False
|
||||
if api:
|
||||
typ = request.POST['scan_type']
|
||||
checksum = request.POST['hash']
|
||||
filename = request.POST['file_name']
|
||||
re_scan = request.POST.get('re_scan', 0)
|
||||
else:
|
||||
typ = request.GET['type']
|
||||
checksum = request.GET['checksum']
|
||||
filename = request.GET['name']
|
||||
re_scan = request.GET.get('rescan', 0)
|
||||
if re_scan == '1':
|
||||
rescan = True
|
||||
# Input validation
|
||||
app_dic = {}
|
||||
match = re.match('^[0-9a-f]{32}$', checksum)
|
||||
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
|
||||
allowed_exts = (
|
||||
'.apk', '.xapk', '.zip', '.apks',
|
||||
'.jar', '.aar', '.so')
|
||||
allowed_typ = [i.replace('.', '') for i in allowed_exts]
|
||||
if (match
|
||||
and filename.lower().endswith(allowed_exts)
|
||||
and typ in allowed_typ):
|
||||
app_dic['dir'] = Path(settings.BASE_DIR) # BASE DIR
|
||||
app_dic['app_name'] = filename # APP ORIGINAL NAME
|
||||
app_dic['md5'] = checksum # MD5
|
||||
logger.info('Scan Hash: %s', checksum)
|
||||
# APP DIRECTORY
|
||||
app_dic['app_dir'] = Path(settings.UPLD_DIR) / checksum
|
||||
app_dic['tools_dir'] = app_dic['dir'] / 'StaticAnalyzer' / 'tools'
|
||||
app_dic['tools_dir'] = app_dic['tools_dir'].as_posix()
|
||||
logger.info('Starting Analysis on: %s', app_dic['app_name'])
|
||||
if typ == 'xapk':
|
||||
# Handle XAPK
|
||||
# Base APK will have the MD5 of XAPK
|
||||
if not handle_xapk(app_dic):
|
||||
raise Exception('Invalid XAPK File')
|
||||
typ = 'apk'
|
||||
elif typ == 'apks':
|
||||
# Handle Split APK
|
||||
if not handle_split_apk(app_dic):
|
||||
raise Exception('Invalid Split APK File')
|
||||
typ = 'apk'
|
||||
if typ == 'apk':
|
||||
app_dic['app_file'] = app_dic['md5'] + '.apk' # NEW FILENAME
|
||||
app_dic['app_path'] = (
|
||||
app_dic['app_dir'] / app_dic['app_file']).as_posix()
|
||||
app_dic['app_dir'] = app_dic['app_dir'].as_posix() + '/'
|
||||
# Check if in DB
|
||||
# pylint: disable=E1101
|
||||
db_entry = StaticAnalyzerAndroid.objects.filter(
|
||||
MD5=app_dic['md5'])
|
||||
if db_entry.exists() and not rescan:
|
||||
context = get_context_from_db_entry(db_entry)
|
||||
if (not filename.lower().endswith(allowed_exts)
|
||||
or typ not in allowed_typ):
|
||||
msg = 'Invalid file extension or file type'
|
||||
return print_n_send_error_response(request, msg, api)
|
||||
|
||||
app_dic['dir'] = Path(settings.BASE_DIR) # BASE DIR
|
||||
app_dic['app_name'] = filename # APP ORIGINAL NAME
|
||||
app_dic['md5'] = checksum # MD5
|
||||
logger.info('Scan Hash: %s', checksum)
|
||||
# APP DIRECTORY
|
||||
app_dic['app_dir'] = Path(settings.UPLD_DIR) / checksum
|
||||
app_dic['tools_dir'] = app_dic['dir'] / 'StaticAnalyzer' / 'tools'
|
||||
app_dic['tools_dir'] = app_dic['tools_dir'].as_posix()
|
||||
app_dic['icon_path'] = ''
|
||||
logger.info('Starting Analysis on: %s', app_dic['app_name'])
|
||||
if typ == 'xapk':
|
||||
# Handle XAPK
|
||||
# Base APK will have the MD5 of XAPK
|
||||
if not handle_xapk(app_dic):
|
||||
raise Exception('Invalid XAPK File')
|
||||
typ = 'apk'
|
||||
elif typ == 'apks':
|
||||
# Handle Split APK
|
||||
if not handle_split_apk(app_dic):
|
||||
raise Exception('Invalid Split APK File')
|
||||
typ = 'apk'
|
||||
if typ == 'apk':
|
||||
app_dic['app_file'] = app_dic['md5'] + '.apk' # NEW FILENAME
|
||||
app_dic['app_path'] = (
|
||||
app_dic['app_dir'] / app_dic['app_file']).as_posix()
|
||||
app_dic['app_dir'] = app_dic['app_dir'].as_posix() + '/'
|
||||
# Check if in DB
|
||||
# pylint: disable=E1101
|
||||
db_entry = StaticAnalyzerAndroid.objects.filter(
|
||||
MD5=app_dic['md5'])
|
||||
if db_entry.exists() and not rescan:
|
||||
context = get_context_from_db_entry(db_entry)
|
||||
else:
|
||||
# ANALYSIS BEGINS
|
||||
app_dic['size'] = str(
|
||||
file_size(app_dic['app_path'])) + 'MB' # FILE SIZE
|
||||
app_dic['sha1'], app_dic[
|
||||
'sha256'] = hash_gen(app_dic['app_path'])
|
||||
app_dic['files'] = unzip(
|
||||
app_dic['app_path'], app_dic['app_dir'])
|
||||
logger.info('APK Extracted')
|
||||
if not app_dic['files']:
|
||||
# Can't Analyze APK, bail out.
|
||||
return print_n_send_error_response(
|
||||
request,
|
||||
'APK file is invalid or corrupt',
|
||||
api)
|
||||
app_dic['certz'] = get_hardcoded_cert_keystore(app_dic[
|
||||
'files'])
|
||||
# Manifest XML
|
||||
mani_file, ns, mani_xml = get_manifest(
|
||||
app_dic['app_path'],
|
||||
app_dic['app_dir'],
|
||||
app_dic['tools_dir'],
|
||||
'apk',
|
||||
)
|
||||
app_dic['manifest_file'] = mani_file
|
||||
app_dic['parsed_xml'] = mani_xml
|
||||
# Parse APK with Androguard
|
||||
apk = parse_apk(app_dic['app_path'])
|
||||
# get app_name
|
||||
app_dic['real_name'] = get_app_name(
|
||||
apk,
|
||||
app_dic['app_dir'],
|
||||
True,
|
||||
)
|
||||
# Set Manifest link
|
||||
man_data_dic = manifest_data(app_dic['parsed_xml'], ns)
|
||||
app_dic['playstore'] = get_app_details(
|
||||
man_data_dic['packagename'])
|
||||
man_an_dic = manifest_analysis(
|
||||
app_dic['parsed_xml'],
|
||||
ns,
|
||||
man_data_dic,
|
||||
'',
|
||||
app_dic['app_dir'],
|
||||
)
|
||||
# Get icon
|
||||
# apktool should run before this
|
||||
get_icon_apk(apk, app_dic)
|
||||
|
||||
elf_dict = library_analysis(app_dic['app_dir'], 'elf')
|
||||
cert_dic = cert_info(
|
||||
apk,
|
||||
app_dic,
|
||||
man_data_dic)
|
||||
apkid_results = apkid_analysis(app_dic[
|
||||
'app_dir'], app_dic['app_path'], app_dic['app_name'])
|
||||
tracker = Trackers.Trackers(
|
||||
app_dic['app_dir'], app_dic['tools_dir'])
|
||||
tracker_res = tracker.get_trackers()
|
||||
|
||||
apk_2_java(app_dic['app_path'], app_dic['app_dir'],
|
||||
app_dic['tools_dir'])
|
||||
|
||||
dex_2_smali(app_dic['app_dir'], app_dic['tools_dir'])
|
||||
|
||||
code_an_dic = code_analysis(
|
||||
app_dic['app_dir'],
|
||||
'apk',
|
||||
app_dic['manifest_file'])
|
||||
|
||||
quark_results = quark_analysis(
|
||||
app_dic['app_dir'],
|
||||
app_dic['app_path'])
|
||||
|
||||
# Get the strings and metadata
|
||||
get_strings_metadata(
|
||||
apk,
|
||||
app_dic['app_dir'],
|
||||
elf_dict['elf_strings'],
|
||||
'apk',
|
||||
['.java'],
|
||||
code_an_dic)
|
||||
|
||||
# Firebase DB Check
|
||||
code_an_dic['firebase'] = firebase_analysis(
|
||||
code_an_dic['urls_list'])
|
||||
# Domain Extraction and Malware Check
|
||||
logger.info(
|
||||
'Performing Malware Check on extracted Domains')
|
||||
code_an_dic['domains'] = MalwareDomainCheck().scan(
|
||||
code_an_dic['urls_list'])
|
||||
|
||||
app_dic['zipped'] = 'apk'
|
||||
context = save_get_ctx(
|
||||
app_dic,
|
||||
man_data_dic,
|
||||
man_an_dic,
|
||||
code_an_dic,
|
||||
cert_dic,
|
||||
elf_dict['elf_analysis'],
|
||||
apkid_results,
|
||||
quark_results,
|
||||
tracker_res,
|
||||
rescan,
|
||||
)
|
||||
context['appsec'] = get_android_dashboard(context, True)
|
||||
context['average_cvss'] = get_avg_cvss(
|
||||
context['code_analysis'])
|
||||
context['dynamic_analysis_done'] = is_file_exists(
|
||||
os.path.join(app_dic['app_dir'], 'logcat.txt'))
|
||||
|
||||
context['virus_total'] = None
|
||||
if settings.VT_ENABLED:
|
||||
vt = VirusTotal.VirusTotal()
|
||||
context['virus_total'] = vt.get_result(
|
||||
app_dic['app_path'],
|
||||
app_dic['md5'])
|
||||
template = 'static_analysis/android_binary_analysis.html'
|
||||
if api:
|
||||
return context
|
||||
else:
|
||||
return render(request, template, context)
|
||||
elif typ == 'jar':
|
||||
return jar_analysis(request, app_dic, rescan, api)
|
||||
elif typ == 'aar':
|
||||
return aar_analysis(request, app_dic, rescan, api)
|
||||
elif typ == 'so':
|
||||
return so_analysis(request, app_dic, rescan, api)
|
||||
elif typ == 'zip':
|
||||
ret = f'/static_analyzer_ios/{checksum}/'
|
||||
# Check if in DB
|
||||
# pylint: disable=E1101
|
||||
cert_dic = {
|
||||
'certificate_info': '',
|
||||
'certificate_status': '',
|
||||
'description': '',
|
||||
}
|
||||
app_dic['strings'] = []
|
||||
app_dic['secrets'] = []
|
||||
app_dic['zipped'] = ''
|
||||
# Above fields are only available for APK and not ZIP
|
||||
app_dic['app_file'] = app_dic['md5'] + '.zip' # NEW FILENAME
|
||||
app_dic['app_path'] = (
|
||||
app_dic['app_dir'] / app_dic['app_file']).as_posix()
|
||||
app_dic['app_dir'] = app_dic['app_dir'].as_posix() + '/'
|
||||
db_entry = StaticAnalyzerAndroid.objects.filter(
|
||||
MD5=app_dic['md5'])
|
||||
ios_db_entry = StaticAnalyzerIOS.objects.filter(
|
||||
MD5=app_dic['md5'])
|
||||
if db_entry.exists() and not rescan:
|
||||
context = get_context_from_db_entry(db_entry)
|
||||
elif ios_db_entry.exists() and not rescan:
|
||||
if api:
|
||||
return {'type': 'ios'}
|
||||
else:
|
||||
return HttpResponseRedirect(ret)
|
||||
else:
|
||||
logger.info('Extracting ZIP')
|
||||
app_dic['files'] = unzip(
|
||||
app_dic['app_path'], app_dic['app_dir'])
|
||||
# Check if Valid Directory Structure and get ZIP Type
|
||||
pro_type, valid = valid_source_code(app_dic['app_dir'])
|
||||
logger.info('Source code type - %s', pro_type)
|
||||
if valid and pro_type == 'ios':
|
||||
logger.info('Redirecting to iOS Source Code Analyzer')
|
||||
if api:
|
||||
return {'type': 'ios'}
|
||||
else:
|
||||
ret += f'?rescan={str(int(rescan))}'
|
||||
return HttpResponseRedirect(ret)
|
||||
app_dic['certz'] = get_hardcoded_cert_keystore(
|
||||
app_dic['files'])
|
||||
app_dic['zipped'] = pro_type
|
||||
if valid and (pro_type in ['eclipse', 'studio']):
|
||||
# ANALYSIS BEGINS
|
||||
app_dic['size'] = str(
|
||||
file_size(app_dic['app_path'])) + 'MB' # FILE SIZE
|
||||
app_dic['sha1'], app_dic[
|
||||
'sha256'] = hash_gen(app_dic['app_path'])
|
||||
app_dic['files'] = unzip(
|
||||
app_dic['app_path'], app_dic['app_dir'])
|
||||
logger.info('APK Extracted')
|
||||
if not app_dic['files']:
|
||||
# Can't Analyze APK, bail out.
|
||||
return print_n_send_error_response(
|
||||
request,
|
||||
'APK file is invalid or corrupt',
|
||||
api)
|
||||
app_dic['certz'] = get_hardcoded_cert_keystore(app_dic[
|
||||
'files'])
|
||||
|
||||
# Manifest XML
|
||||
mani_file, ns, mani_xml = get_manifest(
|
||||
app_dic['app_path'],
|
||||
'',
|
||||
app_dic['app_dir'],
|
||||
app_dic['tools_dir'],
|
||||
'apk',
|
||||
pro_type,
|
||||
)
|
||||
app_dic['manifest_file'] = mani_file
|
||||
app_dic['parsed_xml'] = mani_xml
|
||||
# Parse APK with Androguard
|
||||
apk = parse_apk(app_dic['app_path'])
|
||||
|
||||
# get app_name
|
||||
app_dic['real_name'] = get_app_name(
|
||||
apk,
|
||||
app_dic['app_path'],
|
||||
app_dic['app_dir'],
|
||||
True,
|
||||
False,
|
||||
)
|
||||
|
||||
# Get icon
|
||||
# apktool should run before this
|
||||
get_icon_apk(apk, app_dic)
|
||||
|
||||
# Set Manifest link
|
||||
app_dic['mani'] = (
|
||||
f'../manifest_view/?md5={app_dic["md5"]}&type=apk')
|
||||
# Set manifest view link
|
||||
man_data_dic = manifest_data(app_dic['parsed_xml'], ns)
|
||||
app_dic['playstore'] = get_app_details(
|
||||
man_data_dic['packagename'])
|
||||
@@ -199,41 +361,24 @@ def static_analyzer(request, api=False):
|
||||
app_dic['parsed_xml'],
|
||||
ns,
|
||||
man_data_dic,
|
||||
'',
|
||||
pro_type,
|
||||
app_dic['app_dir'],
|
||||
)
|
||||
elf_dict = library_analysis(app_dic['app_dir'], 'elf')
|
||||
cert_dic = cert_info(
|
||||
apk,
|
||||
app_dic,
|
||||
man_data_dic)
|
||||
apkid_results = apkid_analysis(app_dic[
|
||||
'app_dir'], app_dic['app_path'], app_dic['app_name'])
|
||||
tracker = Trackers.Trackers(
|
||||
app_dic['app_dir'], app_dic['tools_dir'])
|
||||
tracker_res = tracker.get_trackers()
|
||||
|
||||
apk_2_java(app_dic['app_path'], app_dic['app_dir'],
|
||||
app_dic['tools_dir'])
|
||||
|
||||
dex_2_smali(app_dic['app_dir'], app_dic['tools_dir'])
|
||||
# Get icon
|
||||
get_icon_from_src(app_dic, man_data_dic['icons'])
|
||||
|
||||
code_an_dic = code_analysis(
|
||||
app_dic['app_dir'],
|
||||
'apk',
|
||||
pro_type,
|
||||
app_dic['manifest_file'])
|
||||
|
||||
quark_results = quark_analysis(
|
||||
app_dic['app_dir'],
|
||||
app_dic['app_path'])
|
||||
|
||||
# Get the strings and metadata
|
||||
get_strings_metadata(
|
||||
apk,
|
||||
None,
|
||||
app_dic['app_dir'],
|
||||
elf_dict['elf_strings'],
|
||||
'apk',
|
||||
['.java'],
|
||||
None,
|
||||
pro_type,
|
||||
['.java', '.kt'],
|
||||
code_an_dic)
|
||||
|
||||
# Firebase DB Check
|
||||
@@ -245,241 +390,55 @@ def static_analyzer(request, api=False):
|
||||
code_an_dic['domains'] = MalwareDomainCheck().scan(
|
||||
code_an_dic['urls_list'])
|
||||
|
||||
app_dic['zipped'] = 'apk'
|
||||
# Extract Trackers from Domains
|
||||
trk = Trackers.Trackers(
|
||||
None, app_dic['tools_dir'])
|
||||
trackers = trk.get_trackers_domains_or_deps(
|
||||
code_an_dic['domains'], [])
|
||||
context = save_get_ctx(
|
||||
app_dic,
|
||||
man_data_dic,
|
||||
man_an_dic,
|
||||
code_an_dic,
|
||||
cert_dic,
|
||||
elf_dict['elf_analysis'],
|
||||
apkid_results,
|
||||
quark_results,
|
||||
tracker_res,
|
||||
[],
|
||||
{},
|
||||
[],
|
||||
trackers,
|
||||
rescan,
|
||||
)
|
||||
context['appsec'] = get_android_dashboard(context, True)
|
||||
context['average_cvss'] = get_avg_cvss(
|
||||
context['code_analysis'])
|
||||
context['dynamic_analysis_done'] = is_file_exists(
|
||||
os.path.join(app_dic['app_dir'], 'logcat.txt'))
|
||||
|
||||
context['virus_total'] = None
|
||||
if settings.VT_ENABLED:
|
||||
vt = VirusTotal.VirusTotal()
|
||||
context['virus_total'] = vt.get_result(
|
||||
app_dic['app_path'],
|
||||
app_dic['md5'])
|
||||
template = 'static_analysis/android_binary_analysis.html'
|
||||
if api:
|
||||
return context
|
||||
else:
|
||||
return render(request, template, context)
|
||||
elif typ == 'jar':
|
||||
return jar_analysis(request, app_dic, rescan, api)
|
||||
elif typ == 'aar':
|
||||
return aar_analysis(request, app_dic, rescan, api)
|
||||
elif typ == 'so':
|
||||
return so_analysis(request, app_dic, rescan, api)
|
||||
elif typ == 'zip':
|
||||
ret = (
|
||||
'/static_analyzer_ios/?name='
|
||||
+ app_dic['app_name']
|
||||
+ '&type=ios&checksum='
|
||||
+ app_dic['md5']
|
||||
)
|
||||
# Check if in DB
|
||||
# pylint: disable=E1101
|
||||
cert_dic = {
|
||||
'certificate_info': '',
|
||||
'certificate_status': '',
|
||||
'description': '',
|
||||
}
|
||||
app_dic['strings'] = []
|
||||
app_dic['secrets'] = []
|
||||
app_dic['zipped'] = ''
|
||||
# Above fields are only available for APK and not ZIP
|
||||
app_dic['app_file'] = app_dic['md5'] + '.zip' # NEW FILENAME
|
||||
app_dic['app_path'] = (
|
||||
app_dic['app_dir'] / app_dic['app_file']).as_posix()
|
||||
app_dic['app_dir'] = app_dic['app_dir'].as_posix() + '/'
|
||||
db_entry = StaticAnalyzerAndroid.objects.filter(
|
||||
MD5=app_dic['md5'])
|
||||
ios_db_entry = StaticAnalyzerIOS.objects.filter(
|
||||
MD5=app_dic['md5'])
|
||||
if db_entry.exists() and not rescan:
|
||||
context = get_context_from_db_entry(db_entry)
|
||||
elif ios_db_entry.exists() and not rescan:
|
||||
msg = 'This ZIP Format is not supported'
|
||||
if api:
|
||||
return {'type': 'ios'}
|
||||
return print_n_send_error_response(
|
||||
request,
|
||||
msg,
|
||||
True)
|
||||
else:
|
||||
return HttpResponseRedirect(ret)
|
||||
else:
|
||||
logger.info('Extracting ZIP')
|
||||
app_dic['files'] = unzip(
|
||||
app_dic['app_path'], app_dic['app_dir'])
|
||||
# Check if Valid Directory Structure and get ZIP Type
|
||||
pro_type, valid = valid_source_code(app_dic['app_dir'])
|
||||
logger.info('Source code type - %s', pro_type)
|
||||
if valid and pro_type == 'ios':
|
||||
logger.info('Redirecting to iOS Source Code Analyzer')
|
||||
if api:
|
||||
return {'type': 'ios'}
|
||||
else:
|
||||
ret += f'&rescan={str(int(rescan))}'
|
||||
return HttpResponseRedirect(ret)
|
||||
app_dic['certz'] = get_hardcoded_cert_keystore(
|
||||
app_dic['files'])
|
||||
app_dic['zipped'] = pro_type
|
||||
if valid and (pro_type in ['eclipse', 'studio']):
|
||||
# ANALYSIS BEGINS
|
||||
app_dic['size'] = str(
|
||||
file_size(app_dic['app_path'])) + 'MB' # FILE SIZE
|
||||
app_dic['sha1'], app_dic[
|
||||
'sha256'] = hash_gen(app_dic['app_path'])
|
||||
|
||||
# Manifest XML
|
||||
mani_file, ns, mani_xml = get_manifest(
|
||||
'',
|
||||
app_dic['app_dir'],
|
||||
app_dic['tools_dir'],
|
||||
pro_type,
|
||||
)
|
||||
app_dic['manifest_file'] = mani_file
|
||||
app_dic['parsed_xml'] = mani_xml
|
||||
|
||||
# get app_name
|
||||
app_dic['real_name'] = get_app_name(
|
||||
app_dic['app_path'],
|
||||
app_dic['app_dir'],
|
||||
False,
|
||||
)
|
||||
|
||||
# Set manifest view link
|
||||
app_dic['mani'] = (
|
||||
f'../manifest_view/?md5={app_dic["md5"]}'
|
||||
f'&type={pro_type}')
|
||||
man_data_dic = manifest_data(app_dic['parsed_xml'], ns)
|
||||
app_dic['playstore'] = get_app_details(
|
||||
man_data_dic['packagename'])
|
||||
man_an_dic = manifest_analysis(
|
||||
app_dic['parsed_xml'],
|
||||
ns,
|
||||
man_data_dic,
|
||||
pro_type,
|
||||
app_dic['app_dir'],
|
||||
)
|
||||
# Get icon
|
||||
eclipse_res_path = os.path.join(
|
||||
app_dic['app_dir'], 'res')
|
||||
studio_res_path = os.path.join(
|
||||
app_dic['app_dir'], 'app', 'src', 'main', 'res')
|
||||
if os.path.exists(eclipse_res_path):
|
||||
res_path = eclipse_res_path
|
||||
elif os.path.exists(studio_res_path):
|
||||
res_path = studio_res_path
|
||||
else:
|
||||
res_path = ''
|
||||
|
||||
app_dic['icon_hidden'] = man_an_dic['icon_hidden']
|
||||
app_dic['icon_found'] = False
|
||||
app_dic['icon_path'] = ''
|
||||
if res_path:
|
||||
app_dic['icon_path'] = find_icon_path_zip(
|
||||
res_path, man_data_dic['icons'])
|
||||
if app_dic['icon_path']:
|
||||
app_dic['icon_found'] = True
|
||||
|
||||
if app_dic['icon_path']:
|
||||
if os.path.exists(app_dic['icon_path']):
|
||||
shutil.copy2(
|
||||
app_dic['icon_path'],
|
||||
os.path.join(
|
||||
settings.DWD_DIR,
|
||||
app_dic['md5'] + '-icon.png'))
|
||||
|
||||
code_an_dic = code_analysis(
|
||||
app_dic['app_dir'],
|
||||
pro_type,
|
||||
app_dic['manifest_file'])
|
||||
|
||||
# Get the strings and metadata
|
||||
get_strings_metadata(
|
||||
None,
|
||||
app_dic['app_dir'],
|
||||
None,
|
||||
pro_type,
|
||||
['.java', '.kt'],
|
||||
code_an_dic)
|
||||
|
||||
# Firebase DB Check
|
||||
code_an_dic['firebase'] = firebase_analysis(
|
||||
code_an_dic['urls_list'])
|
||||
# Domain Extraction and Malware Check
|
||||
logger.info(
|
||||
'Performing Malware Check on extracted Domains')
|
||||
code_an_dic['domains'] = MalwareDomainCheck().scan(
|
||||
code_an_dic['urls_list'])
|
||||
|
||||
# Extract Trackers from Domains
|
||||
trk = Trackers.Trackers(
|
||||
None, app_dic['tools_dir'])
|
||||
trackers = trk.get_trackers_domains_or_deps(
|
||||
code_an_dic['domains'], [])
|
||||
context = save_get_ctx(
|
||||
app_dic,
|
||||
man_data_dic,
|
||||
man_an_dic,
|
||||
code_an_dic,
|
||||
cert_dic,
|
||||
[],
|
||||
{},
|
||||
[],
|
||||
trackers,
|
||||
rescan,
|
||||
)
|
||||
else:
|
||||
msg = 'This ZIP Format is not supported'
|
||||
if api:
|
||||
return print_n_send_error_response(
|
||||
request,
|
||||
msg,
|
||||
True)
|
||||
else:
|
||||
print_n_send_error_response(request, msg, False)
|
||||
ctx = {
|
||||
'title': 'Invalid ZIP archive',
|
||||
'version': settings.MOBSF_VER,
|
||||
}
|
||||
template = 'general/zip.html'
|
||||
return render(request, template, ctx)
|
||||
context['appsec'] = get_android_dashboard(context, True)
|
||||
context['average_cvss'] = get_avg_cvss(
|
||||
context['code_analysis'])
|
||||
template = 'static_analysis/android_source_analysis.html'
|
||||
if api:
|
||||
return context
|
||||
else:
|
||||
return render(request, template, context)
|
||||
else:
|
||||
err = ('Only APK, JAR, AAR, SO and Zipped '
|
||||
'Android/iOS Source code supported now!')
|
||||
logger.error(err)
|
||||
else:
|
||||
msg = 'Hash match failed or Invalid file extension or file type'
|
||||
print_n_send_error_response(request, msg, False)
|
||||
ctx = {
|
||||
'title': 'Invalid ZIP archive',
|
||||
'version': settings.MOBSF_VER,
|
||||
}
|
||||
template = 'general/zip.html'
|
||||
return render(request, template, ctx)
|
||||
context['appsec'] = get_android_dashboard(context, True)
|
||||
context['average_cvss'] = get_avg_cvss(
|
||||
context['code_analysis'])
|
||||
template = 'static_analysis/android_source_analysis.html'
|
||||
if api:
|
||||
return print_n_send_error_response(request, msg, True)
|
||||
return context
|
||||
else:
|
||||
return print_n_send_error_response(request, msg, False)
|
||||
|
||||
return render(request, template, context)
|
||||
else:
|
||||
err = ('Only APK, JAR, AAR, SO and Zipped '
|
||||
'Android/iOS Source code supported now!')
|
||||
logger.error(err)
|
||||
except Exception as excep:
|
||||
logger.exception('Error Performing Static Analysis')
|
||||
msg = str(excep)
|
||||
exp = excep.__doc__
|
||||
if api:
|
||||
return print_n_send_error_response(request, msg, True, exp)
|
||||
else:
|
||||
return print_n_send_error_response(request, msg, False, exp)
|
||||
return print_n_send_error_response(request, msg, api, exp)
|
||||
|
||||
|
||||
def is_android_source(app_dir):
|
||||
|
||||
@@ -113,6 +113,7 @@ def a_analysis(request, app_dict, rescan, api):
|
||||
'subarch': '',
|
||||
},
|
||||
'bin_type': 'A',
|
||||
'framework_analysis': {},
|
||||
}
|
||||
# Analyze static library
|
||||
slib = library_analysis(app_dict['bin_dir'], 'ar')
|
||||
@@ -126,8 +127,6 @@ def a_analysis(request, app_dict, rescan, api):
|
||||
bin_dict['bin_code_analysis'],
|
||||
all_files['special_files'],
|
||||
b'')
|
||||
# Get Icon
|
||||
app_dict['icon_found'] = False
|
||||
# Extract String metadata
|
||||
code_dict = get_strings_metadata(
|
||||
app_dict,
|
||||
|
||||
@@ -70,6 +70,48 @@ def library_analysis(src, arch):
|
||||
if symbols:
|
||||
res[f'{arch}_symbols'].append({
|
||||
rel_path: symbols})
|
||||
if ext == '*.dylib':
|
||||
# Do Framework Analysis for iOS
|
||||
res['framework_analysis'] = []
|
||||
res['framework_strings'] = []
|
||||
res['framework_symbols'] = []
|
||||
frameworks_analysis(src, res)
|
||||
if res['framework_strings']:
|
||||
res[f'{arch}_strings'].extend(
|
||||
res['framework_strings'])
|
||||
except Exception:
|
||||
logger.exception('Performing Library Binary Analysis')
|
||||
return res
|
||||
|
||||
|
||||
def frameworks_analysis(src, res):
|
||||
"""Binary Analysis on Frameworks."""
|
||||
try:
|
||||
logger.info('Framework Binary Analysis Started')
|
||||
# Supports iOS Frameworks
|
||||
for ffile in Path(src).rglob('*'):
|
||||
parent = ffile.parents[0].name
|
||||
if not parent.endswith('.framework'):
|
||||
continue
|
||||
rel_path = (
|
||||
f'{ffile.parents[1].name}/'
|
||||
f'{ffile.parents[0].name}/'
|
||||
f'{ffile.name}')
|
||||
if ffile.suffix != '' or ffile.name not in parent:
|
||||
continue
|
||||
# Frameworks/XXX.framework/XXX
|
||||
logger.info('Analyzing %s', rel_path)
|
||||
chk = MachOChecksec(ffile, rel_path)
|
||||
chksec = chk.checksec()
|
||||
strings = chk.strings()
|
||||
symbols = chk.get_symbols()
|
||||
if chksec:
|
||||
res['framework_analysis'].append(chksec)
|
||||
if strings:
|
||||
res['framework_strings'].append({
|
||||
rel_path: strings})
|
||||
if symbols:
|
||||
res['framework_symbols'].append({
|
||||
rel_path: symbols})
|
||||
except Exception:
|
||||
logger.exception('Performing Framework Binary Analysis')
|
||||
|
||||
@@ -50,12 +50,8 @@ logger = logging.getLogger(__name__)
|
||||
ctype = 'application/json; charset=utf-8'
|
||||
|
||||
|
||||
def pdf(request, api=False, jsonres=False):
|
||||
def pdf(request, checksum, api=False, jsonres=False):
|
||||
try:
|
||||
if api:
|
||||
checksum = request.POST['hash']
|
||||
else:
|
||||
checksum = request.GET['md5']
|
||||
hash_match = re.match('^[0-9a-f]{32}$', checksum)
|
||||
if not hash_match:
|
||||
if api:
|
||||
|
||||
@@ -119,8 +119,8 @@ def generic_compare(request,
|
||||
'common_browsable_activities': {},
|
||||
'apkid': {},
|
||||
}
|
||||
static_fields = ['md5', 'file_name', 'size', 'icon_found',
|
||||
'icon_hidden', 'activities', 'services', 'providers',
|
||||
static_fields = ['md5', 'file_name', 'size', 'icon_path',
|
||||
'activities', 'services', 'providers',
|
||||
'receivers', 'exported_count', 'apkid']
|
||||
|
||||
# For now - support only android
|
||||
|
||||
@@ -44,7 +44,7 @@ def get_context_from_db_entry(db_entry):
|
||||
'bundle_url_types': python_list(db_entry[0].BUNDLE_URL_TYPES),
|
||||
'bundle_supported_platforms':
|
||||
python_list(db_entry[0].BUNDLE_SUPPORTED_PLATFORMS),
|
||||
'icon_found': db_entry[0].ICON_FOUND,
|
||||
'icon_path': db_entry[0].ICON_PATH,
|
||||
'info_plist': db_entry[0].INFO_PLIST,
|
||||
'binary_info': python_dict(db_entry[0].BINARY_INFO),
|
||||
'permissions': python_dict(db_entry[0].PERMISSIONS),
|
||||
@@ -52,6 +52,7 @@ def get_context_from_db_entry(db_entry):
|
||||
'binary_analysis': binary,
|
||||
'macho_analysis': python_dict(db_entry[0].MACHO_ANALYSIS),
|
||||
'dylib_analysis': python_list(db_entry[0].DYLIB_ANALYSIS),
|
||||
'framework_analysis': python_list(db_entry[0].FRAMEWORK_ANALYSIS),
|
||||
'ios_api': python_dict(db_entry[0].IOS_API),
|
||||
'code_analysis': code,
|
||||
'file_analysis': python_list(db_entry[0].FILE_ANALYSIS),
|
||||
@@ -105,7 +106,7 @@ def get_context_from_analysis(app_dict,
|
||||
'bundle_url_types': info_dict['bundle_url_types'],
|
||||
'bundle_supported_platforms':
|
||||
info_dict['bundle_supported_platforms'],
|
||||
'icon_found': app_dict['icon_found'],
|
||||
'icon_path': app_dict['icon_path'],
|
||||
'info_plist': info_dict['plist_xml'],
|
||||
'binary_info': bin_dict['bin_info'],
|
||||
'permissions': info_dict['permissions'],
|
||||
@@ -113,6 +114,7 @@ def get_context_from_analysis(app_dict,
|
||||
'binary_analysis': binary,
|
||||
'macho_analysis': bin_dict['checksec'],
|
||||
'dylib_analysis': bin_dict['dylib_analysis'],
|
||||
'framework_analysis': bin_dict['framework_analysis'],
|
||||
'ios_api': code_dict['api'],
|
||||
'code_analysis': code,
|
||||
'file_analysis': all_files['special_files'],
|
||||
@@ -157,7 +159,7 @@ def save_or_update(update_type,
|
||||
'BUNDLE_URL_TYPES': info_dict['bundle_url_types'],
|
||||
'BUNDLE_SUPPORTED_PLATFORMS':
|
||||
info_dict['bundle_supported_platforms'],
|
||||
'ICON_FOUND': app_dict['icon_found'],
|
||||
'ICON_PATH': app_dict['icon_path'],
|
||||
'INFO_PLIST': info_dict['plist_xml'],
|
||||
'BINARY_INFO': bin_dict['bin_info'],
|
||||
'PERMISSIONS': info_dict['permissions'],
|
||||
@@ -165,6 +167,7 @@ def save_or_update(update_type,
|
||||
'BINARY_ANALYSIS': bin_dict['bin_code_analysis'],
|
||||
'MACHO_ANALYSIS': bin_dict['checksec'],
|
||||
'DYLIB_ANALYSIS': bin_dict['dylib_analysis'],
|
||||
'FRAMEWORK_ANALYSIS': bin_dict['framework_analysis'],
|
||||
'IOS_API': code_dict['api'],
|
||||
'CODE_ANALYSIS': code_dict['code_anal'],
|
||||
'FILE_ANALYSIS': all_files['special_files'],
|
||||
|
||||
@@ -98,6 +98,7 @@ def dylib_analysis(request, app_dict, rescan, api):
|
||||
# Analyze dylib
|
||||
dy = library_analysis(app_dict['bin_dir'], 'macho')
|
||||
bin_dict['dylib_analysis'] = dy['macho_analysis']
|
||||
bin_dict['framework_analysis'] = {}
|
||||
# Store Symbols in File Analysis
|
||||
all_files['special_files'] = get_symbols(
|
||||
dy['macho_symbols'])
|
||||
@@ -106,8 +107,6 @@ def dylib_analysis(request, app_dict, rescan, api):
|
||||
bin_dict['bin_code_analysis'],
|
||||
all_files['special_files'],
|
||||
b'')
|
||||
# Get Icon
|
||||
app_dict['icon_found'] = False
|
||||
# Extract String metadata
|
||||
code_dict = get_strings_metadata(
|
||||
app_dict,
|
||||
|
||||
@@ -7,6 +7,7 @@ import os
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
@@ -15,24 +16,26 @@ from mobsf.MobSF.utils import is_dir_exists
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_icon(md5, bin_dir, binary):
|
||||
def get_icon_from_ipa(app_dict, binary):
|
||||
"""Get app icon from IPA."""
|
||||
try:
|
||||
md5 = app_dict['md5_hash']
|
||||
bin_dir = app_dict['bin_dir']
|
||||
logger.info('Fetching icon path')
|
||||
bin_path = os.path.join(bin_dir, binary + '.app')
|
||||
if not is_dir_exists(bin_path):
|
||||
logger.warning('Could not find app binary directory')
|
||||
return False
|
||||
return
|
||||
icons = glob.glob(bin_path + '/AppIcon*png')
|
||||
if not icons:
|
||||
logger.warning('Could not find app icon')
|
||||
return False
|
||||
return
|
||||
icon_file = icons.pop()
|
||||
outfile = os.path.join(settings.DWD_DIR, md5 + '-icon.png')
|
||||
outfile = Path(settings.DWD_DIR) / f'{md5}-icon.png'
|
||||
if platform.system() == 'Darwin':
|
||||
args = ['xcrun', '-sdk', 'iphoneos', 'pngcrush', '-q',
|
||||
'-revert-iphone-optimizations',
|
||||
icon_file, outfile]
|
||||
icon_file, outfile.as_posix()]
|
||||
# Uncrush PNG. CgBI -> 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
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
{% endif %}
|
||||
<a href="#" id="ss" class="btn btn-primary" role="button"><i class="fa fa-camera"></i> Take a Screenshot</a>
|
||||
<a href="#" id="logstream" class="btn btn-primary"><i class="fa fa-water"></i> Logcat Stream</a>
|
||||
<a href="../../live_api/?hash={{ hash }}&package={{ package }}" id="apimon" target="_blank" class="btn btn-primary" style='display: none'><i class="fa fa-search"></i> Live API Monitor</a>
|
||||
<a href="{% url 'live_api' %}?hash={{ hash }}&package={{ package }}" id="apimon" target="_blank" class="btn btn-primary" style='display: none'><i class="fa fa-search"></i> Live API Monitor</a>
|
||||
<a href="#" id="stop" class="btn btn-info" role="button" ><i class="fa fa-file-alt"></i> Generate Report</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -119,7 +119,7 @@
|
||||
<div class="sensor"></div>
|
||||
<div class="speaker"></div>
|
||||
<div class="screen" id="container">
|
||||
<img width="320" height="580" src="../../download/screen/screen.png" id="my" onerror="$('#my').attr('src','/static/img/loading.jpg')" style="background-color:black;">
|
||||
<img width="320" height="580" src="{% url 'download' %}screen/screen.png" id="my" onerror="$('#my').attr('src','/static/img/loading.jpg')" style="background-color:black;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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
|
||||
|
||||
@@ -260,28 +260,28 @@
|
||||
<div align="center">
|
||||
<p>
|
||||
{% if apimon %}
|
||||
<a target="_blank" class="btn btn-primary" role="button" href="../live_api/?hash={{ hash }}&package={{ package }}"><i class="fa fa-mobile"></i> API Monitor View</a>
|
||||
<a target="_blank" class="btn btn-primary" role="button" href="{% url 'live_api' %}?hash={{ hash }}&package={{ package }}"><i class="fa fa-mobile"></i> API Monitor View</a>
|
||||
{% endif %}
|
||||
{% if frida_logs %}
|
||||
<a target="_blank" class="btn btn-primary" role="button" href="../frida_logs/?hash={{ hash }}&package={{ package }}"><i class="fas fa-spider"></i> Frida Logs View</a>
|
||||
<a target="_blank" class="btn btn-primary" role="button" href="{% url 'frida_logs' %}?hash={{ hash }}&package={{ package }}"><i class="fas fa-spider"></i> Frida Logs View</a>
|
||||
{% endif %}
|
||||
<a class="btn btn-success" target="_blank" role="button" href="../httptools?project={{package}}"><i class="fab fa-hire-a-helper"></i> Start HTTPTools</a>
|
||||
<a class="btn btn-success" target="_blank" role="button" href="{% url 'httptools' %}?project={{package}}"><i class="fab fa-hire-a-helper"></i> Start HTTPTools</a>
|
||||
</p>
|
||||
<p><h6><strong>Raw Logs</strong></h6></p>
|
||||
<p>
|
||||
{% if droidmon %}
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="../download/{{ hash }}-x_logcat.txt"><i class="fa fa-mobile"></i> Droidmon API Monitor Logs</a>
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="{% url 'download' %}{{ hash }}-x_logcat.txt"><i class="fa fa-mobile"></i> Droidmon API Monitor Logs</a>
|
||||
{% endif %}
|
||||
{% if apimon %}
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="../download/{{ hash }}-api_monitor.txt"><i class="fas fa-water"></i> API Monitor Logs</a>
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="{% url 'download' %}{{ hash }}-api_monitor.txt"><i class="fas fa-water"></i> API Monitor Logs</a>
|
||||
{% endif %}
|
||||
{% if frida_logs %}
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="../download/{{ hash }}-frida_out.txt"><i class="fas fa-water"></i> Frida Logs</a>
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="{% url 'download' %}{{ hash }}-frida_out.txt"><i class="fas fa-water"></i> Frida Logs</a>
|
||||
{% endif %}
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="../download/{{ hash }}-web_traffic.txt"><i class="fas fa-water"></i> HTTP(S) Traffic</a>
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="../download/{{ hash }}-logcat.txt"><i class="fas fa-water"></i> Logcat Logs</a>
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="../download/{{ hash }}-dump.txt"><i class="fas fa-water"></i> Dumpsys Logs</a>
|
||||
<a class="btn btn-primary btn-sm" role="button" href="../download/{{ hash }}-app_data.tar"><i class="fas fa-download"></i> Application Data</a>
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="{% url 'download' %}{{ hash }}-web_traffic.txt"><i class="fas fa-water"></i> HTTP(S) Traffic</a>
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="{% url 'download' %}{{ hash }}-logcat.txt"><i class="fas fa-water"></i> Logcat Logs</a>
|
||||
<a target="_blank" class="btn btn-primary btn-sm" role="button" href="{% url 'download' %}{{ hash }}-dump.txt"><i class="fas fa-water"></i> Dumpsys Logs</a>
|
||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'download' %}{{ hash }}-app_data.tar"><i class="fas fa-download"></i> Application Data</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -463,7 +463,7 @@
|
||||
<tbody>
|
||||
{% for img, desc in exported_activity_tester.items %}
|
||||
<tr>
|
||||
<td><img alt="{{desc}}" src="../download/{{ hash }}-screenshots-apk/{{ img }}" class="img-thumbnail" height="300" width="175"></td>
|
||||
<td><img alt="{{desc}}" src="{% url 'download' %}{{ hash }}-screenshots-apk/{{ img }}" class="img-thumbnail" height="300" width="175"></td>
|
||||
<td>{{ desc }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -500,7 +500,7 @@
|
||||
<tbody>
|
||||
{% for img, desc in activity_tester.items %}
|
||||
<tr>
|
||||
<td><img alt="{{desc}}" src="../download/{{ hash }}-screenshots-apk/{{ img }}" class="img-thumbnail" height="300" width="175"></td>
|
||||
<td><img alt="{{desc}}" src="{% url 'download' %}{{ hash }}-screenshots-apk/{{ img }}" class="img-thumbnail" height="300" width="175"></td>
|
||||
<td>{{ desc }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -527,7 +527,7 @@
|
||||
</p>
|
||||
<div class="list-group">
|
||||
{% for i in screenshots %}
|
||||
<img alt="Screenshot" src="../download/{{ hash }}-screenshots-apk/{{ i}}" class="img-thumbnail" height="600" width="350">
|
||||
<img alt="Screenshot" src="{% url 'download' %}{{ hash }}-screenshots-apk/{{ i}}" class="img-thumbnail" height="600" width="350">
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -862,7 +862,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for file in sqlite %}
|
||||
<tr><td><a href="../dynamic_view_file/?file={{file|key:"file"}}&hash={{hash}}&type={{file|key:"type"}}">{{file|key:"file"}}</a></td></tr>
|
||||
<tr><td><a href="{% url 'dynamic_view_file' %}?file={{file|key:"file"}}&hash={{hash}}&type={{file|key:"type"}}">{{file|key:"file"}}</a></td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -894,7 +894,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for file in xml %}
|
||||
<tr><td><a href="../dynamic_view_file/?file={{file|key:"file"}}&hash={{hash}}&type={{file|key:"type"}}">{{file|key:"file"}}</a></td></tr>
|
||||
<tr><td><a href="{% url 'dynamic_view_file' %}?file={{file|key:"file"}}&hash={{hash}}&type={{file|key:"type"}}">{{file|key:"file"}}</a></td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -926,7 +926,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for file in others %}
|
||||
<tr><td><a href="../dynamic_view_file/?file={{file|key:"file"}}&hash={{hash}}&type={{file|key:"type"}}">{{file|key:"file"}}</a></td></tr>
|
||||
<tr><td><a href="{% url 'dynamic_view_file' %}?file={{file|key:"file"}}&hash={{hash}}&type={{file|key:"type"}}">{{file|key:"file"}}</a></td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -155,7 +155,7 @@ textarea:focus {
|
||||
{% for e in apps %}
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img id="app_icon" src="{% if e.ICON_FOUND %}/download/{{ e.MD5 }}-icon.png{% else %}{% static 'img/no_icon.png' %}{% endif %}"/>
|
||||
<img id="app_icon" src="{% if e.ICON_PATH %}/download/{{ e.ICON_PATH }}{% else %}{% static 'img/no_icon.png' %}{% endif %}"/>
|
||||
<br/><strong>{{ e.APP_NAME }} - {{ e.VERSION_NAME }}</strong>
|
||||
</td>
|
||||
<td>
|
||||
@@ -166,13 +166,13 @@ textarea:focus {
|
||||
</td>
|
||||
<td align="center">
|
||||
<p>
|
||||
<a class="btn btn-success disable" onclick="dynamic_loader()" href="../android_dynamic/{{e.MD5}}"><i class="fab fa-android"></i> Start Dynamic Analysis</a>
|
||||
<a class="btn btn-success disable" onclick="dynamic_loader()" href="{% url "dynamic_analyzer" checksum=e.MD5 %}"><i class="fab fa-android"></i> Start Dynamic Analysis</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="btn btn-primary btn-sm disable" onclick="dynamic_loader()" href="../android_dynamic/{{e.MD5}}?re_install=0"><i class="fab fa-android"></i> Start Dynamic Analysis (without Re-install)</a>
|
||||
<a class="btn btn-primary btn-sm disable" onclick="dynamic_loader()" href="{% url "dynamic_analyzer" checksum=e.MD5 %}?re_install=0"><i class="fab fa-android"></i> Start Dynamic Analysis (without Re-install)</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="btn btn-info {% if not e.DYNAMIC_REPORT_EXISTS %}disabled{% endif %}" href="../dynamic_report/{{ e.MD5 }}"><i class="fa fa-mobile"></i> View Report </a>
|
||||
<a class="btn btn-info {% if not e.DYNAMIC_REPORT_EXISTS %}disabled{% endif %}" href="{% url "dynamic_report" checksum=e.MD5 %}"><i class="fa fa-mobile"></i> View Report </a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -203,13 +203,13 @@ textarea:focus {
|
||||
</td>
|
||||
<td align="center">
|
||||
<p>
|
||||
<a class="btn btn-primary disable" onclick="dynamic_loader()" href="../android_dynamic/{{hash}}?re_install=0&install=0"><i class="fab fa-android"></i> Start Dynamic Analysis</a>
|
||||
<a class="btn btn-primary disable" onclick="dynamic_loader()" href={% url "dynamic_analyzer" checksum=hash %}?re_install=0&install=0"><i class="fab fa-android"></i> Start Dynamic Analysis</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="btn btn-warning disable" onclick="dynamic_loader()" href="../static_scan/{{hash}}"><i class="fa fa-download"></i> Pull & Static Analysis</a>
|
||||
<a class="btn btn-warning disable" onclick="dynamic_loader()" href="{% url "static_scan" checksum=hash %}"><i class="fa fa-download"></i> Pull & Static Analysis</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="btn btn-info" href="../dynamic_report/{{hash}}"><i class="fa fa-mobile"></i> View Report </a>
|
||||
<a class="btn btn-info" href="{% url "dynamic_report" checksum=hash %}"><i class="fa fa-mobile"></i> View Report </a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -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 : {
|
||||
|
||||
@@ -1231,7 +1231,6 @@
|
||||
<strong>Content:</strong> <code>{
|
||||
"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",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,20 +54,22 @@
|
||||
{% for e in entries %}
|
||||
<tr>
|
||||
<td style="text-align: center;">
|
||||
<img id="app_icon" src="/download/{{ e.MD5 }}-icon.png" onerror="this.src='{% static 'img/no_icon.png' %}'">
|
||||
<img id="app_icon" src="{% if e.ICON_PATH %}/download/{{ e.ICON_PATH }}{% else %}{% static 'img/no_icon.png' %}{% endif %}">
|
||||
{% if e.PACKAGE_NAME or e.APP_NAME %}
|
||||
<br/><strong>{{ e.APP_NAME }} {% if e.VERSION_NAME %} - {{ e.VERSION_NAME }} {% endif %}</strong>
|
||||
</br>{{ 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' %}
|
||||
<p> <a href="../appsec_dashboard/{{ e.MD5 }}/" class="btn btn-sm btn-outline-primary" role="button"><i class="fas fa-user-shield"></i> MobSF Scorecard</a></p>
|
||||
<p> <a href="{% url "appsec_dashboard" checksum=e.MD5 %}" class="btn btn-sm btn-outline-primary" role="button"><i class="fas fa-user-shield"></i> MobSF Scorecard</a></p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<p><a class="btn btn-primary btn-sm" href="../{{ e.ANALYZER }}/?name={{e.FILE_NAME | urlencode}}&checksum={{e.MD5}}&type={{e.SCAN_TYPE}}"><i class="fas fa-eye"></i> Static Report</a>
|
||||
<p><a class="btn btn-primary btn-sm" href="../{{ e.ANALYZER }}/{{e.MD5}}/"><i class="fas fa-eye"></i> Static Report</a>
|
||||
{% if '.apk' == e.FILE_NAME|slice:"-4:" or '.xapk' == e.FILE_NAME|slice:"-5:" or '.apks' == e.FILE_NAME|slice:"-5:"%}
|
||||
<a class="btn btn-success btn-sm {% if not e.DYNAMIC_REPORT_EXISTS %}disabled{% endif %}" href="../dynamic_report/{{ e.MD5 }}"><i class="fa fa-mobile"></i> Dynamic Report</a>
|
||||
<a class="btn btn-success btn-sm {% if not e.DYNAMIC_REPORT_EXISTS %}disabled{% endif %}" href="{% url "dynamic_report" checksum=e.MD5 %}"><i class="fa fa-mobile"></i> Dynamic Report</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% else %}
|
||||
@@ -93,8 +95,8 @@
|
||||
<td>{{ e.MD5 }}</td>
|
||||
<td>{{ e.TIMESTAMP }}</td>
|
||||
<td><p>
|
||||
<a class="btn btn-outline-primary btn-sm" href="../pdf/?md5={{ e.MD5 }}"><i class="fas fa-file-pdf"></i></a>
|
||||
<a class="btn btn-outline-info btn-sm" href="../{{ e.ANALYZER }}/?name={{e.FILE_NAME | urlencode}}&checksum={{e.MD5}}&type={{e.SCAN_TYPE}}&rescan=1"><i class="fas fa-sync-alt"></i></a>
|
||||
<a class="btn btn-outline-primary btn-sm" href="{% url "pdf" checksum=e.MD5%}"><i class="fas fa-file-pdf"></i></a>
|
||||
<a class="btn btn-outline-info btn-sm" href="../{{ e.ANALYZER }}/{{e.MD5}}/?rescan=1"><i class="fas fa-sync-alt"></i></a>
|
||||
</p>
|
||||
{% if '.apk' == e.FILE_NAME|slice:"-4:" or '.xapk' == e.FILE_NAME|slice:"-5:" or '.apks' == e.FILE_NAME|slice:"-5:"%}
|
||||
<p><a class="diffButton btn btn-warning btn-sm" id="{{ e.MD5 }}_{{ e.FILE_NAME }}"><i class="fas fa-not-equal"></i> Diff or Compare</a>
|
||||
@@ -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 : {
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
{% extends "base/base_layout.html" %}
|
||||
{% block sidebar_option %}
|
||||
sidebar-collapse
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="content-wrapper">
|
||||
<div class="content-header">
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h3 class="box-title"><i class="fa fa-search"></i> You 've searched for: <strong>{{ term }}</strong>. Found in {{ found }} files.</h3>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
|
||||
|
||||
{% for m in matches %}
|
||||
|
||||
<tr><td>
|
||||
<a href ="../ViewSource/?file={{ m }}&md5={{ md5 }}&type={{ typ }}">{{ m }}</a>
|
||||
</td></tr>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -44,7 +44,7 @@
|
||||
</div>
|
||||
</br></br></br>
|
||||
<div class="app">
|
||||
<img class="center" id="icon" src="{% if icon_found %}{{dwd_dir}}{{ md5 }}-icon.png{% else %}{{base_url}}{% static 'img/no_icon.png' %}{% endif %}" alt="app_icon"/>
|
||||
<img class="center" id="icon" src="{% if icon_path %}{{dwd_dir}}{{icon_path}}{% else %}{{base_url}}{% static 'img/no_icon.png' %}{% endif %}" alt="app_icon"/>
|
||||
</div>
|
||||
<div class="center">
|
||||
<h1><i class="fab fa-android"></i> {% if app_name %} {{ app_name }} {% else %} {{ file_name }} {% endif %} {% if version_name %} ({{version_name}}) {% endif %}</h1>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
<div class="app">
|
||||
{% if app_type not in 'Dylib,A' %}
|
||||
<img class="center" id="icon" src="{% if not appstore_details.error %}{{appstore_details.icon}}{% elif icon_found %}{{dwd_dir}}{{ md5 }}-icon.png{% else %}{{base_url}}{% static 'img/no_icon.png' %}{% endif %}" alt="app_icon"/>
|
||||
<img class="center" id="icon" src="{% if not appstore_details.error %}{{appstore_details.icon}}{% elif icon_path %}{{dwd_dir}}{{ icon_path }}{% else %}{{base_url}}{% static 'img/no_icon.png' %}{% endif %}" alt="app_icon"/>
|
||||
{% else %}
|
||||
<img class="center" id="icon" src="{{base_url}}{% static 'img/no_icon.png' %}" alt="app_icon"/>
|
||||
{% endif %}
|
||||
@@ -572,6 +572,61 @@
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if framework_analysis and app_type not in 'A' %}
|
||||
<h2><i class="fa fa-archive"></i> FRAMEWORK BINARY ANALYSIS</h2>
|
||||
<table class="basic">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>NO</th>
|
||||
<th>FRAMEWORK</th>
|
||||
<th>NX</th>
|
||||
<th>STACK CANARY</th>
|
||||
<th>ARC</th>
|
||||
<th>RPATH</th>
|
||||
<th>CODE SIGNATURE</th>
|
||||
<th>ENCRYPTED</th>
|
||||
<th>SYMBOLS STRIPPED</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for frm in framework_analysis %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
<td>{{frm.name}}</td>
|
||||
<td><b>{{frm.nx.has_nx}}</b>
|
||||
<br/>
|
||||
<span class="{% if frm.nx.severity == 'high' %}danger{% elif frm.nx.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.nx.severity}}</span><br/>
|
||||
<br/>{{frm.nx.description}}</td>
|
||||
<td><b>{{frm.stack_canary.has_canary}}</b>
|
||||
<br/>
|
||||
<span class="{% if frm.stack_canary.severity == 'high' %}danger{% elif frm.stack_canary.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.stack_canary.severity}}</span><br/>
|
||||
<br/>{{frm.stack_canary.description}}</td>
|
||||
<td><b>{{frm.arc.has_arc}}</b>
|
||||
<br/>
|
||||
<span class="{% if frm.arc.severity == 'high' %}danger{% elif frm.arc.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.arc.severity}}</span><br/>
|
||||
<br/>{{frm.arc.description}}</td>
|
||||
<td><b>{{frm.rpath.has_rpath}}</b>
|
||||
<br/>
|
||||
<span class="{% if frm.rpath.severity == 'high' %}danger{% elif frm.rpath.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.rpath.severity}}</span><br/>
|
||||
<br/>{{frm.rpath.description}}</td>
|
||||
<td><b>{{frm.code_signature.has_code_signature}}</b>
|
||||
<br/>
|
||||
<span class="{% if frm.code_signature.severity == 'high' %}danger{% elif frm.code_signature.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.code_signature.severity}}</span><br/>
|
||||
<br/>{{frm.code_signature.description}}</td>
|
||||
<td><b>{{frm.encrypted.is_encrypted}}</b>
|
||||
<br/>
|
||||
<span class="{% if frm.encrypted.severity == 'high' %}danger{% elif frm.encrypted.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.encrypted.severity}}</span><br/>
|
||||
<br/>{{frm.encrypted.description}}</td>
|
||||
<td><b>{{frm.symbol.is_stripped}}</b>
|
||||
<br/>
|
||||
<span class="{% if frm.symbol.severity == 'high' %}danger{% elif frm.symbol.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.symbol.severity}}</span><br/>
|
||||
<br/>{{frm.symbol.description}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
<!--static library-->
|
||||
{% if app_type in 'A' %}
|
||||
<h2><i class="fa fa-flag"></i> STATIC LIBRARY BINARY ANALYSIS</h2>
|
||||
|
||||
@@ -322,7 +322,7 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
<a href="../pdf/?md5={{ md5 }}" class="nav-link">
|
||||
<a href="{% url "pdf" checksum=md5 %}" class="nav-link">
|
||||
<i class="nav-icon fas fa-file-pdf"></i>
|
||||
<p>
|
||||
PDF Report
|
||||
@@ -339,7 +339,7 @@
|
||||
</li>
|
||||
{% if dynamic_analysis_done %}
|
||||
<li class="nav-item">
|
||||
<a href="../dynamic_report/{{ md5 }}" class="nav-link">
|
||||
<a href="{% url "dynamic_report" checksum=md5 %}" class="nav-link">
|
||||
<i class="nav-icon fas fa-file-alt"></i>
|
||||
<p>
|
||||
Dynamic Analysis Report
|
||||
@@ -349,7 +349,7 @@
|
||||
{% else %}
|
||||
{% if app_type not in 'jar,aar,so' %}
|
||||
<li class="nav-item">
|
||||
<a onclick="dynamic_loader()" href="../android_dynamic/{{md5}}" class="nav-link">
|
||||
<a onclick="dynamic_loader()" href="{% url "dynamic_analyzer" checksum=md5 %}" class="nav-link">
|
||||
<i class="nav-icon fa fa-play-circle"></i>
|
||||
<p>
|
||||
Start Dynamic Analysis
|
||||
@@ -395,10 +395,7 @@
|
||||
<div class="col-2">
|
||||
<p><strong><i class="fas fa-check-double"></i> APP SCORES</strong></p>
|
||||
{% if app_type not in 'so' %}
|
||||
<img id="app_icon" src="{% if icon_found %}/download/{{ md5 }}-icon.png{% else %}{% static 'img/no_icon.png' %}{% endif %}"/>
|
||||
{% if icon_hidden %}
|
||||
<strong>Hidden Icon!</strong>
|
||||
{% endif %}
|
||||
<img id="app_icon" src="{% if icon_path %}/download/{{icon_path}}{% else %}{% static 'img/no_icon.png' %}{% endif %}"/>
|
||||
<p>
|
||||
{% if average_cvss %}
|
||||
<span class="badge bg-info">Average CVSS</span> <strong>{{ average_cvss }} </strong><br/>
|
||||
@@ -419,7 +416,7 @@
|
||||
{% endif %}
|
||||
</p>
|
||||
{% if app_type not in 'so' %}
|
||||
<p> <a href="../appsec_dashboard/{{ md5 }}/" class="btn btn-outline-primary btn-sm" role="button"><i class="fas fa-user-shield"></i> MobSF Scorecard</a></p>
|
||||
<p> <a href="{% url 'appsec_dashboard' checksum=md5 %}" class="btn btn-outline-primary btn-sm" role="button"><i class="fas fa-user-shield"></i> MobSF Scorecard</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -661,9 +658,9 @@
|
||||
<p>
|
||||
<strong><i class="fas fa-cog"></i> SCAN OPTIONS</strong>
|
||||
</p>
|
||||
<p> <a href="../static_analyzer/?checksum={{ md5 }}&name={{ file_name }}&type={{ app_type }}&rescan=1" class="btn btn-info" role="button"><i class="fa fa-sync"></i> Rescan</a>
|
||||
<p> <a href="{% url 'static_analyzer' checksum=md5 %}?rescan=1" class="btn btn-info" role="button"><i class="fa fa-sync"></i> Rescan</a>
|
||||
{% if app_type in 'so' %}
|
||||
<a href="../generate_downloads/?hash={{ md5 }}&file_type={{ app_type }}" class="btn btn-warning"> <i class="fa fa-download"></i> Download {{ app_type | upper}}</a>
|
||||
<a href="{% url 'generate_downloads' %}?hash={{ md5 }}&file_type={{ app_type }}" class="btn btn-warning"> <i class="fa fa-download"></i> Download {{ app_type | upper}}</a>
|
||||
{% endif %}
|
||||
{% if app_type not in 'so' %}
|
||||
<a id="supbtn" onclick="list_suppressions()" role="button" class="btn btn-primary" data-target="#sup_list" data-toggle="modal" href="#"><i class="fa fa-list"></i> Manage Suppressions</a>
|
||||
@@ -671,7 +668,7 @@
|
||||
</p>
|
||||
{% if app_type not in 'jar,aar,so' %}
|
||||
<p>
|
||||
<a onclick="dynamic_loader()" href="../android_dynamic/{{md5}}" class="btn btn-success" role="button"><i class="fa fa-play-circle"></i> Start Dynamic Analysis</a>
|
||||
<a onclick="dynamic_loader()" href="{% url 'dynamic_analyzer' checksum=md5 %}" class="btn btn-success" role="button"><i class="fa fa-play-circle"></i> Start Dynamic Analysis</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -686,7 +683,7 @@
|
||||
</p>
|
||||
<p>
|
||||
{% if app_type not in 'jar' %}
|
||||
<a target="_blank" href="../manifest_view/?md5={{ md5 }}&type={{ app_type }}" role="button" class="btn btn-primary"><i class="fa fa-eye"></i> View AndroidManifest.xml</a>
|
||||
<a target="_blank" href="{% url "manifest_view" checksum=md5 %}?type={{ app_type }}" role="button" class="btn btn-primary"><i class="fa fa-eye"></i> View AndroidManifest.xml</a>
|
||||
{% endif %}
|
||||
<a href="{% url "tree_view" %}?md5={{ md5 }}&type=java" class="btn btn-info" role="button"><i class="fa fa-code"></i> View Source</a>
|
||||
{% if app_type not in 'jar,aar' %}
|
||||
@@ -694,11 +691,11 @@
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>
|
||||
<a href="../generate_downloads/?hash={{ md5 }}&file_type=java" class="btn btn-warning" role="button"> <i class="fa fa-download"></i> Download Java Code</a>
|
||||
<a href="{% url 'generate_downloads' %}?hash={{ md5 }}&file_type=java" class="btn btn-warning" role="button"> <i class="fa fa-download"></i> Download Java Code</a>
|
||||
{% if app_type not in 'jar,aar' %}
|
||||
<a href="../generate_downloads/?hash={{ md5 }}&file_type=smali" class="btn btn-warning"> <i class="fa fa-download"></i> Download Smali Code</a>
|
||||
<a href="{% url 'generate_downloads' %}?hash={{ md5 }}&file_type=smali" class="btn btn-warning"> <i class="fa fa-download"></i> Download Smali Code</a>
|
||||
{% endif %}
|
||||
<a href="../generate_downloads/?hash={{ md5 }}&file_type={{ app_type }}" class="btn btn-warning"> <i class="fa fa-download"></i> Download {{ app_type | upper}}</a>
|
||||
<a href="{% url 'generate_downloads' %}?hash={{ md5 }}&file_type={{ app_type }}" class="btn btn-warning"> <i class="fa fa-download"></i> Download {{ app_type | upper}}</a>
|
||||
|
||||
{% if app_type in 'jar,aar' %}
|
||||
<p>
|
||||
@@ -2322,6 +2319,9 @@
|
||||
<script src="{% static "others/js/suppression.js" %}"></script>
|
||||
<script>
|
||||
|
||||
// Remove rescan parameter
|
||||
window.history.replaceState({}, '', window.location.pathname);
|
||||
|
||||
// Globals
|
||||
const csrf = '{{ csrf_token }}'
|
||||
const pkg = '{{ package_name }}'
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="../pdf/?md5={{ md5 }}" class="nav-link">
|
||||
<a href="{% url "pdf" checksum=md5 %}" class="nav-link">
|
||||
<i class="nav-icon fas fa-file-pdf"></i>
|
||||
<p>
|
||||
PDF Report
|
||||
@@ -289,10 +289,7 @@
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<p><strong><i class="fas fa-check-double"></i> APP SCORES</strong></p>
|
||||
<img id="app_icon" src="{% if icon_found %}/download/{{ md5 }}-icon.png{% else %}{% static 'img/no_icon.png' %}{% endif %}"/>
|
||||
{% if icon_hidden %}
|
||||
<strong>Hidden Icon!</strong>
|
||||
{% endif %}
|
||||
<img id="app_icon" src="{% if icon_path %}/download/{{ icon_path }}{% else %}{% static 'img/no_icon.png' %}{% endif %}"/>
|
||||
<p>
|
||||
{% if average_cvss %}
|
||||
<span class="badge bg-info">Average CVSS</span> <b>{{ average_cvss }} </b><br/>
|
||||
@@ -304,7 +301,7 @@
|
||||
<span class="badge bg-success">Trackers Detection</span> <strong>{{ trackers.detected_trackers }}/{{ trackers.total_trackers }}</strong><br/>
|
||||
{% endif %}
|
||||
</p>
|
||||
<p> <a href="../appsec_dashboard/{{ md5 }}/" class="btn btn-outline-primary btn-sm" role="button"><i class="fas fa-user-shield"></i> MobSF Scorecard</a></p>
|
||||
<p> <a href="{% url 'appsec_dashboard' checksum=md5 %}" class="btn btn-outline-primary btn-sm" role="button"><i class="fas fa-user-shield"></i> MobSF Scorecard</a></p>
|
||||
|
||||
</div>
|
||||
<div class="col-6">
|
||||
@@ -539,9 +536,9 @@
|
||||
<strong><i class="fas fa-cog"></i> SCAN OPTIONS</strong>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="../static_analyzer/?checksum={{ md5 }}&name={{ file_name }}&type=zip&rescan=1" class="btn btn-info" role="button"><i class="fa fa-sync"></i> Rescan</a>
|
||||
<a href="{% url 'static_analyzer' checksum=md5 %}?rescan=1" class="btn btn-info" role="button"><i class="fa fa-sync"></i> Rescan</a>
|
||||
<a id="supbtn" onclick="list_suppressions()" role="button" class="btn btn-primary" data-target="#sup_list" data-toggle="modal" href="#"><i class="fa fa-list"></i> Manage Suppressions</a>
|
||||
<a target="_blank" href="../manifest_view/?md5={{ md5 }}&type={{ app_type }}" role="button" class="btn btn-primary"><i class="fa fa-eye"></i> View AndroidManifest.xml</a>
|
||||
<a target="_blank" href="{% url "manifest_view" checksum=md5 %}?type={{ app_type }}" role="button" class="btn btn-primary"><i class="fa fa-eye"></i> View AndroidManifest.xml</a>
|
||||
<a href="{% url "tree_view" %}?md5={{ md5 }}&type=java" class="btn btn-info" role="button"><i class="fa fa-code"></i> View Source</a>
|
||||
</p>
|
||||
</div>
|
||||
@@ -1731,6 +1728,9 @@
|
||||
<script src="{% static "others/js/suppression.js" %}"></script>
|
||||
<script>
|
||||
|
||||
// Remove rescan parameter
|
||||
window.history.replaceState({}, '', window.location.pathname);
|
||||
|
||||
// Globals
|
||||
const csrf = '{{ csrf_token }}'
|
||||
const pkg = '{{ package_name }}'
|
||||
|
||||
@@ -159,27 +159,21 @@
|
||||
<tr>
|
||||
<td>
|
||||
<img id="app_icon" src="
|
||||
{% if first_app.icon_found %}
|
||||
/download/{{ first_app.md5 }}-icon.png
|
||||
{% if first_app.icon_path %}
|
||||
/download/{{ first_app.icon_path }}
|
||||
{% else %}
|
||||
{% static 'img/no_icon.png' %}
|
||||
{% endif %}
|
||||
"/><br/>
|
||||
{% if first_app.icon_hidden %}
|
||||
<strong>Hidden Icon!</strong>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<img id="app_icon" src="
|
||||
{% if second_app.icon_found %}
|
||||
/download/{{ second_app.md5 }}-icon.png
|
||||
{% if second_app.icon_path %}
|
||||
/download/{{ second_app.icon_path }}
|
||||
{% else %}
|
||||
{% static 'img/no_icon.png' %}
|
||||
{% endif %}
|
||||
"/><br/>
|
||||
{% if second_app.icon_hidden %}
|
||||
<strong>Hidden Icon!</strong>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -122,6 +122,12 @@
|
||||
<p>Dylib Analysis</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#framework_analysis" class="nav-link">
|
||||
<i class="nav-icon fa fa-archive"></i>
|
||||
<p>Framework Analysis</p>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if app_type in 'A' %}
|
||||
<li class="nav-item">
|
||||
@@ -248,7 +254,7 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
<a href="../pdf/?md5={{ md5 }}" class="nav-link">
|
||||
<a href="{% url "pdf" checksum=md5 %}" class="nav-link">
|
||||
<i class="nav-icon fas fa-file-pdf"></i>
|
||||
<p>
|
||||
PDF Report
|
||||
@@ -299,7 +305,7 @@
|
||||
<div class="col-2">
|
||||
<p><strong><i class="fas fa-check-double"></i> APP SCORES</strong></p>
|
||||
{% if app_type not in 'Dylib,A' %}
|
||||
<img id="app_icon" src="{% if not appstore_details.error %}{{appstore_details.icon}}{% elif icon_found %}/download/{{ md5 }}-icon.png{% else %}{% static 'img/no_icon.png' %}{% endif %}"/>
|
||||
<img id="app_icon" src="{% if not appstore_details.error %}{{appstore_details.icon}}{% elif icon_path %}/download/{{ icon_path }}{% else %}{% static 'img/no_icon.png' %}{% endif %}"/>
|
||||
<p>
|
||||
{% if average_cvss %}
|
||||
<span class="badge bg-info">Average CVSS</span> <strong>{{ average_cvss }} </strong><br/>
|
||||
@@ -320,7 +326,7 @@
|
||||
{% endif %}
|
||||
</p>
|
||||
{% if app_type not in 'Dylib,A' %}
|
||||
<p> <a href="../appsec_dashboard/{{ md5 }}/" class="btn btn-outline-primary btn-sm" role="button"><i class="fas fa-user-shield"></i> MobSF Scorecard</a></p>
|
||||
<p> <a href="{% url 'appsec_dashboard' checksum=md5 %}" class="btn btn-outline-primary btn-sm" role="button"><i class="fas fa-user-shield"></i> MobSF Scorecard</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@@ -444,7 +450,7 @@
|
||||
<p>
|
||||
<strong><i class="fas fa-cog"></i> SCAN OPTIONS</strong>
|
||||
</p>
|
||||
<a role="button" class="btn btn-info" href="../static_analyzer_ios/?checksum={{ md5 }}&name={{ file_name }}&type={% if app_type in 'Dylib' %}dylib{% elif app_type in 'A' %}a{% else %}ipa{% endif %}&rescan=1" ><i class="fa fa-sync"></i> Rescan</a>
|
||||
<a role="button" class="btn btn-info" href="{% url 'static_analyzer_ios' checksum=md5 %}?rescan=1" ><i class="fa fa-sync"></i> Rescan</a>
|
||||
<a id="supbtn" onclick="list_suppressions()" role="button" class="btn btn-primary" data-target="#sup_list" data-toggle="modal" href="#"><i class="fa fa-list"></i> Manage Suppressions</a>
|
||||
</p>
|
||||
</div>
|
||||
@@ -461,9 +467,9 @@
|
||||
<a role="button" class="btn btn-primary" data-target="#mplist" data-toggle="modal" href="#"><i class="fa fa-list"></i> View Info.plist</a>
|
||||
{% endif %}
|
||||
{% if app_type not in 'Dylib,A' %}
|
||||
<a target="_blank" href="../view_file_ios/?file=classdump.txt&md5={{ md5 }}&type=ios" class="btn btn-warning" role="button"><i class="fa fa-code"></i> View Class Dump</a>
|
||||
<a target="_blank" href="{% url 'view_file_ios' %}?file=classdump.txt&md5={{ md5 }}&type=ios" class="btn btn-warning" role="button"><i class="fa fa-code"></i> View Class Dump</a>
|
||||
{% endif %}
|
||||
<a href="../generate_downloads/?hash={{ md5 }}&file_type={% if app_type in 'Dylib' %}dylib{% elif app_type in 'A' %}a{% else %}ipa{% endif %}" class="btn btn-warning"> <i class="fa fa-download"></i> Download {% if app_type in 'Dylib' %}DYLIB{% elif app_type in 'A' %}A{% else %}IPA{% endif %}</a>
|
||||
<a href="{% url 'generate_downloads' %}?hash={{ md5 }}&file_type={% if app_type in 'Dylib' %}dylib{% elif app_type in 'A' %}a{% else %}ipa{% endif %}" class="btn btn-warning"> <i class="fa fa-download"></i> Download {% if app_type in 'Dylib' %}DYLIB{% elif app_type in 'A' %}A{% else %}IPA{% endif %}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -990,6 +996,81 @@
|
||||
</div>
|
||||
</section>
|
||||
<!-- ===========================end dylib analysis ================================== -->
|
||||
<a id="framework_analysis" class="anchor"></a>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<p>
|
||||
<strong><i class="fa fa-archive"></i> FRAMEWORK BINARY ANALYSIS</strong>
|
||||
</p>
|
||||
<div class="table-responsive">
|
||||
<table id="table_framework" class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>NO</th>
|
||||
<th>FRAMEWORK</th>
|
||||
<th>NX</th>
|
||||
<th>STACK CANARY</th>
|
||||
<th>ARC</th>
|
||||
<th>RPATH</th>
|
||||
<th>CODE SIGNATURE</th>
|
||||
<th>ENCRYPTED</th>
|
||||
<th>SYMBOLS STRIPPED</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if not framework_analysis %}
|
||||
No Frameworks found.
|
||||
{% endif %}
|
||||
{% for frm in framework_analysis %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
<td>{{frm.name}}</td>
|
||||
<td><b>{{frm.nx.has_nx}}</b>
|
||||
<br/>
|
||||
<span class="badge bg-{% if frm.nx.severity == 'high' %}danger{% elif frm.nx.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.nx.severity}}</span>
|
||||
<br/>{{frm.nx.description}}</td>
|
||||
<td><b>{{frm.stack_canary.has_canary}}</b>
|
||||
<br/>
|
||||
<span class="badge bg-{% if frm.stack_canary.severity == 'high' %}danger{% elif frm.stack_canary.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.stack_canary.severity}}</span>
|
||||
<br/>{{frm.stack_canary.description}}</td>
|
||||
<td><b>{{frm.arc.has_arc}}</b>
|
||||
<br/>
|
||||
<span class="badge bg-{% if frm.arc.severity == 'high' %}danger{% elif frm.arc.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.arc.severity}}</span>
|
||||
<br/>{{frm.arc.description}}</td>
|
||||
<td><b>{{frm.rpath.has_rpath}}</b>
|
||||
<br/>
|
||||
<span class="badge bg-{% if frm.rpath.severity == 'high' %}danger{% elif frm.rpath.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.rpath.severity}}</span>
|
||||
<br/>{{frm.rpath.description}}</td>
|
||||
<td><b>{{frm.code_signature.has_code_signature}}</b>
|
||||
<br/>
|
||||
<span class="badge bg-{% if frm.code_signature.severity == 'high' %}danger{% elif frm.code_signature.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.code_signature.severity}}</span>
|
||||
<br/>{{frm.code_signature.description}}</td>
|
||||
<td><b>{{frm.encrypted.is_encrypted}}</b>
|
||||
<br/>
|
||||
<span class="badge bg-{% if frm.encrypted.severity == 'high' %}danger{% elif frm.encrypted.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.encrypted.severity}}</span>
|
||||
<br/>{{frm.encrypted.description}}</td>
|
||||
<td><b>{{frm.symbol.is_stripped}}</b>
|
||||
<br/>
|
||||
<span class="badge bg-{% if frm.symbol.severity == 'high' %}danger{% elif frm.symbol.severity == 'warning' %}warning{% else %}info{% endif %}">{{frm.symbol.severity}}</span>
|
||||
<br/>{{frm.symbol.description}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><!-- /.card -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- ===========================end framework analysis ================================== -->
|
||||
{% endif %}
|
||||
<!--static library-->
|
||||
{% if app_type in 'A' %}
|
||||
@@ -1149,7 +1230,7 @@
|
||||
<td>
|
||||
{% for file in item.files %}
|
||||
{% if file.type %}
|
||||
<a href="../view_file_ios/?file={{file.file_path}}&type={{file.type}}&md5={{file.hash}}">{{ file.file_path }}</a>
|
||||
<a href="{% url 'view_file_ios' %}?file={{file.file_path}}&type={{file.type}}&md5={{file.hash}}">{{ file.file_path }}</a>
|
||||
{% else %}
|
||||
{{ file.file_path }}
|
||||
{% endif %}
|
||||
@@ -1370,7 +1451,7 @@
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="../view_file_ios/?file={{urldict|key:"path"}}&md5={{ md5}}&type=ipa">{{urldict|key:"path"}}</a>
|
||||
<a href="{% url 'view_file_ios' %}?file={{urldict|key:"path"}}&md5={{ md5}}&type=ipa">{{urldict|key:"path"}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -1461,7 +1542,7 @@
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="../view_file_ios/?file={{email_dict|key:"path"}}&md5={{ md5}}&type=ipa">{{email_dict|key:"path"}}</a>
|
||||
<a href="{% url 'view_file_ios' %}?file={{email_dict|key:"path"}}&md5={{ md5}}&type=ipa">{{email_dict|key:"path"}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -1727,6 +1808,11 @@
|
||||
</script>
|
||||
<script src="{% static "others/js/suppression.js" %}"></script>
|
||||
<script>
|
||||
|
||||
// Remove rescan parameter
|
||||
window.history.replaceState({}, '', window.location.pathname);
|
||||
|
||||
|
||||
// Globals
|
||||
const csrf = '{{ csrf_token }}'
|
||||
const pkg = '{{ bundle_id }}'
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="../pdf/?md5={{ md5 }}" class="nav-link">
|
||||
<a href="{% url "pdf" checksum=md5 %}" class="nav-link">
|
||||
<i class="nav-icon fas fa-file-pdf"></i>
|
||||
<p>
|
||||
PDF Report
|
||||
@@ -245,7 +245,7 @@
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<p><strong><i class="fas fa-check-double"></i> APP SCORES</strong></p>
|
||||
<img id="app_icon" src="{% if not appstore_details.error %}{{appstore_details.icon}}{% elif icon_found %}/download/{{ md5 }}-icon.png{% else %}{% static 'img/no_icon.png' %}{% endif %}"/>
|
||||
<img id="app_icon" src="{% if not appstore_details.error %}{{appstore_details.icon}}{% elif icon_path %}/download/{{ icon_path }}{% else %}{% static 'img/no_icon.png' %}{% endif %}"/>
|
||||
<p>
|
||||
{% if average_cvss %}
|
||||
<span class="badge bg-info">Average CVSS</span> <strong>{{ average_cvss }} </strong><br/>
|
||||
@@ -257,7 +257,7 @@
|
||||
<span class="badge bg-success">Trackers Detection</span> <strong>{{ trackers.detected_trackers }}/{{ trackers.total_trackers }}</strong><br/>
|
||||
{% endif %}
|
||||
</p>
|
||||
<p> <a href="../appsec_dashboard/{{ md5 }}/" class="btn btn-outline-primary btn-sm" role="button"><i class="fas fa-user-shield"></i> MobSF Scorecard</a></p>
|
||||
<p> <a href="{% url 'appsec_dashboard' checksum=md5 %}" class="btn btn-outline-primary btn-sm" role="button"><i class="fas fa-user-shield"></i> MobSF Scorecard</a></p>
|
||||
</div>
|
||||
|
||||
<div class="col-5">
|
||||
@@ -367,7 +367,7 @@
|
||||
<strong><i class="fas fa-cog"></i> SCAN OPTIONS</strong>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="../static_analyzer_ios/?checksum={{ md5 }}&name={{ file_name }}&type=ios&rescan=1" class="btn btn-info" role="button"><i class="fa fa-sync"></i> Rescan</a>
|
||||
<a href="{% url 'static_analyzer_ios' checksum=md5 %}?rescan=1" class="btn btn-info" role="button"><i class="fa fa-sync"></i> Rescan</a>
|
||||
<a id="supbtn" onclick="list_suppressions()" role="button" class="btn btn-primary" data-target="#sup_list" data-toggle="modal" href="#"><i class="fa fa-list"></i> Manage Suppressions</a>
|
||||
<a data-target="#mplist" role="button" class="btn btn-primary" data-toggle="modal" href="#"><i class="fa fa-list"></i> View Info.plist</a>
|
||||
</p>
|
||||
@@ -522,7 +522,7 @@
|
||||
</td>
|
||||
<td>
|
||||
{% for file_path, lines in details.files.items %}
|
||||
<a href="../view_file_ios/?file={{ file_path }}&md5={{ md5 }}&type=ios&lines={{ lines }}"> {{ file_path }}</a>
|
||||
<a href="{% url 'view_file_ios' %}?file={{ file_path }}&md5={{ md5 }}&type=ios&lines={{ lines }}"> {{ file_path }}</a>
|
||||
</br>
|
||||
{% endfor %}
|
||||
</td>
|
||||
@@ -746,7 +746,7 @@
|
||||
</td>
|
||||
<td>
|
||||
{% for file_path, lines in details.files.items %}
|
||||
<a href="../view_file_ios/?file={{ file_path }}&md5={{ md5 }}&type=ios&lines={{ lines }}"> {{ file_path }}</a>
|
||||
<a href="{% url 'view_file_ios' %}?file={{ file_path }}&md5={{ md5 }}&type=ios&lines={{ lines }}"> {{ file_path }}</a>
|
||||
</br>
|
||||
{% endfor %}
|
||||
</td>
|
||||
@@ -809,7 +809,7 @@
|
||||
<td>
|
||||
{% for file in item.files %}
|
||||
{% if file.type %}
|
||||
<a href="../view_file_ios/?file={{file.file_path}}&type={{file.type}}&md5={{file.hash}}">{{ file.file_path }}</a>
|
||||
<a href="{% url 'view_file_ios' %}?file={{file.file_path}}&type={{file.type}}&md5={{file.hash}}">{{ file.file_path }}</a>
|
||||
{% else %}
|
||||
{{ file.file_path }}
|
||||
{% endif %}
|
||||
@@ -978,7 +978,7 @@
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="../view_file_ios/?file={{urldict|key:"path"}}&md5={{ md5}}&type=ios">{{urldict|key:"path"}}</a>
|
||||
<a href="{% url 'view_file_ios' %}?file={{urldict|key:"path"}}&md5={{ md5}}&type=ios">{{urldict|key:"path"}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -1069,7 +1069,7 @@
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="../view_file_ios/?file={{email_dict|key:"path"}}&md5={{ md5}}&type=ios">{{email_dict|key:"path"}}</a>
|
||||
<a href="{% url 'view_file_ios' %}?file={{email_dict|key:"path"}}&md5={{ md5}}&type=ios">{{email_dict|key:"path"}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -1279,6 +1279,10 @@
|
||||
</script>
|
||||
<script src="{% static "others/js/suppression.js" %}"></script>
|
||||
<script>
|
||||
|
||||
// Remove rescan parameter
|
||||
window.history.replaceState({}, '', window.location.pathname);
|
||||
|
||||
// Globals
|
||||
const csrf = '{{ csrf_token }}'
|
||||
const pkg = '{{ bundle_id }}'
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="../pdf/?md5={{ md5 }}" class="nav-link">
|
||||
<a href="{% url "pdf" checksum=md5 %}" class="nav-link">
|
||||
<i class="nav-icon fas fa-file-pdf"></i>
|
||||
<p>
|
||||
PDF Report
|
||||
@@ -203,7 +203,7 @@
|
||||
<strong><i class="fas fa-cog"></i> SCAN OPTIONS</strong>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="../static_analyzer_windows/?checksum={{ md5 }}&name={{ file_name }}&type=appx&rescan=1" class="btn btn-info" role="button"><i class="fa fa-sync"></i> Rescan</a>
|
||||
<a href="{% url 'static_analyzer_windows' checksum=md5 %}?rescan=1" class="btn btn-info" role="button"><i class="fa fa-sync"></i> Rescan</a>
|
||||
<a href="#" data-target="#mstrings" role="button" class="btn btn-primary" data-toggle="modal"><i class="fa fa-list"></i> View Strings</a>
|
||||
</p>
|
||||
</div>
|
||||
@@ -390,6 +390,10 @@
|
||||
<script src="{% static "adminlte/plugins/datatables/jquery.dataTables.min.js" %} "></script>
|
||||
<script src="{% static "adminlte/plugins/datatables-bs4/dataTables.bootstrap4.min.js" %}"></script>
|
||||
<script>
|
||||
|
||||
// Remove rescan parameter
|
||||
window.history.replaceState({}, '', window.location.pathname);
|
||||
|
||||
$(function () {
|
||||
// Datatable
|
||||
$('table').DataTable({
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "mobsf"
|
||||
version = "3.7.7"
|
||||
version = "3.7.8"
|
||||
description = "Mobile Security Framework (MobSF) is an automated, all-in-one mobile application (Android/iOS/Windows) pen-testing, malware analysis and security assessment framework capable of performing static and dynamic analysis."
|
||||
keywords = ["mobsf", "mobile security framework", "mobile security", "security tool", "static analysis", "dynamic analysis", "malware analysis"]
|
||||
authors = ["Ajin Abraham <[email protected]>"]
|
||||
|
||||
Reference in New Issue
Block a user