2020-12-02 02:24:25 -08:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
import {
TLP ,
} from '../interfaces/AlertInterface' ;
2021-12-03 00:44:16 -08:00
export const observableOperations : INodeProperties [ ] = [
2020-12-02 02:24:25 -08:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Operation Name or ID' ,
2020-12-02 02:24:25 -08:00
name : 'operation' ,
type : 'options' ,
2022-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-12-02 02:24:25 -08:00
required : true ,
default : 'getAll' ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
} ,
} ,
typeOptions : {
loadOptionsDependsOn : [
'resource' ,
] ,
loadOptionsMethod : 'loadObservableOptions' ,
} ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-12-02 02:24:25 -08:00
2021-12-03 00:44:16 -08:00
export const observableFields : INodeProperties [ ] = [
2020-12-02 02:24:25 -08:00
{
displayName : 'Case ID' ,
name : 'caseId' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'create' ,
'getAll' ,
] ,
} ,
} ,
description : 'ID of the case' ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
operation : [
'getAll' ,
'search' ,
] ,
resource : [
'observable' ,
] ,
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-12-02 02:24:25 -08:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
operation : [
'getAll' ,
'search' ,
] ,
resource : [
'observable' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 500 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-12-02 02:24:25 -08:00
} ,
// required attributs
{
displayName : 'Observable ID' ,
name : 'id' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'update' ,
'executeResponder' ,
'executeAnalyzer' ,
'get' ,
] ,
} ,
} ,
description : 'ID of the observable' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Data Type Name or ID' ,
2020-12-02 02:24:25 -08:00
name : 'dataType' ,
type : 'options' ,
required : true ,
default : '' ,
2021-04-05 01:52:56 -07:00
typeOptions : {
loadOptionsMethod : 'loadObservableTypes' ,
} ,
2020-12-02 02:24:25 -08:00
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'create' ,
'executeAnalyzer' ,
] ,
} ,
} ,
2022-06-03 10:23:49 -07:00
description : 'Type of the observable. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2020-12-02 02:24:25 -08:00
} ,
{
displayName : 'Data' ,
name : 'data' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'create' ,
] ,
} ,
hide : {
dataType : [
'file' ,
] ,
} ,
} ,
} ,
{
displayName : 'Binary Property' ,
name : 'binaryProperty' ,
type : 'string' ,
required : true ,
default : 'data' ,
description : 'Binary Property that represent the attachment file' ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'create' ,
] ,
dataType : [
'file' ,
] ,
} ,
} ,
} ,
{
displayName : 'Message' ,
name : 'message' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
resource : [
2020-12-02 02:54:10 -08:00
'observable' ,
2020-12-02 02:24:25 -08:00
] ,
operation : [
'create' ,
] ,
} ,
} ,
description : 'Description of the observable in the context of the case' ,
} ,
{
displayName : 'Start Date' ,
name : 'startDate' ,
type : 'dateTime' ,
required : true ,
default : '' ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
description : 'Date and time of the begin of the case default=now' ,
} ,
{
displayName : 'TLP' ,
name : 'tlp' ,
type : 'options' ,
required : true ,
default : 2 ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
options : [
{
name : 'White' ,
value : TLP.white ,
} ,
{
name : 'Green' ,
value : TLP.green ,
} ,
{
name : 'Amber' ,
value : TLP.amber ,
} ,
{
name : 'Red' ,
value : TLP.red ,
} ,
] ,
2022-04-22 09:29:51 -07:00
description : 'Traffict Light Protocol (TLP). Default=Amber.' ,
2020-12-02 02:24:25 -08:00
} ,
{
displayName : 'IOC' ,
name : 'ioc' ,
type : 'boolean' ,
required : true ,
default : false ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
2022-06-20 07:54:01 -07:00
description : 'Whether the observable is an IOC (Indicator of compromise)' ,
2020-12-02 02:24:25 -08:00
} ,
{
displayName : 'Sighted' ,
name : 'sighted' ,
type : 'boolean' ,
required : true ,
default : false ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
2022-06-20 07:54:01 -07:00
description : 'Whether sighted previously' ,
2020-12-02 02:24:25 -08:00
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
required : true ,
default : '' ,
options : [
{
name : 'Ok' ,
value : 'Ok' ,
} ,
{
name : 'Deleted' ,
value : 'Deleted' ,
} ,
] ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
2022-04-22 09:29:51 -07:00
description : 'Status of the observable. Default=Ok.' ,
2020-12-02 02:24:25 -08:00
} ,
// required for analyzer execution
{
2022-06-20 07:54:01 -07:00
displayName : 'Analyzer Names or IDs' ,
2020-12-02 02:24:25 -08:00
name : 'analyzers' ,
type : 'multiOptions' ,
2022-07-04 02:12:08 -07:00
description : 'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2020-12-02 02:24:25 -08:00
required : true ,
default : [ ] ,
typeOptions : {
loadOptionsDependsOn : [
'id' ,
'dataType' ,
] ,
loadOptionsMethod : 'loadAnalyzers' ,
} ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'executeAnalyzer' ,
] ,
} ,
hide : {
id : [
'' ,
] ,
} ,
} ,
} ,
// required for responder execution
{
2022-06-03 10:23:49 -07:00
displayName : 'Responder Name or ID' ,
2020-12-02 02:24:25 -08:00
name : 'responder' ,
type : 'options' ,
2022-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2020-12-02 02:24:25 -08:00
required : true ,
default : '' ,
typeOptions : {
loadOptionsDependsOn : [
'id' ,
] ,
loadOptionsMethod : 'loadResponders' ,
} ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'executeResponder' ,
] ,
} ,
hide : {
id : [
'' ,
] ,
} ,
} ,
} ,
// Optional attributes (Create operation)
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
2022-04-22 09:29:51 -07:00
default : { } ,
2020-12-02 02:24:25 -08:00
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
options : [
{
displayName : 'Observable Tags' ,
name : 'tags' ,
type : 'string' ,
default : '' ,
placeholder : 'tag1,tag2' ,
} ,
] ,
} ,
// Optional attributes (Update operation)
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
2022-04-22 09:29:51 -07:00
default : { } ,
2020-12-02 02:24:25 -08:00
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
options : [
{
displayName : 'Message' ,
name : 'message' ,
type : 'string' ,
default : '' ,
description : 'Description of the observable in the context of the case' ,
} ,
{
displayName : 'Observable Tags' ,
name : 'tags' ,
type : 'string' ,
default : '' ,
placeholder : 'tag1,tag2' ,
} ,
{
displayName : 'TLP' ,
name : 'tlp' ,
type : 'options' ,
default : 2 ,
options : [
{
name : 'White' ,
value : TLP.white ,
} ,
{
name : 'Green' ,
value : TLP.green ,
} ,
{
name : 'Amber' ,
value : TLP.amber ,
} ,
{
name : 'Red' ,
value : TLP.red ,
} ,
] ,
2022-04-22 09:29:51 -07:00
description : 'Traffict Light Protocol (TLP). Default=Amber.' ,
2020-12-02 02:24:25 -08:00
} ,
{
displayName : 'IOC' ,
name : 'ioc' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether the observable is an IOC (Indicator of compromise)' ,
2020-12-02 02:24:25 -08:00
} ,
{
displayName : 'Sighted' ,
name : 'sighted' ,
2022-06-20 07:54:01 -07:00
description : 'Whether sighted previously' ,
2020-12-02 02:24:25 -08:00
type : 'boolean' ,
default : false ,
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
default : '' ,
options : [
{
name : 'Ok' ,
value : 'Ok' ,
} ,
{
name : 'Deleted' ,
value : 'Deleted' ,
} ,
] ,
2022-04-22 09:29:51 -07:00
description : 'Status of the observable. Default=Ok.' ,
2020-12-02 02:24:25 -08:00
} ,
] ,
} ,
// query options
{
displayName : 'Options' ,
name : 'options' ,
displayOptions : {
show : {
operation : [
'getAll' ,
'search' ,
] ,
resource : [
'observable' ,
] ,
} ,
} ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
options : [
{
displayName : 'Sort' ,
name : 'sort' ,
type : 'string' ,
placeholder : '±Attribut, exp +status' ,
description : 'Specify the sorting attribut, + for asc, - for desc' ,
default : '' ,
} ,
] ,
} ,
// query attributes
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
2022-04-22 09:29:51 -07:00
default : { } ,
2020-12-02 02:24:25 -08:00
placeholder : 'Add Filter' ,
displayOptions : {
show : {
resource : [
'observable' ,
] ,
operation : [
'search' ,
'count' ,
] ,
} ,
} ,
options : [
{
2022-06-20 07:54:01 -07:00
displayName : 'Data Type Names or IDs' ,
2020-12-02 02:24:25 -08:00
name : 'dataType' ,
type : 'multiOptions' ,
default : [ ] ,
2021-04-05 01:52:56 -07:00
typeOptions : {
loadOptionsMethod : 'loadObservableTypes' ,
} ,
2022-06-20 07:54:01 -07:00
description : 'Type of the observable. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2020-12-02 02:24:25 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Date Range' ,
2020-12-02 02:24:25 -08:00
type : 'fixedCollection' ,
name : 'range' ,
default : { } ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Add Date Range Inputs' ,
2020-12-02 02:24:25 -08:00
name : 'dateRange' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'From Date' ,
2020-12-02 02:24:25 -08:00
name : 'fromDate' ,
type : 'dateTime' ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'To Date' ,
2020-12-02 02:24:25 -08:00
name : 'toDate' ,
type : 'dateTime' ,
default : '' ,
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
default : '' ,
placeholder : 'exp,freetext' ,
} ,
{
displayName : 'IOC' ,
name : 'ioc' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether the observable is an IOC (Indicator of compromise)' ,
2020-12-02 02:24:25 -08:00
} ,
{
displayName : 'Keyword' ,
name : 'keyword' ,
type : 'string' ,
default : '' ,
placeholder : 'exp,freetext' ,
} ,
{
displayName : 'Message' ,
name : 'message' ,
type : 'string' ,
default : '' ,
description : 'Description of the observable in the context of the case' ,
} ,
{
displayName : 'Observable Tags' ,
name : 'tags' ,
type : 'string' ,
default : '' ,
placeholder : 'tag1,tag2' ,
} ,
{
displayName : 'Sighted' ,
name : 'sighted' ,
type : 'boolean' ,
default : false ,
} ,
{
name : 'Status' ,
displayName : 'Status' ,
type : 'options' ,
default : '' ,
options : [
{
name : 'Ok' ,
value : 'Ok' ,
} ,
{
name : 'Deleted' ,
value : 'Deleted' ,
} ,
] ,
2022-04-22 09:29:51 -07:00
description : 'Status of the observable. Default=Ok.' ,
2020-12-02 02:24:25 -08:00
} ,
{
displayName : 'TLP' ,
name : 'tlp' ,
type : 'options' ,
default : 2 ,
options : [
{
name : 'White' ,
value : TLP.white ,
} ,
{
name : 'Green' ,
value : TLP.green ,
} ,
{
name : 'Amber' ,
value : TLP.amber ,
} ,
{
name : 'Red' ,
value : TLP.red ,
} ,
] ,
2022-04-22 09:29:51 -07:00
description : 'Traffict Light Protocol (TLP). Default=Amber.' ,
2020-12-02 02:24:25 -08:00
} ,
{
displayName : 'Value' ,
name : 'data' ,
type : 'string' ,
default : '' ,
placeholder : 'example.com; 8.8.8.8' ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;