refactor: rename central data structures

This commit is contained in:
Dobin
2024-04-07 11:34:13 +01:00
parent de73d5452e
commit a03c267070
12 changed files with 66 additions and 126 deletions
+4 -20
View File
@@ -84,31 +84,23 @@
<!-- row 3 -->
<div class="col-3">
<select class="form-select" name="source_style" aria-label="SOURCESTYLE" onchange="this.form.submit()">
{% for name, value in sourcestyles %}
{% 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="inject_mode" aria-label="INJECTSTYLE" onchange="this.form.submit()">
{% for name, value in injectstyles %}
<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.inject_mode.value %} selected {% endif %}
{% if value in project.settings.carrier_invoke_style.value %} selected {% endif %}
>{{value}}</option>
{% endfor %}
</select>
</div>
<div class="col-3">
<select class="form-select" name="alloc_style" aria-label="ALLOCSTYLE" onchange="this.form.submit()">
{% for name, value in allocstyles %}
<option value="{{name}}"
{% if value in project.settings.alloc_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}}"
@@ -116,14 +108,6 @@
>{{value}}</option>
{% endfor %}
</select>
<select class="form-select" name="exec_style" aria-label="EXECSTYLE" onchange="this.form.submit()">
{% for name, value in execstyles %}
<option value="{{name}}"
{% if value in project.settings.exec_style.value %} selected {% endif %}
>{{value}}</option>
{% endfor %}
</select>
</div>
</div>
</form>
+3 -15
View File
@@ -35,13 +35,7 @@
</select>
<select class="form-select" name="source_style" aria-label="SOURCESTYLE">
{% for name, value in sourcestyles %}
<option value="{{name}}">{{value}}</option>
{% endfor %}
</select>
<select class="form-select" name="alloc_style" aria-label="ALLOCSTYLE">
{% for name, value in allocstyles %}
{% for name, value in function_invoke_styles %}
<option value="{{name}}">{{value}}</option>
{% endfor %}
</select>
@@ -52,14 +46,8 @@
{% endfor %}
</select>
<select class="form-select" name="exec_style" aria-label="EXECSTYLE">
{% for name, value in execstyles %}
<option value="{{name}}">{{value}}</option>
{% endfor %}
</select>
<select class="form-select" name="inject_mode" aria-label="INJECTSTYLE">
{% for name, value in injectstyles %}
<select class="form-select" name="carrier_invoke_style" aria-label="INJECTSTYLE">
{% for name, value in carrier_invoke_styles %}
<option value="{{name}}">{{value}}</option>
{% endfor %}
</select>
+11 -22
View File
@@ -65,11 +65,9 @@ def project(name):
for file in os.listdir(PATH_SHELLCODES):
shellcodes.append(file)
sourcestyles = [(color.name, color.value) for color in SourceStyle]
allocstyles = [(color.name, color.value) for color in AllocStyle]
function_invoke_styles = [(color.name, color.value) for color in FunctionInvokeStyle]
decoderstyles = [(color.name, color.value) for color in DecoderStyle]
execstyles = [(color.name, color.value) for color in ExecStyle]
injectstyles = [(color.name, color.value) for color in InjectStyle]
carrier_invoke_styles = [(color.name, color.value) for color in CarrierInvokeStyle]
return render_template('project.html',
project_name = name,
@@ -79,11 +77,9 @@ def project(name):
exes=exes,
shellcodes=shellcodes,
sourcestyles=sourcestyles,
allocstyles=allocstyles,
function_invoke_styles=function_invoke_styles,
decoderstyles=decoderstyles,
execstyles=execstyles,
injectstyles=injectstyles,
carrier_invoke_styles=carrier_invoke_styles,
log_files=log_files,
is_64=is_64,
@@ -110,13 +106,10 @@ def add_project():
settings.inject_exe_out = request.form['exe'].replace(".exe", ".infected.exe")
source_style = request.form['source_style']
settings.source_style = SourceStyle[source_style]
settings.source_style = FunctionInvokeStyle[source_style]
inject_mode = request.form['inject_mode']
settings.inject_mode = InjectStyle[inject_mode]
alloc_style = request.form['alloc_style']
settings.alloc_style = AllocStyle[alloc_style]
carrier_invoke_style = request.form['carrier_invoke_style']
settings.carrier_invoke_style = CarrierInvokeStyle[carrier_invoke_style]
decoder_style = request.form['decoder_style']
settings.decoder_style = DecoderStyle[decoder_style]
@@ -147,20 +140,16 @@ def add_project():
for file in os.listdir(PATH_SHELLCODES):
shellcodes.append(file)
sourcestyles = [(color.name, color.value) for color in SourceStyle]
allocstyles = [(color.name, color.value) for color in AllocStyle]
function_invoke_styles = [(color.name, color.value) for color in FunctionInvokeStyle]
decoderstyles = [(color.name, color.value) for color in DecoderStyle]
execstyles = [(color.name, color.value) for color in ExecStyle]
injectstyles = [(color.name, color.value) for color in InjectStyle]
carrier_invoke_styles = [(color.name, color.value) for color in CarrierInvokeStyle]
return render_template('project_add_get.html',
exes=exes,
shellcodes=shellcodes,
sourcestyles=sourcestyles,
allocstyles=allocstyles,
function_invoke_styles=function_invoke_styles,
decoderstyles=decoderstyles,
execstyles=execstyles,
injectstyles=injectstyles,
carrier_invoke_styles=carrier_invoke_styles,
)