Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions utils/gcp_pubsub_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def process_message(self, message):
options=sandbox_options,
custom=custom,
category=category,
filename=sample_name,
)
if task_ids:
log.info("Successfully submitted task(s): %s", task_ids)
Expand Down
14 changes: 9 additions & 5 deletions utils/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def submit_file(
unique=False,
quiet=False,
category = None,
filename = None,
Comment thread
doomedraven marked this conversation as resolved.
):
if not File(file_path).get_size():
if not quiet:
Expand All @@ -64,7 +65,9 @@ def submit_file(

try:
with open(file_path, "rb") as f:
tmp_path = store_temp_file(f.read(), sanitize_filename(os.path.basename(file_path)))
if not filename:
filename = os.path.basename(file_path)
tmp_path = store_temp_file(f.read(), sanitize_filename(filename))
with db.session.begin():
# ToDo expose extra_details["errors"]
task_ids, extra_details = db.demux_sample_and_add_to_db(
Expand Down Expand Up @@ -167,10 +170,9 @@ def main():
parser.add_argument(
"--shuffle", action="store_true", default=False, help="Shuffle samples before submitting them", required=False
)
parser.add_argument(
"--unique", action="store_true", default=False, help="Only submit new samples, ignore duplicates", required=False
)
parser.add_argument("--unique", action="store_true", default=False, help="Only submit new samples, ignore duplicates", required=False)
Comment thread
doomedraven marked this conversation as resolved.
parser.add_argument("--quiet", action="store_true", default=False, help="Only print text on failure", required=False)
parser.add_argument("--name", type=str, action="store", default=None, help="Desired sample name", required=False)
Comment thread
doomedraven marked this conversation as resolved.
parser.add_argument("--procdump", action="store_true", default=False, help="Disable process dumps", required=False)

try:
Expand Down Expand Up @@ -339,7 +341,8 @@ def main():
url = "http://{0}/apiv2/tasks/create/file/".format(args.remote)

with open(file_path, "rb") as f:
files = dict(file=f, filename=os.path.basename(file_path))
filename = args.name or os.path.basename(file_path)
files = dict(file=f, filename=filename)

data = dict(
package=args.package,
Expand Down Expand Up @@ -411,6 +414,7 @@ def main():
route=args.route,
unique=args.unique,
quiet=args.quiet,
filename=args.name,
Comment thread
doomedraven marked this conversation as resolved.
)

tasks_count = len(task_ids)
Expand Down
32 changes: 25 additions & 7 deletions web/templates/submission/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -922,20 +922,20 @@ <h5 class="mb-0 text-white"><i class="fas fa-cogs me-2 text-primary"></i>Advance
<label for="form_priority" class="text-white-50">Priority</label>
<select class="form-select border-secondary" id="form_priority"
name="priority">
<option value="1">Low</option>
<option value="2" selected>Medium</option>
<option value="3">High</option>
<option value="1" data-color="#0dcaf0" style="color: #0dcaf0;">Low</option>
<option value="2" selected data-color="#ffc107" style="color: #ffc107;">Medium</option>
<option value="3" data-color="#dc3545" style="color: #dc3545;">High</option>
</select>
</div>
{% if config.tlp %}
<div class="col-md-6">
<label for="form_tlp" class="text-white-50">TLP</label>
<select class="form-select border-secondary" id="form_tlp"
name="tlp">
<option value="" selected>White</option>
<option value="Green">Green</option>
<option value="Amber">Amber</option>
<option value="Red">Red</option>
<option value="" selected data-color="#ffffff" style="color: #ffffff;">White</option>
<option value="Green" data-color="#198754" style="color: #198754;">Green</option>
<option value="Amber" data-color="#ffc107" style="color: #ffc107;">Amber</option>
<option value="Red" data-color="#dc3545" style="color: #dc3545;">Red</option>
</select>
</div>
{% endif %}
Expand Down Expand Up @@ -1177,6 +1177,24 @@ <h5 class="mb-0 text-white"><i class="fas fa-cogs me-2 text-primary"></i>Advance
};
interactive.addEventListener("change", syncManualCheckbox);
}

// Color sync for Priority and TLP
function updateSelectColor(selectId) {
const select = $(selectId);
const selectedOption = select.find('option:selected');
const color = selectedOption.data('color');
if (color) {
select.css('color', color);
}
}

$('#form_priority, #form_tlp').on('change', function() {
updateSelectColor('#' + $(this).attr('id'));
});

// Initialize colors
updateSelectColor('#form_priority');
updateSelectColor('#form_tlp');
});
</script>
{% endblock %}
Loading