--- lib/PXElator/httpd.pm 2009/08/27 17:43:05 310 +++ lib/PXElator/httpd.pm 2009/08/27 17:44:03 311 @@ -26,6 +26,7 @@ server brctl ip +nmap client @@ -54,6 +55,7 @@ use ip; use wireshark; use syslogd; +use nmap; use CouchDB; @@ -253,6 +255,7 @@ map { my @c = split(/\s+/,$_); if ( $#c == 5 ) { + client::save_ip_mac( $c[0], $c[3] ); ( uc $c[3] => [ $c[0] , $c[5] ] ) } else { } @@ -270,12 +273,12 @@ my $conf = client::all_conf( $ip ); my $mac = delete $conf->{mac} || ''; ( - qq|$ip| + qq|$ip| , format::mac( $mac => 'html' ) , ( $arp->{$mac} ? $arp->{$mac}->[1] : '' ) , delete $conf->{hostname} , delete $conf->{deploy} - , html::pre_dump( $conf ) + , ( %$conf ? html::pre_dump( $conf ) : qq|nmap| ) ); } sort { ip::to_int($a) cmp ip::to_int($b) } @@ -303,6 +306,18 @@ , join("\n", map { qq|$_| } ( qw/link addr route neigh ntable tunnel maddr mroute xfrm/ )) , ip::html( $1 ) ; + } elsif ( $path =~ m{^/nmap} ) { + if ( my $scan = $param->{scan} ) { + nmap::scan( $scan ); + print $client redirect("$url/client#$scan"); + } else { + print $client ok, qq| +
+ + +
+ |; + } } elsif ( $path =~ m{^/our/(\w+)/(\S+)} ) { eval 'our $' . $1 . ' = ' . $2; warn $@ if $@;