/[pxelator]/lib/PXElator/amt.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /lib/PXElator/amt.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 263 - (show annotations)
Wed Aug 19 11:51:51 2009 UTC (14 years, 8 months ago) by dpavlin
File size: 982 byte(s)
dump amt data into audit log
1 package amt;
2
3 use warnings;
4 use strict;
5
6 use lib '/srv/Intel-AMT/lib/';
7 use Intel::AMT::RemoteControl;
8 use Intel::AMT::NetworkAdministration;
9 use Data::Dump qw/dump/;
10 use Regexp::Common qw/net/;
11 use Net::Ping;
12
13 use html;
14 use CouchDB;
15
16 sub info {
17 my ( $amt, $client_ip ) = @_;
18 my ( $passwd, $ip ) = split(/\s+/, $amt);
19 ( $ip, $passwd ) = ( $passwd, $ip ) if $passwd =~ m/$RE{net}{IPv4}/;
20
21 $ip ||= $client_ip;
22
23 my $p = Net::Ping->new;
24
25 if ( ! $p->ping( $ip, 0.7 ) ) {
26 return "$ip unreachable";
27 }
28
29 warn "amt $ip ", '*' x length($passwd), "\n";
30
31 $ENV{AMT_HOST} = $ip;
32 $ENV{AMT_PASSWORD} = $passwd;
33
34 my $amt = Intel::AMT::NetworkAdministration::network_settings;
35 $amt->{power_state} = Intel::AMT::RemoteControl::SystemPowerState;
36
37 CouchDB::audit('network', $amt );
38
39 my $out;
40
41 $out =
42 qq| <a href="http://$ip:16992/" target="$ip">amt</a>|
43 . qq| <a href="http://$ip:16992/ip.htm" target="$ip">ip</a>|
44 . qq|<br>|
45 . html::pre_dump( $amt )
46 ;
47
48 return $out;
49 }
50
51 1;

  ViewVC Help
Powered by ViewVC 1.1.26