diff options
-rwxr-xr-x | collector.py | 11 | ||||
-rwxr-xr-x | kernellib.py | 8 |
2 files changed, 11 insertions, 8 deletions
diff --git a/collector.py b/collector.py index 87225fa..d111a33 100755 --- a/collector.py +++ b/collector.py @@ -65,7 +65,7 @@ def main(argv): os.makedirs(folder[directory]) print('Reading available genpatches...') - read_patches = lib.read_genpatch_file('genpatches.xml') + read_patches = lib.read_genpatch_file(folder['out']) print('Parsing genpatches from portage...') found_patches = lib.parse_genpatch_list(folder['tree']) @@ -76,8 +76,8 @@ def main(argv): read_patches.append(item) new_items = new_items + 1 - print('Adding %i new genpatches...' % new_items) - lib.write_genpatch_file(read_patches, 'genpatches.xml') + print('Added %i new genpatches!\n' % new_items) + lib.write_genpatch_file(folder['out'], read_patches) print('Receiving the latest xml file from the nvd...') lib.receive_nvd_recent(folder['nvd']) @@ -89,12 +89,13 @@ def main(argv): print('Creating the nvd dictionary...') nvd_dict = lib.parse_nvd_dict(folder['nvd']) - print('Receiving the kernel bug list from bugzilla...') + print('Receiving the kernel vulnerability list from bugzilla...') lib.receive_bugzilla_list(folder['temp']) - print('Creating the xml files...') buglist = lib.parse_bugzilla_list(os.path.join(folder['temp'], 'list.xml')) + print('Found %i kernel vulnerabilities!\n' % len(buglist)) + print('Creating the xml files...') for item in buglist: lib.receive_bugzilla_bug(folder['bug'], item) bug_dict = lib.parse_bugzilla_dict(folder['bug'], item) diff --git a/kernellib.py b/kernellib.py index 90f348c..00044d2 100755 --- a/kernellib.py +++ b/kernellib.py @@ -164,9 +164,11 @@ def write_xml(root, filename): doc.write(xmlout, encoding='utf-8') -def read_genpatch_file(filename): +def read_genpatch_file(directory): #TODO: Description + filename = os.path.join(directory, 'genpatches.xml') + with open(filename, 'r+') as xml_data: memory_map = mmap.mmap(xml_data.fileno(), 0) root = et.parse(memory_map).getroot() @@ -190,9 +192,10 @@ def read_genpatch_file(filename): return patches -def write_genpatch_file(genpatches, filename): +def write_genpatch_file(directory, genpatches): #TODO: Description + filename = os.path.join(directory, 'genpatches.xml') root = et.Element('patches') for item in genpatches: @@ -221,7 +224,6 @@ def parse_bugzilla_list(filename): memory_map = mmap.mmap(buglist_file.fileno(), 0) buglist = regex['bugzilla'].findall(memory_map.read(-1)) - debug(str(len(buglist)) + ' bugs found') return buglist |