Nmap, tty and Perl

Nmap, tty and Perl

Noam Rathaus noamr at beyondsecurity.com
Sun Jun 28 08:00:16 IDT 2009


Hi sara,

I am not looking for direct HTML rendering, rather that nmap will give
more updates during the process, at the moment it just tells you at
the beging "hello" and when its done "here are the results".

If you want to get an update on its progress you need to "press" a key
on the tty.

I will look into zenmap, thanks for the hint.

On Sat, Jun 27, 2009 at 11:25 PM, sara fink<sara.fink at gmail.com> wrote:
> 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