baseobject

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(correct, toTest *CommonObjectProperties) (bool, int, []string)

Compare - This method will compare the common properties from two objects to make sure they are the same. The common properties correct is the master and represent the correct data, the common properties toTest represents the one we need to test.

Types

type CommonBaseProperties

type CommonBaseProperties struct {
	TypeProperty
	SpecVersionProperty
	IDProperty
}

CommonBaseProperties - This type includes all of the common properties that are used by all STIX objects

func (*CommonBaseProperties) Verify

func (o *CommonBaseProperties) Verify() error

Verify - This method will ensure that all of the required properties are populated and try to ensure all of values are valid. The difference between this method and the one for Common Object Properties is this one is missing the check for the modified property.

type CommonMarkingDefinitionProperties

CommonMarkingDefinitionProperties - This type includes all of the common properties that are used by the STIX Marking Definition object. This inherits the CommonBaseProperties even though the Modified and Revoked properties are not technically valid for this object.

type CommonObjectProperties

CommonObjectProperties - This type includes all of the common properties that are used by all STIX SDOs and SROs

func (*CommonObjectProperties) Compare

func (o *CommonObjectProperties) Compare(toTest *CommonObjectProperties) (bool, int, []string)

Compare - This method will compare the common properties from two objects to make sure they are the same. The common properties receiver is the master and represent the correct data, the common properties that are passed in as toTest represents the one we need to test.

func (*CommonObjectProperties) InitObject

func (o *CommonObjectProperties) InitObject(stixType string) error

InitObject- This method will initialize the object by setting all of the basic properties.

func (*CommonObjectProperties) Verify

func (o *CommonObjectProperties) Verify() error

Verify - This method will ensure that all of the required properties are populated and try to ensure all of values are valid.

type ConfidenceProperty

type ConfidenceProperty struct {
	Confidence int `json:"confidence,omitempty"`
}

ConfidenceProperty - A property used by one or more STIX objects that captures the STIX confidence score, which is a value from 0-100.

func (*ConfidenceProperty) GetConfidence

func (o *ConfidenceProperty) GetConfidence() int

GetConfidence - This method returns the confidence value as an integer.

func (*ConfidenceProperty) SetConfidence

func (o *ConfidenceProperty) SetConfidence(i int) error

SetConfidence - This method takes in an integer representing a STIX confidence level 0-100 and updates the Confidence property.

type CreatedByRefProperty

type CreatedByRefProperty struct {
	CreatedByRef string `json:"created_by_ref,omitempty"`
}

CreatedByRefProperty - A property used by all STIX objects that captures the STIX identifier of the identity that created this object.

func (*CreatedByRefProperty) GetCreatedByRef

func (o *CreatedByRefProperty) GetCreatedByRef() string

GetCreatedByRef - This method returns the STIX identifier for the identity that created this object.

func (*CreatedByRefProperty) SetCreatedByRef

func (o *CreatedByRefProperty) SetCreatedByRef(s string) error

SetCreatedByRef - This method takes in a string value representing a STIX identifier and updates the Created By Ref property.

type CreatedModifiedProperty

type CreatedModifiedProperty struct {
	Created  string `json:"created,omitempty"`
	Modified string `json:"modified,omitempty"`
}

CreatedModifiedProperty - Timestamps to track the created and modified times.

Created - A property used by all STIX objects that captures the date and time that the object was created.

Modified - A property used by all STIX objects that captures the date and time that the object was modified or changed. This property effectively tracks the version of the object.

func (*CreatedModifiedProperty) GetCreated

func (o *CreatedModifiedProperty) GetCreated() string

GetCreated - This method will return the created timestamp as a string.

func (*CreatedModifiedProperty) GetModified

func (o *CreatedModifiedProperty) GetModified() string

GetModified - This method will return the modified timestamp as a string. If the value is the same as the created timestamp, then this object is the first version of the object.

func (*CreatedModifiedProperty) SetCreated

func (o *CreatedModifiedProperty) SetCreated(t interface{}) error

SetCreated - This method takes in a timestamp in either time.Time or string format and updates the created property with it. The value is stored as a string, so if the value is in time.Time format, it will be converted to the correct STIX timestamp format.

func (*CreatedModifiedProperty) SetCreatedToCurrentTime

func (o *CreatedModifiedProperty) SetCreatedToCurrentTime() error

SetCreatedToCurrentTime - This methods sets the object created time to the current time

func (*CreatedModifiedProperty) SetModified

func (o *CreatedModifiedProperty) SetModified(t interface{}) error

SetModified - This method takes in a timestamp in either time.Time or string format and updates the modifed property with it. The value is stored as a string, so if the value is in time.Time format, it will be converted to the correct STIX timestamp format.

func (*CreatedModifiedProperty) SetModifiedToCreated

func (o *CreatedModifiedProperty) SetModifiedToCreated() error

SetModifiedToCreated sets the object modified time to be the same as the created time.

func (*CreatedModifiedProperty) SetModifiedToCurrentTime

func (o *CreatedModifiedProperty) SetModifiedToCurrentTime() error

SetModifiedToCurrentTime - This methods sets the object modified time to the current time

type DatastoreIDProperty

type DatastoreIDProperty struct {
	DatastoreID int `json:"-"`
}

DatastoreIDProperty - A property used by all STIX objects that captures the unique database ID for this object. This is not included in the JSON serialization, but is used with some datastores.

func (*DatastoreIDProperty) GetDatastoreID

func (o *DatastoreIDProperty) GetDatastoreID() int

GetDatastoreID - This method returns the database ID value.

func (*DatastoreIDProperty) SetDatastoreID

func (o *DatastoreIDProperty) SetDatastoreID(i int) error

SetDatastoreID - This method takes in a int representing the database ID and updates the DatastoreID property.

type ExternalReference

type ExternalReference struct {
	SourceName  string            `json:"source_name,omitempty"`
	Description string            `json:"description,omitempty"`
	URL         string            `json:"url,omitempty"`
	Hashes      map[string]string `json:"hashes,omitempty"`
	ExternalID  string            `json:"external_id,omitempty"`
}

ExternalReference - This type defines all of the properties associated with the STIX External Reference type. All of the methods not defined local to this type are inherited from the individual properties.

func (*ExternalReference) AddHash

func (o *ExternalReference) AddHash(k, v string) error

AddHash - This method takes in two parameters and adds the hash to the map. The first is a string value representing a hash type from the STIX hashes vocabulary. The second is a string value representing the actual hash of the content from the remote external reference.

func (*ExternalReference) GetDescription

func (o *ExternalReference) GetDescription() string

GetDescription - This method returns the description for an object as a string.

func (*ExternalReference) GetExternalID

func (o *ExternalReference) GetExternalID() string

GetExternalID - This method returns the external id for this reference.

func (*ExternalReference) GetSourceName

func (o *ExternalReference) GetSourceName() string

GetSourceName - This method will return the source name.

func (*ExternalReference) GetURL

func (o *ExternalReference) GetURL() string

GetURL - This method returns the url for this external reference.

func (*ExternalReference) SetDescription

func (o *ExternalReference) SetDescription(s string) error

SetDescription - This method takes in a string value representing a text description and updates the description property.

func (*ExternalReference) SetExternalID

func (o *ExternalReference) SetExternalID(s string) error

SetExternalID - This method takes in a string value representing an general purpose id in a remote system for the source of this external reference and updates the external id property.

func (*ExternalReference) SetSourceName

func (o *ExternalReference) SetSourceName(s string) error

SetSourceName - This method takes in a string value representing the name of a source for an external reference and udpates the source name property.

func (*ExternalReference) SetURL

func (o *ExternalReference) SetURL(s string) error

SetURL - This method takes in a string value representing a URL location of a source for an external reference and updates the url property.

type ExternalReferencesProperty

type ExternalReferencesProperty struct {
	ExternalReferences []ExternalReference `json:"external_references,omitempty"`
}

ExternalReferencesProperty - A property used by one or more STIX objects that captures a list of external references as defined by STIX.

func (*ExternalReferencesProperty) NewExternalReference

func (o *ExternalReferencesProperty) NewExternalReference() (*ExternalReference, error)

NewExternalReference - This method creates a new external reference and returns a reference to a slice location. This will enable the code to update an object located at that slice location.

type GranularMarking

type GranularMarking struct {
	LangProperty
	MarkingRef string   `json:"marking_ref,omitempty"`
	Selectors  []string `json:"selectors,omitempty"`
}

GranularMarking - This type defines all of the properties associated with the STIX Granular Marking type. All of the methods not defined local to this type are inherited from the individual properties.

func (*GranularMarking) AddSelector

func (o *GranularMarking) AddSelector(s string) error

AddSelector - This method takes in a string value representing a STIX granular marking selector and adds it to the list of selectors.

func (*GranularMarking) GetMarkingRef

func (o *GranularMarking) GetMarkingRef() string

GetMarkingRef - This method returns the STIX identifier of the marking definition object that was recorded in this granular marking type.

func (*GranularMarking) SetMarkingRef

func (o *GranularMarking) SetMarkingRef(s string) error

SetMarkingRef - This method takes in a string value representing a STIX identifier of a marking definition object and sets the marking ref property to that value.

type IDProperty

type IDProperty struct {
	ID string `json:"id,omitempty"`
}

IDProperty - A property used by one or more STIX objects that captures the STIX That identifier in string format.

func (*IDProperty) CreateSTIXUUID

func (o *IDProperty) CreateSTIXUUID(s string) (string, error)

func (*IDProperty) GetID

func (o *IDProperty) GetID() string

GetID - This method will return the id for a given STIX object.

func (*IDProperty) SetID

func (o *IDProperty) SetID(s string) error

SetID - This method takes in a string value representing an existing STIX id and updates the id property for the object.

func (*IDProperty) SetNewID

func (o *IDProperty) SetNewID(s string) error

SetNewID - This method takes in a string value representing a STIX object type and creates a new ID based on the approved STIX UUIDv4 format and update the id property for the object.

type LabelsProperty

type LabelsProperty struct {
	Labels []string `json:"labels,omitempty"`
}

LabelsProperty - A property used by one or more STIX objects that captures a list of labels or tags for a STIX object. On some objects the labels property is defined as coming from an open-vocab.

func (*LabelsProperty) AddLabel

func (o *LabelsProperty) AddLabel(s string) error

AddLabel - This method takes in a string value that represents one or more labels separated by a command for a STIX object and adds it to the list of labels in the labels property.

type LangProperty

type LangProperty struct {
	Lang string `json:"lang,omitempty"`
}

LangProperty - A property used by one or more STIX objects that captures the lang string as defined in RFC 5646. This is used to record the language that a given object is using.

func (*LangProperty) GetLang

func (o *LangProperty) GetLang() string

GetLang - This method returns the current language code for a given object.

func (*LangProperty) SetLang

func (o *LangProperty) SetLang(s string) error

SetLang - This method takes in a string value representing an ISO 639-2 encoded language code as defined in RFC 5646 and updates the lang property.

type MarkingProperties

type MarkingProperties struct {
	ObjectMarkingRefs []string          `json:"object_marking_refs,omitempty"`
	GranularMarkings  []GranularMarking `json:"granular_markings,omitempty"`
}

MarkingProperties - Properties used by one or more STIX objects that captures the data markings for an object. These can be in the form of object markings or granular markings. The object markings is a list of STIX identifier that represent marking definition objects. The granular markings is a list of granular markings.

func (*MarkingProperties) AddObjectMarkingRef

func (o *MarkingProperties) AddObjectMarkingRef(s string) error

AddObjectMarkingRef - This method takes in a string value that represents a STIX identifer for a marking definition object and adds it to the list of object marking refs.

type RawProperty

type RawProperty struct {
	Raw []byte `json:"-"`
}

RawProperty - A property used to store the raw bytes of the JSON object.

func (*RawProperty) GetRawData

func (o *RawProperty) GetRawData() []byte

GetRaw - This method will return the raw bytes for a given STIX object.

func (*RawProperty) SetRawData

func (o *RawProperty) SetRawData(data []byte) error

SetRaw - This method takes in a slice of bytes representing a full JSON object and updates the raw property for the object.

type RevokedProperty

type RevokedProperty struct {
	Revoked bool `json:"revoked,omitempty"`
}

RevokedProperty - A property used by one or more STIX objects that captures whether or not this STIX object has been revoked by the object // creator.

func (*RevokedProperty) GetRevoked

func (o *RevokedProperty) GetRevoked() bool

GetRevoked - This method returns the current value of the revoked property.

func (*RevokedProperty) SetRevoked

func (o *RevokedProperty) SetRevoked() error

SetRevoked - This method sets the revoked boolean to true

type SpecVersionProperty

type SpecVersionProperty struct {
	SpecVersion string `json:"spec_version,omitempty"`
}

SpecVersionProperty - A property used by all STIX objects that captures the STIX specification version.

func (*SpecVersionProperty) GetSpecVersion

func (o *SpecVersionProperty) GetSpecVersion() string

GetSpecVersion - This method returns the version value as a string.

func (*SpecVersionProperty) SetSpecVersion

func (o *SpecVersionProperty) SetSpecVersion(s string) error

SetSpecVersion - This method takes in a string representing a STIX specification version and updates the Version property.

func (*SpecVersionProperty) SetSpecVersion20

func (o *SpecVersionProperty) SetSpecVersion20() error

SetSpecVersion20 - This method will set the specification version to 2.0.

func (*SpecVersionProperty) SetSpecVersion21

func (o *SpecVersionProperty) SetSpecVersion21() error

SetSpecVersion20 - This method will set the specification version to 2.1.

type TypeProperty

type TypeProperty struct {
	ObjectType string `json:"type,omitempty"`
}

TypeProperty - A property used by one or more STIX objects that captures the STIX object type in string format.

func (*TypeProperty) GetObjectType

func (o *TypeProperty) GetObjectType() string

GetObjectType - This method returns the object type.

func (*TypeProperty) SetObjectType

func (o *TypeProperty) SetObjectType(s string) error

SetObjectType - This method takes in a string value representing a STIX object type and updates the type property.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL