UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

251 lines (230 loc) 9.28 kB
import { Relationship } from './schemas/sro/relationship.schema.js'; import { AttackObject } from './schemas/sdo/stix-bundle.schema.js'; import { Analytic } from './schemas/sdo/analytic.schema.js'; import { Asset } from './schemas/sdo/asset.schema.js'; import { Campaign } from './schemas/sdo/campaign.schema.js'; import { Group } from './schemas/sdo/group.schema.js'; import { Malware } from './schemas/sdo/malware.schema.js'; import { Technique } from './schemas/sdo/technique.schema.js'; import { DataComponent } from './schemas/sdo/data-component.schema.js'; import { Mitigation } from './schemas/sdo/mitigation.schema.js'; import { Tactic } from './schemas/sdo/tactic.schema.js'; import { Tool } from './schemas/sdo/tool.schema.js'; import { Collection } from './schemas/sdo/collection.schema.js'; import { DataSource } from './schemas/sdo/data-source.schema.js'; import { DetectionStrategy } from './schemas/sdo/detection-strategy.schema.js'; import { Identity } from './schemas/sdo/identity.schema.js'; import { Matrix } from './schemas/sdo/matrix.schema.js'; import { MarkingDefinition } from './schemas/smo/marking-definition.schema.js'; declare class AnalyticImpl extends AttackBaseImpl implements Analytic { readonly analytic: Analytic; constructor(analytic: Analytic); } interface AnalyticImpl extends Analytic { } declare class AssetImpl extends AttackBaseImpl { readonly asset: Asset; constructor(asset: Asset); private _techniques; addTechnique(technique: string): void; getDisplayName(): string; } interface AssetImpl extends Asset { } declare class DataComponentImpl extends AttackBaseImpl implements DataComponent { readonly dataComponent: DataComponent; private _detectedTechniques; constructor(dataComponent: DataComponent); addDetectedTechnique(technique: TechniqueImpl): void; getDetectedTechniques(): TechniqueImpl[]; } interface DataComponentImpl extends DataComponent { } declare class MitigationImpl extends AttackBaseImpl { readonly mitigation: Mitigation; constructor(mitigation: Mitigation); } interface MitigationImpl extends Mitigation { } declare class TacticImpl extends AttackBaseImpl { readonly tactic: Tactic; constructor(tactic: Tactic); } interface TacticImpl extends Tactic { } declare class TechniqueImpl extends AttackBaseImpl { readonly technique: Technique; private _subTechniques; private _tactics; private _mitigations; private _parentTechnique?; private _relatedTechniques; private _targetAssets; private _detectingDataComponents; constructor(technique: Technique); setParent(parent: TechniqueImpl): void; addSubTechnique(subTechnique: TechniqueImpl): void; addTactic(tactic: TacticImpl): void; addMitigation(mitigation: MitigationImpl): void; addRelatedTechnique(technique: TechniqueImpl): void; addTargetAsset(asset: AssetImpl): void; addDetectingDataComponent(dataComponent: DataComponentImpl): void; getSubTechniques(): TechniqueImpl[]; getTactics(): TacticImpl[]; getMitigations(): MitigationImpl[]; getParentTechnique(): TechniqueImpl | undefined; getRelatedTechniques(): TechniqueImpl[]; getTargetAssets(): AssetImpl[]; getDetectingDataComponents(): DataComponentImpl[]; } interface TechniqueImpl extends Technique { } declare class MalwareImpl extends AttackBaseImpl implements Malware { readonly malware: Malware; private _techniques; constructor(malware: Malware); addTechnique(technique: TechniqueImpl): void; getTechniques(): TechniqueImpl[]; } interface MalwareImpl extends Malware { } declare class ToolImpl extends AttackBaseImpl implements Tool { readonly tool: Tool; private _techniques; constructor(tool: Tool); addTechnique(technique: TechniqueImpl): void; getTechniques(): TechniqueImpl[]; } interface ToolImpl extends Tool { } declare class GroupImpl extends AttackBaseImpl implements Group { readonly group: Group; private _techniques; private _software; private _attributedCampaigns; constructor(group: Group); addTechnique(technique: TechniqueImpl): void; addSoftware(software: MalwareImpl | ToolImpl): void; addAttributedCampaign(campaign: CampaignImpl): void; getTechniques(): TechniqueImpl[]; getSoftware(): (MalwareImpl | ToolImpl)[]; getAttributedCampaigns(): CampaignImpl[]; } interface GroupImpl extends Group { } declare class CampaignImpl extends AttackBaseImpl implements Campaign { readonly campaign: Campaign; private _techniques; private _software; private _attributedTo?; constructor(campaign: Campaign); addTechnique(technique: TechniqueImpl): void; addSoftware(software: MalwareImpl | ToolImpl): void; setAttributedTo(group: GroupImpl): void; getTechniques(): TechniqueImpl[]; getSoftware(): (MalwareImpl | ToolImpl)[]; getAttributedTo(): GroupImpl | undefined; } interface CampaignImpl extends Campaign { } declare class CollectionImpl extends AttackBaseImpl { readonly collection: Collection; constructor(collection: Collection); } interface CollectionImpl extends Collection { } declare class DataSourceImpl extends AttackBaseImpl { readonly dataSource: DataSource; constructor(dataSource: DataSource); } interface DataSourceImpl extends DataSource { } declare class DetectionStrategyImpl extends AttackBaseImpl implements DetectionStrategy { readonly detectionStrategy: DetectionStrategy; private _techniques; constructor(detectionStrategy: DetectionStrategy); addTechnique(technique: TechniqueImpl): void; getTechniques(): TechniqueImpl[]; get detects(): TechniqueImpl[]; } interface DetectionStrategyImpl extends DetectionStrategy { } declare class IdentityImpl extends AttackBaseImpl { readonly identity: Identity; constructor(identity: Identity); } interface IdentityImpl extends Identity { } declare class MatrixImpl extends AttackBaseImpl { readonly matrix: Matrix; constructor(matrix: Matrix); } interface MatrixImpl extends Matrix { } declare class MarkingDefinitionImpl extends AttackBaseImpl { readonly markingDefinition: MarkingDefinition; constructor(markingDefinition: MarkingDefinition); } interface MarkingDefinitionImpl extends MarkingDefinition { } declare class RelationshipImpl extends AttackBaseImpl { readonly relationship: Relationship; constructor(relationship: Relationship); } interface RelationshipImpl extends Relationship { } declare class AttackDataModel { private readonly uuid; private readonly attackObjects; techniques: TechniqueImpl[]; campaigns: CampaignImpl[]; mitigations: MitigationImpl[]; identities: IdentityImpl[]; groups: GroupImpl[]; malware: MalwareImpl[]; tools: ToolImpl[]; markingDefinitions: MarkingDefinitionImpl[]; dataComponents: DataComponentImpl[]; dataSources: DataSourceImpl[]; tactics: TacticImpl[]; assets: AssetImpl[]; matrices: MatrixImpl[]; collections: CollectionImpl[]; relationships: RelationshipImpl[]; detectionStrategies: DetectionStrategyImpl[]; analytics: AnalyticImpl[]; constructor(uuid: string, // Unique ID for the data source attackObjects: AttackObject[]); /** * Returns the unique identifier for this data source/model. * @returns string - Returns the unique identifier for this data source/model */ getUuid(): string; /** * Returns a list of ATT&CK objects that have been parsed by Zod schemas. These objects are not TS classes, but are plain JS objects. They do not contain relationship mappings. * @returns AttackObject[] - a list of ATT&CK objects that have been parsed by Zod schemas. These objects are not TS classes, but are plain JS objects. They do not contain relationship mappings. */ getAttackObjects(): AttackObject[]; /** * Populates the class properties (e.g., techniques, groups, etc.) from the parsed objects array. */ private populateData; /** * Initializes relationships between objects, such as sub-techniques, tactics, mitigations, and more. */ private initializeRelationships; } type AnyAttackObject = MalwareImpl | AssetImpl | CampaignImpl | CollectionImpl | DataComponentImpl | DataSourceImpl | IdentityImpl | MatrixImpl | ToolImpl | TacticImpl | TechniqueImpl | GroupImpl | MitigationImpl | RelationshipImpl | MarkingDefinitionImpl | DetectionStrategyImpl | AnalyticImpl; declare class AttackBaseImpl { private revokedBy?; /** * Sets the object that revokes the current object. * @param obj - The object that revokes this object. */ setRevokedBy(obj: AnyAttackObject): void; /** * Returns the object that revoked this object. */ getRevokedBy(): AnyAttackObject | undefined; } export { AttackBaseImpl as A, CampaignImpl as C, DataComponentImpl as D, GroupImpl as G, IdentityImpl as I, MalwareImpl as M, RelationshipImpl as R, TacticImpl as T, AssetImpl as a, CollectionImpl as b, DataSourceImpl as c, MatrixImpl as d, MitigationImpl as e, TechniqueImpl as f, ToolImpl as g, DetectionStrategyImpl as h, AnalyticImpl as i, MarkingDefinitionImpl as j, AttackDataModel as k, type AnyAttackObject as l };