@@ -30,15 +30,15 @@ def check_once(url):
3030 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit'
3131 '/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'
3232 }
33- response = requests .get (url , headers = headers )
33+ response = requests .get (url , headers = headers , timeout = 5 )
3434 except requests .exceptions .ConnectionError :
3535 return False , - 1
3636 return response .ok , response .status_code
3737
3838
3939def check (url ):
4040 # We try for 5 times, with 3 seconds interval.
41- try_count = 5
41+ try_count = 1
4242 try_interval = 3
4343 for i in range (try_count ):
4444 ok , status_code = check_once (url )
@@ -60,18 +60,34 @@ def test_url():
6060 "http://www.w3.org/TR/html4/loose.dtd" ,
6161 # Don't need to check the DTD
6262
63- "https://www.vmware.com/" ,
64- # Throwing a 403 for some reason, but can't see it going anywhere
65-
66- "https://twitter.com/digininja" ,
63+ # "https://twitter.com/digininja",
6764 # Twitter doesn't like GitHub checking it
6865
6966 "https://www.cgisecurity.com/xss-faq.html" ,
70- # Throwing a 403 for some reason, but can't see it going anywhere
67+ # Timeout
7168
72- "https://www.cgisecurity.com/csrf-faq.html" ,
73- # Throwing a 403 for some reason, but can't see it going anywhere
69+ "https://www.cgisecurity.com/csrf-faq.html"
70+ # Timeout
7471 ]
72+
73+ expected_codes = {
74+ "https://www.vmware.com/" : 403 ,
75+ "https://www.virtualbox.org/" : 402 ,
76+
77+ "https://github.com/digininja/DVWA/blob/master/README.md"
78+ "#vendor-files" : 429 ,
79+ "https://github.com/digininja/DVWA/blob/master/README.md"
80+ "#apache-modules" : 429 ,
81+
82+ "https://hacks.mozilla.org/2020/08/"
83+ "changes-to-samesite-cookie-behavior/" : 403 ,
84+
85+ "https://blog.mozilla.org/security/2014/10/04/"
86+ "csp-for-the-web-we-have/" : 403 ,
87+
88+ "https://medium.com/@masjadaan/oracle-padding-attack-a61369993c86" : 403
89+ }
90+
7591 all_urls = []
7692 broken_urls = []
7793 for php_file in get_php_files ():
@@ -85,7 +101,7 @@ def test_url():
85101 if url not in ignore_urls :
86102 # print("checking %s" % url)
87103 ok , status_code = check (url )
88- if not ok :
104+ if not ok and status_code != expected_codes . get ( url ) :
89105 # The php_file variable is now broken
90106 # as it was set in a previous loop
91107 # and doesn't come across into this one.
0 commit comments