Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.1.8 #2448

Merged
merged 10 commits into from
Nov 10, 2024
Merged

4.1.8 #2448

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions mobsf/MalwareAnalyzer/views/android/apkid.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf_8 -*-
import logging
import os
from pathlib import Path

from django.conf import settings

Expand All @@ -24,9 +24,6 @@ def apkid_analysis(checksum, apk_file):
logger.error(msg)
append_scan_status(checksum, msg, repr(exp))
return {}
if not os.path.exists(apk_file):
logger.error('APKiD - APK not found')
return {}

apkid_ver = apkid.__version__
from apkid.apkid import Scanner, Options
Expand Down Expand Up @@ -87,5 +84,7 @@ def apkid_analysis(checksum, apk_file):
filename = item['filename']
if '!' in filename:
filename = filename.split('!', 1)[1]
else:
filename = Path(filename).name
sanitized[filename] = item['matches']
return sanitized
2 changes: 1 addition & 1 deletion mobsf/MobSF/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

logger = logging.getLogger(__name__)

VERSION = '4.1.7'
VERSION = '4.1.8'
BANNER = r"""
__ __ _ ____ _____ _ _ _
| \/ | ___ | |__/ ___|| ___|_ _| || | / |
Expand Down
5 changes: 3 additions & 2 deletions mobsf/MobSF/tools_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

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


Expand All @@ -41,7 +42,7 @@ def download_file(url, file_path):
# Print progress
if file_size > 0:
done = int(50 * downloaded / file_size)
fmt = (f'\r[{"#" * done}{"-" * (50-done)}] '
fmt = (f'\r[{"#" * done}{"-" * (50 - done)}] '
f'{downloaded * 100 / file_size:.2f}%')
sys.stdout.write(fmt)
sys.stdout.flush()
Expand Down
5 changes: 5 additions & 0 deletions mobsf/MobSF/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,11 @@ def replace(value, arg):
return value.replace(what, to)


def pathify(value):
"""Convert to path."""
return value.replace('.', '/')


def relative_path(value):
"""Show relative path to two parents."""
sep = None
Expand Down
2 changes: 2 additions & 0 deletions mobsf/StaticAnalyzer/views/android/static_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
is_file_exists,
is_md5,
key,
pathify,
print_n_send_error_response,
relative_path,
)
Expand Down Expand Up @@ -107,6 +108,7 @@
register.filter('key', key)
register.filter('android_component', android_component)
register.filter('relative_path', relative_path)
register.filter('pathify', pathify)


@login_required
Expand Down
8 changes: 8 additions & 0 deletions mobsf/templates/base/list_href.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% if list|length != 0 %}
<details {% if list|length < limit %}open{% endif %}>
<summary>{% if list|length < limit %}Showing{% else %}Show{% endif %} all <strong>{{ list | length }}</strong> {{ type }}</summary>
{% for val in list %}
<a href="{% url "view_source" %}?file={{ val | pathify }}.java&amp;md5={{ md5 }}&amp;type={{app_type}}"> {{ val }}</a><br/>
{% endfor %}
</details>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ <h3 class="card-title">Android Runtime not found!</h3>
<h4>MobSF Dynamic Analyzer Supports</h4>
<h5>
<strong>• Genymotion Android VM</strong> version 4.1 - 11.0 (arm64, x86, upto API 30)<br/>
<strong>• Android Emulator AVD</strong> (non production) version 5.0 - 9.0 (arm, arm64, x86, and x86_64 upto API 28)<br/>
<strong>• Android Emulator AVD</strong> (non production) version 5.0 - 11.0 (arm, arm64, x86, and x86_64 upto API 30)<br/>
<strong>• Corellium Android VM</strong> (userdebug builds) version 7.1.2 - 11.0 (arm64 upto API 30)
</h5>
<p>
{% if android_version %}
Android version >= <strong>9.0</strong> recommended<br/>
Detected Android Version: <strong>{{android_version}}</strong>, SDK: <strong>{{ android_sdk }}</strong> <br/>
Detected Android Version: <strong>{{android_version}}</strong>, SDK: API level <strong>{{ android_sdk }}</strong> <br/>
{% if android_sdk|floatformat > android_supported|floatformat %}
<script src="{% static "adminlte/plugins/sweetalert2/sweetalert2.min.js" %}"></script>
<script>
Expand Down
89 changes: 16 additions & 73 deletions mobsf/templates/static_analysis/android_binary_analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -529,119 +529,62 @@ <h5 class="card-title"></h5>
<!-- small box -->
<div class="small-box bg-info">
<div class="inner">
<h3>{{ activities | length }}</h3>
<h3> {{ exported_count.exported_activities }} / {{ activities | length }}</h3>

<p>ACTIVITIES</p>
<p>EXPORTED ACTIVITIES</p>
</div>
<div class="icon">
<i class="fa fa-language"></i>
</div>
<a href="#activities" class="small-box-footer">View <i class="fas fa-arrow-circle-down"></i></a>
<a href="#activities" class="small-box-footer">View All <i class="fas fa-arrow-circle-down"></i></a>
</div>
</div>
<!-- ./col -->
<div class="col-12 col-sm-6 col-md-3">
<!-- small box -->
<div class="small-box bg-success">
<div class="inner">
<h3>{{ services | length }}</h3>
<h3>{{ exported_count.exported_services }} / {{ services | length }}</h3>

<p>SERVICES</p>
<p>EXPORTED SERVICES</p>
</div>
<div class="icon">
<i class="fa fa-cogs"></i>
</div>
<a href="#services" class="small-box-footer">View <i class="fas fa-arrow-circle-down"></i></a>
<a href="#services" class="small-box-footer">View All <i class="fas fa-arrow-circle-down"></i></a>
</div>
</div>
<!-- ./col -->
<div class="col-12 col-sm-6 col-md-3">
<!-- small box -->
<div class="small-box bg-warning">
<div class="inner">
<h3>{{ receivers | length }}</h3>
<h3>{{ exported_count.exported_receivers }} / {{ receivers | length }}</h3>

<p>RECEIVERS</p>
<p>EXPORTED RECEIVERS</p>
</div>
<div class="icon">
<i class="fa fa-assistive-listening-systems"></i>
</div>
<a href="#receivers" class="small-box-footer">View <i class="fas fa-arrow-circle-down"></i></a>
<a href="#receivers" class="small-box-footer">View All <i class="fas fa-arrow-circle-down"></i></a>
</div>
</div>
<!-- ./col -->
<div class="col-12 col-sm-6 col-md-3">
<!-- small box -->
<div class="small-box bg-danger">
<div class="inner">
<h3>{{ providers | length }}</h3>
<h3>{{exported_count.exported_providers}} / {{ providers | length }}</h3>

<p>PROVIDERS</p>
<p>EXPORTED PROVIDERS</p>
</div>
<div class="icon">
<i class="fa fa-database"></i>
</div>
<a href="#providers" class="small-box-footer">View <i class="fas fa-arrow-circle-down"></i></a>
<a href="#providers" class="small-box-footer">View All <i class="fas fa-arrow-circle-down"></i></a>
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
<div class="col-12 col-sm-6 col-md-3">
<div class="info-box">
<span class="info-box-icon bg-info elevation-1"><i class="fas fa-language"></i></span>

<div class="info-box-content">
<span class="info-box-text">Exported <br/>Activities</span>
<span class="info-box-number">
{{ exported_count.exported_activities }}
</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<!-- /.col -->
<div class="col-12 col-sm-6 col-md-3">
<div class="info-box mb-3">
<span class="info-box-icon bg-success elevation-1"><i class="fas fa-cogs"></i></span>

<div class="info-box-content">
<span class="info-box-text">Exported <br/>Services</span>
<span class="info-box-number">{{ exported_count.exported_services }}</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<!-- /.col -->

<!-- fix for small devices only -->
<div class="clearfix hidden-md-up"></div>

<div class="col-12 col-sm-6 col-md-3">
<div class="info-box mb-3">
<span class="info-box-icon bg-warning elevation-1"><i class="fas fa-assistive-listening-systems"></i></span>

<div class="info-box-content">
<span class="info-box-text">Exported <br/>Receivers</span>
<span class="info-box-number">{{ exported_count.exported_receivers }}</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<!-- /.col -->
<div class="col-12 col-sm-6 col-md-3">
<div class="info-box mb-3">
<span class="info-box-icon bg-danger elevation-1"><i class="fas fa-database"></i></span>

<div class="info-box-content">
<span class="info-box-text">Exported <br/>Providers</span>
<span class="info-box-number">{{exported_count.exported_providers}}</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -2234,7 +2177,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
</p>
<div class="list-group">
<p>
{% include 'base/list.html' with list=activities type="activities" limit=50 %}
{% include 'base/list_href.html' with list=activities type="activities" limit=50 %}
</p>
</div>
</div>
Expand All @@ -2257,7 +2200,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
</p>
<div class="list-group">
<p>
{% include 'base/list.html' with list=services type="services" limit=50 %}
{% include 'base/list_href.html' with list=services type="services" limit=50 %}
</p>
</div>
</div>
Expand All @@ -2280,7 +2223,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
</p>
<div class="list-group">
<p>
{% include 'base/list.html' with list=receivers type="receivers" limit=50 %}
{% include 'base/list_href.html' with list=receivers type="receivers" limit=50 %}
</p>
</div>
</div>
Expand All @@ -2304,7 +2247,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
</p>
<div class="list-group">
<p>
{% include 'base/list.html' with list=providers type="providers" limit=50 %}
{% include 'base/list_href.html' with list=providers type="providers" limit=50 %}
</p>
</div>
</div>
Expand Down
Loading
Loading