[Secure-testing-commits] r2151 - tsck

Moritz Muehlenhoff jmm-guest at costa.debian.org
Sat Sep 24 11:06:03 UTC 2005


Author: jmm-guest
Date: 2005-09-24 11:06:02 +0000 (Sat, 24 Sep 2005)
New Revision: 2151

Modified:
   tsck/tsck.py
Log:
add some simple getoptage to select the distribution to run the
check against (currently testing and sid), hardcode dpkg path.


Modified: tsck/tsck.py
===================================================================
--- tsck/tsck.py	2005-09-24 10:14:55 UTC (rev 2150)
+++ tsck/tsck.py	2005-09-24 11:06:02 UTC (rev 2151)
@@ -1,6 +1,35 @@
 #!/usr/bin/python
 
-import httplib
+import os, re, httplib, getopt, sys
+
+def print_usage():
+    print "tsck [-s suite]"
+    sys.exit(-1)
+
+opts = []
+pargs = []
+suite = ""
+
+try:
+    opts, pargs = getopt.getopt(sys.argv[1:], 's:')
+except:
+    print_usage()
+    sys.exit(-1)
+
+for i in opts:
+    if i[0] == '-s':
+        suite = i[1]
+
+if suite == "":
+    suite = "testing"
+elif suite == "testing" or suite == "sarge":
+    suite = "testing"
+elif suite == "sid" or suite == "unstable":
+    suite = "unstable"
+else:
+    print "Unsupported suite."
+    sys.exit(-1)
+
 conn = httplib.HTTPConnection("spohr.debian.org")
 conn.request("GET", "/~joeyh/testing-security.raw")
 r1 = conn.getresponse()
@@ -9,8 +38,6 @@
 print data1
 conn.close()
 
-import os, re
-
 status = open("/var/lib/dpkg/status", "r")
 statlines = status.readlines()
 
@@ -64,7 +91,7 @@
 severity = ""
 fix = ""
 
-print "Generating system-specific security overview:"
+print "Generating system-specific security overview for " + suite
 
 for i in vulns:
     if i.startswith("CAN-"):
@@ -84,7 +111,7 @@
                     else:
                         if fix != "<itp>" and fix != "<not-affected>":
                             installed = source_packages[pkg_name]
-                            if os.system("dpkg --compare-versions " + installed + " ge " + fix) > 0:
+                            if os.system("/usr/bin/dpkg --compare-versions " + installed + " ge " + fix) > 0:
                                 if severity == "low":
                                     low.append((pkg_name, cve, debbugs))
                                 elif severity == "medium":




More information about the Secure-testing-commits mailing list