1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00
Files
nmap/scripts/osprintsunwrap.pl
2006-08-18 07:00:40 +00:00

30 lines
741 B
Perl
Executable File

#!/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 = "";
}
}
}