Python for Security Testing -


i have written below python program http heaaders works site , sites not working. please correct code

python program

import sys import os import urllib import urllib.request url=sys.argv[1] response = urllib2.urlopen(url) if response.info().getheader('x-xss-protection') == '1; mode=block':   print('x-xss-protection                        : enforced')      print('(x-xss-protection) cross-site scripting protection enforced.\n\n') else:   print('x-xss-protection                        : not enforced')   print('vulnerability - x-xss-protection')   print('- server not enforce cross-site scripting protection.\nthe x-xss-protection header setting either inadequate or missing.\nclient may vulnerable cross-site scripting attacks.\n\n') 

output

python test.py <targeturl> example output x-xss-protection                        : enforced (x-xss-protection) cross-site scripting protection enforced. 


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -