<!DOCTYPE html>
<html>
  <head>
    {% include 'header.html' %}
  </head>
  <body>
    {% include 'navigation.html' %}

    <div class="indent">

        <h2> {{project_name}} </h2>

        <div class="row">
            <!-- Row 1: Buttons -->
            <div class="col-1">
                <div class="row">
                    <form method="POST" enctype="multipart/form-data" action="/project/{{project_name}}/exec?no_exec=true">
                        <button class="btn btn-primary" type="submit" value="start">Open Dir</button>
                    </form>

                    <form method="POST" enctype="multipart/form-data" action="/project/{{project_name}}/build">
                        <button class="btn btn-primary" type="submit" value="start">Build</button>
                    </form>
                </div>
                
                {% if is_built %}
                <div class="row">
                        <form method="POST" enctype="multipart/form-data" action="/project/{{project_name}}/exec">
                            <button class="btn btn-primary" type="submit" value="start">Start</button>
                        </form>

                        {% if has_remote %}
                        <form method="POST" enctype="multipart/form-data" action="/project/{{project_name}}/exec?remote=true">
                            <button class="btn btn-primary" type="submit" value="start">Start Remote</button>
                        </form>
                        <form method="POST" enctype="multipart/form-data" action="/project/{{project_name}}/exec?remote=true&no_exec=true">
                            <button class="btn btn-primary" type="submit" value="start">File Remote</button>
                        </form>
                        {% endif %}
                </div>
                {% endif %}
            </div>

            <!-- Row 2: Input files -->
            <div class="col-2">
                <!-- leave this here or it will fuck up layout -->
                <form method="POST" enctype="multipart/form-data" action="/project_add">
                <input type="hidden" name="project_name" value="{{project_name}}">
                
                <input type="text" name="comment" class="hidden form-control" 
                       placeholder="Comment" value="{{project.comment}}"
                       aria-label="PROJECTNAME" aria-describedby="basic-addon1"
                       onchange="this.form.submit()">
            
                <select class="form-select" name="shellcode" aria-label="SHELLCODE" onchange="this.form.submit()">
                    {% for shellcode in shellcodes %}
                    <option value="{{shellcode['filename']}}" 
                            {% if shellcode["filename"] in project.settings.payload_path %} selected {% endif %}
                    >
                        {{shellcode['filename']}} ({{shellcode['size']}})
                    </option>
                    {% endfor %}
                </select>
            
                <select class="form-select" name="exe" aria-label="EXE" onchange="this.form.submit()">
                    {% for exe in exes %}
                    <option value="{{exe['filename']}}"
                        {% if exe['filename'] == project.settings.inject_exe_in %} selected {% endif %}
                    >
                    {{exe['filename'] | basename}} ({{exe['size']}})</option>
                    {% endfor %}
                </select>

                {% if exports != [] %}
                <select class="form-select" name="dllfunc" aria-label="DLLFUNC" onchange="this.form.submit()">
                    {% for export in exports %}
                    <option value="{{export['name']}}"
                        {% if export["name"] == project.settings.dllfunc %} selected {% endif %}
                    >
                    {{export['name']}} ({{export['size']}})</option>
                    {% endfor %}
                </select>
                {% endif %}
                <a href="/exes/{{project.settings.inject_exe_in | basename}}">EXE INFO</a>
            </div>

            <!-- Row 3: exe and shellcode info -->
            <div class="col-2">
                {% if is_64 %}
                x64: {{ is_64 }}
                {% else %}
                <span class="text-danger">x64: {{ is_64 }}</span>
                {% endif %}
                    / Dotnet: {{ is_dotnet}} <br>
                .text: {{ code_sect_size}}  <br>
                .rodata: {{ data_sect_size}} 
                (max: {{ data_sect_largest_gap_size}}) <br>
                {% if not has_rodata_section %}
                <span class="text-danger">No .rodata section</span> <br>
                {% endif %}

                {% if unresolved_dlls|length > 0 %}
                <br>
                <span class="text-danger">Unresolved dlls:</span>
                <ul>
                {% for dll in unresolved_dlls %}
                    <li>{{ dll }} </li>
                {% endfor %}
                </ul>
                {% endif %}
            </div>

            <!-- Row 4: leet settings -->
            <div class="col-2">
                <select class="form-select" name="source_style" aria-label="SOURCESTYLE" onchange="this.form.submit()">
                    {% for name, value in function_invoke_styles %}
                    <option value="{{name}}"
                        {% if name in project.settings.source_style.value %} selected {% endif %}
                    >{{value}}</option>
                    {% endfor %}
                </select>
            
                <select class="form-select" name="carrier_invoke_style" aria-label="INJECTSTYLE" onchange="this.form.submit()">
                    {% for name, value in carrier_invoke_styles %}
                    <option value="{{name}}"
                        {% if value in project.settings.carrier_invoke_style.value %} selected {% endif %}
                    >{{value}}</option>
                    {% endfor %}
                </select>

                <select class="form-select" name="decoder_style" aria-label="DECODERESTYLE" onchange="this.form.submit()">
                    {% for name, value in decoderstyles %}
                    <option value="{{name}}"
                    {% if value in project.settings.decoder_style.value %} selected {% endif %}
                    >{{value}}</option>
                    {% endfor %}
                </select>
            </div>

        </div>
        </form>

        <div class="row">
            <div class="col">
             {{ project_dir }} <br>
              <div class="custom-line"></div>
            </div>
        </div>


    <div class="row">
        <div class="col-md-12">
            {% include 'files.html' %}
        </div>
    </div>
    </div>
</body>
</html>