ui: show more info

This commit is contained in:
Dobin
2024-04-15 20:52:54 +01:00
parent 70c4a95b1b
commit f9aa7e84d8
2 changed files with 34 additions and 18 deletions
+10 -9
View File
@@ -50,7 +50,7 @@
<!-- leave this here or it will fuck up layout --> <!-- leave this here or it will fuck up layout -->
<form method="POST" enctype="multipart/form-data" action="/project_add"> <form method="POST" enctype="multipart/form-data" action="/project_add">
<input type="hidden" name="project_name" value="{{project_name}}"> <input type="hidden" name="project_name" value="{{project_name}}">
<input type="text" name="comment" class="hidden form-control" <input type="text" name="comment" class="hidden form-control"
placeholder="Comment" value="{{project.comment}}" placeholder="Comment" value="{{project.comment}}"
aria-label="PROJECTNAME" aria-describedby="basic-addon1" aria-label="PROJECTNAME" aria-describedby="basic-addon1"
@@ -58,20 +58,20 @@
<select class="form-select" name="shellcode" aria-label="SHELLCODE" onchange="this.form.submit()"> <select class="form-select" name="shellcode" aria-label="SHELLCODE" onchange="this.form.submit()">
{% for shellcode in shellcodes %} {% for shellcode in shellcodes %}
<option value="{{shellcode}}" <option value="{{shellcode['filename']}}"
{% if shellcode in project.settings.payload_path %} selected {% endif %} {% if shellcode["filename"] in project.settings.payload_path %} selected {% endif %}
> >
{{shellcode}} {{shellcode['filename']}} ({{shellcode['size']}})
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
<select class="form-select" name="exe" aria-label="EXE" onchange="this.form.submit()"> <select class="form-select" name="exe" aria-label="EXE" onchange="this.form.submit()">
{% for exe in exes %} {% for exe in exes %}
<option value="{{exe}}" <option value="{{exe['filename']}}"
{% if exe in project.settings.inject_exe_in %} selected {% endif %} {% if exe['filename'] in project.settings.inject_exe_in %} selected {% endif %}
> >
{{exe | basename}}</option> {{exe['filename'] | basename}} ({{exe['size']}})</option>
{% endfor %} {% endfor %}
</select> </select>
@@ -84,7 +84,6 @@
{{export['name']}} ({{export['size']}})</option> {{export['name']}} ({{export['size']}})</option>
{% endfor %} {% endfor %}
</select> </select>
<a href="/exes/{{project.settings.inject_exe_in | basename}}">INFO</a>
{% endif %} {% endif %}
</div> </div>
@@ -106,7 +105,7 @@
>{{value}}</option> >{{value}}</option>
{% endfor %} {% endfor %}
</select> </select>
<select class="form-select" name="decoder_style" aria-label="DECODERESTYLE" onchange="this.form.submit()"> <select class="form-select" name="decoder_style" aria-label="DECODERESTYLE" onchange="this.form.submit()">
{% for name, value in decoderstyles %} {% for name, value in decoderstyles %}
<option value="{{name}}" <option value="{{name}}"
@@ -124,7 +123,9 @@
Code Section size: {{ code_sect_size}} <br> Code Section size: {{ code_sect_size}} <br>
Data Section size: {{ data_sect_size}} <br> Data Section size: {{ data_sect_size}} <br>
Data Section largest: {{ data_sect_largest_gap_size}} <br> Data Section largest: {{ data_sect_largest_gap_size}} <br>
-> Payload len: {{ payload_len}} <br>
{{ project_dir }} <br> {{ project_dir }} <br>
<a href="/exes/{{project.settings.inject_exe_in | basename}}">EXE INFO</a>
</div> </div>
</div> </div>
</form> </form>
+24 -9
View File
@@ -55,6 +55,11 @@ def project(name):
code_sect_size = 0 code_sect_size = 0
data_sect_size = 0 data_sect_size = 0
data_sect_largest_gap_size = 0 data_sect_largest_gap_size = 0
payload_len = 0
# when we select a shellcode
if project.settings.payload_path != "":
payload_len = os.path.getsize(project.settings.payload_path)
# when we selected an input file # when we selected an input file
if project.settings.inject_exe_in != "": if project.settings.inject_exe_in != "":
@@ -69,19 +74,16 @@ def project(name):
exehost.init() exehost.init()
data_sect_largest_gap_size = exehost.get_rdata_relocmanager().find_largest_gap() data_sect_largest_gap_size = exehost.get_rdata_relocmanager().find_largest_gap()
project_dir = os.path.dirname(os.path.abspath(project.settings.inject_exe_out)) project_dir = os.path.dirname(os.path.abspath(project.settings.inject_exe_out))
log_files = get_logfiles(project.settings.main_dir) log_files = get_logfiles(project.settings.main_dir)
exes = [ "" ] exes = list_files_and_sizes(PATH_EXES, prepend=PATH_EXES)
for file in os.listdir(PATH_EXES): #for file in
exes.append(PATH_EXES + file) # exes.append(PATH_EXES + file)
for file in os.listdir(PATH_EXES_MORE): #for file in os.listdir(PATH_EXES_MORE):
exes.append(PATH_EXES_MORE + file) # exes.append(PATH_EXES_MORE + file)
shellcodes = [ "" ] shellcodes = list_files_and_sizes(PATH_SHELLCODES)
for file in os.listdir(PATH_SHELLCODES):
shellcodes.append(file)
function_invoke_styles = [(color.name, color.value) for color in FunctionInvokeStyle] function_invoke_styles = [(color.name, color.value) for color in FunctionInvokeStyle]
decoderstyles = [(color.name, color.value) for color in DecoderStyle] decoderstyles = [(color.name, color.value) for color in DecoderStyle]
@@ -106,8 +108,21 @@ def project(name):
code_sect_size=code_sect_size, code_sect_size=code_sect_size,
data_sect_size=data_sect_size, data_sect_size=data_sect_size,
data_sect_largest_gap_size=data_sect_largest_gap_size, data_sect_largest_gap_size=data_sect_largest_gap_size,
payload_len=payload_len,
) )
def list_files_and_sizes(directory, prepend=""):
# List all files in the directory and get their sizes
files_and_sizes = []
for filename in os.listdir(directory):
filepath = os.path.join(directory, filename)
if os.path.isfile(filepath):
size = os.path.getsize(filepath)
files_and_sizes.append({
"filename": prepend + filename,
"size": size,
})
return files_and_sizes
@views_project.route("/project_add", methods=['POST', 'GET']) @views_project.route("/project_add", methods=['POST', 'GET'])
def add_project(): def add_project():