{% include 'header.html' %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/exploits.css') }}"> {% include 'wrapper.html' %}
<div class="page">
    <h2 style="font-weight: bolder;font-size: 36px;" class="inline">Exploits</h2>
    </br>
    </br>
    </br>
    <div class="exploits">

        <table class="table table-dark">
            <tbody>
                <tr>
                    <form enctype="multipart/form-data" id="add-exploit-form" method="POST" action="{{ url_for('add_exploit') }}">
                        <td class="name">
                            <input placeholder="Exploit Name" name="exploit-name" class="inline new-exploit-name-inp" type="text" required>
                        </td>
                        <td>
                            <div class="exploit-content">
                                <input placeholder="Exploit Data" name="exploit-con" class="inline new-exploit-inp" type="text" required>
                                <div class="buttons inline">
                                    <label id="file_upload_label" for="exploit-upload" class="exploit-file-upload">
                                        <input id="exploit-upload" name="exploit-file" onchange="change_icon();"
                                            type="file" /><i id="file_upload_icon" class="fas fa-upload"></i>
                                    </label>
                                </div>
                            </div>
                        </td>
                        <td class="actions" style="text-align: center;">
                            <a href="#" id="add-exploit" onclick="javascript:document.getElementById('add-exploit-form').submit()">
                                <i class="fas fa-plus" style="font-size: 17px;"></i>
                            </a>
                        </td>
                    </form>
                </tr>
                {% for i in range(exploits_len) %} {% if exploits[i][3] == "None" %}
                <tr>
                    <td class="name">
                        <input placeholder="Exploit Name" name="exploit_name" class="inline" type="hidden" value="{{ exploits[i][1] }}"> {{ exploits[i][1] }}
                    </td>
                    <td>
                        <div class="exploit-content">
                            <form method="POST" action="{{ url_for('update_exploit') }}" id="update-exploit-{{ i }}">
                                <input id="exploit-{{ i }}" name="exploit_data" onkeydown="input_changed(this);" class="inline" type="text" value="{{ exploits[i][2] }}">
                                <input type="hidden" name="exploit_id" value="{{ exploits[i][0] }}">
                                <input type="hidden" name="exploit_name" value="{{ exploits[i][1] }}">
                            </form>
                            <div class="buttons inline">
                                <button id="{{ i }}" onclick="copyCmd(this)" type="button"><i
                                        class="fas fa-copy"></i></button>
                                <button id="exploit-{{ i }}-input" style="display: none;" type="submit" form="update-exploit-{{ i }}"><i class="fas fa-save"></i></button>
                            </div>
                        </div>
                    </td>
                    <td class="actions" style="text-align: center;">
                        <a href="{{ url_for('delete_exploit') }}?id={{ exploits[i][0] }}" onclick="this.parentElement.parentElement.remove()">
                            <i class="fas fa-trash" style="color: rgb(212, 71, 71);"></i>
                        </a>
                    </td>
                </tr>
                {% else %}
                <tr>
                    <td class="name">
                        <input placeholder="Exploit Name" name="exploit_name" class="inline" type="hidden" value="{{ exploits[i][1] }}"> {{ exploits[i][1] }}
                    </td>
                    <td>
                        <div class="exploit-content">
                            <form method="POST" action="{{ url_for('update_exploit') }}" id="update-exploit-{{ i }}">
                                <input id="exploit-{{ i }}" name="exploit_data" onkeydown="input_changed(this);" class="inline" type="text" value="{{ exploits[i][2] }}">
                                <input type="hidden" name="exploit_id" value="{{ exploits[i][0] }}">
                                <input type="hidden" name="exploit_name" value="{{ exploits[i][1] }}">
                            </form>
                            <div class="buttons inline">
                                <form method="GET" action="{{ url_for('files') }}" id="get-files">
                                    <input type="hidden" value="{{ exploits[i][3] }}" name="file_name">
                                    <button id="{{ i }}" type="button" onclick="copyCmd(this)"><i
                                            class="fas fa-copy"></i></button>
                                    <button type="submit" form="get-files"><i class="fas fa-download"></i></button>
                                    <button id="exploit-{{ i }}-input" style="display: none;" type="submit" form="update-exploit-{{ i }}"><i class="fas fa-save"></i></button>
                                </form>
                            </div>
                        </div>
                    </td>
                    <td class="actions" style="text-align: center;">
                        <a href="{{ url_for('delete_exploit') }}?id={{ exploits[i][0] }}" onclick="this.parentElement.parentElement.remove()">
                            <i class="fas fa-trash" style="color: rgb(212, 71, 71);"></i>
                        </a>
                    </td>
                </tr>
                {% endif %} {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% include 'wrapper_end.html' %}
<script>
    key_sc($(".new-exploit-name-inp"), 'n');
    key_sc($("#exploit-upload"), 'u');
    key_sc($("#add-exploit"), 's');
</script>
<script src="{{ url_for('static', filename='js/exploits.js') }}"></script>
{% include 'footer.html' %}