Skip to content
This repository was archived by the owner on May 15, 2023. It is now read-only.
Open
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
20 changes: 12 additions & 8 deletions viper_web/viperweb/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,24 +449,28 @@ def post(self, request, *args, **kwargs):

if len(file_hash) != 64:
file_hash = False

# First check if history is requested
module_history = request.POST.get('moduleHistory', ' ')
if module_history != ' ':
result = Database().get_analysis(module_history)
module_results = print_output(json.loads(result.results))
html = '<p class="text-success">Result for "{0}" stored on {1}</p>'.format(result.cmd_line, result.stored_at)
html += str(parse_text(module_results))
return HttpResponse('<pre>{0}</pre>'.format(html))

# Lot of logic here to decide what command you entered.
module_name = request.POST.get('module')
print("Here: {}".format(module_name))
if module_name == "module":
return HttpResponse("<pre>Error: No Module selected!</pre>")
module_args = request.POST.get('args')
cmd_line = request.POST.get('cmdline')
module_history = request.POST.get('moduleHistory', ' ')

cmd_string = ''
# Order of precedence
# moduleHistory, cmd_line, module_name
# cmd_line, module_name

if module_history != ' ':
result = Database().get_analysis(module_history)
module_results = print_output(json.loads(result.results))
html = '<p class="text-success">Result for "{0}" stored on {1}</p>'.format(result.cmd_line, result.stored_at)
html += str(parse_text(module_results))
return HttpResponse('<pre>{0}</pre>'.format(html))
if cmd_line:
cmd_string = cmd_line
elif module_args:
Expand Down