WPAD now integrated

This commit is contained in:
byt3bl33d3r 2014-12-13 21:30:55 +01:00
commit d01398d8a8
13 changed files with 82 additions and 39 deletions

View file

@ -1,31 +0,0 @@
<html>
<head>
<title>Website Blocked: ISA Proxy Server</title>
<style>
<!--
body, ul, li { font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#737373; margin:0; padding:0;}
.content { padding: 20px 15px 15px 40px; width: 500px; margin: 70px auto 6px auto; border: #D52B1E solid 2px;}
.blocking { border-top: #D52B1E solid 2px; border-bottom: #D52B1E solid 2px;}
.title { font-size: 24px; border-bottom: #ccc solid 1px; padding-bottom:15px; margin-bottom:15px;}
.details li { list-style: none; padding: 4px 0;}
.footer { color: #6d90e7; font-size: 14px; width: 540px; margin: 0 auto; text-align:right; }
-->
</style>
</head>
<body>
<center>
<div class="content blocking">
<div class="title" id="msg_title"><b>New Security Policy: Website Blocked</b></div>
<ul class="details">
<div id="main_block">
<div id="msg_long_reason">
<li><b>Access has been blocked. Please download and install the new </b><span class="url"><a href="http://isaProxysrv/ProxyClient.exe"><b>Proxy Client</b></a></span><b> in order to access internet resources.</b></li>
</div>
</ul>
</div>
<div class="footer">ISA Security <b>Proxy Server</b></div>
</center>
</body>
</html>

Binary file not shown.

View file

@ -22,12 +22,13 @@ from Fingerprint import RunSmbFinger,OsNameClientVersion
from odict import OrderedDict
from socket import inet_aton
from random import randrange
from libs.sslstrip.DnsCache import DnsCache
VERSION = '2.1.2'
#Config parsing
config = ConfigParser.ConfigParser()
config.read("./config/responder.conf")
config.read("./config/responder/responder.conf")
# Set some vars.
On_Off = config.get('Responder Core', 'HTTP').upper()
@ -47,7 +48,7 @@ Exe_On_Off = config.get('HTTP Server', 'Serve-Exe').upper()
Exec_Mode_On_Off = config.get('HTTP Server', 'Serve-Always').upper()
FILENAME = config.get('HTTP Server', 'Filename')
WPAD_Script = config.get('HTTP Server', 'WPADScript')
HTMLToServe = config.get('HTTP Server', 'HTMLToServe')
#HTMLToServe = config.get('HTTP Server', 'HTMLToServe')
RespondTo = config.get('Responder Core', 'RespondTo').strip()
RespondTo.split(",")
RespondToName = config.get('Responder Core', 'RespondToName').strip()
@ -57,8 +58,7 @@ DontRespondTo.split(",")
DontRespondToName = config.get('Responder Core', 'DontRespondToName').strip()
DontRespondToName.split(",")
if HTMLToServe == None:
HTMLToServe = ''
HTMLToServe = ''
if len(NumChal) is not 16:
sys.exit("[-] The challenge must be exactly 16 chars long.\nExample: -c 1122334455667788\n")
@ -338,6 +338,7 @@ class NB(BaseRequestHandler):
if data[2:4] == "\x01\x10":
if Validate_NBT_NS(data,Wredirect):
if RespondToSpecificName(RespondToName) == False:
DnsCache.getInstance().setCustomRes(Name.lower())
buff = NBT_Ans()
buff.calculate(data)
for x in range(1):
@ -358,6 +359,7 @@ class NB(BaseRequestHandler):
logging.warning('[+] Fingerprint failed for host: %s'%(self.client_address[0]))
pass
if RespondToSpecificName(RespondToName) and RespondToNameScope(RespondToName.upper(), Name.upper()):
DnsCache.getInstance().setCustomRes(Name.lower())
buff = NBT_Ans()
buff.calculate(data)
for x in range(1):
@ -386,6 +388,7 @@ class NB(BaseRequestHandler):
if data[2:4] == "\x01\x10":
if Validate_NBT_NS(data,Wredirect) and Analyze(AnalyzeMode) == False:
if RespondToSpecificName(RespondToName) and RespondToNameScope(RespondToName.upper(), Name.upper()):
DnsCache.getInstance().setCustomRes(Name.lower())
buff = NBT_Ans()
buff.calculate(data)
for x in range(1):
@ -406,6 +409,7 @@ class NB(BaseRequestHandler):
logging.warning('[+] Fingerprint failed for host: %s'%(self.client_address[0]))
pass
if RespondToSpecificName(RespondToName) == False:
DnsCache.getInstance().setCustomRes(Name.lower())
buff = NBT_Ans()
buff.calculate(data)
for x in range(1):
@ -2304,7 +2308,8 @@ def Is_HTTPS_On(SSL_On_Off):
#Function name self-explanatory
def Is_WPAD_On(on_off):
if on_off == True:
return thread.start_new(serve_thread_tcp,('', 3141,ProxyHandler))
return True
#return thread.start_new(serve_thread_tcp,('', 3141,ProxyHandler))
if on_off == False:
return False
@ -2522,7 +2527,7 @@ def start_responder(options, ip_address):
start_message += "Serving Executable via HTTP&WPAD: %s\n" % Exe_On_Off
start_message += "Always Serving a Specific File via HTTP&WPAD: %s\n" % Exec_Mode_On_Off
print start_message
logging.debug(start_message)
try:
num_thrd = 1

View file

@ -1,28 +1,41 @@
import logging
class DnsCache:
'''
The DnsCache maintains a cache of DNS lookups, mirroring the browser experience.
'''
'''
The DnsCache maintains a cache of DNS lookups, mirroring the browser experience.
'''
_instance = None
_instance = None
def __init__(self):
self.cache = {}
def __init__(self):
self.customAddress = None
self.cache = {}
def cacheResolution(self, host, address):
self.cache[host] = address
def cacheResolution(self, host, address):
self.cache[host] = address
def getCachedAddress(self, host):
if host in self.cache:
return self.cache[host]
def getCachedAddress(self, host):
if host in self.cache:
return self.cache[host]
return None
return None
def getInstance():
if DnsCache._instance == None:
DnsCache._instance = DnsCache()
def getInstance():
if DnsCache._instance == None:
DnsCache._instance = DnsCache()
return DnsCache._instance
return DnsCache._instance
getInstance = staticmethod(getInstance)
def setCustomRes(self, host, ip_address=None):
if ip_address is not None:
self.cache[host] = ip_address
logging.debug("DNS entry set: %s -> %s" %(host, ip_address))
else:
if self.customAddress is not None:
self.cache[host] = self.customAddress
def setCustomAddress(self, ip_address):
self.customAddress = ip_address
getInstance = staticmethod(getInstance)

View file

@ -1,3 +1,4 @@
import logging
class DnsCache:
@ -8,6 +9,7 @@ class DnsCache:
_instance = None
def __init__(self):
self.customAddress = None
self.cache = {}
def cacheResolution(self, host, address):
@ -25,4 +27,15 @@ class DnsCache:
return DnsCache._instance
getInstance = staticmethod(getInstance)
def setCustomRes(self, host, ip_address=None):
if ip_address is not None:
self.cache[host] = ip_address
logging.debug("DNS entry set: %s -> %s" %(host, ip_address))
else:
if self.customAddress is not None:
self.cache[host] = self.customAddress
def setCustomAddress(self, ip_address):
self.customAddress = ip_address
getInstance = staticmethod(getInstance)