hgn / captcp

A open source program for TCP analysis of PCAP files
http://research.protocollabs.com/captcp/
GNU General Public License v3.0
113 stars 40 forks source link

Captcp fails to analize pcap file. Error: TemplateMod instance has no attribute 'logger' #17

Closed ghost closed 10 years ago

ghost commented 10 years ago

Recent version of captcp fails to analyze pcap file. Version 1.7 works fine so possibly this issue was introduced by recent commit c18793c63ba61c278e1c773511256cfcdcfd26aa "Consolidate logging.getLogger() calls"

$ captcp throughput -i -o test ./test.pcap 
# captcp 2010-2013 Hagen Paul Pfeifer and others (c)
# http://research.protocollabs.com/captcp/
Traceback (most recent call last):
  File "/usr/bin/captcp", line 5220, in 
    sys.exit(captcp.run())
  File "/usr/bin/captcp", line 5181, in run
    classinstance.initialize()
  File "/usr/bin/captcp", line 2702, in initialize
    self.create_gnuplot_environment()
  File "/usr/bin/captcp", line 2652, in create_gnuplot_environment
    tmpl = string.Template(TemplateMod().get_content_by_name("throughput"))
  File "/usr/bin/captcp", line 1014, in __init__
    self.init_db()
  File "/usr/bin/captcp", line 1041, in init_db
    self.logger.debug("initialize local template database")
AttributeError: TemplateMod instance has no attribute 'logger'

Pcap file is a capture of few SSH packets from the network. Captcp v1.7 analyzes same capture successfully.

Fix can be:

diff --git a/captcp.py b/captcp.py
index d3bf33f..930d69e 100755
--- a/captcp.py
+++ b/captcp.py
@@ -1011,6 +1011,7 @@ class TemplateMod(Mod):

     def __init__(self):
+       Mod.__init__(self)
         self.init_db()

hgn commented 10 years ago

Sorry @xrevolver for the long standing bug! And thank you for bug report! If we see us one time I will pay a beer. ;-)

ghost commented 10 years ago

On 01/22/2014 06:14 PM, Hagen Paul Pfeifer wrote:

Sorry @xrevolver https://github.com/xrevolver for the long standing bug! And thank you for bug report! If we see us one time I will pay a beer. ;-)

My pleasure!