et::RDAP::Registry::IANARegistry->new($data);
C<$data> is a hashref corresponding to the decoded JSON representation
of the IANA registry.
=cut
sub new {
my ($package, $args, $url) = @_;
my
se Rex::Interface::Fs;
use Rex::Interface::Exec;
use Rex::User::Linux;
use Rex::Helper::Path;
use JSON::MaybeXS;
use base qw(Rex::User::Linux);
sub new {
my $that = shift;
my $proto = ref($that
$script = q|
unlink $0;
print to_json([ getpwnam($ARGV[0]) ]);
|;
$fh->open( ">", $rnd_file );
$fh->write($script);
$fh->write( func_to_json() );
$fh->close;
my $data_str = i_ru
rmation for $user");
}
Rex::Interface::Fs->create()->unlink($rnd_file);
my $data = decode_json($data_str);
return (
name => $data->[0],
password => $data->[1],
uid => $
->[0] }
sub last { shift->items->[-1] }
sub join { join($_[1] // '', @{$_[0]->items}) }
sub TO_JSON { [@{shift->items}] }
1;
__END__
=encoding utf-8
=head1 NAME
CSAF::Util::List - (Mojo like)
head1 DESCRIPTION
L<CSAF::Util::List> is a collection utility.
=head2 METHODS
=over
=item TO_JSON
Alias for L</"to_array">.
=item add
Alias for L</"item">.
=item each
Evaluate callback for e
qw(pod2usage);
use Carp ();
use JSON::PP ();
use Data::Dumper ();
use CVSS ();
our $VERSION = $CVSS::VERSION;
my %options = (format => 'json');
sub _print { print(($_[0] || '') . (d
act-score
modified-impact-score
null|0
format=s
json
xml
)
) or pod2usage(-verbose => 0);
pod2usage(-exitstatus => 0, -ve
= @args;
pod2usage(-verbose => 1) if !$vector_string;
$options{format} = 'json' if defined $options{json};
$options{format} = 'xml' if defined $options{xml};
$options{'base-severi
qualifiers => $self->qualifiers,
subpath => $self->subpath,
};
}
sub TO_JSON { shift->to_hash }
sub _url_encode {
my ($string, $pattern) = @_;
# RFC-3986
$patt
tem $purl->TO_JSON
Helper method for JSON modules (L<JSON>, L<JSON::PP>, L<JSON::XS>, L<Cpanel::JSON::XS>, L<Mojo::JSON>, etc).
use Mojo::JSON qw(encode_json);
say encode_json($purl);
{json => 'accessVector', values => $AV},
AC => {json => 'accessComplexity', values => $AC},
Au => {json => 'authentication', values => $Au},
C => {json =
s => $C},
I => {json => 'integrityImpact', values => $I},
A => {json => 'availabilityImpact', values => $A},
# Temporal
E => {json => 'exploitability', v
es => $E},
RL => {json => 'remediationLevel', values => $RL},
RC => {json => 'reportConfidence', values => $RC},
# Environmental
CDP => {json => 'collateralDamagePoten
shift->{scores}->{impact} }
sub modified_impact_score { shift->{scores}->{modified_impact} }
# JSON-style alias
sub vectorString { shift->vector_string }
sub baseScore { shift-
ics->{$metric});
}
}
return join '/', @vectors;
}
sub TO_JSON {
my ($self) = @_;
# Required JSON fields:
# CVSS == v2.0: version, vectorString and baseScore
#
ring, baseScore and baseSeverity
$self->calculate_score unless ($self->base_score);
my $json = {
version => sprintf('%.1f', $self->version),
vectorString => $self->vecto
n $item;
}
Carp::croak "Failed to load item class '$item_class': $@" if ($@);
}
sub TO_JSON { shift->TO_CSAF }
sub TO_CSAF {
my $self = shift;
my $output = [];
foreach my $
directory => './csaf-acme-advisories',
include_pattern => qr{acme-sa-2024-\d+\.json}
);
=head1 DESCRIPTION
L<CSAF::Options::Downloader> is a configurator of L<CSAF::Downloade
ss $lang;
# Subtags in official testsuite (optional/oasis_csaf_tc-csaf_2_0-2021-6-2-14-*.json)
if ($lang =~ /\-(AA|XP|ZZ|QM|QABC)$/i) {
return $self->add_message(
rse($version) > $version_class->parse($next_constraint->version)));
return FALSE;
}
sub TO_JSON {
return {scheme => $_[0]->scheme, constraints => $_[0]->constraints};
}
sub _pairwise {
onents.
=item $vers->TO_JSON
Helper method for JSON modules (L<JSON>, L<JSON::PP>, L<JSON::XS>, L<Mojo::JSON>, etc).
use Mojo::JSON qw(encode_json);
say encode_json($vers); # {"constraint
ntent => (is => 'rw', required => 1);
has summary => (is => 'rw');
sub TO_JSON {
my $self = shift;
my $json = {
id => $self->id,
title => $self->title,
=> $self->link,
content => $self->content
};
$json->{summary} = $self->summary if ($self->summary);
return $json;
}
1;
__END__
=encoding utf-8
=head1 NAME
CSAF::ROLIE::Fe
ntry->updated
=item $entry->link
=item $entry->content
=item $entry->summary
=item $entry->TO_JSON
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature reques
e tracking_id_to_well_filename);
use CSAF::ROLIE::Entries;
use CSAF::Options::ROLIE;
use Cpanel::JSON::XS;
use File::Basename;
use File::Find;
use File::Spec::Functions qw(catfile);
use Time::Piece;
ALSE => !!0;
my $CSAF_SCHEMAS = {'2.0' => 'https://docs.oasis-open.org/csaf/csaf/v2.0/csaf_json_schema.json'};
has options => (
isa => sub { Carp::croak q{Not "CSAF::Options::ROLIE" object} un
my $json = eval { Cpanel::JSON::XS->new->decode(file_read($feed_path)) };
Carp::croak "Failed to parse the ROLIE feed: $@" if ($@);
Carp::croak 'Invalid ROLIE feed' unless defined $json->{fe
GetOptionsFromArray :config gnu_compat);
use Pod::Usage qw(pod2usage);
use Carp ();
use JSON::PP ();
use Data::Dumper ();
use URI::VersionRange ();
our $VERSION = '2.23';
sub cli_erro
> 'json');
GetOptionsFromArray(
\@args, \%options, qw(
help
man
v
contains=s
null|0
format=s
json
@args;
pod2usage(-verbose => 1) if !$vers_string;
$options{format} = 'json' if defined $options{json};
$options{format} = 'human-readable' if defined $options{'human-readable'}
sub to_human_string { sprintf '%s %s', $COMPARATOR{$_[0]->comparator}, $_[0]->version }
sub TO_JSON { {version => $_[0]->version, comparator => $_[0]->comparator} }
1;
__END__
=head1 NAME
URI::V
al 2.10
=item $vers->TO_JSON
Helper method for JSON modules (L<JSON>, L<JSON::PP>, L<JSON::XS>, L<Mojo::JSON>, etc).
use Mojo::JSON qw(encode_json);
say encode_json($constraint); # {"comp
.domain.tld/advisories/csaf');
has feed_filename => (is => 'rw', default => 'csaf-feed-tlp-white.json');
has feed_id => (is => 'rw', trigger => 1, default => 'csaf-feed-tlp-white');
has feed_l
);
}
sub _trigger_feed_id {
my $self = shift;
$self->feed_filename($self->feed_id . '.json');
$self->feed_link([{rel => 'self', href => $self->feed_url}]);
}
sub feed_url {
my $s
n.tld/advisories/csaf>).
=item feed_filename
ROLIE feed filename (default C<csaf-feed-tlp-white.json>).
=item feed_id
ROLIE feed ID (default C<csaf-feed-tlp-white> or C<csaf-feed-tlp- + tlp_label>
%s (%s - %s)', $_[0]->type, $_[0]->path, $_[0]->message, $_[0]->code, $_[0]->category;
}
sub TO_JSON {
return {
type => $_[0]->type,
category => $_[0]->category,
mes
=item path
=item type
=item category
=back
=head2 METHODS
=over
=item to_string
=item TO_JSON
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature request
2.0.json'},
cvss3 => {
oneOf => [
{'$ref' => 'https://www.first.org/cvss/cvss-v3.0.json'},
{'$ref' => 'https://www.first.org/cvss/cvss-v3.1.json'}
3.1' ? 'cvss-v3.1' : 'cvss-v3.0'));
my @schema_errors = $v->validate($cvss_v3->TO_JSON);
foreach my $schema_error (@schema_errors) {
$self->add_mes
AF::Schema->validator('cvss-v2.0');
my @schema_errors = $v->validate($cvss_v2->TO_JSON);
foreach my $schema_error (@schema_errors) {
$self->add_mes
;
__END__
=encoding utf-8
=head1 NAME
CSAF::Validator::Schema - Validate CSAF document using JSON Schema.
=head1 SYNOPSIS
use CSAF::Validator::Schema;
my $v = CSAF::Validator::Schema->
cture for purposes of modules like L<Data::Dumper> or
serialisation into things like C<YAML> or C<JSON>.
:repr(keys)
I<Since version 0.803.>
The representation will be a blessed hash reference.
ave predictably with data printing modules like L<Data::Dumper> or
serialisation via C<YAML> or C<JSON>.
These two hash-based representation types may be useful when converting
existing classes into