Skip to content

Commit 70e243d

Browse files
authoredNov 10, 2024··
4.1.8 (#2448)
* APKID QA. * Bash and Batch file script QA. * Android Report template optimizations on how exported components are displayed. * Clickable Android Activities, Services, Providers and Recievers. * Updated Android version support to 11.0 for Android Studio AVD. * Created helper scripts for AVDs `scripts/start_avd.sh` and `scripts/start_avd.ps1`.
1 parent 76596e3 commit 70e243d

File tree

17 files changed

+498
-418
lines changed

17 files changed

+498
-418
lines changed
 

‎mobsf/MalwareAnalyzer/views/android/apkid.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf_8 -*-
22
import logging
3-
import os
3+
from pathlib import Path
44

55
from django.conf import settings
66

@@ -24,9 +24,6 @@ def apkid_analysis(checksum, apk_file):
2424
logger.error(msg)
2525
append_scan_status(checksum, msg, repr(exp))
2626
return {}
27-
if not os.path.exists(apk_file):
28-
logger.error('APKiD - APK not found')
29-
return {}
3027

3128
apkid_ver = apkid.__version__
3229
from apkid.apkid import Scanner, Options
@@ -87,5 +84,7 @@ def apkid_analysis(checksum, apk_file):
8784
filename = item['filename']
8885
if '!' in filename:
8986
filename = filename.split('!', 1)[1]
87+
else:
88+
filename = Path(filename).name
9089
sanitized[filename] = item['matches']
9190
return sanitized

‎mobsf/MobSF/init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
logger = logging.getLogger(__name__)
2020

21-
VERSION = '4.1.7'
21+
VERSION = '4.1.8'
2222
BANNER = r"""
2323
__ __ _ ____ _____ _ _ _
2424
| \/ | ___ | |__/ ___|| ___|_ _| || | / |

‎mobsf/MobSF/tools_download.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
logging.basicConfig(
1616
level=logging.INFO,
17-
format='%(asctime)s - %(levelname)s - %(message)s')
17+
format='[%(levelname)s] %(asctime)-15s - %(message)s',
18+
datefmt='%d/%b/%Y %H:%M:%S')
1819
logger = logging.getLogger(__name__)
1920

2021

@@ -41,7 +42,7 @@ def download_file(url, file_path):
4142
# Print progress
4243
if file_size > 0:
4344
done = int(50 * downloaded / file_size)
44-
fmt = (f'\r[{"#" * done}{"-" * (50-done)}] '
45+
fmt = (f'\r[{"#" * done}{"-" * (50 - done)}] '
4546
f'{downloaded * 100 / file_size:.2f}%')
4647
sys.stdout.write(fmt)
4748
sys.stdout.flush()

‎mobsf/MobSF/utils.py

+5
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,11 @@ def replace(value, arg):
752752
return value.replace(what, to)
753753

754754

755+
def pathify(value):
756+
"""Convert to path."""
757+
return value.replace('.', '/')
758+
759+
755760
def relative_path(value):
756761
"""Show relative path to two parents."""
757762
sep = None

‎mobsf/StaticAnalyzer/views/android/static_analyzer.py

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
is_file_exists,
2929
is_md5,
3030
key,
31+
pathify,
3132
print_n_send_error_response,
3233
relative_path,
3334
)
@@ -107,6 +108,7 @@
107108
register.filter('key', key)
108109
register.filter('android_component', android_component)
109110
register.filter('relative_path', relative_path)
111+
register.filter('pathify', pathify)
110112

111113

112114
@login_required

‎mobsf/templates/base/list_href.html

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% if list|length != 0 %}
2+
<details {% if list|length < limit %}open{% endif %}>
3+
<summary>{% if list|length < limit %}Showing{% else %}Show{% endif %} all <strong>{{ list | length }}</strong> {{ type }}</summary>
4+
{% for val in list %}
5+
<a href="{% url "view_source" %}?file={{ val | pathify }}.java&amp;md5={{ md5 }}&amp;type={{app_type}}"> {{ val }}</a><br/>
6+
{% endfor %}
7+
</details>
8+
{% endif %}

‎mobsf/templates/dynamic_analysis/android/dynamic_analysis.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ <h3 class="card-title">Android Runtime not found!</h3>
8989
<h4>MobSF Dynamic Analyzer Supports</h4>
9090
<h5>
9191
<strong>• Genymotion Android VM</strong> version 4.1 - 11.0 (arm64, x86, upto API 30)<br/>
92-
<strong>• Android Emulator AVD</strong> (non production) version 5.0 - 9.0 (arm, arm64, x86, and x86_64 upto API 28)<br/>
92+
<strong>• Android Emulator AVD</strong> (non production) version 5.0 - 11.0 (arm, arm64, x86, and x86_64 upto API 30)<br/>
9393
<strong>• Corellium Android VM</strong> (userdebug builds) version 7.1.2 - 11.0 (arm64 upto API 30)
9494
</h5>
9595
<p>
9696
{% if android_version %}
9797
Android version >= <strong>9.0</strong> recommended<br/>
98-
Detected Android Version: <strong>{{android_version}}</strong>, SDK: <strong>{{ android_sdk }}</strong> <br/>
98+
Detected Android Version: <strong>{{android_version}}</strong>, SDK: API level <strong>{{ android_sdk }}</strong> <br/>
9999
{% if android_sdk|floatformat > android_supported|floatformat %}
100100
<script src="{% static "adminlte/plugins/sweetalert2/sweetalert2.min.js" %}"></script>
101101
<script>

‎mobsf/templates/static_analysis/android_binary_analysis.html

+16-73
Original file line numberDiff line numberDiff line change
@@ -529,119 +529,62 @@ <h5 class="card-title"></h5>
529529
<!-- small box -->
530530
<div class="small-box bg-info">
531531
<div class="inner">
532-
<h3>{{ activities | length }}</h3>
532+
<h3> {{ exported_count.exported_activities }} / {{ activities | length }}</h3>
533533

534-
<p>ACTIVITIES</p>
534+
<p>EXPORTED ACTIVITIES</p>
535535
</div>
536536
<div class="icon">
537537
<i class="fa fa-language"></i>
538538
</div>
539-
<a href="#activities" class="small-box-footer">View <i class="fas fa-arrow-circle-down"></i></a>
539+
<a href="#activities" class="small-box-footer">View All <i class="fas fa-arrow-circle-down"></i></a>
540540
</div>
541541
</div>
542542
<!-- ./col -->
543543
<div class="col-12 col-sm-6 col-md-3">
544544
<!-- small box -->
545545
<div class="small-box bg-success">
546546
<div class="inner">
547-
<h3>{{ services | length }}</h3>
547+
<h3>{{ exported_count.exported_services }} / {{ services | length }}</h3>
548548

549-
<p>SERVICES</p>
549+
<p>EXPORTED SERVICES</p>
550550
</div>
551551
<div class="icon">
552552
<i class="fa fa-cogs"></i>
553553
</div>
554-
<a href="#services" class="small-box-footer">View <i class="fas fa-arrow-circle-down"></i></a>
554+
<a href="#services" class="small-box-footer">View All <i class="fas fa-arrow-circle-down"></i></a>
555555
</div>
556556
</div>
557557
<!-- ./col -->
558558
<div class="col-12 col-sm-6 col-md-3">
559559
<!-- small box -->
560560
<div class="small-box bg-warning">
561561
<div class="inner">
562-
<h3>{{ receivers | length }}</h3>
562+
<h3>{{ exported_count.exported_receivers }} / {{ receivers | length }}</h3>
563563

564-
<p>RECEIVERS</p>
564+
<p>EXPORTED RECEIVERS</p>
565565
</div>
566566
<div class="icon">
567567
<i class="fa fa-assistive-listening-systems"></i>
568568
</div>
569-
<a href="#receivers" class="small-box-footer">View <i class="fas fa-arrow-circle-down"></i></a>
569+
<a href="#receivers" class="small-box-footer">View All <i class="fas fa-arrow-circle-down"></i></a>
570570
</div>
571571
</div>
572572
<!-- ./col -->
573573
<div class="col-12 col-sm-6 col-md-3">
574574
<!-- small box -->
575575
<div class="small-box bg-danger">
576576
<div class="inner">
577-
<h3>{{ providers | length }}</h3>
577+
<h3>{{exported_count.exported_providers}} / {{ providers | length }}</h3>
578578

579-
<p>PROVIDERS</p>
579+
<p>EXPORTED PROVIDERS</p>
580580
</div>
581581
<div class="icon">
582582
<i class="fa fa-database"></i>
583583
</div>
584-
<a href="#providers" class="small-box-footer">View <i class="fas fa-arrow-circle-down"></i></a>
584+
<a href="#providers" class="small-box-footer">View All <i class="fas fa-arrow-circle-down"></i></a>
585585
</div>
586586
<!-- /.row -->
587587
</div><!-- /.container-fluid -->
588-
<div class="col-12 col-sm-6 col-md-3">
589-
<div class="info-box">
590-
<span class="info-box-icon bg-info elevation-1"><i class="fas fa-language"></i></span>
591-
592-
<div class="info-box-content">
593-
<span class="info-box-text">Exported <br/>Activities</span>
594-
<span class="info-box-number">
595-
{{ exported_count.exported_activities }}
596-
</span>
597-
</div>
598-
<!-- /.info-box-content -->
599-
</div>
600-
<!-- /.info-box -->
601-
</div>
602-
<!-- /.col -->
603-
<div class="col-12 col-sm-6 col-md-3">
604-
<div class="info-box mb-3">
605-
<span class="info-box-icon bg-success elevation-1"><i class="fas fa-cogs"></i></span>
606-
607-
<div class="info-box-content">
608-
<span class="info-box-text">Exported <br/>Services</span>
609-
<span class="info-box-number">{{ exported_count.exported_services }}</span>
610-
</div>
611-
<!-- /.info-box-content -->
612-
</div>
613-
<!-- /.info-box -->
614-
</div>
615-
<!-- /.col -->
616-
617-
<!-- fix for small devices only -->
618-
<div class="clearfix hidden-md-up"></div>
619-
620-
<div class="col-12 col-sm-6 col-md-3">
621-
<div class="info-box mb-3">
622-
<span class="info-box-icon bg-warning elevation-1"><i class="fas fa-assistive-listening-systems"></i></span>
623-
624-
<div class="info-box-content">
625-
<span class="info-box-text">Exported <br/>Receivers</span>
626-
<span class="info-box-number">{{ exported_count.exported_receivers }}</span>
627-
</div>
628-
<!-- /.info-box-content -->
629-
</div>
630-
<!-- /.info-box -->
631-
</div>
632-
<!-- /.col -->
633-
<div class="col-12 col-sm-6 col-md-3">
634-
<div class="info-box mb-3">
635-
<span class="info-box-icon bg-danger elevation-1"><i class="fas fa-database"></i></span>
636-
637-
<div class="info-box-content">
638-
<span class="info-box-text">Exported <br/>Providers</span>
639-
<span class="info-box-number">{{exported_count.exported_providers}}</span>
640-
</div>
641-
<!-- /.info-box-content -->
642-
</div>
643-
<!-- /.info-box -->
644-
</div>
645588
</div>
646589
</div>
647590
</div>
@@ -2234,7 +2177,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
22342177
</p>
22352178
<div class="list-group">
22362179
<p>
2237-
{% include 'base/list.html' with list=activities type="activities" limit=50 %}
2180+
{% include 'base/list_href.html' with list=activities type="activities" limit=50 %}
22382181
</p>
22392182
</div>
22402183
</div>
@@ -2257,7 +2200,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
22572200
</p>
22582201
<div class="list-group">
22592202
<p>
2260-
{% include 'base/list.html' with list=services type="services" limit=50 %}
2203+
{% include 'base/list_href.html' with list=services type="services" limit=50 %}
22612204
</p>
22622205
</div>
22632206
</div>
@@ -2280,7 +2223,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
22802223
</p>
22812224
<div class="list-group">
22822225
<p>
2283-
{% include 'base/list.html' with list=receivers type="receivers" limit=50 %}
2226+
{% include 'base/list_href.html' with list=receivers type="receivers" limit=50 %}
22842227
</p>
22852228
</div>
22862229
</div>
@@ -2304,7 +2247,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
23042247
</p>
23052248
<div class="list-group">
23062249
<p>
2307-
{% include 'base/list.html' with list=providers type="providers" limit=50 %}
2250+
{% include 'base/list_href.html' with list=providers type="providers" limit=50 %}
23082251
</p>
23092252
</div>
23102253
</div>

0 commit comments

Comments
 (0)
Please sign in to comment.