simple script to unwrap os fingerprints

This commit is contained in:
fyodor 2006-08-18 07:00:40 +00:00
parent 7f10cfee2c
commit 3ba4c665a2

29
scripts/osprintsunwrap.pl Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/perl -w
# For now, this script just un-wordwraps all the OS fingerprints found
# in a file (or set of files, or stdin) and prints them out. It also
# adds an IP element if it obtains that info from the Nmap log file.
my $lineno = 0;
my $nextline;
my $fp = "";
# First remove the OS: prefix and extra newlines
while(<>) {
$nextline = $_;
$lineno++;
if ($nextline =~ /^\s*OS:/) {
chomp($nextline);
$nextline =~ s/^\s*OS://;
$nextline =~ s/\s+$//;
$fp .= $nextline;
} else {
if ($fp) {
# I've just finished reading in an FP, apparently. Process and
# print it out. First add appropriate line breaks
$fp =~ s/\)/\)\n/g;
print "New Fingerprint:\n$fp\n";
$fp = "";
}
}
}