From 3ba4c665a20d42b629ff168c55bb28242d49939d Mon Sep 17 00:00:00 2001 From: fyodor Date: Fri, 18 Aug 2006 07:00:40 +0000 Subject: [PATCH] simple script to unwrap os fingerprints --- scripts/osprintsunwrap.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 scripts/osprintsunwrap.pl diff --git a/scripts/osprintsunwrap.pl b/scripts/osprintsunwrap.pl new file mode 100755 index 000000000..c4e571010 --- /dev/null +++ b/scripts/osprintsunwrap.pl @@ -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 = ""; + } + } +} +