Exemplo n.º 1
0
class HTTPProxy(IPC_Process):
    timeout = 60
    
    def __init__(self, hub_ref, forward_match):
        super(HTTPProxy, self).__init__()
        self.hub_ref = hub_ref
        self.forward_match = forward_match
        confdata = self.hub_ref.get('confdata')
        self.proxy_ip = confdata['http_proxy_ip']
        self.proxy_port = confdata['http_proxy_port']
        
        self.process = None
        
    def run(self):
        self.application = HTTP2SocksSmartApplication(self.forward_match, self.timeout)
        self.proxy = HTTPProxyServer(self.proxy_ip, self.proxy_port, self.application, log=None)
        self.proxy.run()
        
    def IPC_update_forward_match(self, forward_match):
        self.forward_match = forward_match
        self.application.set_match(self.forward_match)
        
    def IPC_addr(self):
        return (str(self.proxy_ip), self.proxy_port)
    
    def IPC_url(self):
        return "http://%s:%d" % (str(self.proxy_ip), self.proxy_port)
Exemplo n.º 2
0
class HTTPProxy(IPC_Process):
    timeout = 60

    def __init__(self, hub_ref, forward_match):
        super(HTTPProxy, self).__init__()
        self.hub_ref = hub_ref
        self.forward_match = forward_match
        confdata = self.hub_ref.get('confdata')
        self.proxy_ip = confdata['http_proxy_ip']
        self.proxy_port = confdata['http_proxy_port']

        self.process = None

    def run(self):
        self.application = HTTP2SocksSmartApplication(self.forward_match,
                                                      self.timeout)
        self.proxy = HTTPProxyServer(self.proxy_ip,
                                     self.proxy_port,
                                     self.application,
                                     log=None)
        self.proxy.run()

    def IPC_update_forward_match(self, forward_match):
        self.forward_match = forward_match
        self.application.set_match(self.forward_match)

    def IPC_addr(self):
        return (str(self.proxy_ip), self.proxy_port)

    def IPC_url(self):
        return "http://%s:%d" % (str(self.proxy_ip), self.proxy_port)
Exemplo n.º 3
0
class HTTPProxy(ActorProcess):
    timeout = 60

    def __init__(self, coordinator, matcher):
        super(HTTPProxy, self).__init__()
        self.coordinator = coordinator
        self.matcher = matcher

        confdata = self.coordinator.get('confdata')
        self.ip = confdata['http_proxy_ip']
        self.port = confdata['http_proxy_port']

    def run(self):
        init_logging()
        self.application = FireflyHTTPApplication(self.matcher, self.timeout)
        self.proxy = HTTPProxyServer(self.ip,
                                     self.port,
                                     self.application,
                                     log=None)
        self.proxy.run()

    def IPC_addr(self):
        return (self.ip, self.port)

    def IPC_url(self):
        return "http://%s:%d" % (str(self.ip), self.port)

    def IPC_update_matcher(self, matcher):
        self.matcher = matcher
        self.application.set_matcher(matcher)
Exemplo n.º 4
0
class HTTPProxy(ActorProcess):
    timeout = 60

    def __init__(self, coordinator, matcher):
        super(HTTPProxy, self).__init__()
        self.coordinator = coordinator
        self.matcher = matcher

        confdata = self.coordinator.get("confdata")
        self.ip = confdata["http_proxy_ip"]
        self.port = confdata["http_proxy_port"]

    def run(self):
        init_logging()
        self.application = FireflyHTTPApplication(self.matcher, self.timeout)
        self.proxy = HTTPProxyServer(self.ip, self.port, self.application, log=None)
        self.proxy.run()

    def IPC_addr(self):
        return (self.ip, self.port)

    def IPC_url(self):
        return "http://%s:%d" % (str(self.ip), self.port)

    def IPC_update_matcher(self, matcher):
        self.matcher = matcher
        self.application.set_matcher(matcher)