本文整理汇总了Python中multiprocessing.dummy.Process.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Process.__init__方法的具体用法?Python Process.__init__怎么用?Python Process.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.dummy.Process
的用法示例。
在下文中一共展示了Process.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from multiprocessing.dummy import Process [as 别名]
# 或者: from multiprocessing.dummy.Process import __init__ [as 别名]
def __init__(self, ip, port, uri_opener, proxy_handler=w3afProxyHandler,
proxy_cert='core/controllers/daemons/mitm.crt'):
'''
:param ip: IP address to bind
:param port: Port to bind
:param uri_opener: The uri_opener that will be used to open
the requests that arrive from the browser
:param proxy_handler: A class that will know how to handle
requests from the browser
:param proxy_cert: Proxy certificate to use, this is needed
for proxying SSL connections.
'''
Process.__init__(self)
self.daemon = True
self.name = 'ProxyThread'
# Internal vars
self._server = None
self._proxy_handler = proxy_handler
self._running = False
self._uri_opener = uri_opener
# User configured parameters
self._ip = ip
self._port = port
self._proxy_cert = proxy_cert
# Start the proxy server
try:
self._server = ProxyServer((self._ip, self._port),
self._proxy_handler)
except socket.error, se:
raise w3afProxyException('Socket error while starting proxy: "%s"'
% se.strerror)
示例2: __init__
# 需要导入模块: from multiprocessing.dummy import Process [as 别名]
# 或者: from multiprocessing.dummy.Process import __init__ [as 别名]
def __init__(self, ip, port, uri_opener, handler_klass=ProxyHandler,
ca_certs=CA_CERT_DIR, name='ProxyThread'):
"""
:param ip: IP address to bind
:param port: Port to bind
:param uri_opener: The uri_opener that will be used to open
the requests that arrive from the browser
:param handler_klass: A class that will know how to handle
requests from the browser
"""
Process.__init__(self)
self.daemon = True
self.name = name
# Internal vars
self._server = None
self._running = False
self._uri_opener = uri_opener
self._ca_certs = ca_certs
# Stats
self.total_handled_requests = 0
# User configured parameters
try:
self._config = ProxyConfig(cadir=self._ca_certs,
ssl_version_client='SSLv23',
ssl_version_server='SSLv23',
host=ip,
port=port)
except AttributeError as ae:
if str(ae) == "'module' object has no attribute '_lib'":
# This is a rare issue with the OpenSSL setup that some users
# (mostly in mac os) find. Not related with w3af/mitmproxy but
# with some broken stuff they have
#
# https://github.com/mitmproxy/mitmproxy/issues/281
# https://github.com/andresriancho/w3af/issues/10716
#
# AttributeError: 'module' object has no attribute '_lib'
raise ProxyException(self.INCORRECT_SETUP % ae)
else:
# Something unexpected, raise
raise
# Setting these options together with ssl_version_client and
# ssl_version_server set to SSLv23 means that the proxy will allow all
# types (including insecure) of SSL connections
self._config.openssl_options_client = None
self._config.openssl_options_server = None
# Start the proxy server
try:
self._server = ProxyServer(self._config)
except socket.error, se:
raise ProxyException('Socket error while starting proxy: "%s"'
% se.strerror)
示例3: __init__
# 需要导入模块: from multiprocessing.dummy import Process [as 别名]
# 或者: from multiprocessing.dummy.Process import __init__ [as 别名]
def __init__(self, exec_method, ip_address, socks_port=1080):
Process.__init__(self)
self.daemon = True
# Configuration
self._exec_method = exec_method
self._ip_address = ip_address
self._socks_port = socks_port
# Internal
self._agent_server = None
示例4: __init__
# 需要导入模块: from multiprocessing.dummy import Process [as 别名]
# 或者: from multiprocessing.dummy.Process import __init__ [as 别名]
def __init__(self, ip, port, uri_opener, handler_klass=ProxyHandler,
ca_certs=CA_CERT_DIR, name='ProxyThread'):
"""
:param ip: IP address to bind
:param port: Port to bind
:param uri_opener: The uri_opener that will be used to open
the requests that arrive from the browser
:param handler_klass: A class that will know how to handle
requests from the browser
"""
Process.__init__(self)
self.daemon = True
self.name = name
# Internal vars
self._server = None
self._running = False
self._uri_opener = uri_opener
self._ca_certs = ca_certs
# Stats
self.total_handled_requests = 0
# User configured parameters
self._config = ProxyConfig(cadir=self._ca_certs,
ssl_version_client='all',
ssl_version_server='all',
host=ip,
port=port)
# Start the proxy server
try:
self._server = ProxyServer(self._config)
except socket.error, se:
raise ProxyException('Socket error while starting proxy: "%s"'
% se.strerror)