summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Tropf <asymmail@googlemail.com>2009-06-01 15:47:22 +0200
committerBjoern Tropf <asymmail@googlemail.com>2009-06-01 15:47:22 +0200
commitae5ed46ec74f3d968ccabd995b1269ae0f529b09 (patch)
tree01aa3a13a0320721b8bbbbfaa050078cbb8dcc91 /kernel-check.py
parentClean some code (diff)
downloadkernel-check-ae5ed46ec74f3d968ccabd995b1269ae0f529b09.tar.gz
kernel-check-ae5ed46ec74f3d968ccabd995b1269ae0f529b09.tar.bz2
kernel-check-ae5ed46ec74f3d968ccabd995b1269ae0f529b09.zip
Rework logging inconsistency; Move more methods to kernellib.py
Diffstat (limited to 'kernel-check.py')
-rwxr-xr-xkernel-check.py33
1 files changed, 11 insertions, 22 deletions
diff --git a/kernel-check.py b/kernel-check.py
index 19bfa54..22cc5e8 100755
--- a/kernel-check.py
+++ b/kernel-check.py
@@ -35,15 +35,15 @@ def main(argv):
'Main function'
data = {
- 'kernel' : kernel_version(),
+ 'kernel' : lib.kernel_version(),
'genpatch' : None,
- 'arch' : commands.getstatusoutput('uname -m')[1], #FIXME: cat /proc/?
+ 'arch' : commands.getstatusoutput('uname -m')[1], #FIXME: cat /proc/? + move to lib
'cve' : [345, 284, 274, 0, 4], #TODO: Implement
'latest' : '2.6.27-r13 (gentoo-sources)' #TODO: Implement
}
try:
- opts, args = getopt.getopt(argv, 'ahnr:s:v', ['about', 'help', 'nocolor', 'report=', 'show='])
+ opts, args = getopt.getopt(argv, 'ahnr:s:v', ['about', 'help', 'nocolor', 'report=', 'show=', 'verbose'])
except getopt.GetoptError:
usage()
@@ -61,6 +61,8 @@ def main(argv):
elif opt in ('-s', '--show'):
return
# TODO: show_bugid(arg)
+ elif opt in ('-v', '--verbose'):
+ lib.verbose = True
eout = portage.output.EOutput()
color = portage.output.colorize
@@ -128,11 +130,12 @@ def usage():
print 'kernel-check.py: Kernel security information\r\n'
print 'Usage:'
- print ' -a --about : display information about this tool'
- print ' -h --help : display help information'
- print ' -n --nocolor : disable colors'
- print ' -r --report [file] : create a security report'
- print ' -s --show [bugid] : display information about a bug'
+ print ' -a --about : display information about this tool'
+ print ' -h --help : display help information'
+ print ' -n --nocolor : disable colors'
+ print ' -r --report [file] : create a security report'
+ print ' -s --show [bugid] : display information about a bug'
+ print ' -v --verbose : display debugging information'
sys.exit()
def about():
@@ -146,19 +149,5 @@ def about():
sys.exit()
-def kernel_version():
- 'Provides the kernel version as dictionary'
-
- try:
- with open('/proc/sys/kernel/osrelease', 'r') as proc:
- osrelease = proc.read()[:-1]
- return lib.extract_version_from(osrelease)
- except IOError, e:
- print 'Could not read version from /proc/sys/kernel/osrelease: %s' % str(e)
- return None
-
- return None
-
-
if __name__ == '__main__':
main(sys.argv[1:])