onstant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/grouping.json';
use constant PROPERTIES => (
qw(type spec_version id created modifie
_JSON
Encode the object in JSON.
=item $grouping->to_hash
Return the object HASH.
=item $grouping->to_string
Encode the object in JSON.
=item $grouping->validate
Validate the object using JSON
stant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/observables/file.json';
use constant PROPERTIES => (
qw(type id),
qw(spec_version objec
le->TO_JSON
Encode the object in JSON.
=item $file->to_hash
Return the object HASH.
=item $file->to_string
Encode the object in JSON.
=item $file->validate
Validate the object using JSON Schema
tant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/infrastructure.json';
use constant PROPERTIES => (
qw(type spec_version id created modi
item $infrastructure->TO_JSON
Encode the object in JSON.
=item $infrastructure->to_hash
Return the object HASH.
=item $infrastructure->to_string
Encode the object in JSON.
=item $infrastructure-
>validate
Validate the object using JSON Schema (see L<STIX::Schema>).
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
at
tant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/attack-pattern.json';
use constant PROPERTIES => (
qw(type spec_version id created modi
item $attack_pattern->TO_JSON
Encode the object in JSON.
=item $attack_pattern->to_hash
Return the object HASH.
=item $attack_pattern->to_string
Encode the object in JSON.
=item $attack_pattern-
>validate
Validate the object using JSON Schema (see L<STIX::Schema>).
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
at
tant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/observed-data.json';
use constant PROPERTIES => (
qw(type spec_version id created modif
=item $observed_data->TO_JSON
Encode the object in JSON.
=item $observed_data->to_hash
Return the object HASH.
=item $observed_data->to_string
Encode the object in JSON.
=item $observed_data->v
alidate
Validate the object using JSON Schema (see L<STIX::Schema>).
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
at L
>TO_JSON
Encode the object in JSON.
=item $object->to_hash
Return the object HASH.
=item $object->to_string
Encode the object in JSON.
=item $object->validate
Validate the object using JSON Sch
onstant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/identity.json';
use constant PROPERTIES => (
qw(type spec_version id created modifie
_JSON
Encode the object in JSON.
=item $identity->to_hash
Return the object HASH.
=item $identity->to_string
Encode the object in JSON.
=item $identity->validate
Validate the object using JSON
constant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/tool.json';
use constant PROPERTIES => (
qw(type spec_version id created modified)
ol->TO_JSON
Encode the object in JSON.
=item $tool->to_hash
Return the object HASH.
=item $tool->to_string
Encode the object in JSON.
=item $tool->validate
Validate the object using JSON Schema
tant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/intrusion-set.json';
use constant PROPERTIES => (
qw(type spec_version id created modif
=item $intrusion_set->TO_JSON
Encode the object in JSON.
=item $intrusion_set->to_hash
Return the object HASH.
=item $intrusion_set->to_string
Encode the object in JSON.
=item $intrusion_set->v
alidate
Validate the object using JSON Schema (see L<STIX::Schema>).
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
at L
constant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/report.json';
use constant PROPERTIES => (
qw(type spec_version id created modified
>TO_JSON
Encode the object in JSON.
=item $report->to_hash
Return the object HASH.
=item $report->to_string
Encode the object in JSON.
=item $report->validate
Validate the object using JSON Sch
tant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/vulnerability.json';
use constant PROPERTIES => (
qw(type spec_version id created modif
=item $vulnerability->TO_JSON
Encode the object in JSON.
=item $vulnerability->to_hash
Return the object HASH.
=item $vulnerability->to_string
Encode the object in JSON.
=item $vulnerability->v
alidate
Validate the object using JSON Schema (see L<STIX::Schema>).
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
at L
onstant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/malware.json';
use constant PROPERTIES => (
qw(type spec_version id created modified
TO_JSON
Encode the object in JSON.
=item $malware->to_hash
Return the object HASH.
=item $malware->to_string
Encode the object in JSON.
=item $malware->validate
Validate the object using JSON S
use warnings;
use utf8;
use overload '""' => \&to_string, fallback => 1;
use Carp;
use Cpanel::JSON::XS;
use STIX::Schema;
use Types::Standard qw(Str);
use UUID::Tiny qw(:std);
use Moo;
use n
my $json = Cpanel::JSON::XS->new->utf8->canonical->allow_nonref->allow_unknown->allow_blessed->convert_blessed
->stringify_infnan->escape_slash(0)->allow_dupkeys->pretty;
return $json->en
code($self->TO_JSON);
}
sub to_hash {
my $self = shift;
my $json = $self->to_string;
return Cpanel::JSON::XS->new->decode($json);
}
sub _render_object_ref {
my $object = shift;
constant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/note.json';
use constant PROPERTIES => (
qw(type spec_version id created modified)
te->TO_JSON
Encode the object in JSON.
=item $note->to_hash
Return the object HASH.
=item $note->to_string
Encode the object in JSON.
=item $note->validate
Validate the object using JSON Schema
rter 'import';
use File::Basename qw(dirname);
use File::Spec::Functions qw(catfile);
use JSON::Validator;
use Moo;
use constant DEBUG => $ENV{STIX_DEBUG} || 0;
has object => (is => 'ro');
path { catfile(dirname(__FILE__), 'cache') }
sub validator {
my ($self) = @_;
my $jv = JSON::Validator->new;
DEBUG and say sprintf('-- Load validator and use %s schema', $self->object-
rn $self->validator->validate($self->object);
}
1;
=encoding utf-8
=head1 NAME
STIX::Schema - JSON Schema Validator
=head1 SYNOPSIS
use STIX::Schema;
my $validator = STIX::Schema->new(o
onstant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/incident.json';
use constant PROPERTIES => (
qw(type spec_version id created modifie
_JSON
Encode the object in JSON.
=item $incident->to_hash
Return the object HASH.
=item $incident->to_string
Encode the object in JSON.
=item $incident->validate
Validate the object using JSON
onstant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/campaign.json';
use constant PROPERTIES => (
qw(type spec_version id created modifie
_JSON
Encode the object in JSON.
=item $campaign->to_hash
Return the object HASH.
=item $campaign->to_string
Encode the object in JSON.
=item $campaign->validate
Validate the object using JSON
onstant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/opinion.json';
use constant PROPERTIES => (
qw(type spec_version id created modified
TO_JSON
Encode the object in JSON.
=item $opinion->to_hash
Return the object HASH.
=item $opinion->to_string
Encode the object in JSON.
=item $opinion->validate
Validate the object using JSON S
stant SCHEMA =>
'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sros/relationship.json';
use constant PROPERTIES => (
qw(type spec_version id created modif
r
=item $relationship->TO_JSON
Encode the object in JSON.
=item $relationship->to_hash
Return the object HASH.
=item $relationship->to_string
Encode the object in JSON.
=item $relationship->val
idate
Validate the object using JSON Schema (see L<STIX::Schema>).
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
at L<h
ENTIFIER_REGEXP/;
return $_[0]->id if (ref($_[0]));
}
sub to_string { shift->value }
sub TO_JSON { shift->value }
1;
=encoding utf-8
=head1 NAME
STIX::Common::Identifier - Identifier type
ue
=back
=head2 HELPERS
=over
=item $identifier->TO_JSON
Encode the object in JSON.
=item $identifier->to_string
Encode the object in JSON.
=back
=head1 SUPPORT
=head2 Bugs / Feature Reques