Nmap, tty and Perl
sara fink
sara.fink at gmail.com
Sat Jun 27 23:25:30 IDT 2009
Hello Noam
I see that you use -oX. You have another flag that you can use --stylesheet
--stylesheet <path/URL>: XSL stylesheet to transform XML output to HTML
Have you tried that? From Html you can convert to other formats.
As for the more "interactively" to the user, I am not sure exactly
what you mean. --packet-trace is interactively enough? Or you want
some bar that shows the progress of the scan like "-------50%----->"
If the later is what you are looking for, then in zenmap during a scan
it shows how much in % it already scanned.
I hope I gave you a different point of view.
On 6/25/09, Noam Rathaus <noamr at beyondsecurity.com> wrote:
> Hi,
>
> I am trying to get nmap to be a bit more "friendly" by wrapping it
> inside a perl script that will cause it to spit out a status by
> "sending it a character":
> ==
> #!/usr/bin/perl
> use IPC::Open3;
> use POSIX ":sys_wait_h";
> use FileHandle;
>
> $| = 1;
> my $nmap = "/usr/bin/nmap";
> my @ips = ('192.168.1.*');
>
> my $cmdline = " $nmap $args -v -v -v -sT -p 1-65535 -oX - ".(join ' ', at ips);
> print "cmdline: $cmdline\n";
>
> my ($readfh, $writefh, $errorfh) = (FileHandle->new(),
> FileHandle->new(), FileHandle->new());
>
> my $pid = 0;
>
> $pid = open3($writefh, $readfh, $errorfh, $cmdline) || die "Can't open
> pipe to $cmdline: $!\n";
>
> while(<$readfh>) {
> print $_;
> print $writefh "A";
> }
>
> print STDERR "done\n";
>
> ==
>
> nmap will give out a progress if keyWasPressed is detected the code
> for this is found inside nmap_tty.cc which basically does:
> if ((c = tty_getchar()) >= 0) {
>
> For some reason the above code doesn't do it, is it because its not
> being sent via tty? if so is there a way to fool it?
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
More information about the Linux-il
mailing list