Use new get_current_cipher to show cipher in pathoc SSL output

This commit is contained in:
Aldo Cortesi 2014-03-02 21:54:30 +13:00
parent 53334e437c
commit 602e400ccc

View File

@ -8,8 +8,8 @@ class PathocError(Exception): pass
class SSLInfo: class SSLInfo:
def __init__(self, certchain): def __init__(self, certchain, cipher):
self.certchain = certchain self.certchain, self.cipher = certchain, cipher
class Response: class Response:
@ -68,7 +68,8 @@ class Pathoc(tcp.TCPClient):
except tcp.NetLibError, v: except tcp.NetLibError, v:
raise PathocError(str(v)) raise PathocError(str(v))
self.sslinfo = SSLInfo( self.sslinfo = SSLInfo(
self.connection.get_peer_cert_chain() self.connection.get_peer_cert_chain(),
self.get_current_cipher()
) )
def request(self, spec): def request(self, spec):
@ -160,6 +161,7 @@ class Pathoc(tcp.TCPClient):
self._show_summary(fp, *resp) self._show_summary(fp, *resp)
if self.sslinfo: if self.sslinfo:
print >> fp, "Cipher: %s, %s bit, %s"%self.sslinfo.cipher
print >> fp, "SSL certificate chain:\n" print >> fp, "SSL certificate chain:\n"
for i in self.sslinfo.certchain: for i in self.sslinfo.certchain:
print >> fp, "\tSubject: ", print >> fp, "\tSubject: ",