How to Customize the Flask Web Interface of Maigret: Complete Guide

You can customize the Maigret Flask web interface by editing templates in maigret/web/templates/, modifying CSS in static/style.css, extending routes in maigret/web/app.py, and registering new Blueprints for complex features—all without touching the core username enumeration engine.

The Maigret project by soxoj provides a lightweight Flask-based web UI for running username investigations through the browser. This interface is fully customizable because it follows standard Flask application patterns, allowing you to rebrand the appearance, add new input fields, or create entirely new pages while keeping the powerful run_maigret engine untouched.

Modify the Look and Feel

The visual styling of the Maigret web interface is controlled through standard CSS and static assets located in the web package.

Edit CSS Stylesheets

All styling rules reside in maigret/web/static/style.css. You can override colors, fonts, and layout rules or introduce new classes for custom components.

/* maigret/web/static/style.css - Custom color scheme */
body {
    background-color: #f0f4f8;
    font-family: "Roboto", sans-serif;
}
h1 {
    color: #2c3e50;
}

Replace Static Assets

To swap the logo or add images, place your files in maigret/web/static/ and reference them using Flask's url_for helper in templates:

<img src="{{ url_for('static', filename='logo.png') }}" alt="My Maigret">

Customize HTML Templates

Templates use Jinja2 syntax and are stored in maigret/web/templates/. The main files include base.html for the layout wrapper, index.html for the search form, and results.html for displaying findings.

Add Form Fields to the Search Page

To collect additional user input, modify index.html to include new form elements before the submit button:

<!-- maigret/web/templates/index.html -->
<form action="{{ url_for('search') }}" method="post">
    <input type="text" name="username" placeholder="Username" required>
    <input type="text" name="site_filter"
           placeholder="Comma-separated sites (optional)">
    <button type="submit">Search</button>
</form>

Extend the Results Display

The results.html template receives a results dictionary from the route. You can extend the table to show additional data fields by adding new table cells:

{% for site, data in results.items() %}
<tr>
    <td>{{ site }}</td>
    <td>{{ data.status }}</td>
    <td>{{ data.url or "—" }}</td>
    <td>{{ data.last_checked|default("—") }}</td>
</tr>
{% endfor %}

Extend Flask Routes and Logic

All URL routing and view logic is defined in maigret/web/app.py. You can add simple routes or organize complex features using Flask Blueprints.

Add Custom Routes in app.py

Create new endpoints by adding view functions with the @app.route decorator. Import maigret to access version info or other package data:


# maigret/web/app.py

from flask import render_template
import maigret

@app.route("/about")
def about():
    return render_template("about.html", version=maigret.__version__)

Create the corresponding templates/about.html file extending base.html and filling the {% block content %} section.

Organize Features with Blueprints

For larger customizations, use a Blueprint to keep code modular. Create a separate file and register it in the main application:


# maigret/web/custom_ui.py

from flask import Blueprint, render_template

custom_bp = Blueprint("custom_ui", __name__, template_folder="templates")

@custom_bp.route("/stats")
def stats():
    return render_template("stats.html")

Register the blueprint in app.py:


# maigret/web/app.py

from .custom_ui import custom_bp
app.register_blueprint(custom_bp, url_prefix="/ui")

This makes the new page accessible at /ui/stats.

Configure Flask Settings

The Flask application configuration can be modified to change runtime behavior, security settings, and network binding.

Debug Mode and Secret Keys

Adjust settings in maigret/web/app.py or use environment variables. Never use hardcoded secrets in production:


# maigret/web/app.py

app.config["DEBUG"] = True
app.config["SECRET_KEY"] = "replace-with-your-own-random-string"

Change Host and Port

Modify the development server parameters in the main execution block:

if __name__ == "__main__":
    app.run(host="127.0.0.1", port=8080)

When launching via the CLI (maigret --web), the default is 0.0.0.0:5000 as defined in maigret/__main__.py.

Full Example: Adding Site Filtering

This end-to-end example demonstrates adding an optional site filter field that limits the enumeration to specific services.

Update the template in maigret/web/templates/index.html:

{% extends "base.html" %}
{% block content %}
<h2>Maigret – Username Search</h2>
<form action="{{ url_for('search') }}" method="post">
    <input type="text" name="username" placeholder="Enter username" required>
    <input type="text" name="site_filter"
           placeholder="Only these sites (comma-separated, optional)">
    <button type="submit">Search</button>
</form>
{% endblock %}

Modify the search route in maigret/web/app.py to process the new parameter:

from flask import Flask, render_template, request
from maigret.maigret import run_maigret

@app.route("/search", methods=["POST"])
def search():
    username = request.form["username"]
    raw_filter = request.form.get("site_filter", "")
    site_filter = [s.strip() for s in raw_filter.split(",") if s.strip()]
    results = run_maigret(username, sites=site_filter)
    return render_template("results.html", results=results, query=username)

Add styling in maigret/web/static/style.css:

input[name="site_filter"] {
    margin-top: 0.5rem;
    background-color: #e8f0fe;
}

Now users can enter john_doe with an optional filter like github, twitter to limit the search scope.

Summary

  • Template modifications in maigret/web/templates/ allow you to change HTML structure and add form fields without touching the search engine
  • CSS customization via maigret/web/static/style.css controls the visual appearance and branding
  • Route extensions in maigret/web/app.py or through Blueprints enable new pages and functionality
  • Configuration changes for host, port, and debug mode are made in the Flask app initialization or via environment variables
  • All customizations use standard Flask patterns, keeping the core Maigret logic in maigret/maigret.py completely separate from the presentation layer

Frequently Asked Questions

Where are the Flask templates located in Maigret?

The templates are located in the maigret/web/templates/ directory according to the soxoj/maigret source code. Key files include base.html (layout wrapper), index.html (search form), and results.html (findings display). These use standard Jinja2 syntax and extend each other using {% extends %} and {% block %} tags.

How do I add a new page to the Maigret web interface?

You can add a new page by defining a route in maigret/web/app.py using the @app.route decorator and returning a rendered template. For complex features, create a Blueprint in a separate file (like custom_ui.py), define your routes there, and register the blueprint in app.py with a URL prefix. Create the corresponding HTML file in maigret/web/templates/ extending base.html.

Can I change the port the Maigret web UI runs on?

Yes, you can change the port by modifying the app.run() call in maigret/web/app.py. Change the port parameter from the default 5000 to your desired port number. When running via python -m maigret.web or maigret --web, the application uses the configuration defined in the entry point, which you can override by editing the host and port arguments in the if __name__ == "__main__": block.

Is it possible to customize Maigret without modifying core search logic?

Absolutely. The Flask web interface is decoupled from the core enumeration engine. All UI modifications—including templates in maigret/web/templates/, stylesheets in maigret/web/static/, and routes in maigret/web/app.py—can be made without touching the main run_maigret function or the site parsing logic. This separation ensures your UI customizations won't break the underlying username investigation functionality.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →