Templates and Static Reporting UI
Overview
The MobSF server-rendered UI lives under mobsf/templates/** and uses Django templates plus bundled assets from mobsf/static/**. Most authenticated pages extend mobsf/…/base_layout.html, which provides the AdminLTE shell, common navbar, sidebar/content blocks, footer version text, scan-log modal block, and baseline static dependencies: jQuery, jQuery UI, Bootstrap, OverlayScrollbars, AdminLTE, Font Awesome, and theme includes from mobsf/…/theme_head.html, mobsf/…/theme_body.html, mobsf/…/theme_toggle.html, and mobsf/…/theme_toggle_button.html. mobsf/…/nav.html is the cross-page navigation contract: it links to recent scans, static analyzer upload, dynamic analyzer, API docs, donation/about pages, authenticated account actions, staff-only user management, and the global /search form.
mobsf/…/home.html is the static-analysis upload entry page rather than an AdminLTE child page. It includes the landing nav/footer partials in mobsf/templates/general/includes/, renders the drag/drop upload form, and drives the upload/scan handoff in inline JavaScript: uploads POST with CSRF, successful responses contain analyzer and hash, synchronous scans poll {% url "status" %}, and asynchronous scans redirect after queueing. Related general pages use the shared layout: mobsf/…/recent.html lists completed and incomplete scans with report/download/delete actions, mobsf/…/tasks.html polls {% url 'list_tasks' %} every five seconds for queued/running/completed scan state, mobsf/…/view.html renders source/database/file previews with Prism highlighting and line paging, and mobsf/…/apidocs.html is the server-rendered API reference. Error pages (mobsf/…/403.html, mobsf/…/404.html, mobsf/…/500.html) and auth pages (mobsf/…/login.html, mobsf/…/register.html, mobsf/…/change_password.html, mobsf/…/users.html) are template-only fronts for Django auth/account flows; the login page conditionally exposes password login and SSO based on allow_pwd and sso context values.
Static-analysis report pages are long Django templates in mobsf/templates/static_analysis/. android_binary_analysis.html, android_source_analysis.html, ios_binary_analysis.html, ios_source_analysis.html, and windows_binary_analysis.html render the analyzer contexts produced by the static analyzer flows into sidebars and report sections. Their sidebars are also the report table of contents: Android reports group app/file information, scan options, signing/permissions/API/component data, security findings, malware/recon sections, strings/files, PDF and print links; iOS reports map the same pattern to code signing, URL schemes, transport security, dylib/framework/static-library analysis, and App Store metadata; Windows reports map to package signature, manifest/capabilities, PE/binary analysis, malware lookup, URL/email/tracker/secrets/strings/files sections. These pages expect dense context dictionaries (appsec, virus_total, trackers, js_analysis, URL/email/domain lists, component lists, app metadata, hashes, and analyzer-specific findings) and mostly display them directly with conditional blocks. mobsf/…/source_tree.html and mobsf/…/compare.html support source browsing and scan comparison, while mobsf/…/appsec_dashboard.html and mobsf/…/appsec_finding.html expose application-security score/finding views.
PDF reports are separate standalone HTML documents in mobsf/…/android_report.html, mobsf/…/ios_report.html, and mobsf/…/windows_report.html, with mobsf/…/windows_pe_row.html as a row partial. They do not extend base/base_layout.html; instead they define full HTML documents for the PDF renderer, load mobsf/…/pdf_report.css, and use absolute {{ base_url }}{% static ... %} URLs for fonts, Font Awesome glyph fonts, logos, and fallback app icons. The PDF templates reuse the same analyzer context concepts as the HTML reports but flatten them into print-safe tables, severity summaries, app/file metadata, and finding sections.
Dynamic-analysis UI is split by platform under mobsf/templates/dynamic_analysis/. mobsf/…/dynamic_analysis.html is the Android device/app selection page: it shows connected devices, installed apps, static scans available for dynamic setup, runtime warnings, and forms that submit through the NDJSON progress helper in mobsf/…/dyn_progress.js. mobsf/…/dynamic_analyzer.html is the live Android session console, with buttons for screen streaming, root CA/proxy control, TLS tests, exported/activity testers, dependencies, screenshots, logcat, live web traffic, live API monitor, and report generation. mobsf/…/dynamic_report.html renders captured dynamic results such as API monitor output, TLS/exported activity tests, screenshots, runtime dependencies, URLs/emails/trackers/base64 strings, SQLite/XML/other files, and malware/domain sections. The Android dynamic helpers logcat.html, frida_logs.html, httptools.html, and live_api.html are focused live-data views.
The iOS dynamic templates follow the same split. mobsf/…/dynamic_analysis.html manages Corellium VM lifecycle and installable apps; mobsf/…/dynamic_analyzer.html renders the live iOS session, screen interaction, and instrumentation console; mobsf/…/dynamic_report.html renders captured findings. The mobsf/templates/dynamic_analysis/ios/device/ variants mirror this for a device-oriented iOS flow. mobsf/…/api_monitor.html and system_logs.html expose live API and system log views. Live dynamic analyzer pages use mobsf/…/safe_text.js so untrusted log messages are appended to textareas without parsing as HTML, and iOS screen interaction uses mobsf/…/swipe.js to translate pointer/touch gestures into directional commands.
The custom static assets in mobsf/static/others/ are the important non-vendor glue. mobsf/…/report.css optimizes large report pages with content-visibility, compact report cards, report action rows, sidebar count styling, text clamps, tooltip styles, exported-component strips, domain rows, score/risk widgets, and dark-mode adjustments. mobsf/…/lazy_load.js supports those pages by lazily loading scripts, initializing callbacks when sections enter the viewport, expanding deferred <template> content, marking empty tables, adding sidebar row-count badges, clamping long URL/email cells, preserving anchor jumps while lazy layout settles, and wiring binary check-cell expansion. mobsf/…/datatables_init.js establishes shared DataTables defaults and defers table initialization until visible; its PDF export button lazy-loads mobsf/…/pdfmake.min.js and vfs_fonts.js. mobsf/…/suppression.js is loaded by static report pages that expose code/manifest suppression management; it POSTs with CSRF to template-provided suppression endpoints and mutates the active DataTable after a successful suppression. mobsf/…/pdf_report.css, spinner.css, terminal.css, and dyn_progress.css style PDF output, upload/loading overlays, terminal-like logs, and dynamic-analysis progress panels.
Most other mobsf/static/** content is vendored or static media used by these templates: AdminLTE, Bootstrap, jQuery, Font Awesome webfonts, DataTables, CodeMirror, PrismJS, jsTree, Chart.js, amCharts maps, fonts, logos, favicon, and fallback mobsf/…/no_icon.png. The templates load these assets directly with {% static %} rather than through a frontend bundler, so dependency order is expressed by script/link order inside the templates.
Coupling
- If a Django view changes a route name used in navigation or report actions, update the corresponding
{% url %}calls in mobsf/…/nav.html, mobsf/…/home.html, mobsf/…/recent.html, static report templates such as mobsf/…/android_binary_analysis.html, and dynamic templates such as mobsf/…/dynamic_analyzer.html; these links are template-rendered and will fail at render time or send users to the wrong flow. - If static analyzer context keys or shapes change, update both the HTML report templates in
mobsf/templates/static_analysis/and matching PDF templates inmobsf/templates/pdf/. For example, app score/severity data displayed fromappsec, tracker counts fromtrackers, VirusTotal status fromvirus_total, and JS hybrid data fromjs_analysisappear in multiple Android/iOS HTML/PDF templates, so changing only one output path creates mismatched UI and exported reports. - If table markup on report pages changes, verify mobsf/…/lazy_load.js, mobsf/…/datatables_init.js, and mobsf/…/report.css together. lazy_load.js assumes report tables are not nested and not inside modals, annotates empty tables via
dataset.empty, computes sidebar counts from rendered<tbody>rows, and callsmobsfPrepareTable()before datatables_init.js initializes visible tables. - If suppression endpoints, payloads, or permission behavior change, update the inline variables and button wiring in mobsf/…/android_binary_analysis.html, android_source_analysis.html, ios_binary_analysis.html, and ios_source_analysis.html along with mobsf/…/suppression.js; the script relies on template-provided globals such as
csrf,hash,pkg,list_suppressions_url,delete_suppression_url, and suppression endpoint URLs. - If dynamic-analysis progress responses change, verify forms in mobsf/…/dynamic_analysis.html and mobsf/…/android_binary_analysis.html against mobsf/…/dyn_progress.js. The helper expects either an HTML response or
Content-Typecontainingndjsonwith newline-delimitedlog,done, orerrorobjects, and it sendsX-MobSF-Progress: 1. - If untrusted logs or device output are added to dynamic analyzer pages, use
appendText()from mobsf/…/safe_text.js rather than jQuery.append(string). Existing Android/iOS dynamic analyzer templates append API monitor, TLS, MobSFy, and runtime messages this way to avoid parsing log text as HTML. - If PDF rendering or asset hosting changes, verify the standalone PDF templates under
mobsf/templates/pdf/and mobsf/…/pdf_report.css: the PDF pages use{{ base_url }}{% static ... %}for CSS, fonts, Font Awesome glyphs, and images, while app icons may use download-directory paths such as{{ dwd_dir }}{{ icon_path }}.
Risks
- mobsf/…/android_binary_analysis.html, android_source_analysis.html, ios_binary_analysis.html, ios_source_analysis.html, and mobsf/…/*report.html are very large server-rendered pages that depend on mobsf/…/lazy_load.js and mobsf/…/datatables_init.js for performance. If new report sections bypass
<section class="content">, omit stable anchor IDs, or nest report tables unexpectedly, sidebar counts, active-section highlighting, empty-table replacement, and deferred DataTables initialization can break or make reports slow. - mobsf/…/base_layout.html globally applies
body { zoom: 0.8; }and compensating height calculations for AdminLTE layout. If the shared layout, AdminLTE sizing, or fixed navbar/sidebar behavior changes without revisiting those calculations, pages can render with short sidebars/footers or modal backdrops at the wrong size. - mobsf/…/suppression.js builds some modal HTML and data attributes from rule/file names after escaping. If new suppression fields are interpolated without
escapeHtml()in this script or the corresponding static report templates, a finding value from analyzer output could become executable markup in the suppression UI.