my $time = time();
- my @caller = caller(0);
+ my @caller = caller(1); # skip store wrapper
$caller[3] = (caller(1))[3];
$caller[3] =~ s{^.+::}{}; # stip package name from sub
$data->{package} = {
use html;
use ping;
-use CouchDB;
+use store;
use Carp qw/confess/;
sub ip {
sub power_state {
my $state = eval { Intel::AMT::RemoteControl::SystemPowerState };
- CouchDB::audit('SystemPowerState', { ip => $ENV{AMT_HOST}, SystemPowerState => $state });
+ store::audit('SystemPowerState', { ip => $ENV{AMT_HOST}, SystemPowerState => $state });
return $state;
}
warn "ERROR $@";
} else {
$amt->{ip} = $ENV{AMT_HOST};
- CouchDB::audit('log', $amt );
+ store::audit('log', $amt );
}
$amt;
}
warn "ERROR $@";
} else {
$amt->{ip} = $ENV{AMT_HOST};
- CouchDB::audit('log', $amt );
+ store::audit('log', $amt );
}
$amt;
}
ip shift;
my $command = shift;
eval { Intel::AMT::RemoteControl::run( $command ) };
- CouchDB::audit( $command, { ip => $ENV{AMT_HOST}, error => $@ } );
+ store::audit( $command, { ip => $ENV{AMT_HOST}, error => $@ } );
warn "ERROR $@" if $@;
}
use Data::Dump qw/dump/;
use x11;
-use CouchDB;
+use store;
our $pids;
$pids = {
sub audit {
my $msg = shift;
my $daemon = shift;
- CouchDB::audit( $msg, $daemon, { daemon => $daemon, message => $msg, @_ } );
+ store::audit( $msg, $daemon, { daemon => $daemon, message => $msg, @_ } );
}
mkdir "$server::conf/pid" unless -d "$server::conf/pid";
use Net::DHCP::Packet;
use Net::DHCP::Constants 0.67;
-use CouchDB;
+use store;
use format;
use server;
warn $audit->{error};
}
- CouchDB::audit( @type, $audit );
+ store::audit( @type, $audit );
# system("arp -s $ip $mac"),
print "DHCP listen on ",$sock->sockhost,":",$sock->sockport,"\n";
- CouchDB::audit( 'start', { addr => $sock->sockhost, port => $sock->sockport } );
+ store::audit( 'start', { addr => $sock->sockhost, port => $sock->sockport } );
while (1) {
server->refresh;
use Net::DNS::Nameserver;
use Net::DNS::Resolver;
use Data::Dump qw/dump/;
-use CouchDB;
+use store;
use server;
use client;
$data;
} @ans ];
- CouchDB::audit( 'response', $audit );
+ store::audit( 'response', $audit );
# mark the answer as authoritive (by setting the 'aa' flag
return ($rcode, \@ans, \@auth, \@add, { aa => 1 });
Verbose => $debug,
) || die "couldn't create nameserver object\n";
- CouchDB::audit('start', { port => 53, domain => $server::domain });
+ store::audit('start', { port => 53, domain => $server::domain });
warn "DNS $server::domain";
$ns->main_loop;
use ping;
use wol;
-use CouchDB;
+use store;
sub menu {
my $buff;
my $pos = 0;
- CouchDB::audit( 'static', { pid => $$, path => $path, type => $type, size => $size, block => $block, peerhost => $client->peerhost });
+ store::audit( 'static', { pid => $$, path => $path, type => $type, size => $size, block => $block, peerhost => $client->peerhost });
progress_bar::start;
server->refresh;
- CouchDB::audit( 'request', { path => $path, param => $param, peerhost => $client->peerhost } );
+ store::audit( 'request', { path => $path, param => $param, peerhost => $client->peerhost } );
$title = $path;
use XML::Simple;
use Data::Dump qw/dump/;
-use CouchDB;
+use store;
use client;
ForceArray => [ 'host', 'address', 'osmatch', 'port' ],
);
- CouchDB::audit( $what, $nmap );
+ store::audit( $what, $nmap );
my $count = 0;
use Data::Dump qw/dump/;
use Time::HiRes;
use client;
-use CouchDB;
+use store;
sub host {
my $ip = shift;
$rtt *= 1000; # ms
client::conf( $ip => 'hostname', default => $host ) if $host ne $ip;
$status->{$host} = { host => $host, rtt => $rtt, ip => $ip };
- CouchDB::audit( $ip, $status->{$host});
+ store::audit( $ip, $status->{$host});
}
warn "# fping ",dump($status);
use autodie;
use Data::Dump qw/dump/;
-use CouchDB;
+use store;
our $command;
if ( $key ) {
my $k = $cols[$key - 1];
$info->{$k} = $hash;
- CouchDB::audit( $command, $k, $hash );
+ store::audit( $command, $k, $hash );
} else {
push @$info, $hash;
}
use English;
use Data::Dump qw/dump/;
use client;
-use CouchDB;
+use store;
my $id = 3;
my $id_rsa = '/root/.ssh/id_rsa';
my ($out,$err) = $ssh->capture2( $command ) or die "$command ", $ssh->error;
warn "$out\n$err";
- CouchDB::audit( $ip, $command, { ip => $ip, command => $command, out => $out, err => $err } );
+ store::audit( $ip, $command, { ip => $ip, command => $command, out => $out, err => $err } );
$html .= qq|<tt style="color: grey">root\@$ip:# <b>$command</b></tt><pre>$out</pre>|;
$html .= qq|<pre style="color: red">$err</pre>| if $err;
use IO::Socket;
use Data::Dump qw/dump/;
-use CouchDB;
+use store;
use File::Slurp;
use server;
}
warn "log ",dump( $log );
- CouchDB::audit( $log->{tag}, $log );
+ store::audit( $log->{tag}, $log );
}
sub start {
ReuseAddr => 1,
) || die "can't listen to $port: $!";
- CouchDB::audit('start', { port => $port });
+ store::audit('start', { port => $port });
while(1) {
message($sock);
use Net::TFTPd 0.03 qw(%OPCODES);
use IO::Socket::INET;
use Data::Dump qw/dump/;
-use CouchDB;
+use store;
use server;
path => $file,
state => 'start',
};
- CouchDB::audit( $opcode, $audit );
+ store::audit( $opcode, $audit );
progress_bar::start;
my $size = -s "$dir/$file";
$audit->{state} = 'finish';
$audit->{size} = $size;
- CouchDB::audit( $opcode, $audit );
+ store::audit( $opcode, $audit );
} else {
$audit->{state} = 'error';
$audit->{error} = Net::TFTPd->error;
- CouchDB::audit( $opcode, $audit );
+ store::audit( $opcode, $audit );
}
}
warn 'listener: ',dump( $listener ) if $debug;
- CouchDB::audit( 'start', {
+ store::audit( 'start', {
addr => $listener->{LocalAddr},
port => $listener->{LocalPort},
timeout => $listener->{Timeout},
use IO::Socket::INET;
use Regexp::Common qw/net/;
-use CouchDB;
+use store;
use client;
use server;
send($sock, $packet, 0, $sock_addr);
close ($sock);
- CouchDB::audit( $target, { ip => $target, mac => $mac } );
+ store::audit( $target, { ip => $target, mac => $mac } );
}
1;