Hanno Böck commited on 2008-01-13 13:20:24
Zeige 1 geänderte Dateien mit 20 Einfügungen und 4 Löschungen.
| ... | ... |
@@ -22,8 +22,10 @@ |
| 22 | 22 |
# You should have received a copy of the GNU General Public License |
| 23 | 23 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 24 | 24 |
|
| 25 |
-import ConfigParser, os, glob, pprint, re, optparse, sys |
|
| 25 |
+import ConfigParser, os, glob, pprint, re, optparse, sys, gettext |
|
| 26 | 26 |
|
| 27 |
+gettext.textdomain('freewvs')
|
|
| 28 |
+_ = gettext.gettext |
|
| 27 | 29 |
|
| 28 | 30 |
def versioncompare(safe_version, find_version): |
| 29 | 31 |
if safe_version == [""]: |
| ... | ... |
@@ -35,8 +37,19 @@ def versioncompare(safe_version, find_version): |
| 35 | 37 |
return False |
| 36 | 38 |
return (len(find_version)<len(safe_version)) |
| 37 | 39 |
|
| 38 |
-def vulnprint(appname, version, safeversion, vuln, vfilename, subdir): |
|
| 40 |
+def vulnprint(appname, version, safeversion, vuln, vfilename, subdir, fancy): |
|
| 39 | 41 |
appdir = '/'.join(os.path.abspath(vfilename).split('/')[:-1-subdir])
|
| 42 |
+ if fancy: |
|
| 43 |
+ print _("Directory: %(appdir)s") % vars()
|
|
| 44 |
+ print _("Vulnerable %(appname)s %(version)s found, please update to "+ \
|
|
| 45 |
+ "%(safeversion)s or above.") % vars() |
|
| 46 |
+ if vuln[:3] == "CVE": |
|
| 47 |
+ print _("http://cve.mitre.org/cgi-bin/cvename.cgi?name=%(vuln)s"
|
|
| 48 |
+ % vars()) |
|
| 49 |
+ else: |
|
| 50 |
+ print (vuln) |
|
| 51 |
|
|
| 52 |
+ else: |
|
| 40 | 53 |
print "%(appname)s %(version)s (%(safeversion)s) %(vuln)s %(appdir)s" \ |
| 41 | 54 |
% vars() |
| 42 | 55 |
|
| ... | ... |
@@ -49,6 +62,8 @@ parser.add_option("-a", "--all", action="store_true", dest="ALL",
|
| 49 | 62 |
parser.add_option("-d", "--debug", action="store_true", dest="DEBUG",
|
| 50 | 63 |
help="Show lots of debugging output, mainly useful"+ \ |
| 51 | 64 |
"for development") |
| 65 |
+parser.add_option("-f", "--fancy", action="store_true", dest="FANCY",
|
|
| 66 |
+ help="Show more fancy output") |
|
| 52 | 67 |
opts, args = parser.parse_args() |
| 53 | 68 |
|
| 54 | 69 |
# Parse vulnerability database |
| ... | ... |
@@ -136,13 +151,14 @@ for fdir in args: |
| 136 | 151 |
if opts.DEBUG: |
| 137 | 152 |
print "File "+mfile |
| 138 | 153 |
vulnprint(item['name'], findversion, \ |
| 139 |
- "ok", "", mfile, item['subdir']) |
|
| 154 |
+ "ok", "", mfile, item['subdir'], \ |
|
| 155 |
+ opts.FANCY) |
|
| 140 | 156 |
else: |
| 141 | 157 |
if opts.DEBUG: |
| 142 | 158 |
print "File "+mfile |
| 143 | 159 |
vulnprint (item['name'], findversion, \ |
| 144 | 160 |
item['safe'], item['vuln'], \ |
| 145 |
- mfile, item['subdir']) |
|
| 161 |
+ mfile, item['subdir'], opts.FANCY) |
|
| 146 | 162 |
|
| 147 | 163 |
else: |
| 148 | 164 |
if opts.DEBUG: |
| 149 | 165 |