Bug#316438: fwbuilder: very simple program which outputs an html report from a .fwb xml file

2005-09-30 Thread Luke Kenneth Casson Leighton
On Fri, Sep 30, 2005 at 02:08:55AM -0700, Jeremy T. Bouse wrote:

 hmmm would you mind sending me the .fwb file from which it's
 generated?

 i'll need to identify where id3AECF776 comes from - i may have
 only added things like hosts into service groups.

 can you add _service groups_ to service groups?

 if you use more of the features of fwbuilder than i have, this sort of
 thing is likely to occur.


> The traceback I get from both my fwb data files are similar. The last
> one I ran with the version you sent me is below:
> 
> Traceback (most recent call last):
>   File "./fw_report.py", line 533, in ?
> f.decode_service_groups(o)
>   File "./fw_report.py", line 251, in decode_service_groups
> self.decode_svc_grp(g)
>   File "./fw_report.py", line 239, in decode_svc_grp
> self.decode_svc_group_members(l)
>   File "./fw_report.py", line 225, in decode_svc_group_members
> print """
> KeyError: u'id3AECF776'
> 
> 
> Luke Kenneth Casson Leighton wrote:
> > jeremy,
> > 
> > i am running - have been running - with 2.0.7.
> > 
> > make sure you have an appropriate version of python, 2.2 and 2.3 should
> > do it.
> > 
> > also make sure you have, or recommend to people to have,
> > the python xml libraries installed:
> > 
> > [EMAIL PROTECTED]:~$ dpkg -l > f
> > vi f
> > /[EMAIL PROTECTED]:~$ vi f
> > [EMAIL PROTECTED]:~$ grep python f | grep xml
> > ii  python2.2-xml  0.8.3-4  
> >   XML tools for Python (2.2.x)
> > ii  python2.2-xmlbase  2.2.3-8  
> >   XML support included in Python (v2.2)
> > ii  python2.3-xml  0.8.3-4  
> >   XML tools for Python (2.3.x)
> > 
> > 
> > you do not explain what traceback is "failing to complete" - a copy of
> > that traceback would have been helpful, i can only guess what the
> > problem is, therefore.
> > 
> > my guess is that you do not have python-xml installed.
> > 
> > latest version attached: there was something i had to update, can't
> > remember what it was...
> > 
> > l.
> > 
> > On Wed, Sep 28, 2005 at 12:46:50PM -0700, Jeremy T. Bouse wrote:
> > 
> >>   I am currently working on the 2.0.9 packaging of fwbuilder. If you 
> >>want to make sure that the script supports atleast 2.0.7 which is 
> >>currently in testing I would be willing to consider including in the 
> >>examples directory and adding a note in the README.Debian regarding it 
> >>with the 2.0.9 upload if you can get back in time. I did find that when 
> >>I ran it against a couple of my .fwb files it failed to complete 
> >>properly and threw a traceback.
> >>
> >>   Also include as an attachment rather than inline next time so I can 
> >>just download rather than cut and paste.
> >>
> >>   Regards,
> >>   Jeremy
> >>
> >>Luke Kenneth Casson Leighton wrote:
> >>
> >>
> >>>Package: fwbuilder
> >>>Version: 2.0.3-2
> >>>Severity: normal
> >>>
> >>>
> >>>attached is a joyously useful program that makes up for the lack of
> >>>print reporting in fwbuilder.
> >>>
> >>>it's a dog, it's hacked, it works.  i wouldn't recommend making python a
> >>>dependency because of it, but i _would_ recommend dumping it in the
> >>>/usr/share/doc/fwbuilder/examples directory and referencing it in the
> >>>README.
> >>>
> >>>or makin a separate apt-get install package for it (with a dep on
> >>>python)
> >>>
> >>>l.
> >>>
> >>>#!/usr/bin/env python
> >>>
> >>
> >>>from xml.dom.minidom import parseString, parse
> >>
> >>>
> >>>class fw:
> >>>
> >>>   def __init__(self):
> >>>   
> >>>   self.hosts = {}
> >>>   self.descriptions = {}
> >>>
> >>>   def print_comment(self, c):
> >>>   print ''
> >>>   for l in c.split("\\n"):
> >>>   while l:
> >>>   bp = l.find(' ', 50)
> >>>   if bp < 50: bp = 50
> >>>   if len(l) >= 50:
> >>>   end = l.rfind(' ')
> >>>   if end <= 50:
> >>>   bp = end
> >>>   print "%s" % l[:bp]
> >>>   l = l[bp:]
> >>>   print ''
> >>>
> >>>   
> >>>   def decode_address_ranges(self, i):
> >>>   adrs = []
> >>>   print ''
> >>>   for a in i:
> >>>   print ''
> >>>   self.descriptions[a.getAttribute('id')] = 
> >>>   a.getAttribute('name')
> >>>   print """
> >>>%s: 
> >>>%s 
> >>>%s 
> >>>   """ % \
> >>>   (a.getAttribute('name'),
> >>>a.getAttribute('start_address'),
> >>>a.getAttribute('end_address'))
> >>>
> >>>   comment = a.getAttribute('comment')
> >>>  

Bug#316438: fwbuilder: very simple program which outputs an html report from a .fwb xml file

2005-09-30 Thread Jeremy T. Bouse
The traceback I get from both my fwb data files are similar. The last
one I ran with the version you sent me is below:

Traceback (most recent call last):
  File "./fw_report.py", line 533, in ?
f.decode_service_groups(o)
  File "./fw_report.py", line 251, in decode_service_groups
self.decode_svc_grp(g)
  File "./fw_report.py", line 239, in decode_svc_grp
self.decode_svc_group_members(l)
  File "./fw_report.py", line 225, in decode_svc_group_members
print """
KeyError: u'id3AECF776'


Luke Kenneth Casson Leighton wrote:
> jeremy,
> 
> i am running - have been running - with 2.0.7.
> 
> make sure you have an appropriate version of python, 2.2 and 2.3 should
> do it.
> 
> also make sure you have, or recommend to people to have,
> the python xml libraries installed:
> 
>   [EMAIL PROTECTED]:~$ dpkg -l > f
>   vi f
>   /[EMAIL PROTECTED]:~$ vi f
>   [EMAIL PROTECTED]:~$ grep python f | grep xml
>   ii  python2.2-xml  0.8.3-4  
>   XML tools for Python (2.2.x)
>   ii  python2.2-xmlbase  2.2.3-8  
>   XML support included in Python (v2.2)
>   ii  python2.3-xml  0.8.3-4  
>   XML tools for Python (2.3.x)
> 
> 
> you do not explain what traceback is "failing to complete" - a copy of
> that traceback would have been helpful, i can only guess what the
> problem is, therefore.
> 
> my guess is that you do not have python-xml installed.
> 
> latest version attached: there was something i had to update, can't
> remember what it was...
> 
> l.
> 
> On Wed, Sep 28, 2005 at 12:46:50PM -0700, Jeremy T. Bouse wrote:
> 
>>   I am currently working on the 2.0.9 packaging of fwbuilder. If you 
>>want to make sure that the script supports atleast 2.0.7 which is 
>>currently in testing I would be willing to consider including in the 
>>examples directory and adding a note in the README.Debian regarding it 
>>with the 2.0.9 upload if you can get back in time. I did find that when 
>>I ran it against a couple of my .fwb files it failed to complete 
>>properly and threw a traceback.
>>
>>   Also include as an attachment rather than inline next time so I can 
>>just download rather than cut and paste.
>>
>>   Regards,
>>   Jeremy
>>
>>Luke Kenneth Casson Leighton wrote:
>>
>>
>>>Package: fwbuilder
>>>Version: 2.0.3-2
>>>Severity: normal
>>>
>>>
>>>attached is a joyously useful program that makes up for the lack of
>>>print reporting in fwbuilder.
>>>
>>>it's a dog, it's hacked, it works.  i wouldn't recommend making python a
>>>dependency because of it, but i _would_ recommend dumping it in the
>>>/usr/share/doc/fwbuilder/examples directory and referencing it in the
>>>README.
>>>
>>>or makin a separate apt-get install package for it (with a dep on
>>>python)
>>>
>>>l.
>>>
>>>#!/usr/bin/env python
>>>
>>
>>>from xml.dom.minidom import parseString, parse
>>
>>>
>>>class fw:
>>>
>>> def __init__(self):
>>> 
>>> self.hosts = {}
>>> self.descriptions = {}
>>>
>>> def print_comment(self, c):
>>> print ''
>>> for l in c.split("\\n"):
>>> while l:
>>> bp = l.find(' ', 50)
>>> if bp < 50: bp = 50
>>> if len(l) >= 50:
>>> end = l.rfind(' ')
>>> if end <= 50:
>>> bp = end
>>> print "%s" % l[:bp]
>>> l = l[bp:]
>>> print ''
>>>
>>> 
>>> def decode_address_ranges(self, i):
>>> adrs = []
>>> print ''
>>> for a in i:
>>> print ''
>>> self.descriptions[a.getAttribute('id')] = 
>>> a.getAttribute('name')
>>> print """
>>>  %s: 
>>>  %s 
>>>  %s 
>>> """ % \
>>> (a.getAttribute('name'),
>>>  a.getAttribute('start_address'),
>>>  a.getAttribute('end_address'))
>>>
>>> comment = a.getAttribute('comment')
>>> if comment:
>>> print ''
>>> print ''
>>> print ' '
>>> print ''
>>> self.print_comment(comment)
>>> print ''
>>> print ''
>>> print ''
>>>
>>> def decode_ipv4(self, i):
>>> adrs = []
>>> print ''
>>> for a in i:
>>> self.descriptions[a.getAttribute('id')] = 
>>> a.getAttribute('name')
>>> 

Bug#316438: fwbuilder: very simple program which outputs an html report from a .fwb xml file

2005-09-29 Thread Luke Kenneth Casson Leighton
jeremy,

i am running - have been running - with 2.0.7.

make sure you have an appropriate version of python, 2.2 and 2.3 should
do it.

also make sure you have, or recommend to people to have,
the python xml libraries installed:

[EMAIL PROTECTED]:~$ dpkg -l > f
vi f
/[EMAIL PROTECTED]:~$ vi f
[EMAIL PROTECTED]:~$ grep python f | grep xml
ii  python2.2-xml  0.8.3-4  
  XML tools for Python (2.2.x)
ii  python2.2-xmlbase  2.2.3-8  
  XML support included in Python (v2.2)
ii  python2.3-xml  0.8.3-4  
  XML tools for Python (2.3.x)


you do not explain what traceback is "failing to complete" - a copy of
that traceback would have been helpful, i can only guess what the
problem is, therefore.

my guess is that you do not have python-xml installed.

latest version attached: there was something i had to update, can't
remember what it was...

l.

On Wed, Sep 28, 2005 at 12:46:50PM -0700, Jeremy T. Bouse wrote:
>I am currently working on the 2.0.9 packaging of fwbuilder. If you 
> want to make sure that the script supports atleast 2.0.7 which is 
> currently in testing I would be willing to consider including in the 
> examples directory and adding a note in the README.Debian regarding it 
> with the 2.0.9 upload if you can get back in time. I did find that when 
> I ran it against a couple of my .fwb files it failed to complete 
> properly and threw a traceback.
> 
>Also include as an attachment rather than inline next time so I can 
> just download rather than cut and paste.
> 
>Regards,
>Jeremy
> 
> Luke Kenneth Casson Leighton wrote:
> 
> >Package: fwbuilder
> >Version: 2.0.3-2
> >Severity: normal
> >
> >
> >attached is a joyously useful program that makes up for the lack of
> >print reporting in fwbuilder.
> >
> >it's a dog, it's hacked, it works.  i wouldn't recommend making python a
> >dependency because of it, but i _would_ recommend dumping it in the
> >/usr/share/doc/fwbuilder/examples directory and referencing it in the
> >README.
> >
> >or makin a separate apt-get install package for it (with a dep on
> >python)
> >
> >l.
> >
> >#!/usr/bin/env python
> >
> >from xml.dom.minidom import parseString, parse
> >
> >
> >class fw:
> >
> > def __init__(self):
> > 
> > self.hosts = {}
> > self.descriptions = {}
> >
> > def print_comment(self, c):
> > print ''
> > for l in c.split("\\n"):
> > while l:
> > bp = l.find(' ', 50)
> > if bp < 50: bp = 50
> > if len(l) >= 50:
> > end = l.rfind(' ')
> > if end <= 50:
> > bp = end
> > print "%s" % l[:bp]
> > l = l[bp:]
> > print ''
> >
> > 
> > def decode_address_ranges(self, i):
> > adrs = []
> > print ''
> > for a in i:
> > print ''
> > self.descriptions[a.getAttribute('id')] = 
> > a.getAttribute('name')
> > print """
> >  %s: 
> >  %s 
> >  %s 
> > """ % \
> > (a.getAttribute('name'),
> >  a.getAttribute('start_address'),
> >  a.getAttribute('end_address'))
> >
> > comment = a.getAttribute('comment')
> > if comment:
> > print ''
> > print ''
> > print ' '
> > print ''
> > self.print_comment(comment)
> > print ''
> > print ''
> > print ''
> >
> > def decode_ipv4(self, i):
> > adrs = []
> > print ''
> > for a in i:
> > self.descriptions[a.getAttribute('id')] = 
> > a.getAttribute('name')
> > print ''
> > print "%s:  %s/%s" % \
> > (a.getAttribute('name'), 
> > a.getAttribute('address'), 
> > a.getAttribute('netmask'))
> > print ""
> > comment = a.getAttribute('comment')
> > if comment:
> > print ''
> > print ''
> > print ' '
> > print ''
> > self.print_comment(comment)
>

Bug#316438: fwbuilder: very simple program which outputs an html report from a .fwb xml file

2005-09-29 Thread Luke Kenneth Casson Leighton
will take a look-see..

On Wed, Sep 28, 2005 at 12:46:50PM -0700, Jeremy T. Bouse wrote:
>I am currently working on the 2.0.9 packaging of fwbuilder. If you 
> want to make sure that the script supports atleast 2.0.7 which is 
> currently in testing I would be willing to consider including in the 
> examples directory and adding a note in the README.Debian regarding it 
> with the 2.0.9 upload if you can get back in time. I did find that when 
> I ran it against a couple of my .fwb files it failed to complete 
> properly and threw a traceback.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#316438: fwbuilder: very simple program which outputs an html report from a .fwb xml file

2005-09-28 Thread Jeremy T. Bouse
   I am currently working on the 2.0.9 packaging of fwbuilder. If you 
want to make sure that the script supports atleast 2.0.7 which is 
currently in testing I would be willing to consider including in the 
examples directory and adding a note in the README.Debian regarding it 
with the 2.0.9 upload if you can get back in time. I did find that when 
I ran it against a couple of my .fwb files it failed to complete 
properly and threw a traceback.


   Also include as an attachment rather than inline next time so I can 
just download rather than cut and paste.


   Regards,
   Jeremy

Luke Kenneth Casson Leighton wrote:


Package: fwbuilder
Version: 2.0.3-2
Severity: normal


attached is a joyously useful program that makes up for the lack of
print reporting in fwbuilder.

it's a dog, it's hacked, it works.  i wouldn't recommend making python a
dependency because of it, but i _would_ recommend dumping it in the
/usr/share/doc/fwbuilder/examples directory and referencing it in the
README.

or makin a separate apt-get install package for it (with a dep on
python)

l.

#!/usr/bin/env python

from xml.dom.minidom import parseString, parse


class fw:

def __init__(self):

self.hosts = {}
self.descriptions = {}

def print_comment(self, c):
print ''
for l in c.split("\\n"):
while l:
bp = l.find(' ', 50)
if bp < 50: bp = 50
if len(l) >= 50:
end = l.rfind(' ')
if end <= 50:
bp = end
print "%s" % l[:bp]
l = l[bp:]
print ''


def decode_address_ranges(self, i):
adrs = []
print ''
for a in i:
print ''
self.descriptions[a.getAttribute('id')] = 
a.getAttribute('name')
print """
 %s: 
 %s 
 %s 
""" % \
(a.getAttribute('name'),
 a.getAttribute('start_address'),
 a.getAttribute('end_address'))

comment = a.getAttribute('comment')
if comment:
print ''
print ''
print ' '
print ''
self.print_comment(comment)
print ''
print ''
print ''

def decode_ipv4(self, i):
adrs = []
print ''
for a in i:
self.descriptions[a.getAttribute('id')] = 
a.getAttribute('name')
print ''
print "%s:  %s/%s" % \
(a.getAttribute('name'), 
a.getAttribute('address'), a.getAttribute('netmask'))
print ""
comment = a.getAttribute('comment')
if comment:
print ''
print ''
print ' '
print ''
self.print_comment(comment)
print ''
print ''
print ''

def decode_interface(self, i):
self.descriptions[i.getAttribute('id')] = i.getAttribute('name')

print ''
print "Interface: %-8s   %s " % \
(i.getAttribute('name'), i.getAttribute('label'))
print ""
self.decode_ipv4(i.getElementsByTagName('IPv4'))
print ""
print ""

def get_desc(self, id):
if type(id) is not list:
id = [id]
l = []
for i in id:
l.append(self.descriptions.get(i, "" % 
str(i)))
return ''.join(l)

def decode_host(self, h):
self.descriptions[h.getAttribute('id')] = h.getAttribute('name')

print ""

print ''
print ''
print "Hostname:  %s" % h.getAttribute('name')
print ""
print ''

print ""

print ""

print ''
for i in h.getElementsByTagName('Interface'):
self.decode_interface(i)
print ''


Bug#316438: fwbuilder: very simple program which outputs an html report from a .fwb xml file

2005-06-30 Thread Luke Kenneth Casson Leighton
Package: fwbuilder
Version: 2.0.3-2
Severity: normal


attached is a joyously useful program that makes up for the lack of
print reporting in fwbuilder.

it's a dog, it's hacked, it works.  i wouldn't recommend making python a
dependency because of it, but i _would_ recommend dumping it in the
/usr/share/doc/fwbuilder/examples directory and referencing it in the
README.

or makin a separate apt-get install package for it (with a dep on
python)

l.

#!/usr/bin/env python

from xml.dom.minidom import parseString, parse


class fw:

def __init__(self):

self.hosts = {}
self.descriptions = {}

def print_comment(self, c):
print ''
for l in c.split("\\n"):
while l:
bp = l.find(' ', 50)
if bp < 50: bp = 50
if len(l) >= 50:
end = l.rfind(' ')
if end <= 50:
bp = end
print "%s" % l[:bp]
l = l[bp:]
print ''


def decode_address_ranges(self, i):
adrs = []
print ''
for a in i:
print ''
self.descriptions[a.getAttribute('id')] = 
a.getAttribute('name')
print """
 %s: 
 %s 
 %s 
""" % \
(a.getAttribute('name'),
 a.getAttribute('start_address'),
 a.getAttribute('end_address'))

comment = a.getAttribute('comment')
if comment:
print ''
print ''
print ' '
print ''
self.print_comment(comment)
print ''
print ''
print ''

def decode_ipv4(self, i):
adrs = []
print ''
for a in i:
self.descriptions[a.getAttribute('id')] = 
a.getAttribute('name')
print ''
print "%s:  %s/%s" % \
(a.getAttribute('name'), 
a.getAttribute('address'), a.getAttribute('netmask'))
print ""
comment = a.getAttribute('comment')
if comment:
print ''
print ''
print ' '
print ''
self.print_comment(comment)
print ''
print ''
print ''

def decode_interface(self, i):
self.descriptions[i.getAttribute('id')] = i.getAttribute('name')

print ''
print "Interface: %-8s   %s " % \
(i.getAttribute('name'), i.getAttribute('label'))
print ""
self.decode_ipv4(i.getElementsByTagName('IPv4'))
print ""
print ""

def get_desc(self, id):
if type(id) is not list:
id = [id]
l = []
for i in id:
l.append(self.descriptions.get(i, "" % 
str(i)))
return ''.join(l)

def decode_host(self, h):
self.descriptions[h.getAttribute('id')] = h.getAttribute('name')

print ""

print ''
print ''
print "Hostname:  %s" % h.getAttribute('name')
print ""
print ''

print ""

print ""

print ''
for i in h.getElementsByTagName('Interface'):
self.decode_interface(i)
print ''

print ""

def decode_hosts(self, o):

print ''
hl = o.getElementsByTagName('Host')
for h in hl:
print ''
self.decode_host(h)
print ''
print ''

def decode_svc_icmp(self, t):

self.descriptions[t.getAttribute('id')] = t.getAttribute('name')
print """


   Name: %-10s 
   Code: %s