{% extends "base.html" %}

{% block title %}Process results from scanners{% endblock %}

{% block content %}
    <h1>Process results from scanners (Burp, Lynis, Nessus)</h1>
    <form method=post action="{{ url_for('api_process_findings.upload_scanner_result_post') }}" enctype=multipart/form-data>
        <label for="file[]">File (or multiple files) which should be used as input</label> &nbsp;&nbsp;&nbsp;&nbsp; <input type=file name="file[]" multiple> <br>
        <i>The following file extensions are allowed: {{ ", ".join(allowed_scanner_extensions) }} <br>
            This setting is configurable by server administrator in config.py.
        </i>
        <br> <br>


        <script>
         function addArg(text){
             document.querySelector('#scan2report_args').textContent += text;
         }
        </script>

        <label for="locale">Locale:</label>
        <select name="locale" id="locale">
            {% for value in lang_list %}
                <option value="{{value}}">{{value}}</option>
            {% endfor %}
        </select>
        &nbsp;&nbsp;&nbsp;&nbsp;

        <label for="profile">Profile:</label>
        <select name="profile" id="profile">
            {% for value in profiles %}
                <option value="{{value}}">{{value}}</option>
            {% endfor %}
        </select>
        &nbsp;&nbsp;&nbsp;&nbsp;

        <label for="min-severity">Minimum severity:</label>
        <select name="min-severity" id="min-severity">
            {% for key, value in severities.items() %}
                <option value="{{key}}">{{value}} ({{key}})</option>
            {% endfor %}
        </select>

        <br><br>

        <label for="audit">Pwndoc audit or file output (docx, json, csv):</label>
        <select name="audit" id="audit">

            {% for key, value in audit_dict.items()|reverse%}
                <option value="{{value}}" {{"selected" if audit_id == value else ""}}>{{key}}</option>
            {% endfor %}

        </select>
        <br><i>To import to a new PwnDoc audit first create the audit in PwnDoc.</i>
        <br><br>


        <label for="scan2report_args">Custom arguments for scan2report:</label>
        <p><i>
            Don't set --output, --profile and --min-severity manually. Set them using selectors above.
        </i></p>
        <textarea name="scan2report_args" id="scan2report_args" rows="4" cols="100" placeholder='Example: --ignore "nessus_example1,nessus_example2"'></textarea>
        <br><br>

        <label for="import_dangerous_files">Import custom escaped HTML (can lead to XSS)</label>
        <input type="checkbox" name="import_dangerous_files" id="import_dangerous_files"/>

        <br><br>

        <input type=submit value=Upload>
    </form>
{% endblock %}