summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pym/kernelcheck/kernelcheck.py')
-rwxr-xr-xpym/kernelcheck/kernelcheck.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/pym/kernelcheck/kernelcheck.py b/pym/kernelcheck/kernelcheck.py
index bf3d6ca..2487f02 100755
--- a/pym/kernelcheck/kernelcheck.py
+++ b/pym/kernelcheck/kernelcheck.py
@@ -4,7 +4,7 @@
# Distributed under the terms of the GNU General Public License v2
from portage.output import blue, bold, colorize, EOutput, darkgreen #FIXME
-from _emerge.stdout_spinner import stdout_spinner
+#from _emerge.stdout_spinner import stdout_spinner #TODO
from _emerge.userquery import userquery
import getopt
@@ -67,7 +67,7 @@ def main(argv):
return
information['Kernel source'] = kernel.source
- information['Kernel version'] = '%s%s' % (kernel.version, kernel.revision)
+ information['Kernel version'] = '%s-%s' % (kernel.version, kernel.revision)
kernel.genpatch = lib.get_genpatch(lib.PORTDIR, kernel)
@@ -87,9 +87,7 @@ def main(argv):
return
info(bold('Information:'))
- for item in information.keys():
- print ' %s%s : %s' % (darkgreen(item), ' ' * (14 - len(item)),
- information[item])
+ print_items(information)
min_addr = str() #TODO move to kernellib
try:
@@ -110,9 +108,7 @@ def main(argv):
print ''
info(bold('Configuration:'))
- for item in configuration.keys():
- print ' %s%s : %s' % (darkgreen(item), ' ' * (14 - len(item)),
- configuration[item])
+ print_items(configuration)
print '\nDetermining vulnerabilities... done!' #TODO #spin
print ''
@@ -172,6 +168,18 @@ def main(argv):
else:
print 'Not implemented yet ;)'
+def print_items(category):
+ 'Indents and prints items'
+
+ for item in category.keys():
+ for i, string in enumerate(textwrap.wrap('%s' % category[item],
+ (term[1] - 23))):
+ if i is 0:
+ print ' %s%s : %s' % (darkgreen(item),
+ ' ' * (14 - len(item)), string)
+ else:
+ print '%s%s' % (' ' * 23, string)
+
def print_summary(vullist):
'Prints the vulnerability summary'
@@ -194,9 +202,10 @@ def print_summary(vullist):
cve_text = str()
cve_area = str()
- if 'AV:L' in cve.vector or 'AV:A' in cve.vector:
+ if 'AV:L' in cve.vector:
cve_area += colorize('WARN', 'local')
- else:
+
+ if 'AV:A' in cve.vector or 'AV:N' in cve.vector:
cve_area += colorize('BAD', 'network')
if 'C:P' in cve.vector or 'C:C' in cve.vector:
@@ -211,7 +220,7 @@ def print_summary(vullist):
if ('C:P' in cve.vector or 'C:C' in cve.vector) \
and ('I:P' in cve.vector or 'I:C' in cve.vector) \
and ('A:P' in cve.vector or 'A:C' in cve.vector):
- cve_text = ' -security' #TODO find a better way
+ cve_text = ' -complete'
first_text = textwrap.wrap(cve.desc, term[1] - 44)[0]
print '[%s %26s] %s CVSS="%s %s%s"' % (darkgreen('bugid'),