Fix lint issues, formatting and icons

This commit is contained in:
Jan Oberhauser 2020-12-02 11:54:10 +01:00
parent ea9f61089b
commit a38665e82c
24 changed files with 870 additions and 893 deletions

View file

@ -20,7 +20,7 @@ export class CortexApi implements ICredentialType {
type: 'string' as NodePropertyTypes, type: 'string' as NodePropertyTypes,
description: 'The URL of the Cortex instance', description: 'The URL of the Cortex instance',
default: '', default: '',
placeholder:'https://localhost:9001' placeholder: 'https://localhost:9001',
}, },
]; ];
} }

View file

@ -31,12 +31,12 @@ export class TheHiveApi implements ICredentialType {
{ {
name: 'Version 1', name: 'Version 1',
value: 'v1', value: 'v1',
description:'API version supported by TheHive 4' description: 'API version supported by TheHive 4',
}, },
{ {
name: 'Version 0', name: 'Version 0',
value: '', value: '',
description:'API version supported by TheHive 3' description: 'API version supported by TheHive 3',
}, },
], ],
}, },

View file

@ -169,7 +169,7 @@ export const analyzerFields: INodeProperties[] =[
}, { }, {
name: 'Red', name: 'Red',
value: TLP.red, value: TLP.red,
} },
], ],
default: 2, default: 2,
description: 'The TLP of the analyzed observable', description: 'The TLP of the analyzed observable',

View file

@ -7,14 +7,14 @@ export enum JobStatus {
INPROGRESS = 'InProgress', INPROGRESS = 'InProgress',
SUCCESS = 'Success', SUCCESS = 'Success',
FAILURE = 'Failure', FAILURE = 'Failure',
DELETED = 'Deleted' DELETED = 'Deleted',
} }
export enum TLP { export enum TLP {
white, white,
green, green,
amber, amber,
red red,
} }
export enum ObservableDataType { export enum ObservableDataType {
@ -31,7 +31,7 @@ export enum ObservableDataType {
'registry' = 'registry', 'registry' = 'registry',
'uri_path' = 'uri_path', 'uri_path' = 'uri_path',
'url' = 'url', 'url' = 'url',
'user-agent'= 'user-agent' 'user-agent' = 'user-agent',
} }
export interface IJob { export interface IJob {
id?: string; id?: string;

View file

@ -1,6 +1,6 @@
import { import {
IExecuteFunctions,
BINARY_ENCODING, BINARY_ENCODING,
IExecuteFunctions,
} from 'n8n-core'; } from 'n8n-core';
import { import {
@ -11,23 +11,23 @@ import {
} from './GenericFunctions'; } from './GenericFunctions';
import { import {
analyzersOperations,
analyzerFields, analyzerFields,
analyzersOperations,
} from './AnalyzerDescriptions'; } from './AnalyzerDescriptions';
import { import {
IBinaryData,
IDataObject,
ILoadOptionsFunctions,
INodeExecutionData, INodeExecutionData,
INodePropertyOptions,
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
INodePropertyOptions,
ILoadOptionsFunctions,
IDataObject,
IBinaryData,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { import {
respondersOperations,
responderFields, responderFields,
respondersOperations,
} from './ResponderDescription'; } from './ResponderDescription';
import { import {
@ -82,14 +82,14 @@ export class Cortex implements INodeType {
name: 'Analyzer', name: 'Analyzer',
value: 'analyzer', value: 'analyzer',
}, },
{
name: 'Responder',
value:'responder',
},
{ {
name: 'Job', name: 'Job',
value: 'job', value: 'job',
}, },
{
name: 'Responder',
value: 'responder',
},
], ],
default: 'analyzer', default: 'analyzer',
description: 'Choose a resource', description: 'Choose a resource',
@ -100,7 +100,7 @@ export class Cortex implements INodeType {
...respondersOperations, ...respondersOperations,
...responderFields, ...responderFields,
...jobOperations, ...jobOperations,
...jobFields ...jobFields,
], ],
}; };
@ -183,7 +183,7 @@ export class Cortex implements INodeType {
returnData.push( returnData.push(
{ {
value: (dataType as string).split(':')[1], 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: { options: {
contentType: item.binary[binaryPropertyName].mimeType, contentType: item.binary[binaryPropertyName].mimeType,
filename: item.binary[binaryPropertyName].fileName, filename: item.binary[binaryPropertyName].fileName,
} },
}, },
_json: JSON.stringify({ _json: JSON.stringify({
dataType: observableType, dataType: observableType,
tlp, tlp,
}) }),
} },
}; };
responseData = await cortexApiRequest.call( responseData = await cortexApiRequest.call(
@ -332,8 +332,6 @@ export class Cortex implements INodeType {
if (isJSON) { if (isJSON) {
const entityJson = JSON.parse(this.getNodeParameter('objectData', i) as string); const entityJson = JSON.parse(this.getNodeParameter('objectData', i) as string);
body = { body = {
@ -356,8 +354,8 @@ export class Cortex implements INodeType {
dataType: `thehive:${entityType}`, dataType: `thehive:${entityType}`,
data: { data: {
_type: entityType, _type: entityType,
...prepareParameters(values) ...prepareParameters(values),
} },
}; };
if (entityType === 'alert') { if (entityType === 'alert') {
// deal with alert artifacts // deal with alert artifacts
@ -433,7 +431,7 @@ export class Cortex implements INodeType {
hashes: [ hashes: [
sha256, sha256,
createHash('sha1').update(fileBufferData).digest('hex'), createHash('sha1').update(fileBufferData).digest('hex'),
createHash('md5').update(fileBufferData).digest('hex') createHash('md5').update(fileBufferData).digest('hex'),
], ],
size: fileBufferData.byteLength, size: fileBufferData.byteLength,
contentType: item.binary[binaryPropertyName].mimeType, contentType: item.binary[binaryPropertyName].mimeType,
@ -446,7 +444,7 @@ export class Cortex implements INodeType {
// add the job label after getting all entity attributes // add the job label after getting all entity attributes
body = { body = {
label: getEntityLabel(body.data as IDataObject), label: getEntityLabel(body.data as IDataObject),
...body ...body,
}; };
} }

View file

@ -10,9 +10,9 @@ import {
import { import {
IExecuteFunctions, IExecuteFunctions,
IExecuteSingleFunctions,
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IExecuteSingleFunctions,
} from 'n8n-core'; } from 'n8n-core';
import { import {

View file

@ -12,7 +12,7 @@ export const respondersOperations = [
name: 'operation', name: 'operation',
type: 'options', type: 'options',
required: true, required: true,
description: 'Choose an operation', description: 'Choose an operation.',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource: [
@ -24,11 +24,11 @@ export const respondersOperations = [
{ {
name: 'Execute', name: 'Execute',
value: 'execute', value: 'execute',
description: 'Execute Responder' description: 'Execute Responder',
} },
], ],
default: 'execute' default: 'execute',
} },
] as INodeProperties[]; ] as INodeProperties[];
export const responderFields: INodeProperties[] = [ export const responderFields: INodeProperties[] = [
@ -38,7 +38,7 @@ export const responderFields: INodeProperties[] = [
type: 'options', type: 'options',
required: true, required: true,
typeOptions: { typeOptions: {
loadOptionsMethod: 'loadActiveResponders' loadOptionsMethod: 'loadActiveResponders',
}, },
default: '', default: '',
displayOptions: { displayOptions: {
@ -48,7 +48,7 @@ export const responderFields: INodeProperties[] = [
], ],
}, },
}, },
description: 'Choose the responder' description: 'Choose the responder.',
}, },
{ {
displayName: 'Entity Type', displayName: 'Entity Type',
@ -59,7 +59,7 @@ export const responderFields: INodeProperties[] = [
show: { show: {
resource: [ resource: [
'responder', 'responder',
] ],
}, },
}, },
typeOptions: { typeOptions: {
@ -69,14 +69,14 @@ export const responderFields: INodeProperties[] = [
], ],
}, },
default: '', default: '',
description: 'Choose the Data type', description: 'Choose the Data type.',
}, },
{ {
displayName: 'JSON Parameters', displayName: 'JSON Parameters',
name: 'jsonObject', name: 'jsonObject',
type: 'boolean', type: 'boolean',
default: false, default: false,
description: 'Choose between providing JSON object or seperated attributes', description: 'Choose between providing JSON object or seperated attributes.',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource: [
@ -100,7 +100,7 @@ export const responderFields: INodeProperties[] = [
], ],
}, },
}, },
default: '' default: '',
}, },
{ {
displayName: 'Parameters', displayName: 'Parameters',
@ -160,14 +160,14 @@ export const responderFields: INodeProperties[] = [
name: 'owner', name: 'owner',
type: 'string', type: 'string',
default: '', 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', displayName: 'Flag',
name: 'flag', name: 'flag',
type: 'boolean', type: 'boolean',
default: false, default: false,
description: 'Flag of the case default=false', description: 'Flag of the case default=false.',
}, },
{ {
displayName: 'TLP', displayName: 'TLP',
@ -231,7 +231,7 @@ export const responderFields: INodeProperties[] = [
], ],
}, },
}, },
default: {} default: {},
}, },
{ {
displayName: 'Parameters', displayName: 'Parameters',
@ -266,11 +266,11 @@ export const responderFields: INodeProperties[] = [
options: [ options: [
{ {
name: 'Low', name: 'Low',
value: 1 value: 1,
}, },
{ {
name: 'Medium', name: 'Medium',
value: 2 value: 2,
}, },
{ {
name: 'High', name: 'High',
@ -284,14 +284,14 @@ export const responderFields: INodeProperties[] = [
name: 'date', name: 'date',
type: 'dateTime', type: 'dateTime',
default: '', 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', displayName: 'Tags',
name: 'tags', name: 'tags',
type: 'string', type: 'string',
placeholder: 'tag1,tag2,...', placeholder: 'tag1,tag2,...',
default: '' default: '',
}, },
{ {
displayName: 'TLP', displayName: 'TLP',
@ -333,28 +333,28 @@ export const responderFields: INodeProperties[] = [
}, },
{ {
name: 'Ignored', name: 'Ignored',
value: 'Ignored' value: 'Ignored',
}, },
{ {
name: 'Imported', name: 'Imported',
value: 'Imported', value: 'Imported',
}, },
], ],
description: 'Status of the alert. Default=New' description: 'Status of the alert. Default=New',
}, },
{ {
displayName: 'Type', displayName: 'Type',
name: 'type', name: 'type',
type: 'string', type: 'string',
default: '', default: '',
description: 'Type of the alert', description: 'Type of the alert.',
}, },
{ {
displayName: 'Source', displayName: 'Source',
name: 'source', name: 'source',
type: 'string', type: 'string',
default: '', default: '',
description: 'Source of the alert', description: 'Source of the alert.',
}, },
{ {
displayName: 'SourceRef', displayName: 'SourceRef',
@ -367,7 +367,7 @@ export const responderFields: INodeProperties[] = [
displayName: 'Follow', displayName: 'Follow',
name: 'follow', name: 'follow',
type: 'boolean', type: 'boolean',
default: false default: false,
}, },
{ {
displayName: 'Artifacts', displayName: 'Artifacts',
@ -397,55 +397,55 @@ export const responderFields: INodeProperties[] = [
}, },
{ {
name: 'File', name: 'File',
value: 'file' value: 'file',
}, },
{ {
name: 'Filename', name: 'Filename',
value: 'filename' value: 'filename',
}, },
{ {
name: 'Fqdn', name: 'Fqdn',
value: 'fqdn' value: 'fqdn',
}, },
{ {
name: 'Hash', name: 'Hash',
value: 'hash' value: 'hash',
}, },
{ {
name: 'IP', name: 'IP',
value: 'ip' value: 'ip',
}, },
{ {
name: 'Mail', name: 'Mail',
value: 'mail' value: 'mail',
}, },
{ {
name: 'Mail Subject', name: 'Mail Subject',
value: 'mail_subject' value: 'mail_subject',
}, },
{ {
name: 'Other', name: 'Other',
value: 'other' value: 'other',
}, },
{ {
name: 'Regexp', name: 'Regexp',
value: 'regexp' value: 'regexp',
}, },
{ {
name: 'Registry', name: 'Registry',
value: 'registry' value: 'registry',
}, },
{ {
name: 'Uri Path', name: 'Uri Path',
value: 'uri_path' value: 'uri_path',
}, },
{ {
name: 'URL', name: 'URL',
value: 'url' value: 'url',
}, },
{ {
name: 'User Agent', name: 'User Agent',
value: 'user-agent' value: 'user-agent',
}, },
], ],
description: '', description: '',
@ -493,11 +493,11 @@ export const responderFields: INodeProperties[] = [
description: '', description: '',
}, },
], ],
}
]
}, },
] ],
} },
],
},
], ],
typeOptions: { typeOptions: {
loadOptionsDependsOn: [ loadOptionsDependsOn: [
@ -554,55 +554,55 @@ export const responderFields: INodeProperties[] = [
}, },
{ {
name: 'File', name: 'File',
value: 'file' value: 'file',
}, },
{ {
name: 'Filename', name: 'Filename',
value: 'filename' value: 'filename',
}, },
{ {
name: 'Fqdn', name: 'Fqdn',
value: 'fqdn' value: 'fqdn',
}, },
{ {
name: 'Hash', name: 'Hash',
value: 'hash' value: 'hash',
}, },
{ {
name: 'IP', name: 'IP',
value: 'ip' value: 'ip',
}, },
{ {
name: 'Mail', name: 'Mail',
value: 'mail' value: 'mail',
}, },
{ {
name: 'Mail Subject', name: 'Mail Subject',
value: 'mail_subject' value: 'mail_subject',
}, },
{ {
name: 'Other', name: 'Other',
value: 'other' value: 'other',
}, },
{ {
name: 'Regexp', name: 'Regexp',
value: 'regexp' value: 'regexp',
}, },
{ {
name: 'Registry', name: 'Registry',
value: 'registry' value: 'registry',
}, },
{ {
name: 'Uri Path', name: 'Uri Path',
value: 'uri_path' value: 'uri_path',
}, },
{ {
name: 'URL', name: 'URL',
value: 'url' value: 'url',
}, },
{ {
name: 'User Agent', 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', displayName: 'Message',
name: 'message', name: 'message',
type: 'string', type: 'string',
default: '' default: '',
}, },
{ {
displayName: 'Start Date', displayName: 'Start Date',
name: 'startDate', name: 'startDate',
type: 'dateTime', type: 'dateTime',
default: '', 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', displayName: 'TLP',
@ -666,7 +666,7 @@ export const responderFields: INodeProperties[] = [
}, { }, {
name: 'Red', name: 'Red',
value: TLP.red, value: TLP.red,
} },
], ],
description: 'Traffict Light Protocol (TLP). Default=Amber', description: 'Traffict Light Protocol (TLP). Default=Amber',
}, },
@ -675,7 +675,7 @@ export const responderFields: INodeProperties[] = [
name: 'ioc', name: 'ioc',
type: 'boolean', type: 'boolean',
default: false, 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', displayName: 'Status',
@ -692,8 +692,8 @@ export const responderFields: INodeProperties[] = [
value: 'Deleted', 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', type: 'string',
required: false, required: false,
default: '', default: '',
description: 'Title of the task', description: 'Title of the task.',
}, },
{ {
displayName: 'Status', displayName: 'Status',
@ -776,10 +776,10 @@ export const responderFields: INodeProperties[] = [
displayName: 'Flag', displayName: 'Flag',
name: 'flag', name: 'flag',
type: 'boolean', type: 'boolean',
default: false default: false,
} },
] ],
} },
], ],
typeOptions: { typeOptions: {
loadOptionsDependsOn: [ loadOptionsDependsOn: [
@ -828,7 +828,7 @@ export const responderFields: INodeProperties[] = [
displayName: 'Message', displayName: 'Message',
name: 'message', name: 'message',
type: 'string', type: 'string',
default: '' default: '',
}, },
{ {
displayName: 'Start Date', displayName: 'Start Date',

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 837 B

View file

@ -116,8 +116,8 @@ export function prepareRangeQuery(range: string, body: { 'query': Array<{}> }) {
{ {
'_name': 'page', '_name': 'page',
'from': parseInt(range.split('-')[0], 10), 'from': parseInt(range.split('-')[0], 10),
'to': parseInt(range.split('-')[1], 10) 'to': parseInt(range.split('-')[1], 10),
} },
); );
} }
} }

View file

@ -5,19 +5,19 @@ export type IQueryObject = {
}; };
// Query Functions // 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 }; 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 } }; 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 } }; 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 } }; 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 } }; return { '_lte': { field: value } };
} }
export function And(...criteria: IQueryObject[]): IQueryObject { export function And(...criteria: IQueryObject[]): IQueryObject {
@ -29,7 +29,7 @@ export function Or(...criteria: IQueryObject[]): IQueryObject{
export function Not(criteria: IQueryObject[]): IQueryObject { export function Not(criteria: IQueryObject[]): IQueryObject {
return { '_not': criteria }; 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 } }; return { '_in': { '_field': field, '_values': values } };
} }
export function Contains(field: string): IQueryObject { export function Contains(field: string): IQueryObject {
@ -38,8 +38,8 @@ export function Contains(field: string): IQueryObject{
export function Id(id: string | number): IQueryObject { export function Id(id: string | number): IQueryObject {
return { '_id': id }; return { '_id': id };
} }
export function Between(field:string, from_value: any, to_value: any): IQueryObject{ export function Between(field: string, fromValue: any, toValue: any): IQueryObject { // tslint:disable-line:no-any
return {'_between': {'_field': field, '_from': from_value, '_to': to_value } }; return { '_between': { '_field': field, '_from': fromValue, '_to': toValue } };
} }
export function ParentId(tpe: string, id: string): IQueryObject { export function ParentId(tpe: string, id: string): IQueryObject {
return { '_parent': { '_type': tpe, '_id': id } }; return { '_parent': { '_type': tpe, '_id': id } };
@ -53,8 +53,8 @@ export function Child(tpe:string, criterion:IQueryObject):IQueryObject{
export function Type(tpe: string): IQueryObject { export function Type(tpe: string): IQueryObject {
return { '_type': tpe }; return { '_type': tpe };
} }
export function queryString(query_string:string):IQueryObject{ export function queryString(queryString: string): IQueryObject {
return { '_string': query_string }; return { '_string': queryString };
} }
export function Like(field: string, value: string): IQueryObject { export function Like(field: string, value: string): IQueryObject {
return { '_like': { '_field': field, '_value': value } }; return { '_like': { '_field': field, '_value': value } };

View file

@ -1,42 +1,42 @@
import { import {
IExecuteFunctions, BINARY_ENCODING,
BINARY_ENCODING IExecuteFunctions
} from 'n8n-core'; } from 'n8n-core';
import { import {
INodeExecutionData, IBinaryData,
INodeType,
INodeTypeDescription,
IDataObject, IDataObject,
INodeParameters,
ILoadOptionsFunctions, ILoadOptionsFunctions,
INodeExecutionData,
INodeParameters,
INodePropertyOptions, INodePropertyOptions,
IBinaryData INodeType,
INodeTypeDescription
} from 'n8n-workflow'; } from 'n8n-workflow';
import { import {
alertOperations,
alertFields, alertFields,
alertOperations,
} from './descriptions/AlertDescription'; } from './descriptions/AlertDescription';
import { import {
observableOperations,
observableFields, observableFields,
observableOperations,
} from './descriptions/ObservableDescription'; } from './descriptions/ObservableDescription';
import { import {
caseOperations,
caseFields, caseFields,
caseOperations,
} from './descriptions/CaseDescription'; } from './descriptions/CaseDescription';
import { import {
taskOperations,
taskFields, taskFields,
taskOperations,
} from './descriptions/TaskDescription'; } from './descriptions/TaskDescription';
import { import {
logOperations,
logFields, logFields,
logOperations,
} from './descriptions/LogDescription'; } from './descriptions/LogDescription';
import { import {
@ -44,23 +44,23 @@ import {
} from 'buffer'; } from 'buffer';
import { import {
IQueryObject,
Parent,
Id,
Eq,
And, And,
Between, Between,
In,
ContainsString, ContainsString,
Eq,
Id,
In,
IQueryObject,
Parent,
} from './QueryFunctions'; } from './QueryFunctions';
import { import {
theHiveApiRequest,
mapResource, mapResource,
splitTags,
prepareOptional, prepareOptional,
prepareSortQuery,
prepareRangeQuery, prepareRangeQuery,
prepareSortQuery,
splitTags,
theHiveApiRequest,
} from './GenericFunctions'; } from './GenericFunctions';
export class TheHive implements INodeType { export class TheHive implements INodeType {
@ -164,7 +164,7 @@ export class TheHive implements INodeType {
const requestResult = await theHiveApiRequest.call( const requestResult = await theHiveApiRequest.call(
this, this,
'GET', 'GET',
endpoint as string endpoint as string,
); );
const returnData: INodePropertyOptions[] = []; const returnData: INodePropertyOptions[] = [];
@ -233,8 +233,8 @@ export class TheHive implements INodeType {
{ name: 'Update', value: 'update', description: 'Update a case' }, { name: 'Update', value: 'update', description: 'Update a case' },
]; ];
return options; return options;
} },
} },
}; };
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> { async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
@ -249,22 +249,22 @@ export class TheHive implements INodeType {
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
if (resource === 'alert') { if (resource === 'alert') {
if (operation === 'count') { 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(); const _countSearchQuery: IQueryObject = And();
for (const key of Object.keys(countQueryAttributs)) { for (const key of Object.keys(countQueryAttributs)) {
if (key === 'tags') { if (key === 'tags') {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_countSearchQuery['_and'] as IQueryObject[]).push(
In(key, countQueryAttributs[key] as string[]) In(key, countQueryAttributs[key] as string[]),
); );
} else if (key === 'description' || key === 'title') { } else if (key === 'description' || key === 'title') {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_countSearchQuery['_and'] as IQueryObject[]).push(
ContainsString(key, countQueryAttributs[key] as string) ContainsString(key, countQueryAttributs[key] as string),
); );
} else { } else {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_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', '_name': 'filter',
'_and': _countSearchQuery['_and'] '_and': _countSearchQuery['_and'],
}, },
] ],
}; };
body['query'].push( body['query'].push(
{ {
'_name': 'count', '_name': 'count',
} },
); );
qs.name = 'count-Alert'; qs.name = 'count-Alert';
responseData = await theHiveApiRequest.call( responseData = await theHiveApiRequest.call(
this, this,
'POST', 'POST',
@ -299,7 +298,6 @@ export class TheHive implements INodeType {
); );
responseData = { count: responseData }; responseData = { count: responseData };
} }
if (operation === 'create') { if (operation === 'create') {
@ -315,7 +313,7 @@ export class TheHive implements INodeType {
source: this.getNodeParameter('source', i), source: this.getNodeParameter('source', i),
sourceRef: this.getNodeParameter('sourceRef', i), sourceRef: this.getNodeParameter('sourceRef', i),
follow: this.getNodeParameter('follow', i, true), 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; const artifactUi = this.getNodeParameter('artifactUi', i) as IDataObject;
@ -387,7 +385,7 @@ export class TheHive implements INodeType {
body = { body = {
responderId, responderId,
objectId: alertId, objectId: alertId,
objectType: 'alert' objectType: 'alert',
}; };
response = await theHiveApiRequest.call( response = await theHiveApiRequest.call(
this, this,
@ -398,26 +396,26 @@ export class TheHive implements INodeType {
body = { body = {
query: [ query: [
{ {
'_name': 'listAction' '_name': 'listAction',
}, },
{ {
'_name': 'filter', '_name': 'filter',
'_and': [ '_and': [
{ {
'_field': 'cortexId', '_field': 'cortexId',
'_value': response.cortexId '_value': response.cortexId,
}, },
{ {
'_field': 'objectId', '_field': 'objectId',
'_value': response.objectId '_value': response.objectId,
}, },
{ {
'_field': 'startDate', '_field': 'startDate',
'_value': response.startDate '_value': response.startDate,
} },
] ],
} },
], ],
}; };
qs.name = 'log-actions'; qs.name = 'log-actions';
@ -427,7 +425,7 @@ export class TheHive implements INodeType {
'POST', 'POST',
`/v1/query`, `/v1/query`,
body, body,
qs qs,
); );
} while (response.status === 'Waiting' || response.status === 'InProgress'); } while (response.status === 'Waiting' || response.status === 'InProgress');
@ -452,7 +450,7 @@ export class TheHive implements INodeType {
const version = credentials.apiVersion; 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; const options = this.getNodeParameter('options', i) as IDataObject;
@ -461,15 +459,15 @@ export class TheHive implements INodeType {
for (const key of Object.keys(queryAttributs)) { for (const key of Object.keys(queryAttributs)) {
if (key === 'tags') { if (key === 'tags') {
(_searchQuery['_and'] as IQueryObject[]).push( (_searchQuery['_and'] as IQueryObject[]).push(
In(key, queryAttributs[key] as string[]) In(key, queryAttributs[key] as string[]),
); );
} else if (key === 'description' || key === 'title') { } else if (key === 'description' || key === 'title') {
(_searchQuery['_and'] as IQueryObject[]).push( (_searchQuery['_and'] as IQueryObject[]).push(
ContainsString(key, queryAttributs[key] as string) ContainsString(key, queryAttributs[key] as string),
); );
} else { } else {
(_searchQuery['_and'] as IQueryObject[]).push( (_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', '_name': 'filter',
'_and': _searchQuery['_and'] '_and': _searchQuery['_and'],
}, },
], ],
}; };
@ -633,30 +631,30 @@ export class TheHive implements INodeType {
if (resource === 'observable') { if (resource === 'observable') {
if (operation === 'count') { 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(); const _countSearchQuery: IQueryObject = And();
for (const key of Object.keys(countQueryAttributs)) { for (const key of Object.keys(countQueryAttributs)) {
if (key === 'dataType' || key === 'tags') { if (key === 'dataType' || key === 'tags') {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_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') { } else if (key === 'description' || key === 'keywork' || key === 'message') {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_countSearchQuery['_and'] as IQueryObject[]).push(
ContainsString(key, countQueryAttributs[key] as string) ContainsString(key, countQueryAttributs[key] as string),
); );
} else if (key === 'range') { } else if (key === 'range') {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_countSearchQuery['_and'] as IQueryObject[]).push(
Between( Between(
'startDate', 'startDate',
countQueryAttributs['range']['dateRange']['fromDate'], countQueryAttributs['range']['dateRange']['fromDate'],
countQueryAttributs['range']['dateRange']['toDate'] countQueryAttributs['range']['dateRange']['toDate'],
) ),
); );
} else { } else {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_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 = { const body = {
'query': [ 'query': [
{ {
'_name': 'listObservable' '_name': 'listObservable',
}, },
{ {
'_name': 'filter', '_name': 'filter',
'_and': _countSearchQuery['_and'] '_and': _countSearchQuery['_and'],
}, },
] ],
}; };
body['query'].push( body['query'].push(
{ {
'_name': 'count' '_name': 'count',
} },
); );
qs.name = 'count-observables'; qs.name = 'count-observables';
@ -699,10 +697,10 @@ export class TheHive implements INodeType {
const parts = analyzer.split('::'); const parts = analyzer.split('::');
return { return {
analyzerId: parts[0], analyzerId: parts[0],
cortexId: parts[1] cortexId: parts[1],
}; };
}); });
let response: any; let response: any; // tslint:disable-line:no-any
let body: IDataObject; let body: IDataObject;
responseData = []; responseData = [];
for (const analyzer of analyzers) { for (const analyzer of analyzers) {
@ -716,7 +714,7 @@ export class TheHive implements INodeType {
'POST', 'POST',
'/connector/cortex/job' as string, '/connector/cortex/job' as string,
body, body,
qs qs,
); );
const jobId = response.id; const jobId = response.id;
qs.name = 'observable-jobs'; qs.name = 'observable-jobs';
@ -737,7 +735,7 @@ export class TheHive implements INodeType {
body = { body = {
responderId, responderId,
objectId: observableId, objectId: observableId,
objectType: 'case_artifact' objectType: 'case_artifact',
}; };
response = await theHiveApiRequest.call( response = await theHiveApiRequest.call(
this, this,
@ -748,27 +746,27 @@ export class TheHive implements INodeType {
body = { body = {
query: [ query: [
{ {
'_name': 'listAction' '_name': 'listAction',
}, },
{ {
'_name': 'filter', '_name': 'filter',
'_and': [ '_and': [
{ {
'_field': 'cortexId', '_field': 'cortexId',
'_value': response.cortexId '_value': response.cortexId,
}, },
{ {
'_field': 'objectId', '_field': 'objectId',
'_value': response.objectId '_value': response.objectId,
}, },
{ {
'_field': 'startDate', '_field': 'startDate',
'_value': response.startDate '_value': response.startDate,
} },
] ],
} },
] ],
}; };
qs.name = 'log-actions'; qs.name = 'log-actions';
do { do {
@ -777,7 +775,7 @@ export class TheHive implements INodeType {
'POST', 'POST',
`/v1/query`, `/v1/query`,
body, body,
qs qs,
); );
} while (response.status === 'Waiting' || response.status === 'InProgress'); } while (response.status === 'Waiting' || response.status === 'InProgress');
@ -795,7 +793,7 @@ export class TheHive implements INodeType {
ioc: this.getNodeParameter('ioc', i) as boolean, ioc: this.getNodeParameter('ioc', i) as boolean,
sighted: this.getNodeParameter('sighted', i) as boolean, sighted: this.getNodeParameter('sighted', i) as boolean,
status: this.getNodeParameter('status', i) as string, status: this.getNodeParameter('status', i) as string,
...prepareOptional(this.getNodeParameter('options', i, {}) as INodeParameters) ...prepareOptional(this.getNodeParameter('options', i, {}) as INodeParameters),
}; };
let options: IDataObject = {}; let options: IDataObject = {};
@ -822,10 +820,10 @@ export class TheHive implements INodeType {
options: { options: {
contentType: binaryData.mimeType, contentType: binaryData.mimeType,
filename: binaryData.fileName, filename: binaryData.fileName,
}
}, },
_json: JSON.stringify(body) },
} _json: JSON.stringify(body),
},
}; };
body = {}; body = {};
} else { } else {
@ -839,7 +837,7 @@ export class TheHive implements INodeType {
body, body,
qs, qs,
'', '',
options options,
); );
} }
@ -866,9 +864,9 @@ export class TheHive implements INodeType {
'query': [ 'query': [
{ {
'_name': 'getObservable', '_name': 'getObservable',
'idOrName': observableId 'idOrName': observableId,
} },
] ],
}; };
qs.name = `get-observable-${observableId}`; qs.name = `get-observable-${observableId}`;
@ -914,8 +912,6 @@ export class TheHive implements INodeType {
} }
if (version === 'v1') { if (version === 'v1') {
endpoint = '/v1/query'; endpoint = '/v1/query';
method = 'POST'; method = 'POST';
@ -924,12 +920,12 @@ export class TheHive implements INodeType {
'query': [ 'query': [
{ {
'_name': 'getCase', '_name': 'getCase',
'idOrName': caseId 'idOrName': caseId,
}, },
{ {
'_name': 'observables' '_name': 'observables',
}, },
] ],
}; };
//@ts-ignore //@ts-ignore
@ -943,7 +939,6 @@ export class TheHive implements INodeType {
qs.name = 'observables'; qs.name = 'observables';
} else { } else {
method = 'POST'; method = 'POST';
endpoint = '/case/artifact/_search'; endpoint = '/case/artifact/_search';
@ -973,7 +968,7 @@ export class TheHive implements INodeType {
const version = credentials.apiVersion; 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(); const _searchQuery: IQueryObject = And();
@ -982,23 +977,23 @@ export class TheHive implements INodeType {
for (const key of Object.keys(queryAttributs)) { for (const key of Object.keys(queryAttributs)) {
if (key === 'dataType' || key === 'tags') { if (key === 'dataType' || key === 'tags') {
(_searchQuery['_and'] as IQueryObject[]).push( (_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') { } else if (key === 'description' || key === 'keywork' || key === 'message') {
(_searchQuery['_and'] as IQueryObject[]).push( (_searchQuery['_and'] as IQueryObject[]).push(
ContainsString(key, queryAttributs[key] as string) ContainsString(key, queryAttributs[key] as string),
); );
} else if (key === 'range') { } else if (key === 'range') {
(_searchQuery['_and'] as IQueryObject[]).push( (_searchQuery['_and'] as IQueryObject[]).push(
Between( Between(
'startDate', 'startDate',
queryAttributs['range']['dateRange']['fromDate'], queryAttributs['range']['dateRange']['fromDate'],
queryAttributs['range']['dateRange']['toDate'] queryAttributs['range']['dateRange']['toDate'],
) ),
); );
} else { } else {
(_searchQuery['_and'] as IQueryObject[]).push( (_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') { if (version === 'v1') {
endpoint = '/v1/query'; endpoint = '/v1/query';
method = 'POST'; method = 'POST';
@ -1024,13 +1018,13 @@ export class TheHive implements INodeType {
body = { body = {
'query': [ 'query': [
{ {
'_name': 'listObservable' '_name': 'listObservable',
}, },
{ {
'_name': 'filter', '_name': 'filter',
'_and': _searchQuery['_and'] '_and': _searchQuery['_and'],
}, },
] ],
}; };
//@ts-ignore //@ts-ignore
@ -1044,7 +1038,6 @@ export class TheHive implements INodeType {
qs.name = 'observables'; qs.name = 'observables';
} else { } else {
method = 'POST'; method = 'POST';
endpoint = '/case/artifact/_search'; endpoint = '/case/artifact/_search';
@ -1072,7 +1065,7 @@ export class TheHive implements INodeType {
const id = this.getNodeParameter('id', i) as string; const id = this.getNodeParameter('id', i) as string;
const body: IDataObject = { const body: IDataObject = {
...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters) ...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters),
}; };
responseData = await theHiveApiRequest.call( responseData = await theHiveApiRequest.call(
@ -1089,22 +1082,22 @@ export class TheHive implements INodeType {
if (resource === 'case') { if (resource === 'case') {
if (operation === 'count') { 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(); const _countSearchQuery: IQueryObject = And();
for (const key of Object.keys(countQueryAttributs)) { for (const key of Object.keys(countQueryAttributs)) {
if (key === 'tags') { if (key === 'tags') {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_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') { } else if (key === 'description' || key === 'summary' || key === 'title') {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_countSearchQuery['_and'] as IQueryObject[]).push(
ContainsString(key, countQueryAttributs[key] as string) ContainsString(key, countQueryAttributs[key] as string),
); );
} else { } else {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_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', '_name': 'filter',
'_and': _countSearchQuery['_and'] '_and': _countSearchQuery['_and'],
}, },
] ],
}; };
body['query'].push( body['query'].push(
{ {
'_name': 'count', '_name': 'count',
} },
); );
qs.name = 'count-cases'; qs.name = 'count-cases';
@ -1150,7 +1143,7 @@ export class TheHive implements INodeType {
body = { body = {
responderId, responderId,
objectId: caseId, objectId: caseId,
objectType: 'case' objectType: 'case',
}; };
response = await theHiveApiRequest.call( response = await theHiveApiRequest.call(
this, this,
@ -1161,27 +1154,27 @@ export class TheHive implements INodeType {
body = { body = {
query: [ query: [
{ {
'_name': 'listAction' '_name': 'listAction',
}, },
{ {
'_name': 'filter', '_name': 'filter',
'_and': [ '_and': [
{ {
'_field': 'cortexId', '_field': 'cortexId',
'_value': response.cortexId '_value': response.cortexId,
}, },
{ {
'_field': 'objectId', '_field': 'objectId',
'_value': response.objectId '_value': response.objectId,
}, },
{ {
'_field': 'startDate', '_field': 'startDate',
'_value': response.startDate '_value': response.startDate,
} },
] ],
} },
] ],
}; };
qs.name = 'log-actions'; qs.name = 'log-actions';
do { do {
@ -1190,7 +1183,7 @@ export class TheHive implements INodeType {
'POST', 'POST',
`/v1/query`, `/v1/query`,
body, body,
qs qs,
); );
} while (response.status === 'Waiting' || response.status === 'InProgress'); } while (response.status === 'Waiting' || response.status === 'InProgress');
@ -1208,7 +1201,7 @@ export class TheHive implements INodeType {
flag: this.getNodeParameter('flag', i), flag: this.getNodeParameter('flag', i),
tlp: this.getNodeParameter('tlp', i), tlp: this.getNodeParameter('tlp', i),
tags: splitTags(this.getNodeParameter('tags', i) as string), 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( responseData = await theHiveApiRequest.call(
@ -1242,9 +1235,9 @@ export class TheHive implements INodeType {
'query': [ 'query': [
{ {
'_name': 'getCase', '_name': 'getCase',
'idOrName': caseId 'idOrName': caseId,
} },
] ],
}; };
qs.name = `get-case-${caseId}`; qs.name = `get-case-${caseId}`;
@ -1273,7 +1266,7 @@ export class TheHive implements INodeType {
const version = credentials.apiVersion; 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(); const _searchQuery: IQueryObject = And();
@ -1282,15 +1275,15 @@ export class TheHive implements INodeType {
for (const key of Object.keys(queryAttributs)) { for (const key of Object.keys(queryAttributs)) {
if (key === 'tags') { if (key === 'tags') {
(_searchQuery['_and'] as IQueryObject[]).push( (_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') { } else if (key === 'description' || key === 'summary' || key === 'title') {
(_searchQuery['_and'] as IQueryObject[]).push( (_searchQuery['_and'] as IQueryObject[]).push(
ContainsString(key, queryAttributs[key] as string) ContainsString(key, queryAttributs[key] as string),
); );
} else { } else {
(_searchQuery['_and'] as IQueryObject[]).push( (_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 = { body = {
'query': [ 'query': [
{ {
'_name': 'listCase' '_name': 'listCase',
}, },
{ {
'_name': 'filter', '_name': 'filter',
'_and': _searchQuery['_and'] '_and': _searchQuery['_and'],
}, },
] ],
}; };
//@ts-ignore //@ts-ignore
@ -1361,7 +1354,7 @@ export class TheHive implements INodeType {
const id = this.getNodeParameter('id', i) as string; const id = this.getNodeParameter('id', i) as string;
const body: IDataObject = { const body: IDataObject = {
...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters) ...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters),
}; };
responseData = await theHiveApiRequest.call( responseData = await theHiveApiRequest.call(
@ -1375,18 +1368,18 @@ export class TheHive implements INodeType {
if (resource === 'task') { if (resource === 'task') {
if (operation === 'count') { 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(); const _countSearchQuery: IQueryObject = And();
for (const key of Object.keys(countQueryAttributs)) { for (const key of Object.keys(countQueryAttributs)) {
if (key === 'title' || key === 'description') { if (key === 'title' || key === 'description') {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_countSearchQuery['_and'] as IQueryObject[]).push(
ContainsString(key, countQueryAttributs[key] as string) ContainsString(key, countQueryAttributs[key] as string),
); );
} else { } else {
(_countSearchQuery['_and'] as IQueryObject[]).push( (_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 = { const body = {
'query': [ 'query': [
{ {
'_name': 'listTask' '_name': 'listTask',
}, },
{ {
'_name': 'filter', '_name': 'filter',
'_and': _countSearchQuery['_and'] '_and': _countSearchQuery['_and'],
}, },
] ],
}; };
body['query'].push( body['query'].push(
{ {
'_name': 'count', '_name': 'count',
} },
); );
qs.name = 'count-tasks'; qs.name = 'count-tasks';
@ -1429,7 +1422,7 @@ export class TheHive implements INodeType {
title: this.getNodeParameter('title', i) as string, title: this.getNodeParameter('title', i) as string,
status: this.getNodeParameter('status', i) as string, status: this.getNodeParameter('status', i) as string,
flag: this.getNodeParameter('flag', i), flag: this.getNodeParameter('flag', i),
...prepareOptional(this.getNodeParameter('options', i, {}) as INodeParameters) ...prepareOptional(this.getNodeParameter('options', i, {}) as INodeParameters),
}; };
responseData = await theHiveApiRequest.call( responseData = await theHiveApiRequest.call(
@ -1449,7 +1442,7 @@ export class TheHive implements INodeType {
body = { body = {
responderId, responderId,
objectId: taskId, objectId: taskId,
objectType: 'case_task' objectType: 'case_task',
}; };
response = await theHiveApiRequest.call( response = await theHiveApiRequest.call(
this, this,
@ -1460,26 +1453,26 @@ export class TheHive implements INodeType {
body = { body = {
query: [ query: [
{ {
'_name': 'listAction' '_name': 'listAction',
}, },
{ {
'_name': 'filter', '_name': 'filter',
'_and': [ '_and': [
{ {
'_field': 'cortexId', '_field': 'cortexId',
'_value': response.cortexId '_value': response.cortexId,
}, },
{ {
'_field': 'objectId', '_field': 'objectId',
'_value': response.objectId '_value': response.objectId,
}, },
{ {
'_field': 'startDate', '_field': 'startDate',
'_value': response.startDate '_value': response.startDate,
} },
] ],
} },
], ],
}; };
qs.name = 'task-actions'; qs.name = 'task-actions';
@ -1489,7 +1482,7 @@ export class TheHive implements INodeType {
'POST', 'POST',
`/v1/query`, `/v1/query`,
body, body,
qs qs,
); );
} while (response.status === 'Waiting' || response.status === 'InProgress'); } while (response.status === 'Waiting' || response.status === 'InProgress');
@ -1518,9 +1511,9 @@ export class TheHive implements INodeType {
'query': [ 'query': [
{ {
'_name': 'getTask', '_name': 'getTask',
'idOrName': taskId 'idOrName': taskId,
} },
] ],
}; };
qs.name = `get-task-${taskId}`; qs.name = `get-task-${taskId}`;
@ -1574,12 +1567,12 @@ export class TheHive implements INodeType {
'query': [ 'query': [
{ {
'_name': 'getCase', '_name': 'getCase',
'idOrName': caseId 'idOrName': caseId,
}, },
{ {
'_name': 'tasks' '_name': 'tasks',
}, },
] ],
}; };
//@ts-ignore //@ts-ignore
@ -1624,7 +1617,7 @@ export class TheHive implements INodeType {
const version = credentials.apiVersion; 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(); const _searchQuery: IQueryObject = And();
@ -1633,11 +1626,11 @@ export class TheHive implements INodeType {
for (const key of Object.keys(queryAttributs)) { for (const key of Object.keys(queryAttributs)) {
if (key === 'title' || key === 'description') { if (key === 'title' || key === 'description') {
(_searchQuery['_and'] as IQueryObject[]).push( (_searchQuery['_and'] as IQueryObject[]).push(
ContainsString(key, queryAttributs[key] as string) ContainsString(key, queryAttributs[key] as string),
); );
} else { } else {
(_searchQuery['_and'] as IQueryObject[]).push( (_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 = { body = {
'query': [ 'query': [
{ {
'_name': 'listTask' '_name': 'listTask',
}, },
{ {
'_name': 'filter', '_name': 'filter',
'_and': _searchQuery['_and'] '_and': _searchQuery['_and'],
}, },
] ],
}; };
//@ts-ignore //@ts-ignore
@ -1709,7 +1702,7 @@ export class TheHive implements INodeType {
const id = this.getNodeParameter('id', i) as string; const id = this.getNodeParameter('id', i) as string;
const body: IDataObject = { const body: IDataObject = {
...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters) ...prepareOptional(this.getNodeParameter('updateFields', i, {}) as INodeParameters),
}; };
responseData = await theHiveApiRequest.call( responseData = await theHiveApiRequest.call(
@ -1718,9 +1711,7 @@ export class TheHive implements INodeType {
`/case/task/${id}` as string, `/case/task/${id}` as string,
body, body,
); );
} }
} }
if (resource === 'log') { if (resource === 'log') {
@ -1762,10 +1753,10 @@ export class TheHive implements INodeType {
options: { options: {
contentType: binaryData.mimeType, contentType: binaryData.mimeType,
filename: binaryData.fileName, filename: binaryData.fileName,
}
}, },
_json: JSON.stringify(body) },
} _json: JSON.stringify(body),
},
}; };
body = {}; body = {};
@ -1779,7 +1770,7 @@ export class TheHive implements INodeType {
body, body,
qs, qs,
'', '',
options options,
); );
} }
@ -1792,7 +1783,7 @@ export class TheHive implements INodeType {
body = { body = {
responderId, responderId,
objectId: logId, objectId: logId,
objectType: 'case_task_log' objectType: 'case_task_log',
}; };
response = await theHiveApiRequest.call( response = await theHiveApiRequest.call(
this, this,
@ -1803,27 +1794,27 @@ export class TheHive implements INodeType {
body = { body = {
query: [ query: [
{ {
'_name': 'listAction' '_name': 'listAction',
}, },
{ {
'_name': 'filter', '_name': 'filter',
'_and': [ '_and': [
{ {
'_field': 'cortexId', '_field': 'cortexId',
'_value': response.cortexId '_value': response.cortexId,
}, },
{ {
'_field': 'objectId', '_field': 'objectId',
'_value': response.objectId '_value': response.objectId,
}, },
{ {
'_field': 'startDate', '_field': 'startDate',
'_value': response.startDate '_value': response.startDate,
} },
] ],
} },
] ],
}; };
qs.name = 'log-actions'; qs.name = 'log-actions';
do { do {
@ -1832,7 +1823,7 @@ export class TheHive implements INodeType {
'POST', 'POST',
`/v1/query`, `/v1/query`,
body, body,
qs qs,
); );
} while (response.status === 'Waiting' || response.status === 'InProgress'); } while (response.status === 'Waiting' || response.status === 'InProgress');
@ -1862,21 +1853,18 @@ export class TheHive implements INodeType {
query: [ query: [
{ {
_name: 'getLog', _name: 'getLog',
idOrName: logId idOrName: logId,
} },
] ],
}; };
qs.name = `get-log-${logId}`; qs.name = `get-log-${logId}`;
} else { } else {
method = 'POST'; method = 'POST';
endpoint = '/case/task/log/_search'; endpoint = '/case/task/log/_search';
body.query = { _id: logId }; body.query = { _id: logId };
} }
responseData = await theHiveApiRequest.call( responseData = await theHiveApiRequest.call(
@ -1889,7 +1877,6 @@ export class TheHive implements INodeType {
} }
if (operation === 'getAll') { if (operation === 'getAll') {
const credentials = this.getCredentials('theHiveApi') as IDataObject; const credentials = this.getCredentials('theHiveApi') as IDataObject;
const returnAll = this.getNodeParameter('returnAll', i) as boolean; const returnAll = this.getNodeParameter('returnAll', i) as boolean;
@ -1919,12 +1906,12 @@ export class TheHive implements INodeType {
'query': [ 'query': [
{ {
'_name': 'getTask', '_name': 'getTask',
'idOrName': taskId 'idOrName': taskId,
}, },
{ {
'_name': 'logs' '_name': 'logs',
}, },
] ],
}; };
if (limit !== undefined) { if (limit !== undefined) {
@ -1945,7 +1932,7 @@ export class TheHive implements INodeType {
body.query = And(Parent( body.query = And(Parent(
'task', 'task',
Id(taskId) Id(taskId),
)); ));
} }

View file

@ -4,10 +4,10 @@ import {
import { import {
IDataObject, IDataObject,
INodeTypeDescription,
INodeType,
IWebhookResponseData,
IHookFunctions, IHookFunctions,
INodeType,
INodeTypeDescription,
IWebhookResponseData,
} from 'n8n-workflow'; } from 'n8n-workflow';
export class TheHiveTrigger implements INodeType { export class TheHiveTrigger implements INodeType {
@ -111,9 +111,9 @@ export class TheHiveTrigger implements INodeType {
value: 'case_task_log_create', value: 'case_task_log_create',
description: 'Triggered when a task log is created', description: 'Triggered when a task log is created',
}, },
] ],
} },
] ],
}; };
// @ts-ignore (because of request) // @ts-ignore (because of request)
webhookMethods = { webhookMethods = {
@ -158,7 +158,7 @@ export class TheHiveTrigger implements INodeType {
return { return {
workflowData: [ workflowData: [
this.helpers.returnJsonArray(returnData) this.helpers.returnJsonArray(returnData),
], ],
}; };
} }

View file

@ -78,7 +78,7 @@ export const alertFields = [
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource: [
'alert' 'alert',
], ],
operation: [ operation: [
'promote', 'promote',
@ -89,7 +89,7 @@ export const alertFields = [
], ],
}, },
}, },
description: 'Title of the alert' description: 'Title of the alert',
}, },
{ {
displayName: 'Case ID', displayName: 'Case ID',
@ -151,11 +151,11 @@ export const alertFields = [
options: [ options: [
{ {
name: 'Low', name: 'Low',
value: 1 value: 1,
}, },
{ {
name: 'Medium', name: 'Medium',
value: 2 value: 2,
}, },
{ {
name: 'High', 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', displayName: 'Tags',
@ -211,7 +211,7 @@ export const alertFields = [
], ],
}, },
}, },
description: 'Case Tags' description: 'Case Tags',
}, },
{ {
displayName: 'TLP', displayName: 'TLP',
@ -234,7 +234,7 @@ export const alertFields = [
}, { }, {
name: 'Red', name: 'Red',
value: TLP.red, value: TLP.red,
} },
], ],
displayOptions: { displayOptions: {
show: { show: {
@ -246,7 +246,7 @@ export const alertFields = [
], ],
}, },
}, },
description: 'Traffict Light Protocol (TLP). Default=Amber' description: 'Traffict Light Protocol (TLP). Default=Amber',
}, },
{ {
displayName: 'Status', displayName: 'Status',
@ -264,7 +264,7 @@ export const alertFields = [
}, },
{ {
name: 'Ignored', name: 'Ignored',
value: 'Ignored' value: 'Ignored',
}, },
{ {
name: 'Imported', name: 'Imported',
@ -300,7 +300,7 @@ export const alertFields = [
], ],
}, },
}, },
description: 'Type of the alert' description: 'Type of the alert',
}, },
{ {
displayName: 'Source', displayName: 'Source',
@ -318,7 +318,7 @@ export const alertFields = [
], ],
}, },
}, },
description: 'Source of the alert' description: 'Source of the alert',
}, },
{ {
displayName: 'SourceRef', displayName: 'SourceRef',
@ -336,7 +336,7 @@ export const alertFields = [
], ],
}, },
}, },
description: 'Source reference of the alert' description: 'Source reference of the alert',
}, },
{ {
displayName: 'Follow', displayName: 'Follow',
@ -446,7 +446,7 @@ export const alertFields = [
], ],
}, },
], ],
description: 'Artifact attributes' description: 'Artifact attributes',
}, },
// required for responder execution // required for responder execution
{ {
@ -502,7 +502,7 @@ export const alertFields = [
name: 'caseTemplate', name: 'caseTemplate',
type: 'string', type: 'string',
default: '', 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', value: 'file',
}, },
], ],
description: '',
}, },
{ {
displayName: 'Data', displayName: 'Data',
@ -571,7 +570,6 @@ export const alertFields = [
}, },
}, },
default: '', default: '',
description: '',
}, },
{ {
displayName: 'Binary Property', displayName: 'Binary Property',
@ -585,21 +583,18 @@ export const alertFields = [
}, },
}, },
default: 'data', default: 'data',
description: '',
}, },
{ {
displayName: 'Message', displayName: 'Message',
name: 'message', name: 'message',
type: 'string', type: 'string',
default: '', default: '',
description: '',
}, },
{ {
displayName: 'Case Tags', displayName: 'Case Tags',
name: 'tags', name: 'tags',
type: 'string', type: 'string',
default: '', default: '',
description: '',
}, },
], ],
}, },
@ -611,7 +606,7 @@ export const alertFields = [
type: 'string', type: 'string',
required: false, required: false,
default: '', 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', displayName: 'Description',
@ -619,14 +614,14 @@ export const alertFields = [
type: 'string', type: 'string',
required: false, required: false,
default: '', default: '',
description: 'Description of the alert', description: 'Description of the alert.',
}, },
{ {
displayName: 'Follow', displayName: 'Follow',
name: 'follow', name: 'follow',
type: 'boolean', type: 'boolean',
default: true, 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', displayName: 'Severity',
@ -686,7 +681,7 @@ export const alertFields = [
type: 'string', type: 'string',
required: false, required: false,
default: '', default: '',
description: 'Title of the alert' description: 'Title of the alert.',
}, },
{ {
displayName: 'TLP', displayName: 'TLP',
@ -712,7 +707,7 @@ export const alertFields = [
value: TLP.red, 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: { displayOptions: {
show: { show: {
resource: [ resource: [
'alert' 'alert',
], ],
operation: [ operation: [
'getAll', 'getAll',
@ -766,7 +761,7 @@ export const alertFields = [
name: 'description', name: 'description',
type: 'string', type: 'string',
default: '', default: '',
description: 'Description of the alert', description: 'Description of the alert.',
}, },
{ {
displayName: 'Follow', displayName: 'Follow',
@ -782,15 +777,15 @@ export const alertFields = [
options: [ options: [
{ {
name: 'Low', name: 'Low',
value: 1 value: 1,
}, },
{ {
name: 'Medium', name: 'Medium',
value: 2 value: 2,
}, },
{ {
name: 'High', name: 'High',
value: 3 value: 3,
}, },
], ],
default: 2, default: 2,
@ -830,10 +825,10 @@ export const alertFields = [
{ {
name: 'Red', name: 'Red',
value: TLP.red, value: TLP.red,
}
],
description: 'Traffict Light Protocol (TLP). Default=Amber'
}, },
], ],
} description: 'Traffict Light Protocol (TLP). Default=Amber',
},
],
},
] as INodeProperties[]; ] as INodeProperties[];

View file

@ -247,7 +247,7 @@ export const caseFields = [
], ],
}, },
}, },
description: 'Traffict Light Protocol (TLP). Default=Amber' description: 'Traffict Light Protocol (TLP). Default=Amber',
}, },
{ {
displayName: 'Tags', displayName: 'Tags',
@ -385,15 +385,15 @@ export const caseFields = [
options: [ options: [
{ {
name: 'No Impact', name: 'No Impact',
value: 'NoImpact' value: 'NoImpact',
}, },
{ {
name: 'With Impact', name: 'With Impact',
value: 'WithImpact' value: 'WithImpact',
}, },
{ {
name: 'Not Applicable', name: 'Not Applicable',
value: 'NotApplicable' value: 'NotApplicable',
}, },
], ],
description: 'Impact status of the case', description: 'Impact status of the case',
@ -419,23 +419,23 @@ export const caseFields = [
options: [ options: [
{ {
value: 'Indeterminate', value: 'Indeterminate',
name: 'Indeterminate' name: 'Indeterminate',
}, },
{ {
value: 'False Positive', value: 'False Positive',
name: 'FalsePositive' name: 'FalsePositive',
}, },
{ {
value: 'True Positive', value: 'True Positive',
name: 'TruePositive' name: 'TruePositive',
}, },
{ {
value: 'Other', value: 'Other',
name: 'Other' name: 'Other',
}, },
{ {
value: 'Duplicated', value: 'Duplicated',
name: 'Duplicated' name: 'Duplicated',
}, },
], ],
description: 'Resolution status of the case', description: 'Resolution status of the case',
@ -447,15 +447,15 @@ export const caseFields = [
options: [ options: [
{ {
name: 'Low', name: 'Low',
value: 1 value: 1,
}, },
{ {
name: 'Medium', name: 'Medium',
value: 2 value: 2,
}, },
{ {
name: 'High', name: 'High',
value: 3 value: 3,
}, },
], ],
default: 2, default: 2,
@ -493,7 +493,7 @@ export const caseFields = [
name: 'summary', name: 'summary',
type: 'string', type: 'string',
default: '', 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', displayName: 'Tags',
@ -531,7 +531,7 @@ export const caseFields = [
value: TLP.red, 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: { displayOptions: {
show: { show: {
resource: [ resource: [
'case' 'case',
], ],
operation: [ operation: [
'getAll', 'getAll',
@ -665,15 +665,15 @@ export const caseFields = [
options: [ options: [
{ {
name: 'Low', name: 'Low',
value: 1 value: 1,
}, },
{ {
name: 'Medium', name: 'Medium',
value: 2 value: 2,
}, },
{ {
name: 'High', name: 'High',
value: 3 value: 3,
}, },
], ],
default: 2, default: 2,

View file

@ -25,12 +25,12 @@ export const logOperations = [
{ {
name: 'Execute Responder', name: 'Execute Responder',
value: 'executeResponder', value: 'executeResponder',
description: 'Execute a responder on a selected log' description: 'Execute a responder on a selected log',
}, },
{ {
name: 'Get All', name: 'Get All',
value: 'getAll', value: 'getAll',
description: 'Get all task logs' description: 'Get all task logs',
}, },
{ {
name: 'Get', name: 'Get',
@ -38,7 +38,7 @@ export const logOperations = [
description: 'Get a single log', description: 'Get a single log',
}, },
], ],
} },
] as INodeProperties[]; ] as INodeProperties[];
export const logFields = [ export const logFields = [
@ -195,7 +195,7 @@ export const logFields = [
loadOptionsDependsOn: [ loadOptionsDependsOn: [
'id', 'id',
], ],
loadOptionsMethod: 'loadResponders' loadOptionsMethod: 'loadResponders',
}, },
displayOptions: { displayOptions: {
show: { show: {
@ -258,5 +258,5 @@ export const logFields = [
description: 'File attached to the log', description: 'File attached to the log',
}, },
], ],
} },
] as INodeProperties[]; ] as INodeProperties[];

View file

@ -127,55 +127,55 @@ export const observableFields = [
}, },
{ {
name: 'file', name: 'file',
value: 'file' value: 'file',
}, },
{ {
name: 'filename', name: 'filename',
value: 'filename' value: 'filename',
}, },
{ {
name: 'fqdn', name: 'fqdn',
value: 'fqdn' value: 'fqdn',
}, },
{ {
name: 'hash', name: 'hash',
value: 'hash' value: 'hash',
}, },
{ {
name: 'ip', name: 'ip',
value: 'ip' value: 'ip',
}, },
{ {
name: 'mail', name: 'mail',
value: 'mail' value: 'mail',
}, },
{ {
name: 'mail_subject', name: 'mail_subject',
value: 'mail_subject' value: 'mail_subject',
}, },
{ {
name: 'other', name: 'other',
value: 'other' value: 'other',
}, },
{ {
name: 'regexp', name: 'regexp',
value: 'regexp' value: 'regexp',
}, },
{ {
name: 'registry', name: 'registry',
value: 'registry' value: 'registry',
}, },
{ {
name: 'uri_path', name: 'uri_path',
value: 'uri_path' value: 'uri_path',
}, },
{ {
name: 'url', name: 'url',
value: 'url' value: 'url',
}, },
{ {
name: 'user-agent', name: 'user-agent',
value: 'user-agent' value: 'user-agent',
}, },
], ],
displayOptions: { displayOptions: {
@ -243,7 +243,7 @@ export const observableFields = [
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource: [
'observable' 'observable',
], ],
operation: [ operation: [
'create', 'create',
@ -607,59 +607,59 @@ export const observableFields = [
options: [ options: [
{ {
name: 'domain', name: 'domain',
value: 'domain' value: 'domain',
}, },
{ {
name: 'file', name: 'file',
value: 'file' value: 'file',
}, },
{ {
name: 'filename', name: 'filename',
value: 'filename' value: 'filename',
}, },
{ {
name: 'fqdn', name: 'fqdn',
value: 'fqdn' value: 'fqdn',
}, },
{ {
name: 'hash', name: 'hash',
value: 'hash' value: 'hash',
}, },
{ {
name: 'ip', name: 'ip',
value: 'ip' value: 'ip',
}, },
{ {
name: 'mail', name: 'mail',
value: 'mail' value: 'mail',
}, },
{ {
name: 'mail_subject', name: 'mail_subject',
value: 'mail_subject' value: 'mail_subject',
}, },
{ {
name: 'other', name: 'other',
value: 'other' value: 'other',
}, },
{ {
name: 'regexp', name: 'regexp',
value: 'regexp' value: 'regexp',
}, },
{ {
name: 'registry', name: 'registry',
value: 'registry' value: 'registry',
}, },
{ {
name: 'uri_path', name: 'uri_path',
value: 'uri_path' value: 'uri_path',
}, },
{ {
name: 'url', name: 'url',
value: 'url' value: 'url',
}, },
{ {
name: 'user-agent', name: 'user-agent',
value: 'user-agent' value: 'user-agent',
}, },
], ],
description: 'Type of the observable', description: 'Type of the observable',

View file

@ -132,20 +132,20 @@ export const taskFields = [
default: 'Waiting', default: 'Waiting',
options: [ options: [
{ {
name: 'Waiting', name: 'Cancel',
value: 'Waiting', value: 'Cancel',
},
{
name: 'InProgress',
value: 'InProgress',
}, },
{ {
name: 'Completed', name: 'Completed',
value: 'Completed', value: 'Completed',
}, },
{ {
name: 'Cancel', name: 'InProgress',
value: 'Cancel', value: 'InProgress',
},
{
name: 'Waiting',
value: 'Waiting',
}, },
], ],
required: true, 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', description: 'Date of the beginning of the task. This is automatically set when status is set to Open',
}, },
{ {
displayName: 'status', displayName: 'Status',
name: 'status', name: 'status',
type: 'options', type: 'options',
default: 'Waiting', default: 'Waiting',
options: [ options: [
{ {
name: 'Waiting', name: 'Cancel',
value: 'Waiting', value: 'Cancel',
},
{
name: 'In Progress',
value: 'InProgress',
}, },
{ {
name: 'Completed', name: 'Completed',
value: 'Completed', value: 'Completed',
}, },
{ {
name: 'Cancel', name: 'In Progress',
value: 'Cancel', value: 'InProgress',
},
{
name: 'Waiting',
value: 'Waiting',
}, },
], ],
description: 'Status of the task. Default=Waiting', description: 'Status of the task. Default=Waiting',
@ -438,20 +438,20 @@ export const taskFields = [
default: 'Waiting', default: 'Waiting',
options: [ options: [
{ {
name: 'Waiting', name: 'Cancel',
value: 'Waiting', value: 'Cancel',
},
{
name: 'In Progress',
value: 'InProgress'
}, },
{ {
name: 'Completed', name: 'Completed',
value: 'Completed' value: 'Completed',
}, },
{ {
name: 'Cancel', name: 'In Progress',
value: 'Cancel' value: 'InProgress',
},
{
name: 'Waiting',
value: 'Waiting',
}, },
], ],
description: 'Status of the task. Default=Waiting', description: 'Status of the task. Default=Waiting',

View file

@ -1,17 +1,17 @@
import { import {
IDataObject IDataObject,
}from 'n8n-workflow' } from 'n8n-workflow';
export enum AlertStatus { export enum AlertStatus {
NEW="New", NEW = 'New',
UPDATED="Updated", UPDATED = 'Updated',
IGNORED="Ignored", IGNORED = 'Ignored',
IMPORTED="Imported", IMPORTED = 'Imported',
} }
export enum TLP { export enum TLP {
white, white,
green, green,
amber, amber,
red red,
} }
export interface IAlert { export interface IAlert {

View file

@ -1,4 +1,4 @@
import { IDataObject } from "n8n-workflow"; import { IDataObject } from 'n8n-workflow';
import { TLP } from './AlertInterface'; import { TLP } from './AlertInterface';
export interface ICase { export interface ICase {
// Required attributes // Required attributes
@ -33,21 +33,21 @@ export interface ICase{
export enum CaseStatus { export enum CaseStatus {
OPEN="Open", OPEN = 'Open',
RESOLVED="Resolved", RESOLVED = 'Resolved',
DELETED="Deleted", DELETED = 'Deleted',
} }
export enum CaseResolutionStatus { export enum CaseResolutionStatus {
INDETERMINATE="Indeterminate", INDETERMINATE = 'Indeterminate',
FALSEPOSITIVE="FalsePositive", FALSEPOSITIVE = 'FalsePositive',
TRUEPOSITIVE="TruePositive", TRUEPOSITIVE = 'TruePositive',
OTHER="Other", OTHER = 'Other',
DUPLICATED="Duplicated", DUPLICATED = 'Duplicated',
} }
export enum CaseImpactStatus { export enum CaseImpactStatus {
NOIMPACT="NoImpact", NOIMPACT = 'NoImpact',
WITHIMPACT="WithImpact", WITHIMPACT = 'WithImpact',
NOTAPPLICABLE="NotApplicable", NOTAPPLICABLE = 'NotApplicable',
} }

View file

@ -1,8 +1,7 @@
import { IDataObject } from "n8n-workflow"; import { IAttachment } from './ObservableInterface';
import {IAttachment} from "./ObservableInterface";
export enum LogStatus { export enum LogStatus {
OK="Ok", OK = 'Ok',
DELETED="Deleted" DELETED = 'Deleted',
} }
export interface ILog { export interface ILog {
// Required attributes // Required attributes

View file

@ -1,27 +1,26 @@
import { import {
TLP TLP
}from './AlertInterface' } from './AlertInterface';
import { IDataObject } from 'n8n-workflow';
export enum ObservableStatus { export enum ObservableStatus {
OK="Ok", OK = 'Ok',
DELETED="Deleted", DELETED = 'Deleted',
} }
export enum ObservableDataType { export enum ObservableDataType {
"domain"= "domain", 'domain' = 'domain',
"file"= "file", 'file' = 'file',
"filename"= "filename", 'filename' = 'filename',
"fqdn"= "fqdn", 'fqdn' = 'fqdn',
"hash"= "hash", 'hash' = 'hash',
"ip"= "ip", 'ip' = 'ip',
"mail"= "mail", 'mail' = 'mail',
"mail_subject"= "mail_subject", 'mail_subject' = 'mail_subject',
"other"= "other", 'other' = 'other',
"regexp"= "regexp", 'regexp' = 'regexp',
"registry"= "registry", 'registry' = 'registry',
"uri_path"= "uri_path", 'uri_path' = 'uri_path',
"url"= "url", 'url' = 'url',
"user-agent"= "user-agent" 'user-agent' = 'user-agent',
} }
export interface IAttachment { export interface IAttachment {
@ -50,5 +49,4 @@ export interface IObservable{
createdAt?: Date; createdAt?: Date;
updatedBy?: string; updatedBy?: string;
upadtedAt?: Date; upadtedAt?: Date;
} }

View file

@ -18,8 +18,8 @@ export interface ITask{
} }
export enum TaskStatus { export enum TaskStatus {
WAITING="Waiting", WAITING = 'Waiting',
INPROGRESS="InProgress", INPROGRESS = 'InProgress',
COMPLETED="Completed", COMPLETED = 'Completed',
CANCEL="Cancel", CANCEL = 'Cancel',
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 819 B