package App::Spoor::OutputFormatter;
use v5.10;
use strict;
use warnings;
use JSON;
use Text::CSV;
use Date::Format;
=head1 NAME
App::Spoor::OutputFormatter
=head1 VERSION
Version 0.08
=cut
our
p qw/croak carp/;
use URI::Escape;
use LWP::UserAgent;
use File::Basename;
use HTTP::Request;
use JSON::XS;
use Mediafire::Api::UploadFile;
use Mediafire::Api::DownloadFile;
our $VERSION = '0.02';
=json';
my $res = $self->{ua}->get($url, %headers);
my $code = $res->code;
if ($code ne '200') {
croak "Can't renew session token by url: '$url'. Code: $code";
}
my $json
val {
decode_json($res->decoded_content);
};
if ($@) {
croak "Can't decode response to json: $res->decoded_content";
}
my $response_result = $json_res->{response}->{re
if the event is 'unrecognised'.
=back
=cut
sub parse {
use DateTime::Format::Strptime;
use JSON;
my $log_entry = shift;
my $date_parser = DateTime::Format::Strptime->new(pattern => '%Y-%m-
\s
info\s
\[spoor_forward_added\]\s
(?<data>{.+})
\Z
/x) {
$data_ref = from_json($+{data});
$timestamp = $date_parser->parse_datetime($+{timestamp})->epoch();
if ($data_
#use diagnostics;
use Authen::Captcha;
use JSON::XS;
use XML::Simple;
use CGI::Carp qw(fatalsToBrowser);
require Exporter;
use vars qw(
$m_outXML
$m_sJson
$m_bMainTemplate
$DefaultClass
$ACC
$m_sAction = ( $m_sAction =~ /^(\w{3,50})$/ ) ? $1 : $m_hrSettings->{defaultAction};
$m_sJson = {
m_sCurrentAction => $m_sAction,
m_nRight => $m_nRight,
m_nHtm
?>\n<xml>\n\n);
$m_sJson->{m_sSid} = $m_sSid;
my $encode_json = encode_json $m_sJson;
print qq|<output id="sid"><![CDATA[
<script>
m_sJson = '$encode_json';
m_sid = "$m_s
p qw/croak carp/;
use URI::Escape;
use LWP::UserAgent;
use File::Basename;
use HTTP::Request;
use JSON::XS;
use Mediafire::Api::File;
our $VERSION = '0.01';
my $DEFAULT_BUFF_SIZE = 104857
Resources expose easily understood directory structure URIs.
=item *
Representations transfer JSON or XML to represent data objects and attributes.
=item *
Messages use HTTP methods explicitly (
quested
within an HTTP request. The client may set C<Accept> to C<application/json> if it is requesting a
response in JSON. Conversely, when sending data, setting the C<Content-Type> to
C<application/
ray => 1,
ForceContent => 1,
}
],
json => [
{ # Sserialize
utf8 => 0,
port::Codecov;
use strict;
use warnings;
use utf8;
our $VERSION = '0.25';
use URI;
use Furl;
use JSON::XS;
use Sub::Retry;
use Module::Find;
useall 'Devel::Cover::Report::Codecov::Service';
our $A
url = get_request_url($API_ENDPOINT, $query);
my $json = get_codecov_json($options->{file}, $db);
my $res = send_report($url, $json);
if ($res->{ok}) {
print $res->{message}
odecov_json {
my ($files, $db) = @_;
my %coverages = map { get_file_coverage($_, $db) } @$files;
my $request = { coverage => \%coverages, messages => {} };
return encode_json($requ
application/json" http://localhost/%PROJECT_NAMEL%?bar=123
> GET /%PROJECT_NAMEL%?bar=123 HTTP/1.1
> Host: localhost
> User-Agent: curl/7.50.1
> Accept: application/json
>
<
MT
< Server: Apache/2.4.18 (Ubuntu)
< Content-Length: 528
< Content-Type: application/json
<
{
"key" : "GET#/#default",
"uri" : "/%PROJECT_NAMEL%",
"dvars" : {
es:
curl -v --raw http://localhost/%PROJECT_NAMEL%
curl -v --raw -H "Accept: application/json" http://localhost/%PROJECT_NAMEL%
curl -v --raw -H "Accept: application/xml" http://localhost
llower services
monitor the log files and if they come across an item of interest, they create a JSON-representation of the event and
write it to /var/lib/spoor/parsed.
The transmitter service monit
changes and sends these to the Spoor API. If a transmission
recives a response of HTTP 202, the JSON file is moved to /var/lib/spoor/transmitted, otherwise it remains in /var/lib/spoor/parsed and
th
lash
);
use Carp;
use CTK::Util qw/ :BASE :EXT /;
use CTK::ConfGenUtil;
use YAML::XS ();
use JSON::XS ();
use Try::Tiny;
use File::Spec;
# Get (HTTP_ROOT, SERVER_CONFIG_FILE, SERVER_VERSION, APA
} elsif ($metaf =~ /\.json$/) {
try {
my $json_text = CTK::Util::bload($metaf, 1) // "";
$meta = JSON::XS->new->decode($json_text);
} catch
qw/getApache load_metadata/;
use constant {
META_FILES => [qw/MYMETA.yml MYMETA.json META.yml META.json/],
MACRO_KEY => 'x_macro',
OS_TYPES => [qw/
Unix
$subject) = @_;
return do {
if (!reftype $subject) {
undef
# RDF/JSON
} elsif (reftype $subject eq 'HASH') {
if ($subject->{type} eq 'uri' or $subj
) = @_;
$predicate = do {
if (!reftype $predicate) {
undef
# RDF/JSON
} elsif (reftype $predicate eq 'HASH' and $predicate->{type} eq 'uri') {
$pre
, $object) = @_;
return do {
if (!reftype $object) {
undef
# RDF/JSON
} elsif (reftype $object eq 'HASH') {
if ($object->{type} eq 'literal') {
nwhile have largely been
solved by L<JSON-LD|https://json-ld.org/>. Despite aRef having its own
benefits, please consider using a more established technology (JSON-LD)
instead!
=head1 EXPORTED FUNCTI
ce of L<Attean::API::TripleStore> (experimental)
=item
hash reference with L<RDF/JSON|http://www.w3.org/TR/rdf-json/> format (as
returned by method C<as_hashref> in L<RDF::Trine::Model>)
=back
=he
use strict;
use warnings;
use File::Spec;
use File::Copy qw(move);
use Path::Tiny qw(path);
use JSON;
=head1 NAME
App::Spoor::ParsedFileManager
=head1 VERSION
Version 0.06
=cut
our $VERSION =
ss|login)\.\d+\.\d+\.json)\z/ } readdir $parsed_entries_dir;
foreach my $file_name (@file_names) {
# Untaint
if ($file_name =~ /\A((error|access|login)\.\d+\.\d+\.json)\z/) {
my $san
_file_name);
if ($file_security_check->($source_file_path)) {
$file_contents = from_json(path($source_file_path)->slurp_utf8());
if ($transmitter->($file_contents)) {
package App::Spoor::ApiClient;
use v5.10;
use strict;
use warnings;
use JSON;
use PHP::HTTPBuildQuery qw(http_build_query);
use MIME::Base64 qw(encode_base64);
=head1 NAME
App::Spoor::ApiClient
=h
t->get(
$uri,
'Authorization' => $credentials,
'HTTP-Accept' => 'application/json'
);
from_json($response->content)->{reports};
}
=head2 most_recent_mailbox_events
Fetches the most
t->get(
$uri,
'Authorization' => $credentials,
'HTTP-Accept' => 'application/json'
);
from_json($response->content)->{mailbox_events};
}
=head1 AUTHOR
Rory McKinley, C<< <rorymckinl
p qw/croak carp/;
use URI::Escape;
use LWP::UserAgent;
use File::Basename;
use HTTP::Request;
use JSON::XS;
use MIME::Detect;
use Crypt::Digest::SHA256 qw/sha256_hex/;
use Time::HiRes qw/gettimeofday/
f->{path},
'session_token' => $self->{session_token},
'response_format' => 'json',
$microseconds => '',
);
my $param_str = join('&', map {"$_=" . uri_esca
}
my $json_res = eval {
decode_json($res->decoded_content);
};
if ($@) {
croak "Can't parse respone '" . $res->decoded_content . "' to json";
}
# Get json response
package App::Spoor::EntryTransmitter;
use v5.10;
use strict;
use warnings;
use JSON;
use MIME::Base64 qw(encode_base64);
=head1 NAME
App::Spoor::EntryTransmitter
=head1 VERSION
Version 0.01
=cut
{credentials}{api_identifier} . ':' . $config->{credentials}{api_secret}
);
my $content = to_json({
report => {
entries => [
$data
],
metadata => {
reporter
ter}
}
},
});
my $result = $ua->post(
$uri,
'Content-Type' => 'application/json',
'Authorization' => $credentials,
'Content' => $content
);
$result->code() eq '202'
utf8;
use JSON;
use File::Touch;
=head1 NAME
App::Spoor::ParsedEntryWriter
=head1 VERSION
Version 0.01
=cut
our $VERSION = '0.01';
=head1 SYNOPSIS
Writes a parsed log entry as json to a file
rite_parsed_entry
For parsed entries that meet the criteria, this subroutine writes the entry as JSON to a file located in /var/lib/spoor/parsed.
Currently the criteria only allows for parsed entrie
ilbox context.
=back
The created filenames adhere to the pattern "type.timestamp.random_element.json", where 'type' would be the type of log
that produced the entry ('login', 'access', 'error'), 'ti
05;
use strict;
use warnings;
use utf8;
use Carp;
use HTTP::Request::Common qw(POST);
use JSON qw(decode_json);
use LWP::UserAgent;
use URL::Encode qw(url_decode);
use XML::Hash::LX qw(xml2hash);
us
t}) eq 'json'
? 'json' : 'xml';
my $response = $self->{ua}->request($request);
if ($response->is_success) {
my $content = ($format eq 'json')
? decode_json($respo
{
my ($error_code, $error_msg) = ('', '');
if ($format eq 'json') {
my $content = decode_json($response->decoded_content);
$error_code = $content->{status};
nts {
my $contents = <<'END_MESSAGE';
package SpoorForwardHook;
use strict;
use warnings;
use JSON;
use Cpanel::Logger;
my $logger = Cpanel::Logger->new();
sub describe {
my $uapi_add = {
}
sub write_forward_added {
my ( $context, $data ) = @_;
my %message = (
message => to_json($data),
service => 'spoor_forward_added',
output => 1,
backtrace => 0,
level => '
sub write_forward_removed {
my ( $context, $data ) = @_;
my %message = (
message => to_json($data),
service => 'spoor_forward_removed',
output => 1,
backtrace => 0,
level =>