How to create a proxy that can decode SSL traffic?

I was writing a proxy that can capture the requests made in my selenium tests. In selenium I used this

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) 

The proxy part that accepts client requests

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) 

And this is the part where the connection is made twith the server

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])) 

I have access to the server. My question is what should be the part for both the client request acceptance part and also forwarding it to the server , in between ###, that would allow me to capture the traffic in a human readable format? I am not very good with certificates. Any help would be welcome.

Replay

Category: python Time: 2016-07-28 Views: 2

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.121 (s). 12 q(s)