Armadito-Agent

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

  directory:
    - inc
    - t
requires:
  DBD::SQLite: 0
  Date::Calc: 0
  Encode: 0
  File::Stat: 0
  File::Which: 0
  Getopt::Long: 0
  HTTP::Request: 0
  HTTP::Request::Common: 0
  IPC::System::Simple: 0
  JSON: 0
  LWP::UserAgent: 0
  Memoize: 0
  Parse::Syslog: 0
  Perl::Critic: 0
  Pod::Usage: 0
  Readonly: 0
  Time::Local: 0
  Time::Piece: 0

Makefile.PL  view on Meta::CPAN

name 'Armadito-Agent';
include 'Module::AutoInstall';
abstract 'Armadito Agent for Linux and Windows';
license 'gpl';
repository 'https://github.com/armadito/armadito-agent';
version_from 'lib/Armadito/Agent.pm';
perl_version '5.008';
authors 'Teclib';

requires 'UNIVERSAL::require'    => '0';
requires 'HTTP::Request::Common' => '0';
requires 'HTTP::Request'         => '0';
requires 'URI::Escape'           => '0';
requires 'URI'                   => '0';
requires 'JSON'                  => '0';
requires 'Encode'                => '0';
requires 'Getopt::Long'          => '0';
requires 'Pod::Usage'            => '0';
requires 'XML::LibXML'           => '0';
requires 'Readonly'              => '0';
requires 'Try::Tiny'             => '0';
requires 'Perl::Critic'          => '0';

lib/Armadito/Agent/HTTP/Client.pm  view on Meta::CPAN

the file containing trusted certificates

=item I<ca_cert_dir>

the directory containing trusted certificates

=back

=head2 request($request)

Send given HTTP::Request object, handling SSL checking and user authentication
automatically if needed.

lib/Armadito/Agent/HTTP/Client/ArmaditoAV.pm  view on Meta::CPAN

package Armadito::Agent::HTTP::Client::ArmaditoAV;

use strict;
use warnings;
use base 'Armadito::Agent::HTTP::Client';

use English qw(-no_match_vars);
use HTTP::Request;
use HTTP::Request::Common qw{ POST };
use UNIVERSAL::require;
use URI;
use Encode;
use Data::Dumper;
use URI::Escape;
use JSON;

use Armadito::Agent::HTTP::Client::ArmaditoAV::Event;
use Armadito::Agent::HTTP::Client::ArmaditoAV::Event::DetectionEvent;
use Armadito::Agent::HTTP::Client::ArmaditoAV::Event::OnDemandCompletedEvent;

lib/Armadito/Agent/HTTP/Client/ArmaditoAV.pm  view on Meta::CPAN

	$self->{logger}->debug2($url) if $self->{logger};

	my $headers = HTTP::Headers->new(
		'User-Agent' => 'armadito-agent',
		'Referer'    => $url
	);

	$headers->header( 'Content-Type'     => 'application/json' ) if ( $params{method} eq 'POST' );
	$headers->header( 'X-Armadito-Token' => $self->{token} )     if ( defined( $self->{token} ) );

	my $request = HTTP::Request->new(
		$params{method} => $url,
		$headers
	);

	if ( $params{message} && $params{method} eq 'POST' ) {
		$request->content( encode( 'UTF-8', $params{message} ) );
	}

	return $self->request($request);
}

lib/Armadito/Agent/HTTP/Client/ArmaditoAV.pm  view on Meta::CPAN

=item I<method>

the method used: GET or POST. (mandatory)

=item I<message>

the message to send (mandatory if method is POST)

=back

The return value is a response object. See L<HTTP::Request> and L<HTTP::Response> for a description of the interface provided by these classes.

lib/Armadito/Agent/HTTP/Client/ArmaditoGLPI.pm  view on Meta::CPAN

package Armadito::Agent::HTTP::Client::ArmaditoGLPI;

use strict;
use warnings;
use base 'Armadito::Agent::HTTP::Client';

use English qw(-no_match_vars);
use HTTP::Request;
use HTTP::Request::Common qw{ POST };
use UNIVERSAL::require;
use URI;
use Encode;
use Data::Dumper;
use URI::Escape;

sub new {
	my ( $class, %params ) = @_;
	my $self = $class->SUPER::new(%params);

lib/Armadito/Agent/HTTP/Client/ArmaditoGLPI.pm  view on Meta::CPAN


	my $url = $self->_prepareURL(%params);

	$self->{logger}->debug2($url) if $self->{logger};

	my $headers = HTTP::Headers->new(
		'Content-Type' => 'application/json',
		'Referer'      => $url
	);

	my $request = HTTP::Request->new(
		$params{method} => $url,
		$headers
	);

	if ( $params{message} && $params{method} eq 'POST' ) {
		$request->content( encode( 'UTF-8', $params{message} ) );
	}

	return $self->request($request);
}

lib/Armadito/Agent/HTTP/Client/ArmaditoGLPI.pm  view on Meta::CPAN

=item I<method>

the method used: GET or POST. (mandatory)

=item I<message>

the message to send (mandatory if method is POST)

=back

The return value is a response object. See L<HTTP::Request> and L<HTTP::Response> for a description of the interface provided by these classes.



( run in 0.296 second using v1.01-cache-2.11-cpan-de7293f3b23 )