diff --git a/viper_web/viperweb/views.py b/viper_web/viperweb/views.py index d2e80c9..5b4f148 100644 --- a/viper_web/viperweb/views.py +++ b/viper_web/viperweb/views.py @@ -449,6 +449,16 @@ 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 = '
Result for "{0}" stored on {1}
'.format(result.cmd_line, result.stored_at) + html += str(parse_text(module_results)) + return HttpResponse('{0}'.format(html))
+
# Lot of logic here to decide what command you entered.
module_name = request.POST.get('module')
print("Here: {}".format(module_name))
@@ -456,17 +466,11 @@ def post(self, request, *args, **kwargs):
return HttpResponse("Error: No Module selected!") 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 = '
Result for "{0}" stored on {1}
'.format(result.cmd_line, result.stored_at) - html += str(parse_text(module_results)) - return HttpResponse('{0}'.format(html))
if cmd_line:
cmd_string = cmd_line
elif module_args: