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 -->
<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"
@@ -58,20 +58,20 @@
<select class="form-select" name="shellcode" aria-label="SHELLCODE" onchange="this.form.submit()">
{% for shellcode in shellcodes %}
<option value="{{shellcode}}"
{% if shellcode in project.settings.payload_path %} selected {% endif %}
<option value="{{shellcode['filename']}}"
{% if shellcode["filename"] in project.settings.payload_path %} selected {% endif %}
>
{{shellcode}}
{{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}}"
{% if exe in project.settings.inject_exe_in %} selected {% endif %}
<option value="{{exe['filename']}}"
{% if exe['filename'] in project.settings.inject_exe_in %} selected {% endif %}
>
{{exe | basename}}</option>
{{exe['filename'] | basename}} ({{exe['size']}})</option>
{% endfor %}
</select>
@@ -84,7 +84,6 @@
{{export['name']}} ({{export['size']}})</option>
{% endfor %}
</select>
<a href="/exes/{{project.settings.inject_exe_in | basename}}">INFO</a>
{% endif %}
</div>
@@ -106,7 +105,7 @@
>{{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}}"
@@ -124,7 +123,9 @@
Code Section size: {{ code_sect_size}} <br>
Data Section size: {{ data_sect_size}} <br>
Data Section largest: {{ data_sect_largest_gap_size}} <br>
-> Payload len: {{ payload_len}} <br>
{{ project_dir }} <br>
<a href="/exes/{{project.settings.inject_exe_in | basename}}">EXE INFO</a>
</div>
</div>
</form>
+24 -9
View File
@@ -55,6 +55,11 @@ def project(name):
code_sect_size = 0
data_sect_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
if project.settings.inject_exe_in != "":
@@ -69,19 +74,16 @@ def project(name):
exehost.init()
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))
log_files = get_logfiles(project.settings.main_dir)
exes = [ "" ]
for file in os.listdir(PATH_EXES):
exes.append(PATH_EXES + file)
for file in os.listdir(PATH_EXES_MORE):
exes.append(PATH_EXES_MORE + file)
exes = list_files_and_sizes(PATH_EXES, prepend=PATH_EXES)
#for file in
# exes.append(PATH_EXES + file)
#for file in os.listdir(PATH_EXES_MORE):
# exes.append(PATH_EXES_MORE + file)
shellcodes = [ "" ]
for file in os.listdir(PATH_SHELLCODES):
shellcodes.append(file)
shellcodes = list_files_and_sizes(PATH_SHELLCODES)
function_invoke_styles = [(color.name, color.value) for color in FunctionInvokeStyle]
decoderstyles = [(color.name, color.value) for color in DecoderStyle]
@@ -106,8 +108,21 @@ def project(name):
code_sect_size=code_sect_size,
data_sect_size=data_sect_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'])
def add_project():