1

I want to run the following command and its sending output to template

def nikto(request):
    context = {}
    host = request.GET.get('host', False)

    nikto_output = os.popen('nikto -h ' + request.GET['host']).read()
    # context['nikto_output'] = nikto_output
    context['nikto_output']=nikto_output
    return render(request,'nikto.html',context)
    # return render(request,'nikto.html',context)

but it's first performing a complete task and then sent to the template, till then webpage is loading, I want to display one-by-one line output. if you know of any solution, please let me know.

Viral
  • 297
  • 3
  • 11

1 Answers1

1
nikto_output = os.popen('nikto -h ' + request.GET['host']).readlines()

try this

Tech
  • 734
  • 1
  • 6
  • 20