WMI => \&_getFromWMI
);
# How to validate JSON for retreived jobs
sub _OPTIONAL { 0 }
sub _MANDATORY { 1 }
sub _OPTIONAL_EXCLUSIVE { 2 }
my %json_validation = (
getFromRegistry => {
$self->{logger}->debug("Bad JSON: No answer from server.");
return 0;
}
if (ref($answer) ne 'HASH') {
$self->{logger}->debug("Bad JSON: Bad answer from server. Not a ha
efined($answer->{jobs}) || ref($answer->{jobs}) ne 'ARRAY') {
$self->{logger}->debug("Bad JSON: Missing jobs");
return 0;
}
foreach my $job (@{$answer->{jobs}}) {
for
n;
use strict;
use warnings;
use parent 'FusionInventory::Agent::Task::Inventory::Module';
use JSON::PP;
use FusionInventory::Agent::Tools;
use FusionInventory::Agent::Tools::Network;
sub isEnable
%params
) or return;
my @interfaces;
eval {
my $json = JSON::PP->new;
my $data = $json->decode($lines);
foreach my $record (@$data) {
while (m
200,
'OK',
HTTP::Headers->new( 'Content-Type' => 'application/json' ),
'{}'
);
$client->send_response($response);
return 200;
arnings;
use parent 'FusionInventory::Agent::HTTP::Client';
use English qw(-no_match_vars);
use JSON::PP;
use HTTP::Request;
use HTTP::Headers;
use HTTP::Cookies;
use URI::Escape;
my $log_prefix =
r};
return;
}
my $answer;
eval {
my $decoder = JSON::PP->new
or die "Can't use JSON::PP decoder: $!";
$answer = $decoder->decode($content);
};
= split(/\n/, $content);
$self->{logger}->error(
$log_prefix . "Can't decode JSON content, starting with $lines[0]"
) if $self->{logger};
return;
}
return
r;
use strict;
use warnings;
use parent 'FusionInventory::Agent::Task::Inventory::Module';
use JSON::PP;
use FusionInventory::Agent::Tools;
use FusionInventory::Agent::Tools::Virtualization;
# wa
= @_;
my $lines = getAllLines(%params);
my $status = '';
eval {
my $coder = JSON::PP->new;
my $containerData = $coder->decode($lines);
$status =
((ref
f $found->{"/file_set_visible_version"};
# Try to find license "expiry_date" from a specific json file
$fsecReg = _getSoftwareRegistryKeys(
'F-Secure\CCF\DLLHoster\100\Plugins\CosmosS
h for the expected json file
$path .= "\\safe.S-1-5-18.local.cosmos";
return unless -f $path;
my $infos = getAllLines(file => $path);
return unless $infos;
JSON::PP->require();
my @licenses;
eval {
$infos = JSON::PP::decode_json($infos);
@licenses = @{$infos->{local}->{windows}->{secl}->{subscription}->{license_table}};
};
return unless @licens
rn 0;
}
my $msg;
if (!_validateAnswer(\$msg, $answer)) {
$logger->debug("bad JSON: ".$msg);
return 0;
}
foreach my $sha512 ( keys %{ $answer->{associatedFiles} }
if ( !$files->{$uuid} ) {
$logger->error("unknown file: '$uuid'. Not found in JSON answer!");
next;
}
push @$associatedFiles, $f
iatedFiles != @{$job->{associatedFiles}}) {
$logger->error("Bad job definition in JSON answer!");
next;
}
}
push @$jobList, FusionInventory