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

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -