From d429c3c3f9d3ab3b8c9cc15ae49953673c2b8938 Mon Sep 17 00:00:00 2001 From: pi-rho Date: Sat, 26 Jan 2013 18:55:59 -0600 Subject: [PATCH] refactor HtmlSession to expose CSS (startlog) --- netarch/ip.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/netarch/ip.py b/netarch/ip.py index 0f6ff13..3138dff 100644 --- a/netarch/ip.py +++ b/netarch/ip.py @@ -775,7 +775,14 @@ class Session(object): class HtmlSession(Session): def __init__(self, frame, packetClass=Packet, debug=True): Session.__init__(self, frame, packetClass) + self.sessfd = None self.debug = debug + self.startlog() + + def startlog(self, client="#a8a8a8", server="white"): + if self.sessfd is not None: + self.sessfd.close() + self.sessfd = self.open_out('session.html') self.sessfd.write(''' %s -''' % self.__class__.__name__) +''' % (self.__class__.__name__, server, client)) self.sessfd.write('

%s

\n' % self.__class__.__name__) self.sessfd.write('
')