-
-
Save dlangille/c7aee2ce3a717443d73e3d7f86a74130 to your computer and use it in GitHub Desktop.
Harold! Does your code need updating?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[dan@testgit-ingress01:/usr/local/libexec/freshports] $ cat vuxml_ident.pl | |
#!/usr/local/bin/perl -w | |
# | |
# $Id: vuxml_ident.pl,v 1.3 2012-07-22 12:02:46 dan Exp $ | |
# | |
# Copyright (c) 2005 DVL Software | |
# | |
# Parse vuln.xml and load into vuxml table | |
# | |
use strict; | |
sub vuln_ident($) { | |
# | |
# From code originally written by Harold Paulson | |
# | |
my $VUXML = shift; | |
my %ident; | |
my $IDENT_BIN = '/usr/bin/ident'; | |
open(VUXML, "$IDENT_BIN $VUXML |") | |
|| die("ERROR: Cound not ident $VUXML: $!\n"); | |
while (<VUXML>) { | |
next unless m#^\s+\$FreeBSD: head/security/vuxml/vuln.xml (\d+) (\d\d\d\d\-\d\d\-\d\d) (\d\d:\d\d:\d\d\S+) (\S+) .*$#; | |
$ident{Revision} = $1; | |
$ident{Date} = $2; | |
$ident{Time} = $3; | |
$ident{Committer} = $4; | |
} | |
return %ident; | |
} | |
sub usage { | |
print "USAGE : $0 INPUTFILE\n"; | |
} | |
my %ident; | |
my $vulnfile; | |
if (($#ARGV+1) == 1) { | |
$vulnfile = $ARGV[0]; | |
} else { | |
usage(); | |
exit 1; | |
} | |
%ident = vuln_ident($vulnfile); | |
if (%ident) { | |
print("Revision: $ident{Revision}\n"); | |
print("Date: $ident{Date}\n"); | |
print("Time: $ident{Time}\n"); | |
print("Committer: $ident{Committer}\n"); | |
} else { | |
print "nothing found there\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment