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

Optimize rendering of big lists #2351

Merged
merged 5 commits into from
Mar 22, 2024
Merged
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
9 changes: 9 additions & 0 deletions mobsf/templates/base/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- "strings" on big binaries can easily result in millions of hits, avoid rendering them unless needed: -->
{% 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 %}
{{ val }}<br/>
{% endfor %}
</details>
{% endif %}
81 changes: 20 additions & 61 deletions mobsf/templates/static_analysis/android_binary_analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -2118,11 +2118,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fas fa-key"></i> POSSIBLE HARDCODED SECRETS</strong>
</p>
<div class="list-group">
<p>
{% for val in secrets %}
{{ val }}<br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=secrets type="secrets" limit=100 %}
</div>
</div>
</div>
Expand All @@ -2145,41 +2141,24 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<div class="list-group">
{% if app_type not in 'so' %}
<p><strong>From APK Resource</strong></p>
<p>
{% for key, val in strings.items %}
{% if key == 'strings_apk_res' %}
{% for v in val %}
{{ v }}<br/>
{% endfor %}
{% endif %}
{% endfor %}
</p>
<p><strong>From Code</strong></p>
<p>
{% for key, val in strings.items %}
{% if key == 'strings_code' %}
{% for v in val %}
{{ v }}<br/>
{% endfor %}
{% endif %}
{% endfor %}
</p>
{% include 'base/list.html' with list=strings.strings_apk_res type="strings" limit=100 %}
<p></p><p><strong>From Code</strong></p>
{% include 'base/list.html' with list=strings.strings_code type="strings" limit=100 %}
{% endif %}
<p></p>
<p><strong>From Shared Objects</strong></p>
<p>
{% for key, val in strings.items %}
{% if key == 'strings_so' %}
{% for ls in val %}
{% for k,v in ls.items %}
<p></br><b><i>{{ k }}</i></b></p>
{% for i in v %}
{{ i }}<br/>
{% endfor %}
<p></br><strong><i>{{ k }}</i></strong></p>
<div class="list-group">
{% include 'base/list.html' with list=v type="strings" limit=5 %}
</div>
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
</p>
</div>
</div>
</div>
Expand All @@ -2201,11 +2180,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fa fa-th"></i> SYMBOLS</strong>
</p>
<div class="list-group">
<p>
{% for val in file_analysis %}
{{ val }}<br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=file_analysis type="symbols" limit=50 %}
</div>
</div>
</div>
Expand All @@ -2228,10 +2203,8 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fa fa-language"></i> ACTIVITIES</strong>
</p>
<div class="list-group">
<p>
{% for act in activities %}
{{ act}} <br/>
{% endfor %}
<p>
{% include 'base/list.html' with list=activities type="activities" limit=50 %}
</p>
</div>
</div>
Expand All @@ -2253,10 +2226,8 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fa fa-cogs"></i> SERVICES</strong>
</p>
<div class="list-group">
<p>
{% for srv in services %}
{{ srv}} <br/>
{% endfor %}
<p>
{% include 'base/list.html' with list=services type="services" limit=50 %}
</p>
</div>
</div>
Expand All @@ -2278,10 +2249,8 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fa fa-assistive-listening-systems"></i> RECEIVERS</strong>
</p>
<div class="list-group">
<p>
{% for rcv in receivers %}
{{ rcv}} <br/>
{% endfor %}
<p>
{% include 'base/list.html' with list=receivers type="receivers" limit=50 %}
</p>
</div>
</div>
Expand All @@ -2304,10 +2273,8 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fa fa-database"></i> PROVIDERS</strong>
</p>
<div class="list-group">
<p>
{% for prv in providers %}
{{ prv }} <br/>
{% endfor %}
<p>
{% include 'base/list.html' with list=providers type="providers" limit=50 %}
</p>
</div>
</div>
Expand All @@ -2329,11 +2296,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fab fa-buffer"></i> LIBRARIES</strong>
</p>
<div class="list-group">
<p>
{% for lib in libraries %}
{{ lib }} <br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=libraries type="libraries" limit=100 %}
</div>
</div>
</div>
Expand All @@ -2354,11 +2317,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="far fa-copy"></i> FILES</strong>
</p>
<div class="list-group">
<p>
{% for file in files %}
{{ file}} <br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=files type="files" limit=200 %}
</div>
</div>
</div>
Expand Down
52 changes: 8 additions & 44 deletions mobsf/templates/static_analysis/android_source_analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -1587,11 +1587,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fas fa-key"></i> POSSIBLE HARDCODED SECRETS</strong>
</p>
<div class="list-group">
<p>
{% for val in secrets %}
{{ val }}<br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=secrets type="secrets" limit=100 %}
</div>
</div>
</div>
Expand All @@ -1613,15 +1609,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
</p>
<div class="list-group">
<p><strong>From Code</strong></p>
<p>
{% for key, val in strings.items %}
{% if key == 'strings_code' %}
{% for v in val %}
{{ v }}<br/>
{% endfor %}
{% endif %}
{% endfor %}
</p>
{% include 'base/list.html' with list=strings.strings_code type="strings" limit=100 %}
</div>
</div>
</div>
Expand All @@ -1642,11 +1630,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fa fa-language"></i> ACTIVITIES</strong>
</p>
<div class="list-group">
<p>
{% for act in activities %}
{{ act}} <br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=activities type="activities" limit=50 %}
</div>
</div>
</div>
Expand All @@ -1667,11 +1651,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fa fa-cogs"></i> SERVICES</strong>
</p>
<div class="list-group">
<p>
{% for srv in services %}
{{ srv}} <br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=services type="services" limit=50 %}
</div>
</div>
</div>
Expand All @@ -1692,11 +1672,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fa fa-assistive-listening-systems"></i> RECEIVERS</strong>
</p>
<div class="list-group">
<p>
{% for rcv in receivers %}
{{ rcv}} <br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=receivers type="receivers" limit=50%}
</div>
</div>
</div>
Expand All @@ -1718,11 +1694,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fa fa-database"></i> PROVIDERS</strong>
</p>
<div class="list-group">
<p>
{% for prv in providers %}
{{ prv }} <br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=providers type="providers" limit=50 %}
</div>
</div>
</div>
Expand All @@ -1743,11 +1715,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="fab fa-buffer"></i> LIBRARIES</strong>
</p>
<div class="list-group">
<p>
{% for lib in libraries %}
{{ lib }} <br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=libraries type="libraries" limit=50 %}
</div>
</div>
</div>
Expand All @@ -1768,11 +1736,7 @@ <h5 class="description-header">{{ code_analysis.summary.suppressed }}</h5>
<strong><i class="far fa-copy"></i> FILES</strong>
</p>
<div class="list-group">
<p>
{% for file in files %}
{{ file}} <br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=files type="files" limit=200 %}
</div>
</div>
</div>
Expand Down
55 changes: 29 additions & 26 deletions mobsf/templates/static_analysis/ios_binary_analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -1185,14 +1185,36 @@ <h5 class="description-header">{{ binary_analysis.summary.suppressed }}</h5>
{{ item.issue }}
</td>
<td>
{% for file in item.files %}
{% if item.files|length < 4 %}
{% for file in item.files %}
<small>
{% if file.type %}
<a href="{% url 'view_file_ios' %}?file={{file.file_path}}&amp;type={{file.type}}&amp;md5={{file.hash}}">{{ file.file_path }}</a>
{% else %}
{{ file.file_path }}
{% endif %}
<br/>
</small>
</br>
{% endfor %}
{% else %}
<a class="btn btn-primary btn-xs" data-toggle="collapse" href="#collapsefiles{{forloop.counter}}" role="button" aria-expanded="false" aria-controls="collapsefiles{{forloop.counter}}">
Show Files
</a>
<div class="collapse" id="collapsefiles{{forloop.counter}}">
{% for file in item.files %}
<small>
{% if file.type %}
<a href="{% url 'view_file_ios' %}?file={{file.file_path}}&amp;type={{file.type}}&amp;md5={{file.hash}}">{{ file.file_path }}</a>
{% else %}
{{ file.file_path }}
{% endif %}
</small>
</br>
{% endfor %}
</div>
{% endif %}


</td>

</tr>
Expand Down Expand Up @@ -1572,11 +1594,7 @@ <h5 class="description-header">{{ binary_analysis.summary.suppressed }}</h5>
<strong><i class="fas fa-key"></i> POSSIBLE HARDCODED SECRETS</strong>
</p>
<div class="list-group">
<p>
{% for val in secrets %}
{{ val }}<br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=secrets type="secrets" limit=100 %}
</div>
</div>
</div>
Expand All @@ -1597,9 +1615,7 @@ <h5 class="description-header">{{ binary_analysis.summary.suppressed }}</h5>
<strong><i class="fas fa-font"></i> STRINGS</strong>
</p>
<div class="list-group">
{% for string in strings %}
{{string}} <br>
{% endfor %}
{% include 'base/list.html' with list=strings type="strings" limit=100 %}
</div>
</div>
</div>
Expand All @@ -1621,11 +1637,7 @@ <h5 class="description-header">{{ binary_analysis.summary.suppressed }}</h5>
<strong><i class="fa fa-th"></i> SYMBOLS</strong>
</p>
<div class="list-group">
<p>
{% for val in file_analysis %}
{{ val }}<br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=file_analysis type="symbols" limit=100 %}
</div>
</div>
</div>
Expand All @@ -1648,12 +1660,7 @@ <h5 class="description-header">{{ binary_analysis.summary.suppressed }}</h5>
<strong><i class="fab fa-buffer"></i> LIBRARIES</strong>
</p>
<div class="list-group">
<p>
{% for lib in libraries %}
{{ lib }}
<br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=libraries type="libraries" limit=100 %}
</div>
</div>
</div>
Expand All @@ -1674,11 +1681,7 @@ <h5 class="description-header">{{ binary_analysis.summary.suppressed }}</h5>
<strong><i class="far fa-copy"></i> FILES</strong>
</p>
<div class="list-group">
<p>
{% for file in files %}
{{ file}} <br/>
{% endfor %}
</p>
{% include 'base/list.html' with list=files type="files" limit=200 %}
</div>
</div>
</div>
Expand Down
Loading
Loading