1
我正在寫一個代理,可以捕獲我的硒測試中提出的請求。在硒我用的是接受客戶端請求如何創建可以解碼SSL流量的代理?
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
###
ssl.wrap_socket(self.socket, ssl_version=ssl.PROTOCOL_TLSv1, keyfile = ??, certfile = ???, server_side=True)
###
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.bind((self.hostname, self.port))
self.socket.listen(self.backlog)
while True:
conn, addr = self.socket.accept()
logger.debug('Accepted connection %r at address %r' % (conn, addr))
self.handle(conn,addr)
而這正是該連接twith服務器
self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
###
ssl.wrap_socket(self.socket, ssl_version=ssl.PROTOCOL_TLSv1, keyfile = ??, certfile = ???, server_side=True)
###
self.conn.connect((self.addr[0], self.addr[1]))
我曾訪問所作的部分原因
host = '10.203.9.156'
profile = webdriver.FirefoxProfile()
myProxy = "localhost:8899"
proxy = Proxy({
'proxyType': ProxyType.MANUAL,
'httpProxy': myProxy,
'ftpProxy': myProxy,
'sslProxy': myProxy,
'noProxy': '' # set this value as desired
})
driver = webdriver.Firefox(proxy=proxy)
代理部分服務器。我的問題是什麼應該是客戶端請求接受部分的一部分,並在###之間將其轉發給服務器,這將允許我以可讀的格式捕獲流量?證書不是很好。任何幫助將受到歡迎。
我用mitmproxy如你所說後,有趣的問題。它解釋瞭如何安裝(或成爲CA權威機構)。但是我沒有做到這一點,並且當我通過mitmproxy進行代理時,我能夠看到所有SSL流量。這對我的系統有什麼影響? – user1429322
@ user1429322:這可能意味着您已經設置Selenium/Firefox來忽略證書錯誤,如[在此描述](http://stackoverflow.com/questions/16879566/how-to-disable-firefoxs-untrusted-connection-warning - 使用 - 硒)。 –