forked from zigoo0/webpwn3r
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheaders.py
45 lines (40 loc) · 1.4 KB
/
headers.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
#!/usr/bin/env python
# WebPwn3r is a Web Applications Security Scanner
# By Ebrahim Hegazy - twitter.com/zigoo0
# First demo conducted 12Apr-2014 @OWASP Chapter Egypt
# https://www.owasp.org/index.php/Cairo
import urllib
import re
import time
class colors:
def __init__(self):
self.green = "\033[92m"
self.blue = "\033[94m"
self.bold = "\033[1m"
self.yellow = "\033[93m"
self.red = "\033[91m"
self.end = "\033[0m"
ga = colors()
class HTTP_HEADER:
HOST = "Host"
SERVER = "Server"
def headers_reader(url):
# This function will print the server headers such as WebServer OS & Version.
print ga.bold+" \n [!] Fingerprinting the backend Technologies."+ga.end
opener = urllib.urlopen(url)
if opener.code == 200:
print ga.green+" [!] Status code: 200 OK"+ga.end
if opener.code == 404:
print ga.red+" [!] Page was not found! Please check the URL \n"+ga.end
exit()
#Host = opener.headers.get(HTTP_HEADER.HOST)
Server = opener.headers.get(HTTP_HEADER.SERVER)
# HOST will split the HostName from the URL
Host = url.split("/")[2]
print ga.green+" [!] Host: " + str(Host) +ga.end
print ga.green+" [!] WebServer: " + str(Server) +ga.end
for item in opener.headers.items():
for powered in item:
sig = "x-powered-by"
if sig in item:
print ga.green+ " [!] " + str(powered).strip() + ga.end