On 20 Feb 2008, at 15:35, carlopmart wrote:
Is it possible to install roo components: hflowd, p0f, walleye, etc
(except base OS) under a CentOS paravirtualized xen guest?? Which
packages do I need to install?
I think it's probably possible now, but I've never tried. I'd advise
caution as updating will be a pain and possibly lead to breakage as
the various repos conflict. I think you'd be cleaner installing the
cdrom into xen directly. I prefer to think of the honeywall as an
appliance device.
If you want to do it, look at
http://www.honeynet.org/tools/cdrom/roo/repo-1.3
You'll need to yum install any package in there that isn't on your
system.
The attached code will tell you what isn't on your system and what
version mismatches you have. Let us know how it goes.
Arthur
--
Arthur Clune UK Honeynet Project [EMAIL PROTECTED]
www.ukhoneynet.org
import re
import os
import urllib2
import sgmllib
import sys
class MyParser(sgmllib.SGMLParser):
"A simple parser class from http://www.boddie.org.uk/python/downloads/HTML1.py"
def parse(self, s):
"Parse the given string 's'."
self.feed(s)
self.close()
def __init__(self, verbose=0):
"Initialise an object, passing 'verbose' to the superclass."
sgmllib.SGMLParser.__init__(self, verbose)
self.hyperlinks = []
def start_a(self, attributes):
"Process a hyperlink and its 'attributes'."
for name, value in attributes:
if name == "href":
self.hyperlinks.append(value)
def get_hyperlinks(self):
"Return the list of hyperlinks."
return self.hyperlinks
# locale independend string methods
def _xisalpha(c):
return (c >= "a" and c <= "z") or (c >= "A" and c <= "Z")
def _xisdigit(c):
return c >= "0" and c <= "9"
def _xisalnum(c):
return ((c >= "a" and c <= "z") or (c >= "A" and c <= "Z")
or (c >= "0" and c <= "9"))
# compare two strings, rpm/lib/rpmver.c:rpmvercmp()
def stringCompare(str1, str2):
""" Loop through each version segment (alpha or numeric) of
str1 and str2 and compare them. """
if str1 == str2:
return 0
lenstr1 = len(str1)
lenstr2 = len(str2)
i1 = 0
i2 = 0
while i1 < lenstr1 and i2 < lenstr2:
# remove leading separators
while i1 < lenstr1 and not _xisalnum(str1[i1]):
i1 += 1
while i2 < lenstr2 and not _xisalnum(str2[i2]):
i2 += 1
if i1 == lenstr1 or i2 == lenstr2: # bz 178798
break
# start of the comparison data, search digits or alpha chars
j1 = i1
j2 = i2
if j1 < lenstr1 and _xisdigit(str1[j1]):
while j1 < lenstr1 and _xisdigit(str1[j1]):
j1 += 1
while j2 < lenstr2 and _xisdigit(str2[j2]):
j2 += 1
isnum = 1
else:
while j1 < lenstr1 and _xisalpha(str1[j1]):
j1 += 1
while j2 < lenstr2 and _xisalpha(str2[j2]):
j2 += 1
isnum = 0
# check if we already hit the end
if j1 == i1:
return -1
if j2 == i2:
if isnum:
return 1
return -1
if isnum:
# ignore leading "0" for numbers (1.01 == 1.000001)
while i1 < j1 and str1[i1] == "0":
i1 += 1
while i2 < j2 and str2[i2] == "0":
i2 += 1
# longer size of digits wins
if j1 - i1 > j2 - i2:
return 1
if j2 - i2 > j1 - i1:
return -1
x = cmp(str1[i1:j1], str2[i2:j2])
if x:
return x
# move to next comparison start
i1 = j1
i2 = j2
if i1 == lenstr1:
if i2 == lenstr2:
return 0
return -1
return 1
# EVR compare: uses stringCompare to compare epoch/version/release
def labelCompare(e1, e2):
# remove comparison of the release string if one of them is missing
r = stringCompare(e1[0], e2[0])
if r == 0:
r = stringCompare(e1[1], e2[1])
if r == 0 and e1[2] != "" and e2[2] != "":
r = stringCompare(e1[2], e2[2])
return r
def get_name_version(filename):
"""return version string given a filename"""
name = ""
version = ""
found_ver = False
for part in filename.split('-'):
if re.match('\d', part):
found_ver = True
if found_ver:
version += '-' + part
else:
name += '-' + part
version = '.'.join(version.split('.')[:-2])
return name[1:], version[1:]
def get_rpm_info():
"""get list of all available rpms on this system"""
results = {}
p = os.popen('rpm -q -a')
for l in p:
l = l.strip()
# bodge to use code designed for filenames ;(
name, ver = get_name_version(l+'.noarch.rpm')
results[name] = ver
return results
if __name__=='__main__':
rpms = get_rpm_info()
f = urllib2.urlopen('http://www.honeynet.org/tools/cdrom/roo/repo-1.3')
s = f.read()
f.close()
myparser = MyParser()
myparser.parse(s)
results = []
for link in myparser.get_hyperlinks():
if link[-4:] == '.rpm':
name, ver = get_name_version(link)
print '%s, %s, %s' % (link, name, ver)
if not rpms.get(name):
results.append("%s: CDROM needs %s. Not installed" % (name, ver))
elif rpms.get(name) != ver:
results.append("%s: Version mismatch. You have %s, CDROM need %s" % (name, rpms.get(name), ver))
results.sort()
print '\n'.join(results)
_______________________________________________
Honeywall mailing list
[email protected]
https://public.honeynet.org/mailman/listinfo/honeywall