<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://feeltheajf.github.io/materialize/materialize.min.css">
    <script src="https://feeltheajf.github.io/materialize/materialize.min.js"></script>

    <title>TruffleHog3 Report</title>

    <style>
        @media only screen and (max-width: 992px) {
            td h4 {
                font-size: 14pt;
                margin: 0;
            }

            td {
                height: 40pt;
            }
        }

        :root {
            --pt-color: rgb(0, 32, 77);
            --st-color: rgb(72, 117, 179);
            --bd-color: rgba(0, 32, 77, 0.1);
            --pb-color: rgba(0, 32, 77, 0.05);
            --sb-color: rgba(0, 32, 77, 0.025);
        }

        [theme="dark"] {
            --pt-color: rgb(217, 217, 217);
            --st-color: rgb(166, 166, 166);
            --bd-color: rgb(56, 56, 56);
            --pb-color: rgb(36, 36, 36);
            --sb-color: rgba(255, 255, 255, 0.025);
        }

        body {
            color: var(--pt-color);
            background-color: var(--pb-color);
        }

        pre {
            white-space: pre-wrap;
            word-wrap: break-word;
            word-break: break-word;
            font-family: inherit;
            margin: inherit;
        }

        a,
        h6 {
            color: var(--st-color);
        }

        h4,
        h5 {
            color: var(--pt-color)
        }

        td {
            text-align: center;
        }

        * {
            border-color: var(--bd-color) !important;
        }

        ul.no-bottom-border li:last-child div {
            border-bottom: none !important;
        }

        .collapsible-header,
        .collapsible-body {
            background-color: var(--sb-color) !important;
        }

        .no-border {
            border: none !important;
        }

        .transparent {
            background-color: transparent !important;
        }
    </style>
    <script>
        function scannerHelp() {
            window.open("https://github.com/feeltheajf/truffleHog3");
        }

        function switchTheme() {
            var theme = document.documentElement.getAttribute("theme") == "dark" ? "light" : "dark"
            document.documentElement.setAttribute("theme", theme);
            localStorage.setItem("theme", theme);
        }

        if (localStorage.getItem("theme") == "dark") {
            switchTheme();
        }
    </script>
</head>

<body>
    <div class="fixed-action-btn">
        <a class="btn-floating blue"><i class="material-icons">menu</i></a>
        <ul>
            <li><a class="btn-floating purple" onclick="scannerHelp()"><i class="material-icons">help</i></a></li>
            <li><a class="btn-floating yellow" onclick="switchTheme()"><i class="material-icons">brightness_medium</i></a></li>
        </ul>
    </div>
    <div class="row">
        <div class="col l2 hide-on-med-and-down">
            <ul class="collection with-header no-border">
                <li class="collection-header transparent">
                    <h4>Report</h4>
                </li>
                {% for reason, _ in report.issues.items() -%}
                <li class="collection-item no-border transparent">
                    <a href="#{{reason}}">{{reason}}</a>
                </li>
                {% endfor -%}
            </ul>
        </div>
        <div class="col s12 m12 l6 offset-l1">
            <table class="responsive-table">
                <tr>
                    <td><h4>Status</h4></td>
                    <td><h4>#Issues</h4></td>
                    <td><h4>#Entropy</h4></td>
                    <td><h4>#Regexes</h4></td>
                </tr>
                <tr>
                    {%- if report.total == 0 -%}
                        {% set color, text = "green", "PASS" %}
                    {%- else -%}
                        {% set color, text = "red", "FAIL" %}
                    {%- endif %}
                    <td><span class="new badge {{color}} darken-1" data-badge-caption="{{text}}"></span></td>
                    <td>{{report.total}}</td>
                    <td>{{report.entropy}}</td>
                    <td>{{report.regexes}}</td>
                </tr>
            </table>
            {%- for reason, folders in report.issues.items() %}
            <br>
            <a id="{{reason}}"></a>
            <h5>{{reason}}</h5>
            {% for folder, files in folders.items() -%}
            <br>
            <h6>{{folder}}</h6>
             <ul class="collapsible">
                {% for file, issues in files.items() -%}
                {% for issue in issues -%}
                <li>
                    <div class="collapsible-header transparent">
                        {{file}}
                        {%- if issue.reason == "High Entropy" -%}
                            {% set color, status = "green", "LOW" %}
                        {%- else -%}
                            {% set color, status = "orange", "HIGH" %}
                        {%- endif %}
                        <span class="new badge {{color}} darken-1" data-badge-caption="{{status}}"></span>
                    </div>
                    <div class="collapsible-body">
<pre>
<b>Reason:</b> {{issue.reason}}
<b>Path:</b> {{issue.path}}
<b>Branch:</b> {{issue.branch}}
<b>Commit:</b> {{issue.commit | strip}}
<b>Hash:</b> {{issue.commitHash}}

{{issue.stringsFound | join("\n")}}
</pre>
                {% endfor -%}
                {% endfor -%}
            </ul>
            {% endfor -%}
            {% endfor -%}
        </div>
    </div>
    <script>
        M.AutoInit();
        document.addEventListener("DOMContentLoaded", function() {
            var elems = document.querySelectorAll(".fixed-action-btn");
            var instances = M.FloatingActionButton.init(elems, {hoverEnabled: false});
        });
    </script>
</body>

</html>
