Ejemplo n.º 1
0
    def __init__(self):
        Thread.__init__(self)

        config = proxy.ProxyConfig(
            cacert = os.path.expanduser("~/.mitmproxy/mitmproxy-ca.pem"),
            transparent_proxy = dict (showhost=True,resolver = platform.resolver(), sslports = [443, 8443]) #Thanks nmonkee
        )
        state = flow.State()
        server = proxy.ProxyServer(config, 8080)
        self.m = MyMaster(server, state)
Ejemplo n.º 2
0
 def __init__(self, ctx):
     super(TransparentProxy, self).__init__(ctx)
     self.resolver = platform.resolver()
Ejemplo n.º 3
0
# Initial CONFIG reading
user_config = ConfigObj(CONFIGFILE)

#################### BEGIN OVERALL CONFIGS ############################
# DOES NOT UPDATE ON THE FLY
resourceScript = user_config['Overall']['resourceScriptFile']

config = proxy.ProxyConfig(clientcerts=os.path.expanduser(user_config['Overall']['certLocation']),
                           body_size_limit=int(user_config['Overall']['MaxSizeFileRequested']),
                           port=int(user_config['Overall']['proxyPort']),
                           mode=user_config['Overall']['proxyMode'],
                           )

if user_config['Overall']['proxyMode'] != "None":
    config.proxy_mode = {'sslports': user_config['Overall']['sslports'],
                         'resolver': platform.resolver()
                         }

server = ProxyServer(config)

numericLogLevel = getattr(logging, user_config['Overall']['loglevel'].upper(), None)

if not isinstance(numericLogLevel, int):
    EnhancedOutput.print_error("INFO, DEBUG, WARNING, ERROR, CRITICAL for loglevel in conifg")
    sys.exit(1)

logging.basicConfig(filename=user_config['Overall']['logname'],
                    level=numericLogLevel,
                    format='%(asctime)s %(message)s'
                    )
Ejemplo n.º 4
0
 def __init__(self, ctx):
     super().__init__(ctx)
     self.resolver = platform.resolver()
Ejemplo n.º 5
0
#################### BEGIN OVERALL CONFIGS ############################
# DOES NOT UPDATE ON THE FLY
resourceScript = user_config['Overall']['resourceScriptFile']

config = proxy.ProxyConfig(
    clientcerts=os.path.expanduser(user_config['Overall']['certLocation']),
    body_size_limit=int(user_config['Overall']['MaxSizeFileRequested']),
    port=int(user_config['Overall']['proxyPort']),
    mode=user_config['Overall']['proxyMode'],
)

if user_config['Overall']['proxyMode'] != "None":
    config.proxy_mode = {
        'sslports': user_config['Overall']['sslports'],
        'resolver': platform.resolver()
    }

server = ProxyServer(config)

numericLogLevel = getattr(logging, user_config['Overall']['loglevel'].upper(),
                          None)

if not isinstance(numericLogLevel, int):
    EnhancedOutput.print_error(
        "INFO, DEBUG, WARNING, ERROR, CRITICAL for loglevel in conifg")
    sys.exit(1)

logging.basicConfig(filename=user_config['Overall']['logname'],
                    level=numericLogLevel,
                    format='%(asctime)s %(message)s')
Ejemplo n.º 6
0
 def __init__(self, ctx):
     super().__init__(ctx)
     self.resolver = platform.resolver()