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

@ -27,16 +27,16 @@ export class TheHiveApi implements ICredentialType {
default: '', default: '',
type: 'options' as NodePropertyTypes, type: 'options' as NodePropertyTypes,
description: 'The version of api to be used', description: 'The version of api to be used',
options:[ options: [
{ {
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

@ -4,7 +4,7 @@ import {
import { import {
TLP, TLP,
}from './AnalyzerInterface'; } from './AnalyzerInterface';
export const analyzersOperations = [ export const analyzersOperations = [
{ {
@ -31,7 +31,7 @@ export const analyzersOperations = [
}, },
] as INodeProperties[]; ] as INodeProperties[];
export const analyzerFields: INodeProperties[] =[ export const analyzerFields: INodeProperties[] = [
{ {
displayName: 'Analyzer Type', displayName: 'Analyzer Type',
name: 'analyzer', name: 'analyzer',
@ -40,12 +40,12 @@ export const analyzerFields: INodeProperties[] =[
typeOptions: { typeOptions: {
loadOptionsMethod: 'loadActiveAnalyzers', loadOptionsMethod: 'loadActiveAnalyzers',
}, },
displayOptions:{ displayOptions: {
show: { show: {
resource: [ resource: [
'analyzer', 'analyzer',
], ],
operation:[ operation: [
'execute', 'execute',
], ],
}, },
@ -58,22 +58,22 @@ export const analyzerFields: INodeProperties[] =[
name: 'observableType', name: 'observableType',
type: 'options', type: 'options',
required: true, required: true,
displayOptions:{ displayOptions: {
show: { show: {
resource: [ resource: [
'analyzer', 'analyzer',
], ],
operation:[ operation: [
'execute', 'execute',
], ],
}, },
hide:{ hide: {
analyzer:[ analyzer: [
'', '',
], ],
}, },
}, },
typeOptions:{ typeOptions: {
loadOptionsMethod: 'loadObservableOptions', loadOptionsMethod: 'loadObservableOptions',
loadOptionsDependsOn: [ loadOptionsDependsOn: [
'analyzer', 'analyzer',
@ -94,15 +94,15 @@ export const analyzerFields: INodeProperties[] =[
resource: [ resource: [
'analyzer', 'analyzer',
], ],
operation:[ operation: [
'execute', 'execute',
], ],
}, },
hide:{ hide: {
observableType: [ observableType: [
'file', 'file',
], ],
analyzer:[ analyzer: [
'', '',
], ],
}, },
@ -136,7 +136,7 @@ export const analyzerFields: INodeProperties[] =[
name: 'tlp', name: 'tlp',
type: 'options', type: 'options',
required: false, required: false,
displayOptions:{ displayOptions: {
show: { show: {
resource: [ resource: [
'analyzer', 'analyzer',
@ -145,7 +145,7 @@ export const analyzerFields: INodeProperties[] =[
'execute', 'execute',
], ],
}, },
hide:{ hide: {
observableType: [ observableType: [
'', '',
], ],
@ -166,10 +166,10 @@ export const analyzerFields: INodeProperties[] =[
{ {
name: 'Amber', name: 'Amber',
value: TLP.amber, value: TLP.amber,
},{ }, {
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

@ -1,39 +1,39 @@
import { import {
IDataObject, IDataObject,
}from 'n8n-workflow'; } from 'n8n-workflow';
export enum JobStatus { export enum JobStatus {
WAITING = 'Waiting', WAITING = 'Waiting',
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 {
'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 IJob{ export interface IJob {
id?: string; id?: string;
organization?: string; organization?: string;
analyzerDefinitionId?: string; analyzerDefinitionId?: string;
@ -44,7 +44,7 @@ export interface IJob{
data?: string; data?: string;
attachment?: IDataObject; attachment?: IDataObject;
parameters?: IDataObject; parameters?: IDataObject;
message? :string; message?: string;
tlp?: TLP; tlp?: TLP;
startDate?: Date; startDate?: Date;
endDate?: Date; endDate?: Date;
@ -54,10 +54,10 @@ export interface IJob{
updatedBy?: Date; updatedBy?: Date;
report?: IDataObject | string; report?: IDataObject | string;
} }
export interface IAnalyzer{ export interface IAnalyzer {
id?: string; id?: string;
analyzerDefinitionId?: string; analyzerDefinitionId?: string;
name? :string; name?: string;
version?: string; version?: string;
description?: string; description?: string;
author?: string; author?: string;
@ -74,7 +74,7 @@ export interface IAnalyzer{
updatedBy?: Date; updatedBy?: Date;
} }
export interface IResponder{ export interface IResponder {
id?: string; id?: string;
name?: string; name?: string;
version?: string; version?: 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 {
@ -74,21 +74,21 @@ export class Cortex implements INodeType {
// Node properties which the user gets displayed and // Node properties which the user gets displayed and
// can change on the node. // can change on the node.
{ {
displayName:'Resource', displayName: 'Resource',
name:'resource', name: 'resource',
type:'options', type: 'options',
options:[ options: [
{ {
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',
@ -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(
@ -327,13 +327,11 @@ export class Cortex implements INodeType {
const entityType = this.getNodeParameter('entityType', i) as string; const entityType = this.getNodeParameter('entityType', i) as string;
const isJSON = this.getNodeParameter('jsonObject',i) as boolean; const isJSON = this.getNodeParameter('jsonObject', i) as boolean;
let body:IDataObject; let body: IDataObject;
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 = {
@ -344,22 +342,22 @@ export class Cortex implements INodeType {
tlp: entityJson.tlp || 2, tlp: entityJson.tlp || 2,
pap: entityJson.pap || 2, pap: entityJson.pap || 2,
message: entityJson.message || '', message: entityJson.message || '',
parameters:[], parameters: [],
}; };
}else{ } else {
const values = (this.getNodeParameter('parameters',i) as IDataObject).values as IDataObject; const values = (this.getNodeParameter('parameters', i) as IDataObject).values as IDataObject;
body= { body = {
responderId, responderId,
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
const artifacts = (body.data as IDataObject).artifacts as IDataObject; const artifacts = (body.data as IDataObject).artifacts as IDataObject;
@ -409,7 +407,7 @@ export class Cortex implements INodeType {
} }
} }
} }
if(entityType ==='case_artifact'){ if (entityType === 'case_artifact') {
// deal with file observable // deal with file observable
if ((body.data as IDataObject).dataType === 'file') { if ((body.data as IDataObject).dataType === 'file') {
@ -433,11 +431,11 @@ 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,
id:sha256, id: sha256,
}; };
delete (body.data as IDataObject).binaryPropertyName; delete (body.data as IDataObject).binaryPropertyName;
@ -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 {
@ -29,7 +29,7 @@ export async function cortexApiRequest(this: IHookFunctions | IExecuteFunctions
throw new Error('No credentials got returned!'); throw new Error('No credentials got returned!');
} }
const headerWithAuthentication = Object.assign({}, { Authorization: ` Bearer ${credentials.cortexApiKey}`}); const headerWithAuthentication = Object.assign({}, { Authorization: ` Bearer ${credentials.cortexApiKey}` });
let options: OptionsWithUri = { let options: OptionsWithUri = {
headers: headerWithAuthentication, headers: headerWithAuthentication,
@ -41,7 +41,7 @@ export async function cortexApiRequest(this: IHookFunctions | IExecuteFunctions
}; };
if (Object.keys(option).length !== 0) { if (Object.keys(option).length !== 0) {
options = Object.assign({},options, option); options = Object.assign({}, options, option);
} }
if (Object.keys(body).length === 0) { if (Object.keys(body).length === 0) {
delete options.body; delete options.body;
@ -53,14 +53,14 @@ export async function cortexApiRequest(this: IHookFunctions | IExecuteFunctions
try { try {
return await this.helpers.request!(options); return await this.helpers.request!(options);
} catch (error) { } catch (error) {
if (error.error ) { if (error.error) {
const errorMessage = `Cortex error response [${error.statusCode}]: ${error.error.message}`; const errorMessage = `Cortex error response [${error.statusCode}]: ${error.error.message}`;
throw new Error(errorMessage); throw new Error(errorMessage);
} else throw error; } else throw error;
} }
} }
export function getEntityLabel(entity: IDataObject): string{ export function getEntityLabel(entity: IDataObject): string {
let label = ''; let label = '';
switch (entity._type) { switch (entity._type) {
case 'case': case 'case':
@ -68,7 +68,7 @@ export function getEntityLabel(entity: IDataObject): string{
break; break;
case 'case_artifact': case 'case_artifact':
//@ts-ignore //@ts-ignore
label = `[${entity.dataType}] ${entity.data?entity.data:(entity.attachment.name)}`; label = `[${entity.dataType}] ${entity.data ? entity.data : (entity.attachment.name)}`;
break; break;
case 'alert': case 'alert':
label = `[${entity.source}:${entity.sourceRef}] ${entity.title}`; label = `[${entity.source}:${entity.sourceRef}] ${entity.title}`;
@ -95,7 +95,7 @@ export function splitTags(tags: string): string[] {
export function prepareParameters(values: IDataObject): IDataObject { export function prepareParameters(values: IDataObject): IDataObject {
const response: IDataObject = {}; const response: IDataObject = {};
for (const key in values) { for (const key in values) {
if (values[key]!== undefined && values[key]!==null && values[key]!=='') { if (values[key] !== undefined && values[key] !== null && values[key] !== '') {
if (moment(values[key] as string, moment.ISO_8601).isValid()) { if (moment(values[key] as string, moment.ISO_8601).isValid()) {
response[key] = Date.parse(values[key] as string); response[key] = Date.parse(values[key] as string);
} else if (key === 'tags') { } else if (key === 'tags') {

View file

@ -7,7 +7,7 @@ export const jobOperations = [
displayName: 'Operation', displayName: 'Operation',
name: 'operation', name: 'operation',
type: 'options', type: 'options',
description:'Choose an operation', description: 'Choose an operation',
required: true, required: true,
displayOptions: { displayOptions: {
show: { show: {
@ -32,13 +32,13 @@ export const jobOperations = [
}, },
] as INodeProperties[]; ] as INodeProperties[];
export const jobFields: INodeProperties[] =[ export const jobFields: INodeProperties[] = [
{ {
displayName: 'Job ID', displayName: 'Job ID',
name: 'jobId', name: 'jobId',
type: 'string', type: 'string',
required: true, required: true,
displayOptions:{ displayOptions: {
show: { show: {
resource: [ resource: [
'job', 'job',
@ -49,7 +49,7 @@ export const jobFields: INodeProperties[] =[
], ],
}, },
}, },
default:'', default: '',
description: 'ID of the job', description: 'ID of the job',
}, },
]; ];

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',
@ -199,13 +199,13 @@ export const responderFields: INodeProperties[] = [
name: 'tags', name: 'tags',
type: 'string', type: 'string',
default: '', default: '',
placeholder:'tag1,tag2,...', placeholder: 'tag1,tag2,...',
}, },
], ],
}, },
], ],
typeOptions:{ typeOptions: {
loadOptionsDependsOn:[ loadOptionsDependsOn: [
'entityType', 'entityType',
], ],
}, },
@ -231,7 +231,7 @@ export const responderFields: INodeProperties[] = [
], ],
}, },
}, },
default: {} default: {},
}, },
{ {
displayName: 'Parameters', displayName: 'Parameters',
@ -263,14 +263,14 @@ export const responderFields: INodeProperties[] = [
name: 'severity', name: 'severity',
type: 'options', type: 'options',
default: 2, default: 2,
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',
@ -300,19 +300,19 @@ export const responderFields: INodeProperties[] = [
default: 2, default: 2,
options: [ options: [
{ {
name:'White', name: 'White',
value:TLP.white, value: TLP.white,
}, },
{ {
name:'Green', name: 'Green',
value:TLP.green, value: TLP.green,
}, },
{ {
name:'Amber', name: 'Amber',
value:TLP.amber, value: TLP.amber,
},{ }, {
name:'Red', name: 'Red',
value:TLP.red, value: TLP.red,
} }
], ],
description: 'Traffict Light Protocol (TLP). Default=Amber', description: 'Traffict Light Protocol (TLP). Default=Amber',
@ -322,7 +322,7 @@ export const responderFields: INodeProperties[] = [
name: 'status', name: 'status',
type: 'options', type: 'options',
default: 'New', default: 'New',
options:[ options: [
{ {
name: 'New', name: 'New',
value: 'New', value: 'New',
@ -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,13 +367,13 @@ export const responderFields: INodeProperties[] = [
displayName: 'Follow', displayName: 'Follow',
name: 'follow', name: 'follow',
type: 'boolean', type: 'boolean',
default: false default: false,
}, },
{ {
displayName: 'Artifacts', displayName: 'Artifacts',
name: 'artifacts', name: 'artifacts',
type: 'fixedCollection', type: 'fixedCollection',
placeholder:'Add an artifact', placeholder: 'Add an artifact',
required: false, required: false,
typeOptions: { typeOptions: {
multipleValues: true, multipleValues: true,
@ -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,14 +493,14 @@ export const responderFields: INodeProperties[] = [
description: '', description: '',
}, },
], ],
}
]
}, },
]
}
], ],
typeOptions:{ },
loadOptionsDependsOn:[ ],
},
],
typeOptions: {
loadOptionsDependsOn: [
'entityType', 'entityType',
], ],
}, },
@ -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',
}, },
], ],
}, },
@ -611,9 +611,9 @@ export const responderFields: INodeProperties[] = [
name: 'data', name: 'data',
type: 'string', type: 'string',
default: '', default: '',
displayOptions:{ displayOptions: {
hide:{ hide: {
dataType:[ dataType: [
'file', 'file',
], ],
}, },
@ -626,25 +626,25 @@ export const responderFields: INodeProperties[] = [
default: 'data', default: 'data',
displayOptions: { displayOptions: {
show: { show: {
dataType:[ dataType: [
'file', 'file',
], ],
}, },
}, },
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',
@ -653,20 +653,20 @@ export const responderFields: INodeProperties[] = [
default: 2, default: 2,
options: [ options: [
{ {
name:'White', name: 'White',
value:TLP.white, value: TLP.white,
}, },
{ {
name:'Green', name: 'Green',
value:TLP.green, value: TLP.green,
}, },
{ {
name:'Amber', name: 'Amber',
value:TLP.amber, value: TLP.amber,
},{ }, {
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,13 +692,13 @@ 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.',
} },
], ],
}, },
], ],
typeOptions:{ typeOptions: {
loadOptionsDependsOn:[ loadOptionsDependsOn: [
'entityType', 'entityType',
], ],
}, },
@ -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,13 +776,13 @@ export const responderFields: INodeProperties[] = [
displayName: 'Flag', displayName: 'Flag',
name: 'flag', name: 'flag',
type: 'boolean', type: 'boolean',
default: false default: false,
} },
]
}
], ],
typeOptions:{ },
loadOptionsDependsOn:[ ],
typeOptions: {
loadOptionsDependsOn: [
'entityType', 'entityType',
], ],
}, },
@ -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',
@ -857,8 +857,8 @@ export const responderFields: INodeProperties[] = [
], ],
}, },
], ],
typeOptions:{ typeOptions: {
loadOptionsDependsOn:[ loadOptionsDependsOn: [
'entityType', 'entityType',
], ],
}, },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 837 B

View file

@ -33,7 +33,7 @@ export async function theHiveApiRequest(this: IHookFunctions | IExecuteFunctions
}; };
if (Object.keys(option).length !== 0) { if (Object.keys(option).length !== 0) {
options = Object.assign({},options, option); options = Object.assign({}, options, option);
} }
if (Object.keys(body).length === 0) { if (Object.keys(body).length === 0) {
@ -46,7 +46,7 @@ export async function theHiveApiRequest(this: IHookFunctions | IExecuteFunctions
try { try {
return await this.helpers.request!(options); return await this.helpers.request!(options);
} catch (error) { } catch (error) {
if (error.error ) { if (error.error) {
const errorMessage = `TheHive error response [${error.statusCode}]: ${error.error.message || error.error.type}`; const errorMessage = `TheHive error response [${error.statusCode}]: ${error.error.message || error.error.type}`;
throw new Error(errorMessage); throw new Error(errorMessage);
} else throw error; } else throw error;
@ -78,7 +78,7 @@ export function splitTags(tags: string): string[] {
export function prepareOptional(optionals: IDataObject): IDataObject { export function prepareOptional(optionals: IDataObject): IDataObject {
const response: IDataObject = {}; const response: IDataObject = {};
for (const key in optionals) { for (const key in optionals) {
if (optionals[key]!== undefined && optionals[key]!==null && optionals[key]!=='') { if (optionals[key] !== undefined && optionals[key] !== null && optionals[key] !== '') {
if (moment(optionals[key] as string, moment.ISO_8601).isValid()) { if (moment(optionals[key] as string, moment.ISO_8601).isValid()) {
response[key] = Date.parse(optionals[key] as string); response[key] = Date.parse(optionals[key] as string);
} else if (key === 'artifacts') { } else if (key === 'artifacts') {
@ -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

@ -1,81 +1,81 @@
// Query types // Query types
export declare type queryIndexSignature = '_field'|'_gt'|'_value'|'_gte'|'_lt'|'_lte'|'_and'|'_or'|'_not'|'_in'|'_contains'|'_id'|'_between'|'_parent'|'_parent'|'_child'|'_type'|'_string'|'_like'|'_wildcard'; export declare type queryIndexSignature = '_field' | '_gt' | '_value' | '_gte' | '_lt' | '_lte' | '_and' | '_or' | '_not' | '_in' | '_contains' | '_id' | '_between' | '_parent' | '_parent' | '_child' | '_type' | '_string' | '_like' | '_wildcard';
export type IQueryObject = { export type IQueryObject = {
[key in queryIndexSignature]?: IQueryObject|IQueryObject[]|string|number|object [key in queryIndexSignature]?: IQueryObject | IQueryObject[] | string | number | object
}; };
// 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 {
return { '_and': criteria }; return { '_and': criteria };
} }
export function Or(...criteria: IQueryObject[]): IQueryObject{ export function Or(...criteria: IQueryObject[]): IQueryObject {
return { '_or': criteria }; return { '_or': criteria };
} }
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 {
return { '_contains': field }; return { '_contains': field };
} }
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 } };
} }
export function Parent(tpe:string, criterion:IQueryObject):IQueryObject{ export function Parent(tpe: string, criterion: IQueryObject): IQueryObject {
return { '_parent': {'_type': tpe, '_query': criterion } }; return { '_parent': { '_type': tpe, '_query': criterion } };
} }
export function Child(tpe:string, criterion:IQueryObject):IQueryObject{ export function Child(tpe: string, criterion: IQueryObject): IQueryObject {
return { '_child': {'_type': tpe, '_query': criterion } }; return { '_child': { '_type': tpe, '_query': criterion } };
} }
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 } };
} }
export function StartsWith(field:string, value:string){ export function StartsWith(field: string, value: string) {
if (!value.startsWith('*')){ if (!value.startsWith('*')) {
value = value + '*'; value = value + '*';
} }
return { '_wildcard': { '_field': field, '_value': value } }; return { '_wildcard': { '_field': field, '_value': value } };
} }
export function EndsWith(field:string, value:string){ export function EndsWith(field: string, value: string) {
if (!value.endsWith('*')){ if (!value.endsWith('*')) {
value = '*' + value; value = '*' + value;
} }
return { '_wildcard': { '_field': field, '_value': value } }; return { '_wildcard': { '_field': field, '_value': value } };
} }
export function ContainsString(field:string, value:string){ export function ContainsString(field: string, value: string) {
if (!value.endsWith('*')){ if (!value.endsWith('*')) {
value = value + '*'; value = value + '*';
} }
if (!value.startsWith('*')){ if (!value.startsWith('*')) {
value = '*' + value; value = '*' + value;
} }
return { '_wildcard': { '_field': field, '_value': value } }; return { '_wildcard': { '_field': field, '_value': value } };

File diff suppressed because it is too large Load diff

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 = {
@ -134,14 +134,14 @@ export class TheHiveTrigger implements INodeType {
// Get the request body // Get the request body
const bodyData = this.getBodyData(); const bodyData = this.getBodyData();
const events = this.getNodeParameter('events', []) as string[]; const events = this.getNodeParameter('events', []) as string[];
if(!bodyData.operation || !bodyData.objectType) { if (!bodyData.operation || !bodyData.objectType) {
// Don't start the workflow if mandatory fields are not specified // Don't start the workflow if mandatory fields are not specified
return {}; return {};
} }
// Don't start the workflow if the event is not fired // Don't start the workflow if the event is not fired
const event = `${(bodyData.objectType as string).toLowerCase()}_${(bodyData.operation as string).toLowerCase()}`; const event = `${(bodyData.objectType as string).toLowerCase()}_${(bodyData.operation as string).toLowerCase()}`;
if(events.indexOf('*') === -1 && events.indexOf(event) === -1) { if (events.indexOf('*') === -1 && events.indexOf(event) === -1) {
return {}; return {};
} }
@ -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',
@ -148,14 +148,14 @@ export const alertFields = [
displayName: 'Severity', displayName: 'Severity',
name: 'severity', name: 'severity',
type: 'options', type: 'options',
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',
@ -200,7 +200,7 @@ export const alertFields = [
type: 'string', type: 'string',
required: true, required: true,
default: '', default: '',
placeholder:'tag,tag2,tag3...', placeholder: 'tag,tag2,tag3...',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource: [
@ -211,7 +211,7 @@ export const alertFields = [
], ],
}, },
}, },
description: 'Case Tags' description: 'Case Tags',
}, },
{ {
displayName: 'TLP', displayName: 'TLP',
@ -221,20 +221,20 @@ export const alertFields = [
default: 2, default: 2,
options: [ options: [
{ {
name:'White', name: 'White',
value:TLP.white, value: TLP.white,
}, },
{ {
name:'Green', name: 'Green',
value:TLP.green, value: TLP.green,
}, },
{ {
name:'Amber', name: 'Amber',
value:TLP.amber, value: TLP.amber,
},{ }, {
name:'Red', name: 'Red',
value:TLP.red, value: TLP.red,
} },
], ],
displayOptions: { displayOptions: {
show: { show: {
@ -246,14 +246,14 @@ export const alertFields = [
], ],
}, },
}, },
description: 'Traffict Light Protocol (TLP). Default=Amber' description: 'Traffict Light Protocol (TLP). Default=Amber',
}, },
{ {
displayName: 'Status', displayName: 'Status',
name: 'status', name: 'status',
type: 'options', type: 'options',
required: true, required: true,
options:[ options: [
{ {
name: 'New', name: 'New',
value: 'New', value: 'New',
@ -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
{ {
@ -461,7 +461,7 @@ export const alertFields = [
], ],
loadOptionsMethod: 'loadResponders', loadOptionsMethod: 'loadResponders',
}, },
displayOptions:{ displayOptions: {
show: { show: {
resource: [ resource: [
'alert', 'alert',
@ -496,13 +496,13 @@ export const alertFields = [
], ],
}, },
}, },
options:[ options: [
{ {
displayName: 'Case Template', displayName: 'Case Template',
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,20 +614,20 @@ 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',
name: ' severity', name: ' severity',
type: 'options', type: 'options',
options:[ options: [
{ {
name: 'Low', name: 'Low',
value: 1, value: 1,
@ -653,22 +648,22 @@ export const alertFields = [
displayName: 'Status', displayName: 'Status',
name: 'status', name: 'status',
type: 'options', type: 'options',
options:[ options: [
{ {
name: 'New', name: 'New',
value: 'New', value: 'New',
}, },
{ {
name:'Updated', name: 'Updated',
value:'Updated', value: 'Updated',
}, },
{ {
name: 'Ignored', name: 'Ignored',
value:'Ignored', value: 'Ignored',
}, },
{ {
name:'Imported', name: 'Imported',
value:'Imported', value: 'Imported',
}, },
], ],
default: 'New', default: 'New',
@ -678,7 +673,7 @@ export const alertFields = [
name: 'tags', name: 'tags',
type: 'string', type: 'string',
default: '', default: '',
placeholder:'tag,tag2,tag3...', placeholder: 'tag,tag2,tag3...',
}, },
{ {
displayName: 'Title', displayName: 'Title',
@ -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',
@ -760,13 +755,13 @@ export const alertFields = [
], ],
}, },
}, },
options:[ options: [
{ {
displayName: 'Description', displayName: 'Description',
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,
@ -816,24 +811,24 @@ export const alertFields = [
default: 2, default: 2,
options: [ options: [
{ {
name:'White', name: 'White',
value:TLP.white, value: TLP.white,
}, },
{ {
name:'Green', name: 'Green',
value:TLP.green, value: TLP.green,
}, },
{ {
name:'Amber', name: 'Amber',
value:TLP.amber, value: TLP.amber,
}, },
{ {
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,44 +1,44 @@
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 {
// Required attributes // Required attributes
id?:string; id?: string;
title?:string; title?: string;
description?:string; description?: string;
severity?:number; severity?: number;
date?:Date; date?: Date;
tags?:string[]; tags?: string[];
tlp?:TLP; tlp?: TLP;
status?:AlertStatus; status?: AlertStatus;
type?:string; type?: string;
source?:string; source?: string;
sourceRef?:string; sourceRef?: string;
artifacts?:IDataObject[]; artifacts?: IDataObject[];
follow?:boolean; follow?: boolean;
// Optional attributes // Optional attributes
caseTemplate?:string; caseTemplate?: string;
// Backend generated attributes // Backend generated attributes
lastSyncDate?:Date; lastSyncDate?: Date;
case?:string; case?: string;
createdBy?:string; createdBy?: string;
createdAt?:Date; createdAt?: Date;
updatedBy?:string; updatedBy?: string;
upadtedAt?:Date; upadtedAt?: Date;
} }

View file

@ -1,53 +1,53 @@
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
id?:string; id?: string;
title?:string; title?: string;
description?:string; description?: string;
severity?:number; severity?: number;
startDate?:Date; startDate?: Date;
owner?:string; owner?: string;
flag?:boolean; flag?: boolean;
tlp?:TLP; tlp?: TLP;
tags?:string[]; tags?: string[];
// Optional attributes // Optional attributes
resolutionStatus?:CaseResolutionStatus; resolutionStatus?: CaseResolutionStatus;
impactStatus?:CaseImpactStatus; impactStatus?: CaseImpactStatus;
summary?:string; summary?: string;
endDate?:Date; endDate?: Date;
metrics?:IDataObject; metrics?: IDataObject;
// Backend generated attributes // Backend generated attributes
status?:CaseStatus; status?: CaseStatus;
caseId?:number; // auto-generated attribute caseId?: number; // auto-generated attribute
mergeInto?:string; mergeInto?: string;
mergeFrom?:string[]; mergeFrom?: string[];
createdBy?:string; createdBy?: string;
createdAt?:Date; createdAt?: Date;
updatedBy?:string; updatedBy?: string;
upadtedAt?:Date; upadtedAt?: Date;
} }
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,23 +1,22 @@
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
id?:string; id?: string;
message?:string; message?: string;
startDate?:Date; startDate?: Date;
status?:LogStatus; status?: LogStatus;
// Optional attributes // Optional attributes
attachment?:IAttachment; attachment?: IAttachment;
// Backend generated attributes // Backend generated attributes
createdBy?:string; createdBy?: string;
createdAt?:Date; createdAt?: Date;
updatedBy?:string; updatedBy?: string;
upadtedAt?:Date; upadtedAt?: Date;
} }

View file

@ -1,54 +1,52 @@
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 {
name?:string; name?: string;
size?:number; size?: number;
id?:string; id?: string;
contentType?:string; contentType?: string;
hashes:string[]; hashes: string[];
} }
export interface IObservable{ export interface IObservable {
// Required attributes // Required attributes
id?:string; id?: string;
data?:string; data?: string;
attachment?:IAttachment; attachment?: IAttachment;
dataType?:ObservableDataType; dataType?: ObservableDataType;
message?:string; message?: string;
startDate?:Date; startDate?: Date;
tlp?:TLP; tlp?: TLP;
ioc?:boolean; ioc?: boolean;
status?:ObservableStatus; status?: ObservableStatus;
// Optional attributes // Optional attributes
tags:string[]; tags: string[];
// Backend generated attributes // Backend generated attributes
createdBy?:string; createdBy?: string;
createdAt?:Date; createdAt?: Date;
updatedBy?:string; updatedBy?: string;
upadtedAt?:Date; upadtedAt?: Date;
} }

View file

@ -1,25 +1,25 @@
export interface ITask{ export interface ITask {
// Required attributes // Required attributes
id?:string; id?: string;
title?:string; title?: string;
status?:TaskStatus; status?: TaskStatus;
flag?:boolean; flag?: boolean;
// Optional attributes // Optional attributes
owner?:string; owner?: string;
description?:string; description?: string;
startDate?:Date; startDate?: Date;
endDate?:Date; endDate?: Date;
// Backend generated attributes // Backend generated attributes
createdBy?:string; createdBy?: string;
createdAt?:Date; createdAt?: Date;
updatedBy?:string; updatedBy?: string;
upadtedAt?:Date; upadtedAt?: Date;
} }
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