mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Fix lint issues, formatting and icons
This commit is contained in:
parent
ea9f61089b
commit
a38665e82c
|
@ -20,7 +20,7 @@ export class CortexApi implements ICredentialType {
|
|||
type: 'string' as NodePropertyTypes,
|
||||
description: 'The URL of the Cortex instance',
|
||||
default: '',
|
||||
placeholder:'https://localhost:9001'
|
||||
placeholder: 'https://localhost:9001',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -31,12 +31,12 @@ export class TheHiveApi implements ICredentialType {
|
|||
{
|
||||
name: 'Version 1',
|
||||
value: 'v1',
|
||||
description:'API version supported by TheHive 4'
|
||||
description: 'API version supported by TheHive 4',
|
||||
},
|
||||
{
|
||||
name: 'Version 0',
|
||||
value: '',
|
||||
description:'API version supported by TheHive 3'
|
||||
description: 'API version supported by TheHive 3',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -169,7 +169,7 @@ export const analyzerFields: INodeProperties[] =[
|
|||
}, {
|
||||
name: 'Red',
|
||||
value: TLP.red,
|
||||
}
|
||||
},
|
||||
],
|
||||
default: 2,
|
||||
description: 'The TLP of the analyzed observable',
|
||||
|
|
|
@ -7,14 +7,14 @@ export enum JobStatus {
|
|||
INPROGRESS = 'InProgress',
|
||||
SUCCESS = 'Success',
|
||||
FAILURE = 'Failure',
|
||||
DELETED = 'Deleted'
|
||||
DELETED = 'Deleted',
|
||||
}
|
||||
|
||||
export enum TLP {
|
||||
white,
|
||||
green,
|
||||
amber,
|
||||
red
|
||||
red,
|
||||
}
|
||||
|
||||
export enum ObservableDataType {
|
||||
|
@ -31,7 +31,7 @@ export enum ObservableDataType {
|
|||
'registry' = 'registry',
|
||||
'uri_path' = 'uri_path',
|
||||
'url' = 'url',
|
||||
'user-agent'= 'user-agent'
|
||||
'user-agent' = 'user-agent',
|
||||
}
|
||||
export interface IJob {
|
||||
id?: string;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
IExecuteFunctions,
|
||||
BINARY_ENCODING,
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
|
@ -11,23 +11,23 @@ import {
|
|||
} from './GenericFunctions';
|
||||
|
||||
import {
|
||||
analyzersOperations,
|
||||
analyzerFields,
|
||||
analyzersOperations,
|
||||
} from './AnalyzerDescriptions';
|
||||
|
||||
import {
|
||||
IBinaryData,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
INodePropertyOptions,
|
||||
ILoadOptionsFunctions,
|
||||
IDataObject,
|
||||
IBinaryData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
respondersOperations,
|
||||
responderFields,
|
||||
respondersOperations,
|
||||
} from './ResponderDescription';
|
||||
|
||||
import {
|
||||
|
@ -82,14 +82,14 @@ export class Cortex implements INodeType {
|
|||
name: 'Analyzer',
|
||||
value: 'analyzer',
|
||||
},
|
||||
{
|
||||
name: 'Responder',
|
||||
value:'responder',
|
||||
},
|
||||
{
|
||||
name: 'Job',
|
||||
value: 'job',
|
||||
},
|
||||
{
|
||||
name: 'Responder',
|
||||
value: 'responder',
|
||||
},
|
||||
],
|
||||
default: 'analyzer',
|
||||
description: 'Choose a resource',
|
||||
|
@ -100,7 +100,7 @@ export class Cortex implements INodeType {
|
|||
...respondersOperations,
|
||||
...responderFields,
|
||||
...jobOperations,
|
||||
...jobFields
|
||||
...jobFields,
|
||||
],
|
||||
};
|
||||
|
||||
|
@ -183,7 +183,7 @@ export class Cortex implements INodeType {
|
|||
returnData.push(
|
||||
{
|
||||
value: (dataType as string).split(':')[1],
|
||||
name: changeCase.capitalCase((dataType as string).split(':')[1])
|
||||
name: changeCase.capitalCase((dataType as string).split(':')[1]),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -249,13 +249,13 @@ export class Cortex implements INodeType {
|
|||
options: {
|
||||
contentType: item.binary[binaryPropertyName].mimeType,
|
||||
filename: item.binary[binaryPropertyName].fileName,
|
||||
}
|
||||
},
|
||||
},
|
||||
_json: JSON.stringify({
|
||||
dataType: observableType,
|
||||
tlp,
|
||||
})
|
||||
}
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
responseData = await cortexApiRequest.call(
|
||||
|
@ -332,8 +332,6 @@ export class Cortex implements INodeType {
|
|||
|
||||
|
||||
if (isJSON) {
|
||||
|
||||
|
||||
const entityJson = JSON.parse(this.getNodeParameter('objectData', i) as string);
|
||||
|
||||
body = {
|
||||
|
@ -356,8 +354,8 @@ export class Cortex implements INodeType {
|
|||
dataType: `thehive:${entityType}`,
|
||||
data: {
|
||||
_type: entityType,
|
||||
...prepareParameters(values)
|
||||
}
|
||||
...prepareParameters(values),
|
||||
},
|
||||
};
|
||||
if (entityType === 'alert') {
|
||||
// deal with alert artifacts
|
||||
|
@ -433,7 +431,7 @@ export class Cortex implements INodeType {
|
|||
hashes: [
|
||||
sha256,
|
||||
createHash('sha1').update(fileBufferData).digest('hex'),
|
||||
createHash('md5').update(fileBufferData).digest('hex')
|
||||
createHash('md5').update(fileBufferData).digest('hex'),
|
||||
],
|
||||
size: fileBufferData.byteLength,
|
||||
contentType: item.binary[binaryPropertyName].mimeType,
|
||||
|
@ -446,7 +444,7 @@ export class Cortex implements INodeType {
|
|||
// add the job label after getting all entity attributes
|
||||
body = {
|
||||
label: getEntityLabel(body.data as IDataObject),
|
||||
...body
|
||||
...body,
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import {
|
|||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
|
|
|
@ -12,7 +12,7 @@ export const respondersOperations = [
|
|||
name: 'operation',
|
||||
type: 'options',
|
||||
required: true,
|
||||
description: 'Choose an operation',
|
||||
description: 'Choose an operation.',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
|
@ -24,11 +24,11 @@ export const respondersOperations = [
|
|||
{
|
||||
name: 'Execute',
|
||||
value: 'execute',
|
||||
description: 'Execute Responder'
|
||||
}
|
||||
description: 'Execute Responder',
|
||||
},
|
||||
],
|
||||
default: 'execute'
|
||||
}
|
||||
default: 'execute',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const responderFields: INodeProperties[] = [
|
||||
|
@ -38,7 +38,7 @@ export const responderFields: INodeProperties[] = [
|
|||
type: 'options',
|
||||
required: true,
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'loadActiveResponders'
|
||||
loadOptionsMethod: 'loadActiveResponders',
|
||||
},
|
||||
default: '',
|
||||
displayOptions: {
|
||||
|
@ -48,7 +48,7 @@ export const responderFields: INodeProperties[] = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Choose the responder'
|
||||
description: 'Choose the responder.',
|
||||
},
|
||||
{
|
||||
displayName: 'Entity Type',
|
||||
|
@ -59,7 +59,7 @@ export const responderFields: INodeProperties[] = [
|
|||
show: {
|
||||
resource: [
|
||||
'responder',
|
||||
]
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
|
@ -69,14 +69,14 @@ export const responderFields: INodeProperties[] = [
|
|||
],
|
||||
},
|
||||
default: '',
|
||||
description: 'Choose the Data type',
|
||||
description: 'Choose the Data type.',
|
||||
},
|
||||
{
|
||||
displayName: 'JSON Parameters',
|
||||
name: 'jsonObject',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Choose between providing JSON object or seperated attributes',
|
||||
description: 'Choose between providing JSON object or seperated attributes.',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
|
@ -100,7 +100,7 @@ export const responderFields: INodeProperties[] = [
|
|||
],
|
||||
},
|
||||
},
|
||||
default: ''
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Parameters',
|
||||
|
@ -160,14 +160,14 @@ export const responderFields: INodeProperties[] = [
|
|||
name: 'owner',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `User who owns the case. This is automatically set to current user when status is set to InProgress`,
|
||||
description: `User who owns the case. This is automatically set to current user when status is set to InProgress.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Flag',
|
||||
name: 'flag',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Flag of the case default=false',
|
||||
description: 'Flag of the case default=false.',
|
||||
},
|
||||
{
|
||||
displayName: 'TLP',
|
||||
|
@ -231,7 +231,7 @@ export const responderFields: INodeProperties[] = [
|
|||
],
|
||||
},
|
||||
},
|
||||
default: {}
|
||||
default: {},
|
||||
},
|
||||
{
|
||||
displayName: 'Parameters',
|
||||
|
@ -266,11 +266,11 @@ export const responderFields: INodeProperties[] = [
|
|||
options: [
|
||||
{
|
||||
name: 'Low',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Medium',
|
||||
value: 2
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'High',
|
||||
|
@ -284,14 +284,14 @@ export const responderFields: INodeProperties[] = [
|
|||
name: 'date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'Date and time when the alert was raised default=now',
|
||||
description: 'Date and time when the alert was raised default=now.',
|
||||
},
|
||||
{
|
||||
displayName: 'Tags',
|
||||
name: 'tags',
|
||||
type: 'string',
|
||||
placeholder: 'tag1,tag2,...',
|
||||
default: ''
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'TLP',
|
||||
|
@ -333,28 +333,28 @@ export const responderFields: INodeProperties[] = [
|
|||
},
|
||||
{
|
||||
name: 'Ignored',
|
||||
value: 'Ignored'
|
||||
value: 'Ignored',
|
||||
},
|
||||
{
|
||||
name: 'Imported',
|
||||
value: 'Imported',
|
||||
},
|
||||
],
|
||||
description: 'Status of the alert. Default=New'
|
||||
description: 'Status of the alert. Default=New',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Type of the alert',
|
||||
description: 'Type of the alert.',
|
||||
},
|
||||
{
|
||||
displayName: 'Source',
|
||||
name: 'source',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Source of the alert',
|
||||
description: 'Source of the alert.',
|
||||
},
|
||||
{
|
||||
displayName: 'SourceRef',
|
||||
|
@ -367,7 +367,7 @@ export const responderFields: INodeProperties[] = [
|
|||
displayName: 'Follow',
|
||||
name: 'follow',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Artifacts',
|
||||
|
@ -397,55 +397,55 @@ export const responderFields: INodeProperties[] = [
|
|||
},
|
||||
{
|
||||
name: 'File',
|
||||
value: 'file'
|
||||
value: 'file',
|
||||
},
|
||||
{
|
||||
name: 'Filename',
|
||||
value: 'filename'
|
||||
value: 'filename',
|
||||
},
|
||||
{
|
||||
name: 'Fqdn',
|
||||
value: 'fqdn'
|
||||
value: 'fqdn',
|
||||
},
|
||||
{
|
||||
name: 'Hash',
|
||||
value: 'hash'
|
||||
value: 'hash',
|
||||
},
|
||||
{
|
||||
name: 'IP',
|
||||
value: 'ip'
|
||||
value: 'ip',
|
||||
},
|
||||
{
|
||||
name: 'Mail',
|
||||
value: 'mail'
|
||||
value: 'mail',
|
||||
},
|
||||
{
|
||||
name: 'Mail Subject',
|
||||
value: 'mail_subject'
|
||||
value: 'mail_subject',
|
||||
},
|
||||
{
|
||||
name: 'Other',
|
||||
value: 'other'
|
||||
value: 'other',
|
||||
},
|
||||
{
|
||||
name: 'Regexp',
|
||||
value: 'regexp'
|
||||
value: 'regexp',
|
||||
},
|
||||
{
|
||||
name: 'Registry',
|
||||
value: 'registry'
|
||||
value: 'registry',
|
||||
},
|
||||
{
|
||||
name: 'Uri Path',
|
||||
value: 'uri_path'
|
||||
value: 'uri_path',
|
||||
},
|
||||
{
|
||||
name: 'URL',
|
||||
value: 'url'
|
||||
value: 'url',
|
||||
},
|
||||
{
|
||||
name: 'User Agent',
|
||||
value: 'user-agent'
|
||||
value: 'user-agent',
|
||||
},
|
||||
],
|
||||
description: '',
|
||||
|
@ -493,11 +493,11 @@ export const responderFields: INodeProperties[] = [
|
|||
description: '',
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: [
|
||||
|
@ -554,55 +554,55 @@ export const responderFields: INodeProperties[] = [
|
|||
},
|
||||
{
|
||||
name: 'File',
|
||||
value: 'file'
|
||||
value: 'file',
|
||||
},
|
||||
{
|
||||
name: 'Filename',
|
||||
value: 'filename'
|
||||
value: 'filename',
|
||||
},
|
||||
{
|
||||
name: 'Fqdn',
|
||||
value: 'fqdn'
|
||||
value: 'fqdn',
|
||||
},
|
||||
{
|
||||
name: 'Hash',
|
||||
value: 'hash'
|
||||
value: 'hash',
|
||||
},
|
||||
{
|
||||
name: 'IP',
|
||||
value: 'ip'
|
||||
value: 'ip',
|
||||
},
|
||||
{
|
||||
name: 'Mail',
|
||||
value: 'mail'
|
||||
value: 'mail',
|
||||
},
|
||||
{
|
||||
name: 'Mail Subject',
|
||||
value: 'mail_subject'
|
||||
value: 'mail_subject',
|
||||
},
|
||||
{
|
||||
name: 'Other',
|
||||
value: 'other'
|
||||
value: 'other',
|
||||
},
|
||||
{
|
||||
name: 'Regexp',
|
||||
value: 'regexp'
|
||||
value: 'regexp',
|
||||
},
|
||||
{
|
||||
name: 'Registry',
|
||||
value: 'registry'
|
||||
value: 'registry',
|
||||
},
|
||||
{
|
||||
name: 'Uri Path',
|
||||
value: 'uri_path'
|
||||
value: 'uri_path',
|
||||
},
|
||||
{
|
||||
name: 'URL',
|
||||
value: 'url'
|
||||
value: 'url',
|
||||
},
|
||||
{
|
||||
name: 'User Agent',
|
||||
value: 'user-agent'
|
||||
value: 'user-agent',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -631,20 +631,20 @@ export const responderFields: INodeProperties[] = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Name of the binary property which contains the attachement data',
|
||||
description: 'Name of the binary property which contains the attachement data.',
|
||||
},
|
||||
{
|
||||
displayName: 'Message',
|
||||
name: 'message',
|
||||
type: 'string',
|
||||
default: ''
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Start Date',
|
||||
name: 'startDate',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'Date and time of the begin of the case default=now',
|
||||
description: 'Date and time of the begin of the case default=now.',
|
||||
},
|
||||
{
|
||||
displayName: 'TLP',
|
||||
|
@ -666,7 +666,7 @@ export const responderFields: INodeProperties[] = [
|
|||
}, {
|
||||
name: 'Red',
|
||||
value: TLP.red,
|
||||
}
|
||||
},
|
||||
],
|
||||
description: 'Traffict Light Protocol (TLP). Default=Amber',
|
||||
},
|
||||
|
@ -675,7 +675,7 @@ export const responderFields: INodeProperties[] = [
|
|||
name: 'ioc',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Indicates if the observable is an IOC (Indicator of compromise)',
|
||||
description: 'Indicates if the observable is an IOC (Indicator of compromise).',
|
||||
},
|
||||
{
|
||||
displayName: 'Status',
|
||||
|
@ -692,8 +692,8 @@ export const responderFields: INodeProperties[] = [
|
|||
value: 'Deleted',
|
||||
},
|
||||
],
|
||||
description: 'Status of the observable (Ok or Deleted) default=Ok',
|
||||
}
|
||||
description: 'Status of the observable (Ok or Deleted) default=Ok.',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -746,7 +746,7 @@ export const responderFields: INodeProperties[] = [
|
|||
type: 'string',
|
||||
required: false,
|
||||
default: '',
|
||||
description: 'Title of the task',
|
||||
description: 'Title of the task.',
|
||||
},
|
||||
{
|
||||
displayName: 'Status',
|
||||
|
@ -776,10 +776,10 @@ export const responderFields: INodeProperties[] = [
|
|||
displayName: 'Flag',
|
||||
name: 'flag',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
}
|
||||
]
|
||||
}
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: [
|
||||
|
@ -828,7 +828,7 @@ export const responderFields: INodeProperties[] = [
|
|||
displayName: 'Message',
|
||||
name: 'message',
|
||||
type: 'string',
|
||||
default: ''
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Start Date',
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 837 B |
|
@ -116,8 +116,8 @@ export function prepareRangeQuery(range: string, body: { 'query': Array<{}> }) {
|
|||
{
|
||||
'_name': 'page',
|
||||
'from': parseInt(range.split('-')[0], 10),
|
||||
'to': parseInt(range.split('-')[1], 10)
|
||||
}
|
||||
'to': parseInt(range.split('-')[1], 10),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,19 +5,19 @@ export type IQueryObject = {
|
|||
};
|
||||
|
||||
// Query Functions
|
||||
export function Eq(field: string, value: any):IQueryObject{
|
||||
export function Eq(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_field': field, '_value': value };
|
||||
}
|
||||
export function Gt(field: string, value: any):IQueryObject{
|
||||
export function Gt(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_gt': { field: value } };
|
||||
}
|
||||
export function Gte(field: string, value: any):IQueryObject{
|
||||
export function Gte(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_gte': { field: value } };
|
||||
}
|
||||
export function Lt(field: string, value: any):IQueryObject{
|
||||
export function Lt(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_lt': { field: value } };
|
||||
}
|
||||
export function Lte(field: string, value: any):IQueryObject{
|
||||
export function Lte(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_lte': { field: value } };
|
||||
}
|
||||
export function And(...criteria: IQueryObject[]): IQueryObject {
|
||||
|
@ -29,7 +29,7 @@ export function Or(...criteria: IQueryObject[]): IQueryObject{
|
|||
export function Not(criteria: IQueryObject[]): IQueryObject {
|
||||
return { '_not': criteria };
|
||||
}
|
||||
export function In(field: string, values: any[]): IQueryObject{
|
||||
export function In(field: string, values: any[]): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_in': { '_field': field, '_values': values } };
|
||||
}
|
||||
export function Contains(field: string): IQueryObject {
|
||||
|
@ -38,8 +38,8 @@ export function Contains(field: string): IQueryObject{
|
|||
export function Id(id: string | number): IQueryObject {
|
||||
return { '_id': id };
|
||||
}
|
||||
export function Between(field:string, from_value: any, to_value: any): IQueryObject{
|
||||
return {'_between': {'_field': field, '_from': from_value, '_to': to_value } };
|
||||
export function Between(field: string, fromValue: any, toValue: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_between': { '_field': field, '_from': fromValue, '_to': toValue } };
|
||||
}
|
||||
export function ParentId(tpe: string, id: string): IQueryObject {
|
||||
return { '_parent': { '_type': tpe, '_id': id } };
|
||||
|
@ -53,8 +53,8 @@ export function Child(tpe:string, criterion:IQueryObject):IQueryObject{
|
|||
export function Type(tpe: string): IQueryObject {
|
||||
return { '_type': tpe };
|
||||
}
|
||||
export function queryString(query_string:string):IQueryObject{
|
||||
return { '_string': query_string };
|
||||
export function queryString(queryString: string): IQueryObject {
|
||||
return { '_string': queryString };
|
||||
}
|
||||
export function Like(field: string, value: string): IQueryObject {
|
||||
return { '_like': { '_field': field, '_value': value } };
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
import {
|
||||
IExecuteFunctions,
|
||||
BINARY_ENCODING
|
||||
BINARY_ENCODING,
|
||||
IExecuteFunctions
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IBinaryData,
|
||||
IDataObject,
|
||||
INodeParameters,
|
||||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
INodeParameters,
|
||||
INodePropertyOptions,
|
||||
IBinaryData
|
||||
INodeType,
|
||||
INodeTypeDescription
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
alertOperations,
|
||||
alertFields,
|
||||
alertOperations,
|
||||
} from './descriptions/AlertDescription';
|
||||
|
||||
import {
|
||||
observableOperations,
|
||||
observableFields,
|
||||
observableOperations,
|
||||
} from './descriptions/ObservableDescription';
|
||||
|
||||
import {
|
||||
caseOperations,
|
||||
caseFields,
|
||||
caseOperations,
|
||||
} from './descriptions/CaseDescription';
|
||||
|
||||
import {
|
||||
taskOperations,
|
||||
taskFields,
|
||||
taskOperations,
|
||||
} from './descriptions/TaskDescription';
|
||||
|
||||
import {
|
||||
logOperations,
|
||||
logFields,
|
||||
logOperations,
|
||||
} from './descriptions/LogDescription';
|
||||
|
||||
import {
|
||||
|
@ -44,23 +44,23 @@ import {
|
|||
} from 'buffer';
|
||||
|
||||
import {
|
||||
IQueryObject,
|
||||
Parent,
|
||||
Id,
|
||||
Eq,
|
||||
And,
|
||||
Between,
|
||||
In,
|
||||
ContainsString,
|
||||
Eq,
|
||||
Id,
|
||||
In,
|
||||
IQueryObject,
|
||||
Parent,
|
||||
} from './QueryFunctions';
|
||||
|
||||
import {
|
||||
theHiveApiRequest,
|
||||
mapResource,
|
||||
splitTags,
|
||||
prepareOptional,
|
||||
prepareSortQuery,
|
||||
prepareRangeQuery,
|
||||
prepareSortQuery,
|
||||
splitTags,
|
||||
theHiveApiRequest,
|
||||
} from './GenericFunctions';
|
||||
|
||||
export class TheHive implements INodeType {
|
||||
|
@ -164,7 +164,7 @@ export class TheHive implements INodeType {
|
|||
const requestResult = await theHiveApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
endpoint as string
|
||||
endpoint as string,
|
||||
);
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
|
||||
|
@ -233,8 +233,8 @@ export class TheHive implements INodeType {
|
|||
{ name: 'Update', value: 'update', description: 'Update a case' },
|
||||
];
|
||||
return options;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
|
@ -249,22 +249,22 @@ export class TheHive implements INodeType {
|
|||
for (let i = 0; i < length; i++) {
|
||||
if (resource === 'alert') {
|
||||
if (operation === 'count') {
|
||||
const countQueryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters);
|
||||
const countQueryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters); // tslint:disable-line:no-any
|
||||
|
||||
const _countSearchQuery: IQueryObject = And();
|
||||
|
||||
for (const key of Object.keys(countQueryAttributs)) {
|
||||
if (key === 'tags') {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
In(key, countQueryAttributs[key] as string[])
|
||||
In(key, countQueryAttributs[key] as string[]),
|
||||
);
|
||||
} else if (key === 'description' || key === 'title') {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
ContainsString(key, countQueryAttributs[key] as string)
|
||||
ContainsString(key, countQueryAttributs[key] as string),
|
||||
);
|
||||
} else {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
Eq(key, countQueryAttributs[key] as string)
|
||||
Eq(key, countQueryAttributs[key] as string),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -276,20 +276,19 @@ export class TheHive implements INodeType {
|
|||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': _countSearchQuery['_and']
|
||||
'_and': _countSearchQuery['_and'],
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
body['query'].push(
|
||||
{
|
||||
'_name': 'count',
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
qs.name = 'count-Alert';
|
||||
|
||||
|
||||
responseData = await theHiveApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
|
@ -299,7 +298,6 @@ export class TheHive implements INodeType {
|
|||
);
|
||||
|
||||
responseData = { count: responseData };
|
||||
|
||||
}
|
||||
|
||||
if (operation === 'create') {
|
||||
|
@ -315,7 +313,7 @@ export class TheHive implements INodeType {
|
|||
source: this.getNodeParameter('source', i),
|
||||
sourceRef: this.getNodeParameter('sourceRef', i),
|
||||
follow: this.getNodeParameter('follow', i, true),
|
||||
...prepareOptional(this.getNodeParameter('optionals', i, {}) as INodeParameters)
|
||||
...prepareOptional(this.getNodeParameter('optionals', i, {}) as INodeParameters),
|
||||
};
|
||||
|
||||
const artifactUi = this.getNodeParameter('artifactUi', i) as IDataObject;
|
||||
|
@ -387,7 +385,7 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
responderId,
|
||||
objectId: alertId,
|
||||
objectType: 'alert'
|
||||
objectType: 'alert',
|
||||
};
|
||||
response = await theHiveApiRequest.call(
|
||||
this,
|
||||
|
@ -398,26 +396,26 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
query: [
|
||||
{
|
||||
'_name': 'listAction'
|
||||
'_name': 'listAction',
|
||||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': [
|
||||
{
|
||||
'_field': 'cortexId',
|
||||
'_value': response.cortexId
|
||||
'_value': response.cortexId,
|
||||
},
|
||||
{
|
||||
'_field': 'objectId',
|
||||
'_value': response.objectId
|
||||
'_value': response.objectId,
|
||||
},
|
||||
{
|
||||
'_field': 'startDate',
|
||||
'_value': response.startDate
|
||||
}
|
||||
'_value': response.startDate,
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
qs.name = 'log-actions';
|
||||
|
@ -427,7 +425,7 @@ export class TheHive implements INodeType {
|
|||
'POST',
|
||||
`/v1/query`,
|
||||
body,
|
||||
qs
|
||||
qs,
|
||||
);
|
||||
} while (response.status === 'Waiting' || response.status === 'InProgress');
|
||||
|
||||
|
@ -452,7 +450,7 @@ export class TheHive implements INodeType {
|
|||
|
||||
const version = credentials.apiVersion;
|
||||
|
||||
const queryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters);
|
||||
const queryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters); // tslint:disable-line:no-any
|
||||
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
|
||||
|
@ -461,15 +459,15 @@ export class TheHive implements INodeType {
|
|||
for (const key of Object.keys(queryAttributs)) {
|
||||
if (key === 'tags') {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
In(key, queryAttributs[key] as string[])
|
||||
In(key, queryAttributs[key] as string[]),
|
||||
);
|
||||
} else if (key === 'description' || key === 'title') {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
ContainsString(key, queryAttributs[key] as string)
|
||||
ContainsString(key, queryAttributs[key] as string),
|
||||
);
|
||||
} else {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
Eq(key, queryAttributs[key] as string)
|
||||
Eq(key, queryAttributs[key] as string),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +496,7 @@ export class TheHive implements INodeType {
|
|||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': _searchQuery['_and']
|
||||
'_and': _searchQuery['_and'],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@ -633,30 +631,30 @@ export class TheHive implements INodeType {
|
|||
|
||||
if (resource === 'observable') {
|
||||
if (operation === 'count') {
|
||||
const countQueryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters);
|
||||
const countQueryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters); // tslint:disable-line:no-any
|
||||
|
||||
const _countSearchQuery: IQueryObject = And();
|
||||
|
||||
for (const key of Object.keys(countQueryAttributs)) {
|
||||
if (key === 'dataType' || key === 'tags') {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
In(key, countQueryAttributs[key] as string[])
|
||||
In(key, countQueryAttributs[key] as string[]),
|
||||
);
|
||||
} else if (key === 'description' || key === 'keywork' || key === 'message') {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
ContainsString(key, countQueryAttributs[key] as string)
|
||||
ContainsString(key, countQueryAttributs[key] as string),
|
||||
);
|
||||
} else if (key === 'range') {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
Between(
|
||||
'startDate',
|
||||
countQueryAttributs['range']['dateRange']['fromDate'],
|
||||
countQueryAttributs['range']['dateRange']['toDate']
|
||||
)
|
||||
countQueryAttributs['range']['dateRange']['toDate'],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
Eq(key, countQueryAttributs[key] as string)
|
||||
Eq(key, countQueryAttributs[key] as string),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -664,19 +662,19 @@ export class TheHive implements INodeType {
|
|||
const body = {
|
||||
'query': [
|
||||
{
|
||||
'_name': 'listObservable'
|
||||
'_name': 'listObservable',
|
||||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': _countSearchQuery['_and']
|
||||
'_and': _countSearchQuery['_and'],
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
body['query'].push(
|
||||
{
|
||||
'_name': 'count'
|
||||
}
|
||||
'_name': 'count',
|
||||
},
|
||||
);
|
||||
|
||||
qs.name = 'count-observables';
|
||||
|
@ -699,10 +697,10 @@ export class TheHive implements INodeType {
|
|||
const parts = analyzer.split('::');
|
||||
return {
|
||||
analyzerId: parts[0],
|
||||
cortexId: parts[1]
|
||||
cortexId: parts[1],
|
||||
};
|
||||
});
|
||||
let response: any;
|
||||
let response: any; // tslint:disable-line:no-any
|
||||
let body: IDataObject;
|
||||
responseData = [];
|
||||
for (const analyzer of analyzers) {
|
||||
|
@ -716,7 +714,7 @@ export class TheHive implements INodeType {
|
|||
'POST',
|
||||
'/connector/cortex/job' as string,
|
||||
body,
|
||||
qs
|
||||
qs,
|
||||
);
|
||||
const jobId = response.id;
|
||||
qs.name = 'observable-jobs';
|
||||
|
@ -737,7 +735,7 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
responderId,
|
||||
objectId: observableId,
|
||||
objectType: 'case_artifact'
|
||||
objectType: 'case_artifact',
|
||||
};
|
||||
response = await theHiveApiRequest.call(
|
||||
this,
|
||||
|
@ -748,27 +746,27 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
query: [
|
||||
{
|
||||
'_name': 'listAction'
|
||||
'_name': 'listAction',
|
||||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': [
|
||||
{
|
||||
'_field': 'cortexId',
|
||||
'_value': response.cortexId
|
||||
'_value': response.cortexId,
|
||||
},
|
||||
{
|
||||
'_field': 'objectId',
|
||||
'_value': response.objectId
|
||||
'_value': response.objectId,
|
||||
},
|
||||
{
|
||||
'_field': 'startDate',
|
||||
'_value': response.startDate
|
||||
}
|
||||
'_value': response.startDate,
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
qs.name = 'log-actions';
|
||||
do {
|
||||
|
@ -777,7 +775,7 @@ export class TheHive implements INodeType {
|
|||
'POST',
|
||||
`/v1/query`,
|
||||
body,
|
||||
qs
|
||||
qs,
|
||||
);
|
||||
} while (response.status === 'Waiting' || response.status === 'InProgress');
|
||||
|
||||
|
@ -795,7 +793,7 @@ export class TheHive implements INodeType {
|
|||
ioc: this.getNodeParameter('ioc', i) as boolean,
|
||||
sighted: this.getNodeParameter('sighted', i) as boolean,
|
||||
status: this.getNodeParameter('status', i) as string,
|
||||
...prepareOptional(this.getNodeParameter('options', i, {}) as INodeParameters)
|
||||
...prepareOptional(this.getNodeParameter('options', i, {}) as INodeParameters),
|
||||
};
|
||||
|
||||
let options: IDataObject = {};
|
||||
|
@ -822,10 +820,10 @@ export class TheHive implements INodeType {
|
|||
options: {
|
||||
contentType: binaryData.mimeType,
|
||||
filename: binaryData.fileName,
|
||||
}
|
||||
},
|
||||
_json: JSON.stringify(body)
|
||||
}
|
||||
},
|
||||
_json: JSON.stringify(body),
|
||||
},
|
||||
};
|
||||
body = {};
|
||||
} else {
|
||||
|
@ -839,7 +837,7 @@ export class TheHive implements INodeType {
|
|||
body,
|
||||
qs,
|
||||
'',
|
||||
options
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -866,9 +864,9 @@ export class TheHive implements INodeType {
|
|||
'query': [
|
||||
{
|
||||
'_name': 'getObservable',
|
||||
'idOrName': observableId
|
||||
}
|
||||
]
|
||||
'idOrName': observableId,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
qs.name = `get-observable-${observableId}`;
|
||||
|
@ -914,8 +912,6 @@ export class TheHive implements INodeType {
|
|||
}
|
||||
|
||||
if (version === 'v1') {
|
||||
|
||||
|
||||
endpoint = '/v1/query';
|
||||
|
||||
method = 'POST';
|
||||
|
@ -924,12 +920,12 @@ export class TheHive implements INodeType {
|
|||
'query': [
|
||||
{
|
||||
'_name': 'getCase',
|
||||
'idOrName': caseId
|
||||
'idOrName': caseId,
|
||||
},
|
||||
{
|
||||
'_name': 'observables'
|
||||
'_name': 'observables',
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
//@ts-ignore
|
||||
|
@ -943,7 +939,6 @@ export class TheHive implements INodeType {
|
|||
qs.name = 'observables';
|
||||
|
||||
} else {
|
||||
|
||||
method = 'POST';
|
||||
|
||||
endpoint = '/case/artifact/_search';
|
||||
|
@ -973,7 +968,7 @@ export class TheHive implements INodeType {
|
|||
|
||||
const version = credentials.apiVersion;
|
||||
|
||||
const queryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters);
|
||||
const queryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters); // tslint:disable-line:no-any
|
||||
|
||||
const _searchQuery: IQueryObject = And();
|
||||
|
||||
|
@ -982,23 +977,23 @@ export class TheHive implements INodeType {
|
|||
for (const key of Object.keys(queryAttributs)) {
|
||||
if (key === 'dataType' || key === 'tags') {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
In(key, queryAttributs[key] as string[])
|
||||
In(key, queryAttributs[key] as string[]),
|
||||
);
|
||||
} else if (key === 'description' || key === 'keywork' || key === 'message') {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
ContainsString(key, queryAttributs[key] as string)
|
||||
ContainsString(key, queryAttributs[key] as string),
|
||||
);
|
||||
} else if (key === 'range') {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
Between(
|
||||
'startDate',
|
||||
queryAttributs['range']['dateRange']['fromDate'],
|
||||
queryAttributs['range']['dateRange']['toDate']
|
||||
)
|
||||
queryAttributs['range']['dateRange']['toDate'],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
Eq(key, queryAttributs[key] as string)
|
||||
Eq(key, queryAttributs[key] as string),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1016,7 +1011,6 @@ export class TheHive implements INodeType {
|
|||
}
|
||||
|
||||
if (version === 'v1') {
|
||||
|
||||
endpoint = '/v1/query';
|
||||
|
||||
method = 'POST';
|
||||
|
@ -1024,13 +1018,13 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
'query': [
|
||||
{
|
||||
'_name': 'listObservable'
|
||||
'_name': 'listObservable',
|
||||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': _searchQuery['_and']
|
||||
'_and': _searchQuery['_and'],
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
//@ts-ignore
|
||||
|
@ -1044,7 +1038,6 @@ export class TheHive implements INodeType {
|
|||
qs.name = 'observables';
|
||||
|
||||
} else {
|
||||
|
||||
method = 'POST';
|
||||
|
||||
endpoint = '/case/artifact/_search';
|
||||
|
@ -1072,7 +1065,7 @@ export class TheHive implements INodeType {
|
|||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const body: IDataObject = {
|
||||
...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters)
|
||||
...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters),
|
||||
};
|
||||
|
||||
responseData = await theHiveApiRequest.call(
|
||||
|
@ -1089,22 +1082,22 @@ export class TheHive implements INodeType {
|
|||
|
||||
if (resource === 'case') {
|
||||
if (operation === 'count') {
|
||||
const countQueryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters);
|
||||
const countQueryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters); // tslint:disable-line:no-any
|
||||
|
||||
const _countSearchQuery: IQueryObject = And();
|
||||
|
||||
for (const key of Object.keys(countQueryAttributs)) {
|
||||
if (key === 'tags') {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
In(key, countQueryAttributs[key] as string[])
|
||||
In(key, countQueryAttributs[key] as string[]),
|
||||
);
|
||||
} else if (key === 'description' || key === 'summary' || key === 'title') {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
ContainsString(key, countQueryAttributs[key] as string)
|
||||
ContainsString(key, countQueryAttributs[key] as string),
|
||||
);
|
||||
} else {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
Eq(key, countQueryAttributs[key] as string)
|
||||
Eq(key, countQueryAttributs[key] as string),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1116,15 +1109,15 @@ export class TheHive implements INodeType {
|
|||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': _countSearchQuery['_and']
|
||||
'_and': _countSearchQuery['_and'],
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
body['query'].push(
|
||||
{
|
||||
'_name': 'count',
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
qs.name = 'count-cases';
|
||||
|
@ -1150,7 +1143,7 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
responderId,
|
||||
objectId: caseId,
|
||||
objectType: 'case'
|
||||
objectType: 'case',
|
||||
};
|
||||
response = await theHiveApiRequest.call(
|
||||
this,
|
||||
|
@ -1161,27 +1154,27 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
query: [
|
||||
{
|
||||
'_name': 'listAction'
|
||||
'_name': 'listAction',
|
||||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': [
|
||||
{
|
||||
'_field': 'cortexId',
|
||||
'_value': response.cortexId
|
||||
'_value': response.cortexId,
|
||||
},
|
||||
{
|
||||
'_field': 'objectId',
|
||||
'_value': response.objectId
|
||||
'_value': response.objectId,
|
||||
},
|
||||
{
|
||||
'_field': 'startDate',
|
||||
'_value': response.startDate
|
||||
}
|
||||
'_value': response.startDate,
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
qs.name = 'log-actions';
|
||||
do {
|
||||
|
@ -1190,7 +1183,7 @@ export class TheHive implements INodeType {
|
|||
'POST',
|
||||
`/v1/query`,
|
||||
body,
|
||||
qs
|
||||
qs,
|
||||
);
|
||||
} while (response.status === 'Waiting' || response.status === 'InProgress');
|
||||
|
||||
|
@ -1208,7 +1201,7 @@ export class TheHive implements INodeType {
|
|||
flag: this.getNodeParameter('flag', i),
|
||||
tlp: this.getNodeParameter('tlp', i),
|
||||
tags: splitTags(this.getNodeParameter('tags', i) as string),
|
||||
...prepareOptional(this.getNodeParameter('options', i, {}) as INodeParameters)
|
||||
...prepareOptional(this.getNodeParameter('options', i, {}) as INodeParameters),
|
||||
};
|
||||
|
||||
responseData = await theHiveApiRequest.call(
|
||||
|
@ -1242,9 +1235,9 @@ export class TheHive implements INodeType {
|
|||
'query': [
|
||||
{
|
||||
'_name': 'getCase',
|
||||
'idOrName': caseId
|
||||
}
|
||||
]
|
||||
'idOrName': caseId,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
qs.name = `get-case-${caseId}`;
|
||||
|
@ -1273,7 +1266,7 @@ export class TheHive implements INodeType {
|
|||
|
||||
const version = credentials.apiVersion;
|
||||
|
||||
const queryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters);
|
||||
const queryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters); // tslint:disable-line:no-any
|
||||
|
||||
const _searchQuery: IQueryObject = And();
|
||||
|
||||
|
@ -1282,15 +1275,15 @@ export class TheHive implements INodeType {
|
|||
for (const key of Object.keys(queryAttributs)) {
|
||||
if (key === 'tags') {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
In(key, queryAttributs[key] as string[])
|
||||
In(key, queryAttributs[key] as string[]),
|
||||
);
|
||||
} else if (key === 'description' || key === 'summary' || key === 'title') {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
ContainsString(key, queryAttributs[key] as string)
|
||||
ContainsString(key, queryAttributs[key] as string),
|
||||
);
|
||||
} else {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
Eq(key, queryAttributs[key] as string)
|
||||
Eq(key, queryAttributs[key] as string),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1315,13 +1308,13 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
'query': [
|
||||
{
|
||||
'_name': 'listCase'
|
||||
'_name': 'listCase',
|
||||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': _searchQuery['_and']
|
||||
'_and': _searchQuery['_and'],
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
//@ts-ignore
|
||||
|
@ -1361,7 +1354,7 @@ export class TheHive implements INodeType {
|
|||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const body: IDataObject = {
|
||||
...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters)
|
||||
...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters),
|
||||
};
|
||||
|
||||
responseData = await theHiveApiRequest.call(
|
||||
|
@ -1375,18 +1368,18 @@ export class TheHive implements INodeType {
|
|||
|
||||
if (resource === 'task') {
|
||||
if (operation === 'count') {
|
||||
const countQueryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters);
|
||||
const countQueryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters); // tslint:disable-line:no-any
|
||||
|
||||
const _countSearchQuery: IQueryObject = And();
|
||||
|
||||
for (const key of Object.keys(countQueryAttributs)) {
|
||||
if (key === 'title' || key === 'description') {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
ContainsString(key, countQueryAttributs[key] as string)
|
||||
ContainsString(key, countQueryAttributs[key] as string),
|
||||
);
|
||||
} else {
|
||||
(_countSearchQuery['_and'] as IQueryObject[]).push(
|
||||
Eq(key, countQueryAttributs[key] as string)
|
||||
Eq(key, countQueryAttributs[key] as string),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1394,19 +1387,19 @@ export class TheHive implements INodeType {
|
|||
const body = {
|
||||
'query': [
|
||||
{
|
||||
'_name': 'listTask'
|
||||
'_name': 'listTask',
|
||||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': _countSearchQuery['_and']
|
||||
'_and': _countSearchQuery['_and'],
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
body['query'].push(
|
||||
{
|
||||
'_name': 'count',
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
qs.name = 'count-tasks';
|
||||
|
@ -1429,7 +1422,7 @@ export class TheHive implements INodeType {
|
|||
title: this.getNodeParameter('title', i) as string,
|
||||
status: this.getNodeParameter('status', i) as string,
|
||||
flag: this.getNodeParameter('flag', i),
|
||||
...prepareOptional(this.getNodeParameter('options', i, {}) as INodeParameters)
|
||||
...prepareOptional(this.getNodeParameter('options', i, {}) as INodeParameters),
|
||||
};
|
||||
|
||||
responseData = await theHiveApiRequest.call(
|
||||
|
@ -1449,7 +1442,7 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
responderId,
|
||||
objectId: taskId,
|
||||
objectType: 'case_task'
|
||||
objectType: 'case_task',
|
||||
};
|
||||
response = await theHiveApiRequest.call(
|
||||
this,
|
||||
|
@ -1460,26 +1453,26 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
query: [
|
||||
{
|
||||
'_name': 'listAction'
|
||||
'_name': 'listAction',
|
||||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': [
|
||||
{
|
||||
'_field': 'cortexId',
|
||||
'_value': response.cortexId
|
||||
'_value': response.cortexId,
|
||||
},
|
||||
{
|
||||
'_field': 'objectId',
|
||||
'_value': response.objectId
|
||||
'_value': response.objectId,
|
||||
},
|
||||
{
|
||||
'_field': 'startDate',
|
||||
'_value': response.startDate
|
||||
}
|
||||
'_value': response.startDate,
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
qs.name = 'task-actions';
|
||||
|
@ -1489,7 +1482,7 @@ export class TheHive implements INodeType {
|
|||
'POST',
|
||||
`/v1/query`,
|
||||
body,
|
||||
qs
|
||||
qs,
|
||||
);
|
||||
} while (response.status === 'Waiting' || response.status === 'InProgress');
|
||||
|
||||
|
@ -1518,9 +1511,9 @@ export class TheHive implements INodeType {
|
|||
'query': [
|
||||
{
|
||||
'_name': 'getTask',
|
||||
'idOrName': taskId
|
||||
}
|
||||
]
|
||||
'idOrName': taskId,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
qs.name = `get-task-${taskId}`;
|
||||
|
@ -1574,12 +1567,12 @@ export class TheHive implements INodeType {
|
|||
'query': [
|
||||
{
|
||||
'_name': 'getCase',
|
||||
'idOrName': caseId
|
||||
'idOrName': caseId,
|
||||
},
|
||||
{
|
||||
'_name': 'tasks'
|
||||
'_name': 'tasks',
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
//@ts-ignore
|
||||
|
@ -1624,7 +1617,7 @@ export class TheHive implements INodeType {
|
|||
|
||||
const version = credentials.apiVersion;
|
||||
|
||||
const queryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters);
|
||||
const queryAttributs: any = prepareOptional(this.getNodeParameter('filters', i, {}) as INodeParameters); // tslint:disable-line:no-any
|
||||
|
||||
const _searchQuery: IQueryObject = And();
|
||||
|
||||
|
@ -1633,11 +1626,11 @@ export class TheHive implements INodeType {
|
|||
for (const key of Object.keys(queryAttributs)) {
|
||||
if (key === 'title' || key === 'description') {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
ContainsString(key, queryAttributs[key] as string)
|
||||
ContainsString(key, queryAttributs[key] as string),
|
||||
);
|
||||
} else {
|
||||
(_searchQuery['_and'] as IQueryObject[]).push(
|
||||
Eq(key, queryAttributs[key] as string)
|
||||
Eq(key, queryAttributs[key] as string),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1662,13 +1655,13 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
'query': [
|
||||
{
|
||||
'_name': 'listTask'
|
||||
'_name': 'listTask',
|
||||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': _searchQuery['_and']
|
||||
'_and': _searchQuery['_and'],
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
//@ts-ignore
|
||||
|
@ -1709,7 +1702,7 @@ export class TheHive implements INodeType {
|
|||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const body: IDataObject = {
|
||||
...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters)
|
||||
...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters),
|
||||
};
|
||||
|
||||
responseData = await theHiveApiRequest.call(
|
||||
|
@ -1718,9 +1711,7 @@ export class TheHive implements INodeType {
|
|||
`/case/task/${id}` as string,
|
||||
body,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (resource === 'log') {
|
||||
|
@ -1762,10 +1753,10 @@ export class TheHive implements INodeType {
|
|||
options: {
|
||||
contentType: binaryData.mimeType,
|
||||
filename: binaryData.fileName,
|
||||
}
|
||||
},
|
||||
_json: JSON.stringify(body)
|
||||
}
|
||||
},
|
||||
_json: JSON.stringify(body),
|
||||
},
|
||||
};
|
||||
|
||||
body = {};
|
||||
|
@ -1779,7 +1770,7 @@ export class TheHive implements INodeType {
|
|||
body,
|
||||
qs,
|
||||
'',
|
||||
options
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1792,7 +1783,7 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
responderId,
|
||||
objectId: logId,
|
||||
objectType: 'case_task_log'
|
||||
objectType: 'case_task_log',
|
||||
};
|
||||
response = await theHiveApiRequest.call(
|
||||
this,
|
||||
|
@ -1803,27 +1794,27 @@ export class TheHive implements INodeType {
|
|||
body = {
|
||||
query: [
|
||||
{
|
||||
'_name': 'listAction'
|
||||
'_name': 'listAction',
|
||||
},
|
||||
{
|
||||
'_name': 'filter',
|
||||
'_and': [
|
||||
{
|
||||
'_field': 'cortexId',
|
||||
'_value': response.cortexId
|
||||
'_value': response.cortexId,
|
||||
},
|
||||
{
|
||||
'_field': 'objectId',
|
||||
'_value': response.objectId
|
||||
'_value': response.objectId,
|
||||
},
|
||||
{
|
||||
'_field': 'startDate',
|
||||
'_value': response.startDate
|
||||
}
|
||||
'_value': response.startDate,
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
qs.name = 'log-actions';
|
||||
do {
|
||||
|
@ -1832,7 +1823,7 @@ export class TheHive implements INodeType {
|
|||
'POST',
|
||||
`/v1/query`,
|
||||
body,
|
||||
qs
|
||||
qs,
|
||||
);
|
||||
} while (response.status === 'Waiting' || response.status === 'InProgress');
|
||||
|
||||
|
@ -1862,21 +1853,18 @@ export class TheHive implements INodeType {
|
|||
query: [
|
||||
{
|
||||
_name: 'getLog',
|
||||
idOrName: logId
|
||||
}
|
||||
]
|
||||
idOrName: logId,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
qs.name = `get-log-${logId}`;
|
||||
|
||||
} else {
|
||||
|
||||
method = 'POST';
|
||||
|
||||
endpoint = '/case/task/log/_search';
|
||||
|
||||
body.query = { _id: logId };
|
||||
|
||||
}
|
||||
|
||||
responseData = await theHiveApiRequest.call(
|
||||
|
@ -1889,7 +1877,6 @@ export class TheHive implements INodeType {
|
|||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
|
||||
const credentials = this.getCredentials('theHiveApi') as IDataObject;
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
@ -1919,12 +1906,12 @@ export class TheHive implements INodeType {
|
|||
'query': [
|
||||
{
|
||||
'_name': 'getTask',
|
||||
'idOrName': taskId
|
||||
'idOrName': taskId,
|
||||
},
|
||||
{
|
||||
'_name': 'logs'
|
||||
'_name': 'logs',
|
||||
},
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
if (limit !== undefined) {
|
||||
|
@ -1945,7 +1932,7 @@ export class TheHive implements INodeType {
|
|||
|
||||
body.query = And(Parent(
|
||||
'task',
|
||||
Id(taskId)
|
||||
Id(taskId),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ import {
|
|||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeTypeDescription,
|
||||
INodeType,
|
||||
IWebhookResponseData,
|
||||
IHookFunctions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IWebhookResponseData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export class TheHiveTrigger implements INodeType {
|
||||
|
@ -111,9 +111,9 @@ export class TheHiveTrigger implements INodeType {
|
|||
value: 'case_task_log_create',
|
||||
description: 'Triggered when a task log is created',
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
// @ts-ignore (because of request)
|
||||
webhookMethods = {
|
||||
|
@ -158,7 +158,7 @@ export class TheHiveTrigger implements INodeType {
|
|||
|
||||
return {
|
||||
workflowData: [
|
||||
this.helpers.returnJsonArray(returnData)
|
||||
this.helpers.returnJsonArray(returnData),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ export const alertFields = [
|
|||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'alert'
|
||||
'alert',
|
||||
],
|
||||
operation: [
|
||||
'promote',
|
||||
|
@ -89,7 +89,7 @@ export const alertFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Title of the alert'
|
||||
description: 'Title of the alert',
|
||||
},
|
||||
{
|
||||
displayName: 'Case ID',
|
||||
|
@ -151,11 +151,11 @@ export const alertFields = [
|
|||
options: [
|
||||
{
|
||||
name: 'Low',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Medium',
|
||||
value: 2
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'High',
|
||||
|
@ -192,7 +192,7 @@ export const alertFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Date and time when the alert was raised default=now'
|
||||
description: 'Date and time when the alert was raised default=now',
|
||||
},
|
||||
{
|
||||
displayName: 'Tags',
|
||||
|
@ -211,7 +211,7 @@ export const alertFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Case Tags'
|
||||
description: 'Case Tags',
|
||||
},
|
||||
{
|
||||
displayName: 'TLP',
|
||||
|
@ -234,7 +234,7 @@ export const alertFields = [
|
|||
}, {
|
||||
name: 'Red',
|
||||
value: TLP.red,
|
||||
}
|
||||
},
|
||||
],
|
||||
displayOptions: {
|
||||
show: {
|
||||
|
@ -246,7 +246,7 @@ export const alertFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Traffict Light Protocol (TLP). Default=Amber'
|
||||
description: 'Traffict Light Protocol (TLP). Default=Amber',
|
||||
},
|
||||
{
|
||||
displayName: 'Status',
|
||||
|
@ -264,7 +264,7 @@ export const alertFields = [
|
|||
},
|
||||
{
|
||||
name: 'Ignored',
|
||||
value: 'Ignored'
|
||||
value: 'Ignored',
|
||||
},
|
||||
{
|
||||
name: 'Imported',
|
||||
|
@ -300,7 +300,7 @@ export const alertFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Type of the alert'
|
||||
description: 'Type of the alert',
|
||||
},
|
||||
{
|
||||
displayName: 'Source',
|
||||
|
@ -318,7 +318,7 @@ export const alertFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Source of the alert'
|
||||
description: 'Source of the alert',
|
||||
},
|
||||
{
|
||||
displayName: 'SourceRef',
|
||||
|
@ -336,7 +336,7 @@ export const alertFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Source reference of the alert'
|
||||
description: 'Source reference of the alert',
|
||||
},
|
||||
{
|
||||
displayName: 'Follow',
|
||||
|
@ -446,7 +446,7 @@ export const alertFields = [
|
|||
],
|
||||
},
|
||||
],
|
||||
description: 'Artifact attributes'
|
||||
description: 'Artifact attributes',
|
||||
},
|
||||
// required for responder execution
|
||||
{
|
||||
|
@ -502,7 +502,7 @@ export const alertFields = [
|
|||
name: 'caseTemplate',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `Case template to use when a case is created from this alert`,
|
||||
description: `Case template to use when a case is created from this alert.`,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -557,7 +557,6 @@ export const alertFields = [
|
|||
value: 'file',
|
||||
},
|
||||
],
|
||||
description: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Data',
|
||||
|
@ -571,7 +570,6 @@ export const alertFields = [
|
|||
},
|
||||
},
|
||||
default: '',
|
||||
description: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Binary Property',
|
||||
|
@ -585,21 +583,18 @@ export const alertFields = [
|
|||
},
|
||||
},
|
||||
default: 'data',
|
||||
description: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Message',
|
||||
name: 'message',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Case Tags',
|
||||
name: 'tags',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -611,7 +606,7 @@ export const alertFields = [
|
|||
type: 'string',
|
||||
required: false,
|
||||
default: '',
|
||||
description: `Case template to use when a case is created from this alert`,
|
||||
description: `Case template to use when a case is created from this alert.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
|
@ -619,14 +614,14 @@ export const alertFields = [
|
|||
type: 'string',
|
||||
required: false,
|
||||
default: '',
|
||||
description: 'Description of the alert',
|
||||
description: 'Description of the alert.',
|
||||
},
|
||||
{
|
||||
displayName: 'Follow',
|
||||
name: 'follow',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'if true, the alert becomes active when updated default=true',
|
||||
description: 'if true, the alert becomes active when updated default=true.',
|
||||
},
|
||||
{
|
||||
displayName: 'Severity',
|
||||
|
@ -686,7 +681,7 @@ export const alertFields = [
|
|||
type: 'string',
|
||||
required: false,
|
||||
default: '',
|
||||
description: 'Title of the alert'
|
||||
description: 'Title of the alert.',
|
||||
},
|
||||
{
|
||||
displayName: 'TLP',
|
||||
|
@ -712,7 +707,7 @@ export const alertFields = [
|
|||
value: TLP.red,
|
||||
},
|
||||
],
|
||||
description: 'Traffict Light Protocol (TLP). Default=Amber'
|
||||
description: 'Traffict Light Protocol (TLP). Default=Amber',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -752,7 +747,7 @@ export const alertFields = [
|
|||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'alert'
|
||||
'alert',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
|
@ -766,7 +761,7 @@ export const alertFields = [
|
|||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Description of the alert',
|
||||
description: 'Description of the alert.',
|
||||
},
|
||||
{
|
||||
displayName: 'Follow',
|
||||
|
@ -782,15 +777,15 @@ export const alertFields = [
|
|||
options: [
|
||||
{
|
||||
name: 'Low',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Medium',
|
||||
value: 2
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'High',
|
||||
value: 3
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
default: 2,
|
||||
|
@ -830,10 +825,10 @@ export const alertFields = [
|
|||
{
|
||||
name: 'Red',
|
||||
value: TLP.red,
|
||||
}
|
||||
],
|
||||
description: 'Traffict Light Protocol (TLP). Default=Amber'
|
||||
},
|
||||
],
|
||||
}
|
||||
description: 'Traffict Light Protocol (TLP). Default=Amber',
|
||||
},
|
||||
],
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -247,7 +247,7 @@ export const caseFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Traffict Light Protocol (TLP). Default=Amber'
|
||||
description: 'Traffict Light Protocol (TLP). Default=Amber',
|
||||
},
|
||||
{
|
||||
displayName: 'Tags',
|
||||
|
@ -385,15 +385,15 @@ export const caseFields = [
|
|||
options: [
|
||||
{
|
||||
name: 'No Impact',
|
||||
value: 'NoImpact'
|
||||
value: 'NoImpact',
|
||||
},
|
||||
{
|
||||
name: 'With Impact',
|
||||
value: 'WithImpact'
|
||||
value: 'WithImpact',
|
||||
},
|
||||
{
|
||||
name: 'Not Applicable',
|
||||
value: 'NotApplicable'
|
||||
value: 'NotApplicable',
|
||||
},
|
||||
],
|
||||
description: 'Impact status of the case',
|
||||
|
@ -419,23 +419,23 @@ export const caseFields = [
|
|||
options: [
|
||||
{
|
||||
value: 'Indeterminate',
|
||||
name: 'Indeterminate'
|
||||
name: 'Indeterminate',
|
||||
},
|
||||
{
|
||||
value: 'False Positive',
|
||||
name: 'FalsePositive'
|
||||
name: 'FalsePositive',
|
||||
},
|
||||
{
|
||||
value: 'True Positive',
|
||||
name: 'TruePositive'
|
||||
name: 'TruePositive',
|
||||
},
|
||||
{
|
||||
value: 'Other',
|
||||
name: 'Other'
|
||||
name: 'Other',
|
||||
},
|
||||
{
|
||||
value: 'Duplicated',
|
||||
name: 'Duplicated'
|
||||
name: 'Duplicated',
|
||||
},
|
||||
],
|
||||
description: 'Resolution status of the case',
|
||||
|
@ -447,15 +447,15 @@ export const caseFields = [
|
|||
options: [
|
||||
{
|
||||
name: 'Low',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Medium',
|
||||
value: 2
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'High',
|
||||
value: 3
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
default: 2,
|
||||
|
@ -493,7 +493,7 @@ export const caseFields = [
|
|||
name: 'summary',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Summary of the case, to be provided when closing a case'
|
||||
description: 'Summary of the case, to be provided when closing a case',
|
||||
},
|
||||
{
|
||||
displayName: 'Tags',
|
||||
|
@ -531,7 +531,7 @@ export const caseFields = [
|
|||
value: TLP.red,
|
||||
},
|
||||
],
|
||||
description: 'Traffict Light Protocol (TLP). Default=Amber'
|
||||
description: 'Traffict Light Protocol (TLP). Default=Amber',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -574,7 +574,7 @@ export const caseFields = [
|
|||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'case'
|
||||
'case',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
|
@ -665,15 +665,15 @@ export const caseFields = [
|
|||
options: [
|
||||
{
|
||||
name: 'Low',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Medium',
|
||||
value: 2
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'High',
|
||||
value: 3
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
default: 2,
|
||||
|
|
|
@ -25,12 +25,12 @@ export const logOperations = [
|
|||
{
|
||||
name: 'Execute Responder',
|
||||
value: 'executeResponder',
|
||||
description: 'Execute a responder on a selected log'
|
||||
description: 'Execute a responder on a selected log',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get all task logs'
|
||||
description: 'Get all task logs',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
|
@ -38,7 +38,7 @@ export const logOperations = [
|
|||
description: 'Get a single log',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const logFields = [
|
||||
|
@ -195,7 +195,7 @@ export const logFields = [
|
|||
loadOptionsDependsOn: [
|
||||
'id',
|
||||
],
|
||||
loadOptionsMethod: 'loadResponders'
|
||||
loadOptionsMethod: 'loadResponders',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
|
@ -258,5 +258,5 @@ export const logFields = [
|
|||
description: 'File attached to the log',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -127,55 +127,55 @@ export const observableFields = [
|
|||
},
|
||||
{
|
||||
name: 'file',
|
||||
value: 'file'
|
||||
value: 'file',
|
||||
},
|
||||
{
|
||||
name: 'filename',
|
||||
value: 'filename'
|
||||
value: 'filename',
|
||||
},
|
||||
{
|
||||
name: 'fqdn',
|
||||
value: 'fqdn'
|
||||
value: 'fqdn',
|
||||
},
|
||||
{
|
||||
name: 'hash',
|
||||
value: 'hash'
|
||||
value: 'hash',
|
||||
},
|
||||
{
|
||||
name: 'ip',
|
||||
value: 'ip'
|
||||
value: 'ip',
|
||||
},
|
||||
{
|
||||
name: 'mail',
|
||||
value: 'mail'
|
||||
value: 'mail',
|
||||
},
|
||||
{
|
||||
name: 'mail_subject',
|
||||
value: 'mail_subject'
|
||||
value: 'mail_subject',
|
||||
},
|
||||
{
|
||||
name: 'other',
|
||||
value: 'other'
|
||||
value: 'other',
|
||||
},
|
||||
{
|
||||
name: 'regexp',
|
||||
value: 'regexp'
|
||||
value: 'regexp',
|
||||
},
|
||||
{
|
||||
name: 'registry',
|
||||
value: 'registry'
|
||||
value: 'registry',
|
||||
},
|
||||
{
|
||||
name: 'uri_path',
|
||||
value: 'uri_path'
|
||||
value: 'uri_path',
|
||||
},
|
||||
{
|
||||
name: 'url',
|
||||
value: 'url'
|
||||
value: 'url',
|
||||
},
|
||||
{
|
||||
name: 'user-agent',
|
||||
value: 'user-agent'
|
||||
value: 'user-agent',
|
||||
},
|
||||
],
|
||||
displayOptions: {
|
||||
|
@ -243,7 +243,7 @@ export const observableFields = [
|
|||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'observable'
|
||||
'observable',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
|
@ -607,59 +607,59 @@ export const observableFields = [
|
|||
options: [
|
||||
{
|
||||
name: 'domain',
|
||||
value: 'domain'
|
||||
value: 'domain',
|
||||
},
|
||||
{
|
||||
name: 'file',
|
||||
value: 'file'
|
||||
value: 'file',
|
||||
},
|
||||
{
|
||||
name: 'filename',
|
||||
value: 'filename'
|
||||
value: 'filename',
|
||||
},
|
||||
{
|
||||
name: 'fqdn',
|
||||
value: 'fqdn'
|
||||
value: 'fqdn',
|
||||
},
|
||||
{
|
||||
name: 'hash',
|
||||
value: 'hash'
|
||||
value: 'hash',
|
||||
},
|
||||
{
|
||||
name: 'ip',
|
||||
value: 'ip'
|
||||
value: 'ip',
|
||||
},
|
||||
{
|
||||
name: 'mail',
|
||||
value: 'mail'
|
||||
value: 'mail',
|
||||
},
|
||||
{
|
||||
name: 'mail_subject',
|
||||
value: 'mail_subject'
|
||||
value: 'mail_subject',
|
||||
},
|
||||
{
|
||||
name: 'other',
|
||||
value: 'other'
|
||||
value: 'other',
|
||||
},
|
||||
{
|
||||
name: 'regexp',
|
||||
value: 'regexp'
|
||||
value: 'regexp',
|
||||
},
|
||||
{
|
||||
name: 'registry',
|
||||
value: 'registry'
|
||||
value: 'registry',
|
||||
},
|
||||
{
|
||||
name: 'uri_path',
|
||||
value: 'uri_path'
|
||||
value: 'uri_path',
|
||||
},
|
||||
{
|
||||
name: 'url',
|
||||
value: 'url'
|
||||
value: 'url',
|
||||
},
|
||||
{
|
||||
name: 'user-agent',
|
||||
value: 'user-agent'
|
||||
value: 'user-agent',
|
||||
},
|
||||
],
|
||||
description: 'Type of the observable',
|
||||
|
|
|
@ -132,20 +132,20 @@ export const taskFields = [
|
|||
default: 'Waiting',
|
||||
options: [
|
||||
{
|
||||
name: 'Waiting',
|
||||
value: 'Waiting',
|
||||
},
|
||||
{
|
||||
name: 'InProgress',
|
||||
value: 'InProgress',
|
||||
name: 'Cancel',
|
||||
value: 'Cancel',
|
||||
},
|
||||
{
|
||||
name: 'Completed',
|
||||
value: 'Completed',
|
||||
},
|
||||
{
|
||||
name: 'Cancel',
|
||||
value: 'Cancel',
|
||||
name: 'InProgress',
|
||||
value: 'InProgress',
|
||||
},
|
||||
{
|
||||
name: 'Waiting',
|
||||
value: 'Waiting',
|
||||
},
|
||||
],
|
||||
required: true,
|
||||
|
@ -313,26 +313,26 @@ export const taskFields = [
|
|||
description: 'Date of the beginning of the task. This is automatically set when status is set to Open',
|
||||
},
|
||||
{
|
||||
displayName: 'status',
|
||||
displayName: 'Status',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
default: 'Waiting',
|
||||
options: [
|
||||
{
|
||||
name: 'Waiting',
|
||||
value: 'Waiting',
|
||||
},
|
||||
{
|
||||
name: 'In Progress',
|
||||
value: 'InProgress',
|
||||
name: 'Cancel',
|
||||
value: 'Cancel',
|
||||
},
|
||||
{
|
||||
name: 'Completed',
|
||||
value: 'Completed',
|
||||
},
|
||||
{
|
||||
name: 'Cancel',
|
||||
value: 'Cancel',
|
||||
name: 'In Progress',
|
||||
value: 'InProgress',
|
||||
},
|
||||
{
|
||||
name: 'Waiting',
|
||||
value: 'Waiting',
|
||||
},
|
||||
],
|
||||
description: 'Status of the task. Default=Waiting',
|
||||
|
@ -438,20 +438,20 @@ export const taskFields = [
|
|||
default: 'Waiting',
|
||||
options: [
|
||||
{
|
||||
name: 'Waiting',
|
||||
value: 'Waiting',
|
||||
},
|
||||
{
|
||||
name: 'In Progress',
|
||||
value: 'InProgress'
|
||||
name: 'Cancel',
|
||||
value: 'Cancel',
|
||||
},
|
||||
{
|
||||
name: 'Completed',
|
||||
value: 'Completed'
|
||||
value: 'Completed',
|
||||
},
|
||||
{
|
||||
name: 'Cancel',
|
||||
value: 'Cancel'
|
||||
name: 'In Progress',
|
||||
value: 'InProgress',
|
||||
},
|
||||
{
|
||||
name: 'Waiting',
|
||||
value: 'Waiting',
|
||||
},
|
||||
],
|
||||
description: 'Status of the task. Default=Waiting',
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import {
|
||||
IDataObject
|
||||
}from 'n8n-workflow'
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
export enum AlertStatus {
|
||||
NEW="New",
|
||||
UPDATED="Updated",
|
||||
IGNORED="Ignored",
|
||||
IMPORTED="Imported",
|
||||
NEW = 'New',
|
||||
UPDATED = 'Updated',
|
||||
IGNORED = 'Ignored',
|
||||
IMPORTED = 'Imported',
|
||||
}
|
||||
export enum TLP {
|
||||
white,
|
||||
green,
|
||||
amber,
|
||||
red
|
||||
red,
|
||||
}
|
||||
|
||||
export interface IAlert {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { IDataObject } from "n8n-workflow";
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
import { TLP } from './AlertInterface';
|
||||
export interface ICase {
|
||||
// Required attributes
|
||||
|
@ -33,21 +33,21 @@ export interface ICase{
|
|||
|
||||
|
||||
export enum CaseStatus {
|
||||
OPEN="Open",
|
||||
RESOLVED="Resolved",
|
||||
DELETED="Deleted",
|
||||
OPEN = 'Open',
|
||||
RESOLVED = 'Resolved',
|
||||
DELETED = 'Deleted',
|
||||
}
|
||||
|
||||
export enum CaseResolutionStatus {
|
||||
INDETERMINATE="Indeterminate",
|
||||
FALSEPOSITIVE="FalsePositive",
|
||||
TRUEPOSITIVE="TruePositive",
|
||||
OTHER="Other",
|
||||
DUPLICATED="Duplicated",
|
||||
INDETERMINATE = 'Indeterminate',
|
||||
FALSEPOSITIVE = 'FalsePositive',
|
||||
TRUEPOSITIVE = 'TruePositive',
|
||||
OTHER = 'Other',
|
||||
DUPLICATED = 'Duplicated',
|
||||
}
|
||||
|
||||
export enum CaseImpactStatus {
|
||||
NOIMPACT="NoImpact",
|
||||
WITHIMPACT="WithImpact",
|
||||
NOTAPPLICABLE="NotApplicable",
|
||||
NOIMPACT = 'NoImpact',
|
||||
WITHIMPACT = 'WithImpact',
|
||||
NOTAPPLICABLE = 'NotApplicable',
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
import { IDataObject } from "n8n-workflow";
|
||||
import {IAttachment} from "./ObservableInterface";
|
||||
import { IAttachment } from './ObservableInterface';
|
||||
export enum LogStatus {
|
||||
OK="Ok",
|
||||
DELETED="Deleted"
|
||||
OK = 'Ok',
|
||||
DELETED = 'Deleted',
|
||||
}
|
||||
export interface ILog {
|
||||
// Required attributes
|
||||
|
|
|
@ -1,27 +1,26 @@
|
|||
import {
|
||||
TLP
|
||||
}from './AlertInterface'
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
} from './AlertInterface';
|
||||
|
||||
export enum ObservableStatus {
|
||||
OK="Ok",
|
||||
DELETED="Deleted",
|
||||
OK = 'Ok',
|
||||
DELETED = 'Deleted',
|
||||
}
|
||||
export enum ObservableDataType {
|
||||
"domain"= "domain",
|
||||
"file"= "file",
|
||||
"filename"= "filename",
|
||||
"fqdn"= "fqdn",
|
||||
"hash"= "hash",
|
||||
"ip"= "ip",
|
||||
"mail"= "mail",
|
||||
"mail_subject"= "mail_subject",
|
||||
"other"= "other",
|
||||
"regexp"= "regexp",
|
||||
"registry"= "registry",
|
||||
"uri_path"= "uri_path",
|
||||
"url"= "url",
|
||||
"user-agent"= "user-agent"
|
||||
'domain' = 'domain',
|
||||
'file' = 'file',
|
||||
'filename' = 'filename',
|
||||
'fqdn' = 'fqdn',
|
||||
'hash' = 'hash',
|
||||
'ip' = 'ip',
|
||||
'mail' = 'mail',
|
||||
'mail_subject' = 'mail_subject',
|
||||
'other' = 'other',
|
||||
'regexp' = 'regexp',
|
||||
'registry' = 'registry',
|
||||
'uri_path' = 'uri_path',
|
||||
'url' = 'url',
|
||||
'user-agent' = 'user-agent',
|
||||
}
|
||||
|
||||
export interface IAttachment {
|
||||
|
@ -50,5 +49,4 @@ export interface IObservable{
|
|||
createdAt?: Date;
|
||||
updatedBy?: string;
|
||||
upadtedAt?: Date;
|
||||
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ export interface ITask{
|
|||
}
|
||||
|
||||
export enum TaskStatus {
|
||||
WAITING="Waiting",
|
||||
INPROGRESS="InProgress",
|
||||
COMPLETED="Completed",
|
||||
CANCEL="Cancel",
|
||||
WAITING = 'Waiting',
|
||||
INPROGRESS = 'InProgress',
|
||||
COMPLETED = 'Completed',
|
||||
CANCEL = 'Cancel',
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 819 B |
Loading…
Reference in a new issue