-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetecting_WAF.py
88 lines (78 loc) · 2.56 KB
/
detecting_WAF.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#import urllib2
#import sys
#url = raw_input("Full url:")
#url.rstrip()
#header = urllib2.urlopen(url).info()
#print(str(header))
import urllib2
x=raw_input('enter the url')
hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'Accept-Encoding': 'none',
'Accept-Language': 'en-US,en;q=0.8',
'Connection': 'keep-alive'}
req = urllib2.Request(x,headers=hdr)
res = urllib2.urlopen(req)
print res.info()
res.close();
server=res.info().get('Server')
cookies=res.info().get('Set-Cookie')
akamai=res.info().get('X-akamai-transformed')
varnish1=res.info().get('Via')
varnish2=res.info().get('X-Varnish')
anquanbao=res.info().get('X-Powered-By-Anquanbao')
aws1=res.info().get('X-Cache')
Powercdn=res.info().get('X-PowerCDN-Error')
xlabs=res.info().get('Secured')
#print (akamai)
#Cloudflare
if server is not None:
if server=='cloudflare':
print ('cloudflare WAF is detected')
elif cookies is not None:
if cookies.find('__cfduid')!= -1:
print ('cloudflare WAF is detected')
#Akamai
if akamai is not None:
print ('Akamai Kona WAF detected')
#Varnish
if server is not None:
if server=='Varnish':
print ('Varnish WAF is detected')
elif varnish1 is not None:
if varnish1.find('Varnish')!= -1:
print ('Varnish WAF is detected')
elif varnish2 is not None:
print ('Varnish WAF is detected')
if cookies is not None:
if cookies.find('ns_af')!= -1:
print ('Citrix Netscaler WAF is detected')
if server is not None:
if server=='ASERVER':
print ('Anquanbao WAF is detected')
elif anquanbao is not None:
print ('Anquanbao WAF is detected')
if aws1 is not None:
if aws1.find('Cloudfront')!= -1:
print ('cloudfront WAF is detected')
elif varnish1 is not None:
if varnish1.find('Cloudfront')!= -1:
print ('Cloudfront WAF is detected')
if server is not None:
if server=='PowerCDN':
print ('Power CDN WAF is detected')
elif Powercdn is not None:
print ('Power CDN WAF is detected')
if server is not None:
if server=='Safedog WAF':
print ('Safedog WAF is detected')
elif cookies is not None:
if cookies.find('safedog-flow-item')!= -1:
print ('Safedog WAF is detected')
if server is not None:
if server=='XLabs WAF':
print ('XLabs WAF is detected')
elif xlabs is not None:
if xlabs.find('XLabs')!= -1:
print ('XLabs WAF is detected')