location

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package location implements the STIX 2.1 Attack Pattern object.

The following information comes directly from the STIX 2.1 specification.

A Location represents a geographic location. The location may be described as any, some or all of the following: region (e.g., North America), civic address (e.g. New York, US), latitude and longitude.

Locations are primarily used to give context to other SDOs. For example, a Location could be used in a relationship to describe that the Bourgeois Swallow intrusion set originates from Eastern Europe. The Location SDO can be related to an Identity or Intrusion Set to indicate that the identity or intrusion set is located in that location. It can also be related from a malware or attack pattern to indicate that they target victims in that location. The Location object describes geographic areas, not governments, even in cases where that area might have a government. For example, a Location representing the United States describes the United States as a geographic area, not the federal government of the United States.

At least one of the following properties/sets of properties MUST be provided: region, country, latitude and longitude

When a combination of properties is provided (e.g. a region and a latitude and longitude) the more precise properties are what the location describes. In other words, if a location contains both a region of northern-america and a country of us, then the location describes the United States, not all of North America. In cases where a latitude and longitude are specified without a precision, the location describes the most precise other value.

If precision is specified, then the datum for latitude and longitude MUST be WGS 84 [WGS84]. Organizations specifying a designated location using latitude and longitude SHOULD specify the precision which is appropriate for the scope of the location being identified. The scope is defined by the boundary as outlined by the precision around the coordinates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location struct {
	objects.CommonObjectProperties
	properties.NameProperty
	properties.DescriptionProperty
	Latitude           float64 `json:"latitude,omitempty"`
	Longitude          float64 `json:"longitude,omitempty"`
	Precision          float64 `json:"precision,omitempty"`
	Region             string  `json:"region,omitempty"`
	Country            string  `json:"country,omitempty"`
	AdministrativeArea string  `json:"administrative_area,omitempty"`
	City               string  `json:"city,omitempty"`
	StreetAddress      string  `json:"street_address,omitempty"`
	PostalCode         string  `json:"postal_code,omitempty"`
}
Location - This type implements the STIX 2 Location SDO and

defines all of the properties and methods needed to create and work with this object. All of the methods not defined local to this type are inherited from the individual properties.

func Decode

func Decode(data []byte) (*Location, error)
Decode - This function is a simple wrapper for decoding JSON data. It will

decode a slice of bytes into an actual struct and return a pointer to that object along with any errors.

func New

func New() *Location
New - This function will create a new STIX Location object and return

it as a pointer. It will also initialize the object by setting all of the basic properties.

func (*Location) Encode

func (o *Location) Encode() ([]byte, error)

Encode - This method is a simple wrapper for encoding an object into JSON

func (*Location) EncodeToString

func (o *Location) EncodeToString() (string, error)
EncodeToString - This method is a simple wrapper for encoding an object into

JSON

func (*Location) GetPropertyList

func (o *Location) GetPropertyList() []string
GetProperties - This method will return a list of all of the properties that

are unique to this object. This is used by the custom UnmarshalJSON for this object. It is defined here in this file to make it easy to keep in sync.

func (*Location) UnmarshalJSON

func (o *Location) UnmarshalJSON(b []byte) error
UnmarshalJSON - This method will over write the default UnmarshalJSON method

to enable custom properties that this library does not know about. It will store them as map where the value of each key is a byte arrays. This way a tool that does know how to deal with them can then further process them after this is done. This will also allow the storage of the raw JSON data.

func (*Location) Valid

func (o *Location) Valid() (bool, int, []string)
Valid - This method will verify and test all of the properties on an object

to make sure they are valid per the specification. It will return a boolean, an integer that tracks the number of problems found, and a slice of strings that contain the detailed results, whether good or bad.

Jump to

Keyboard shortcuts

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