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,
description: 'The URL of the Cortex instance',
default: '',
placeholder:'https://localhost:9001'
placeholder: 'https://localhost:9001',
},
];
}

View file

@ -27,16 +27,16 @@ export class TheHiveApi implements ICredentialType {
default: '',
type: 'options' as NodePropertyTypes,
description: 'The version of api to be used',
options:[
options: [
{
name:'Version 1',
value:'v1',
description:'API version supported by TheHive 4'
name: 'Version 1',
value: 'v1',
description: 'API version supported by TheHive 4',
},
{
name:'Version 0',
value:'',
description:'API version supported by TheHive 3'
name: 'Version 0',
value: '',
description: 'API version supported by TheHive 3',
},
],
},

View file

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

View file

@ -1,39 +1,39 @@
import {
IDataObject,
}from 'n8n-workflow';
IDataObject,
} from 'n8n-workflow';
export enum JobStatus {
WAITING = 'Waiting',
INPROGRESS = 'InProgress',
SUCCESS = 'Success',
FAILURE = 'Failure',
DELETED = 'Deleted'
DELETED = 'Deleted',
}
export enum TLP {
white,
green,
amber,
red
white,
green,
amber,
red,
}
export enum ObservableDataType {
'domain'= 'domain',
'file'= 'file',
'filename'= 'filename',
'fqdn'= 'fqdn',
'hash'= 'hash',
'ip'= 'ip',
'mail'= 'mail',
'mail_subject'= 'mail_subject',
'other'= 'other',
'regexp'= 'regexp',
'registry'= 'registry',
'uri_path'= 'uri_path',
'url'= 'url',
'user-agent'= 'user-agent'
'domain' = 'domain',
'file' = 'file',
'filename' = 'filename',
'fqdn' = 'fqdn',
'hash' = 'hash',
'ip' = 'ip',
'mail' = 'mail',
'mail_subject' = 'mail_subject',
'other' = 'other',
'regexp' = 'regexp',
'registry' = 'registry',
'uri_path' = 'uri_path',
'url' = 'url',
'user-agent' = 'user-agent',
}
export interface IJob{
export interface IJob {
id?: string;
organization?: string;
analyzerDefinitionId?: string;
@ -44,7 +44,7 @@ export interface IJob{
data?: string;
attachment?: IDataObject;
parameters?: IDataObject;
message? :string;
message?: string;
tlp?: TLP;
startDate?: Date;
endDate?: Date;
@ -54,10 +54,10 @@ export interface IJob{
updatedBy?: Date;
report?: IDataObject | string;
}
export interface IAnalyzer{
export interface IAnalyzer {
id?: string;
analyzerDefinitionId?: string;
name? :string;
name?: string;
version?: string;
description?: string;
author?: string;
@ -74,7 +74,7 @@ export interface IAnalyzer{
updatedBy?: Date;
}
export interface IResponder{
export interface IResponder {
id?: string;
name?: string;
version?: string;

View file

@ -1,6 +1,6 @@
import {
IExecuteFunctions,
BINARY_ENCODING,
IExecuteFunctions,
} from 'n8n-core';
import {
@ -11,23 +11,23 @@ import {
} from './GenericFunctions';
import {
analyzersOperations,
analyzerFields,
analyzersOperations,
} from './AnalyzerDescriptions';
import {
IBinaryData,
IDataObject,
ILoadOptionsFunctions,
INodeExecutionData,
INodePropertyOptions,
INodeType,
INodeTypeDescription,
INodePropertyOptions,
ILoadOptionsFunctions,
IDataObject,
IBinaryData,
} from 'n8n-workflow';
import {
respondersOperations,
responderFields,
respondersOperations,
} from './ResponderDescription';
import {
@ -43,7 +43,7 @@ import {
IJob,
} from './AnalyzerInterface';
import {
import {
createHash,
} from 'crypto';
@ -74,21 +74,21 @@ export class Cortex implements INodeType {
// Node properties which the user gets displayed and
// can change on the node.
{
displayName:'Resource',
name:'resource',
type:'options',
options:[
displayName: 'Resource',
name: 'resource',
type: 'options',
options: [
{
name: 'Analyzer',
value:'analyzer',
},
{
name: 'Responder',
value:'responder',
value: 'analyzer',
},
{
name: 'Job',
value:'job',
value: 'job',
},
{
name: 'Responder',
value: 'responder',
},
],
default: 'analyzer',
@ -100,7 +100,7 @@ export class Cortex implements INodeType {
...respondersOperations,
...responderFields,
...jobOperations,
...jobFields
...jobFields,
],
};
@ -183,7 +183,7 @@ export class Cortex implements INodeType {
returnData.push(
{
value: (dataType as string).split(':')[1],
name: changeCase.capitalCase((dataType as string).split(':')[1])
name: changeCase.capitalCase((dataType as string).split(':')[1]),
},
);
}
@ -249,13 +249,13 @@ export class Cortex implements INodeType {
options: {
contentType: item.binary[binaryPropertyName].mimeType,
filename: item.binary[binaryPropertyName].fileName,
}
},
},
_json: JSON.stringify({
dataType: observableType,
tlp,
})
}
}),
},
};
responseData = await cortexApiRequest.call(
@ -327,15 +327,13 @@ export class Cortex implements INodeType {
const entityType = this.getNodeParameter('entityType', i) as string;
const isJSON = this.getNodeParameter('jsonObject',i) as boolean;
let body:IDataObject;
if(isJSON){
const isJSON = this.getNodeParameter('jsonObject', i) as boolean;
let body: IDataObject;
if (isJSON) {
const entityJson = JSON.parse(this.getNodeParameter('objectData', i) as string);
body = {
responderId,
label: getEntityLabel(entityJson),
@ -344,29 +342,29 @@ export class Cortex implements INodeType {
tlp: entityJson.tlp || 2,
pap: entityJson.pap || 2,
message: entityJson.message || '',
parameters:[],
parameters: [],
};
}else{
const values = (this.getNodeParameter('parameters',i) as IDataObject).values as IDataObject;
} else {
body= {
const values = (this.getNodeParameter('parameters', i) as IDataObject).values as IDataObject;
body = {
responderId,
dataType: `thehive:${entityType}`,
data: {
data: {
_type: entityType,
...prepareParameters(values)
}
...prepareParameters(values),
},
};
if( entityType === 'alert'){
if (entityType === 'alert') {
// deal with alert artifacts
const artifacts = (body.data as IDataObject).artifacts as IDataObject;
if (artifacts) {
const artifactValues = (artifacts as IDataObject).artifactValues as IDataObject[];
if (artifactValues) {
const artifactData = [];
@ -404,51 +402,51 @@ export class Cortex implements INodeType {
artifactData.push(element);
}
(body.data as IDataObject).artifacts = artifactData;
}
}
}
if(entityType ==='case_artifact'){
if (entityType === 'case_artifact') {
// deal with file observable
if ((body.data as IDataObject).dataType === 'file') {
const item = items[i];
if (item.binary === undefined) {
throw new Error('No binary data exists on item!');
}
const binaryPropertyName = (body.data as IDataObject).binaryPropertyName as string;
if (item.binary[binaryPropertyName] === undefined) {
throw new Error(`No binary data property "${binaryPropertyName}" does not exists on item!`);
}
const fileBufferData = Buffer.from(item.binary[binaryPropertyName].data, BINARY_ENCODING);
const sha256 = createHash('sha256').update(fileBufferData).digest('hex');
(body.data as IDataObject).attachment = {
name: item.binary[binaryPropertyName].fileName,
hashes: [
sha256,
createHash('sha1').update(fileBufferData).digest('hex'),
createHash('md5').update(fileBufferData).digest('hex')
sha256,
createHash('sha1').update(fileBufferData).digest('hex'),
createHash('md5').update(fileBufferData).digest('hex'),
],
size:fileBufferData.byteLength,
size: fileBufferData.byteLength,
contentType: item.binary[binaryPropertyName].mimeType,
id:sha256,
};
id: sha256,
};
delete (body.data as IDataObject).binaryPropertyName;
}
}
// add the job label after getting all entity attributes
body = {
label: getEntityLabel(body.data as IDataObject),
...body
...body,
};
}
responseData = await cortexApiRequest.call(
this,

View file

@ -10,9 +10,9 @@ import {
import {
IExecuteFunctions,
IExecuteSingleFunctions,
IHookFunctions,
ILoadOptionsFunctions,
IExecuteSingleFunctions,
} from 'n8n-core';
import {
@ -29,7 +29,7 @@ export async function cortexApiRequest(this: IHookFunctions | IExecuteFunctions
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 = {
headers: headerWithAuthentication,
@ -41,45 +41,45 @@ export async function cortexApiRequest(this: IHookFunctions | IExecuteFunctions
};
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;
}
if (Object.keys(query).length === 0) {
if (Object.keys(query).length === 0) {
delete options.qs;
}
try {
return await this.helpers.request!(options);
} catch (error) {
if (error.error ) {
if (error.error) {
const errorMessage = `Cortex error response [${error.statusCode}]: ${error.error.message}`;
throw new Error(errorMessage);
} else throw error;
}
}
export function getEntityLabel(entity: IDataObject): string{
export function getEntityLabel(entity: IDataObject): string {
let label = '';
switch (entity._type) {
case 'case':
case 'case':
label = `#${entity.caseId} ${entity.title}`;
break;
case 'case_artifact':
case 'case_artifact':
//@ts-ignore
label = `[${entity.dataType}] ${entity.data?entity.data:(entity.attachment.name)}`;
label = `[${entity.dataType}] ${entity.data ? entity.data : (entity.attachment.name)}`;
break;
case 'alert':
case 'alert':
label = `[${entity.source}:${entity.sourceRef}] ${entity.title}`;
break;
case 'case_task_log':
case 'case_task_log':
label = `${entity.message} from ${entity.createdBy}`;
break;
case 'case_task':
case 'case_task':
label = `${entity.title} (${entity.status})`;
break;
case 'job':
case 'job':
label = `${entity.analyzerName} (${entity.status})`;
break;
default:
@ -95,7 +95,7 @@ export function splitTags(tags: string): string[] {
export function prepareParameters(values: IDataObject): IDataObject {
const response: IDataObject = {};
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()) {
response[key] = Date.parse(values[key] as string);
} else if (key === 'tags') {

View file

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

View file

@ -1,8 +1,8 @@
import {
import {
INodeProperties,
} from 'n8n-workflow';
import {
import {
TLP,
} from './AnalyzerInterface';
@ -12,7 +12,7 @@ export const respondersOperations = [
name: 'operation',
type: 'options',
required: true,
description: 'Choose an operation',
description: 'Choose an operation.',
displayOptions: {
show: {
resource: [
@ -24,11 +24,11 @@ export const respondersOperations = [
{
name: 'Execute',
value: 'execute',
description: 'Execute Responder'
}
description: 'Execute Responder',
},
],
default: 'execute'
}
default: 'execute',
},
] as INodeProperties[];
export const responderFields: INodeProperties[] = [
@ -38,7 +38,7 @@ export const responderFields: INodeProperties[] = [
type: 'options',
required: true,
typeOptions: {
loadOptionsMethod: 'loadActiveResponders'
loadOptionsMethod: 'loadActiveResponders',
},
default: '',
displayOptions: {
@ -48,7 +48,7 @@ export const responderFields: INodeProperties[] = [
],
},
},
description: 'Choose the responder'
description: 'Choose the responder.',
},
{
displayName: 'Entity Type',
@ -59,7 +59,7 @@ export const responderFields: INodeProperties[] = [
show: {
resource: [
'responder',
]
],
},
},
typeOptions: {
@ -69,14 +69,14 @@ export const responderFields: INodeProperties[] = [
],
},
default: '',
description: 'Choose the Data type',
description: 'Choose the Data type.',
},
{
displayName: 'JSON Parameters',
name: 'jsonObject',
type: 'boolean',
default: false,
description: 'Choose between providing JSON object or seperated attributes',
description: 'Choose between providing JSON object or seperated attributes.',
displayOptions: {
show: {
resource: [
@ -100,7 +100,7 @@ export const responderFields: INodeProperties[] = [
],
},
},
default: ''
default: '',
},
{
displayName: 'Parameters',
@ -125,7 +125,7 @@ export const responderFields: INodeProperties[] = [
name: 'description',
type: 'string',
default: '',
description: 'Description of the case',
description: 'Description of the case',
},
{
displayName: 'Severity',
@ -160,14 +160,14 @@ export const responderFields: INodeProperties[] = [
name: 'owner',
type: 'string',
default: '',
description: `User who owns the case. This is automatically set to current user when status is set to InProgress`,
description: `User who owns the case. This is automatically set to current user when status is set to InProgress.`,
},
{
displayName: 'Flag',
name: 'flag',
type: 'boolean',
default: false,
description: 'Flag of the case default=false',
description: 'Flag of the case default=false.',
},
{
displayName: 'TLP',
@ -199,13 +199,13 @@ export const responderFields: INodeProperties[] = [
name: 'tags',
type: 'string',
default: '',
placeholder:'tag1,tag2,...',
placeholder: 'tag1,tag2,...',
},
],
},
],
typeOptions:{
loadOptionsDependsOn:[
typeOptions: {
loadOptionsDependsOn: [
'entityType',
],
},
@ -231,7 +231,7 @@ export const responderFields: INodeProperties[] = [
],
},
},
default: {}
default: {},
},
{
displayName: 'Parameters',
@ -263,14 +263,14 @@ export const responderFields: INodeProperties[] = [
name: 'severity',
type: 'options',
default: 2,
options:[
options: [
{
name: 'Low',
value: 1
value: 1,
},
{
name: 'Medium',
value: 2
value: 2,
},
{
name: 'High',
@ -284,14 +284,14 @@ export const responderFields: INodeProperties[] = [
name: 'date',
type: 'dateTime',
default: '',
description: 'Date and time when the alert was raised default=now',
description: 'Date and time when the alert was raised default=now.',
},
{
displayName: 'Tags',
name: 'tags',
type: 'string',
placeholder:'tag1,tag2,...',
default: ''
placeholder: 'tag1,tag2,...',
default: '',
},
{
displayName: 'TLP',
@ -300,19 +300,19 @@ export const responderFields: INodeProperties[] = [
default: 2,
options: [
{
name:'White',
value:TLP.white,
name: 'White',
value: TLP.white,
},
{
name:'Green',
value:TLP.green,
name: 'Green',
value: TLP.green,
},
{
name:'Amber',
value:TLP.amber,
},{
name:'Red',
value:TLP.red,
name: 'Amber',
value: TLP.amber,
}, {
name: 'Red',
value: TLP.red,
}
],
description: 'Traffict Light Protocol (TLP). Default=Amber',
@ -322,7 +322,7 @@ export const responderFields: INodeProperties[] = [
name: 'status',
type: 'options',
default: 'New',
options:[
options: [
{
name: 'New',
value: 'New',
@ -333,28 +333,28 @@ export const responderFields: INodeProperties[] = [
},
{
name: 'Ignored',
value: 'Ignored'
value: 'Ignored',
},
{
name: 'Imported',
value: 'Imported',
},
],
description: 'Status of the alert. Default=New'
description: 'Status of the alert. Default=New',
},
{
displayName: 'Type',
name: 'type',
type: 'string',
default: '',
description: 'Type of the alert',
description: 'Type of the alert.',
},
{
displayName: 'Source',
name: 'source',
type: 'string',
default: '',
description: 'Source of the alert',
description: 'Source of the alert.',
},
{
displayName: 'SourceRef',
@ -367,13 +367,13 @@ export const responderFields: INodeProperties[] = [
displayName: 'Follow',
name: 'follow',
type: 'boolean',
default: false
default: false,
},
{
displayName: 'Artifacts',
name: 'artifacts',
type: 'fixedCollection',
placeholder:'Add an artifact',
placeholder: 'Add an artifact',
required: false,
typeOptions: {
multipleValues: true,
@ -397,55 +397,55 @@ export const responderFields: INodeProperties[] = [
},
{
name: 'File',
value: 'file'
value: 'file',
},
{
name: 'Filename',
value: 'filename'
value: 'filename',
},
{
name: 'Fqdn',
value: 'fqdn'
value: 'fqdn',
},
{
name: 'Hash',
value: 'hash'
value: 'hash',
},
{
name: 'IP',
value: 'ip'
value: 'ip',
},
{
name: 'Mail',
value: 'mail'
value: 'mail',
},
{
name: 'Mail Subject',
value: 'mail_subject'
value: 'mail_subject',
},
{
name: 'Other',
value: 'other'
value: 'other',
},
{
name: 'Regexp',
value: 'regexp'
value: 'regexp',
},
{
name: 'Registry',
value: 'registry'
value: 'registry',
},
{
name: 'Uri Path',
value: 'uri_path'
value: 'uri_path',
},
{
name: 'URL',
value: 'url'
value: 'url',
},
{
name: 'User Agent',
value: 'user-agent'
value: 'user-agent',
},
],
description: '',
@ -493,14 +493,14 @@ export const responderFields: INodeProperties[] = [
description: '',
},
],
}
]
},
],
},
]
}
],
},
],
typeOptions:{
loadOptionsDependsOn:[
typeOptions: {
loadOptionsDependsOn: [
'entityType',
],
},
@ -554,55 +554,55 @@ export const responderFields: INodeProperties[] = [
},
{
name: 'File',
value: 'file'
value: 'file',
},
{
name: 'Filename',
value: 'filename'
value: 'filename',
},
{
name: 'Fqdn',
value: 'fqdn'
value: 'fqdn',
},
{
name: 'Hash',
value: 'hash'
value: 'hash',
},
{
name: 'IP',
value: 'ip'
value: 'ip',
},
{
name: 'Mail',
value: 'mail'
value: 'mail',
},
{
name: 'Mail Subject',
value: 'mail_subject'
value: 'mail_subject',
},
{
name: 'Other',
value: 'other'
value: 'other',
},
{
name: 'Regexp',
value: 'regexp'
value: 'regexp',
},
{
name: 'Registry',
value: 'registry'
value: 'registry',
},
{
name: 'Uri Path',
value: 'uri_path'
value: 'uri_path',
},
{
name: 'URL',
value: 'url'
value: 'url',
},
{
name: 'User Agent',
value: 'user-agent'
value: 'user-agent',
},
],
},
@ -611,9 +611,9 @@ export const responderFields: INodeProperties[] = [
name: 'data',
type: 'string',
default: '',
displayOptions:{
hide:{
dataType:[
displayOptions: {
hide: {
dataType: [
'file',
],
},
@ -626,25 +626,25 @@ export const responderFields: INodeProperties[] = [
default: 'data',
displayOptions: {
show: {
dataType:[
dataType: [
'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',
name: 'message',
type: 'string',
default: ''
default: '',
},
{
displayName: 'Start Date',
name: 'startDate',
type: 'dateTime',
default: '',
description: 'Date and time of the begin of the case default=now',
description: 'Date and time of the begin of the case default=now.',
},
{
displayName: 'TLP',
@ -653,20 +653,20 @@ export const responderFields: INodeProperties[] = [
default: 2,
options: [
{
name:'White',
value:TLP.white,
name: 'White',
value: TLP.white,
},
{
name:'Green',
value:TLP.green,
name: 'Green',
value: TLP.green,
},
{
name:'Amber',
value:TLP.amber,
},{
name:'Red',
value:TLP.red,
}
name: 'Amber',
value: TLP.amber,
}, {
name: 'Red',
value: TLP.red,
},
],
description: 'Traffict Light Protocol (TLP). Default=Amber',
},
@ -675,7 +675,7 @@ export const responderFields: INodeProperties[] = [
name: 'ioc',
type: 'boolean',
default: false,
description: 'Indicates if the observable is an IOC (Indicator of compromise)',
description: 'Indicates if the observable is an IOC (Indicator of compromise).',
},
{
displayName: 'Status',
@ -692,13 +692,13 @@ export const responderFields: INodeProperties[] = [
value: 'Deleted',
},
],
description: 'Status of the observable (Ok or Deleted) default=Ok',
}
description: 'Status of the observable (Ok or Deleted) default=Ok.',
},
],
},
],
typeOptions:{
loadOptionsDependsOn:[
typeOptions: {
loadOptionsDependsOn: [
'entityType',
],
},
@ -746,7 +746,7 @@ export const responderFields: INodeProperties[] = [
type: 'string',
required: false,
default: '',
description: 'Title of the task',
description: 'Title of the task.',
},
{
displayName: 'Status',
@ -776,13 +776,13 @@ export const responderFields: INodeProperties[] = [
displayName: 'Flag',
name: 'flag',
type: 'boolean',
default: false
}
]
}
default: false,
},
],
},
],
typeOptions:{
loadOptionsDependsOn:[
typeOptions: {
loadOptionsDependsOn: [
'entityType',
],
},
@ -828,7 +828,7 @@ export const responderFields: INodeProperties[] = [
displayName: 'Message',
name: 'message',
type: 'string',
default: ''
default: '',
},
{
displayName: 'Start Date',
@ -857,8 +857,8 @@ export const responderFields: INodeProperties[] = [
],
},
],
typeOptions:{
loadOptionsDependsOn:[
typeOptions: {
loadOptionsDependsOn: [
'entityType',
],
},
@ -889,4 +889,4 @@ export const responderFields: INodeProperties[] = [
},
default: {},
},
];
];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 837 B

View file

@ -33,20 +33,20 @@ export async function theHiveApiRequest(this: IHookFunctions | IExecuteFunctions
};
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;
}
if (Object.keys(query).length === 0) {
if (Object.keys(query).length === 0) {
delete options.qs;
}
try {
return await this.helpers.request!(options);
} catch (error) {
if (error.error ) {
if (error.error) {
const errorMessage = `TheHive error response [${error.statusCode}]: ${error.error.message || error.error.type}`;
throw new Error(errorMessage);
} else throw error;
@ -78,7 +78,7 @@ export function splitTags(tags: string): string[] {
export function prepareOptional(optionals: IDataObject): IDataObject {
const response: IDataObject = {};
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()) {
response[key] = Date.parse(optionals[key] as string);
} else if (key === 'artifacts') {
@ -116,8 +116,8 @@ export function prepareRangeQuery(range: string, body: { 'query': Array<{}> }) {
{
'_name': 'page',
'from': parseInt(range.split('-')[0], 10),
'to': parseInt(range.split('-')[1], 10)
}
'to': parseInt(range.split('-')[1], 10),
},
);
}
}

View file

@ -1,81 +1,81 @@
// 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 = {
[key in queryIndexSignature]?: IQueryObject|IQueryObject[]|string|number|object
[key in queryIndexSignature]?: IQueryObject | IQueryObject[] | string | number | object
};
// Query Functions
export function Eq(field: string, value: any):IQueryObject{
export function Eq(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
return { '_field': field, '_value': value };
}
export function Gt(field: string, value: any):IQueryObject{
export function Gt(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
return { '_gt': { field: value } };
}
export function Gte(field: string, value: any):IQueryObject{
export function Gte(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
return { '_gte': { field: value } };
}
export function Lt(field: string, value: any):IQueryObject{
export function Lt(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
return { '_lt': { field: value } };
}
export function Lte(field: string, value: any):IQueryObject{
export function Lte(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
return { '_lte': { field: value } };
}
export function And(...criteria: IQueryObject[]): IQueryObject{
export function And(...criteria: IQueryObject[]): IQueryObject {
return { '_and': criteria };
}
export function Or(...criteria: IQueryObject[]): IQueryObject{
export function Or(...criteria: IQueryObject[]): IQueryObject {
return { '_or': criteria };
}
export function Not(criteria: IQueryObject[]): IQueryObject{
export function Not(criteria: IQueryObject[]): IQueryObject {
return { '_not': criteria };
}
export function In(field: string, values: any[]): IQueryObject{
export function In(field: string, values: any[]): IQueryObject { // tslint:disable-line:no-any
return { '_in': { '_field': field, '_values': values } };
}
export function Contains(field: string): IQueryObject{
export function Contains(field: string): IQueryObject {
return { '_contains': field };
}
export function Id(id: string|number): IQueryObject{
return {'_id': id };
export function Id(id: string | number): IQueryObject {
return { '_id': id };
}
export function Between(field:string, from_value: any, to_value: any): IQueryObject{
return {'_between': {'_field': field, '_from': from_value, '_to': to_value } };
export function Between(field: string, fromValue: any, toValue: any): IQueryObject { // tslint:disable-line:no-any
return { '_between': { '_field': field, '_from': fromValue, '_to': toValue } };
}
export function ParentId(tpe:string, id:string):IQueryObject{
return { '_parent': {'_type': tpe, '_id': id } };
export function ParentId(tpe: string, id: string): IQueryObject {
return { '_parent': { '_type': tpe, '_id': id } };
}
export function Parent(tpe:string, criterion:IQueryObject):IQueryObject{
return { '_parent': {'_type': tpe, '_query': criterion } };
export function Parent(tpe: string, criterion: IQueryObject): IQueryObject {
return { '_parent': { '_type': tpe, '_query': criterion } };
}
export function Child(tpe:string, criterion:IQueryObject):IQueryObject{
return { '_child': {'_type': tpe, '_query': criterion } };
export function Child(tpe: string, criterion: IQueryObject): IQueryObject {
return { '_child': { '_type': tpe, '_query': criterion } };
}
export function Type(tpe:string):IQueryObject{
export function Type(tpe: string): IQueryObject {
return { '_type': tpe };
}
export function queryString(query_string:string):IQueryObject{
return { '_string': query_string };
export function queryString(queryString: string): IQueryObject {
return { '_string': queryString };
}
export function Like(field:string, value:string):IQueryObject{
export function Like(field: string, value: string): IQueryObject {
return { '_like': { '_field': field, '_value': value } };
}
export function StartsWith(field:string, value:string){
if (!value.startsWith('*')){
export function StartsWith(field: string, value: string) {
if (!value.startsWith('*')) {
value = value + '*';
}
return { '_wildcard': { '_field': field, '_value': value } };
}
export function EndsWith(field:string, value:string){
if (!value.endsWith('*')){
export function EndsWith(field: string, value: string) {
if (!value.endsWith('*')) {
value = '*' + value;
}
return { '_wildcard': { '_field': field, '_value': value } };
}
export function ContainsString(field:string, value:string){
if (!value.endsWith('*')){
export function ContainsString(field: string, value: string) {
if (!value.endsWith('*')) {
value = value + '*';
}
if (!value.startsWith('*')){
if (!value.startsWith('*')) {
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 {
IDataObject,
INodeTypeDescription,
INodeType,
IWebhookResponseData,
IHookFunctions,
INodeType,
INodeTypeDescription,
IWebhookResponseData,
} from 'n8n-workflow';
export class TheHiveTrigger implements INodeType {
@ -111,9 +111,9 @@ export class TheHiveTrigger implements INodeType {
value: 'case_task_log_create',
description: 'Triggered when a task log is created',
},
]
}
]
],
},
],
};
// @ts-ignore (because of request)
webhookMethods = {
@ -134,14 +134,14 @@ export class TheHiveTrigger implements INodeType {
// Get the request body
const bodyData = this.getBodyData();
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
return {};
}
// Don't start the workflow if the event is not fired
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 {};
}
@ -158,7 +158,7 @@ export class TheHiveTrigger implements INodeType {
return {
workflowData: [
this.helpers.returnJsonArray(returnData)
this.helpers.returnJsonArray(returnData),
],
};
}

View file

@ -78,7 +78,7 @@ export const alertFields = [
displayOptions: {
show: {
resource: [
'alert'
'alert',
],
operation: [
'promote',
@ -89,7 +89,7 @@ export const alertFields = [
],
},
},
description: 'Title of the alert'
description: 'Title of the alert',
},
{
displayName: 'Case ID',
@ -148,14 +148,14 @@ export const alertFields = [
displayName: 'Severity',
name: 'severity',
type: 'options',
options:[
options: [
{
name: 'Low',
value: 1
value: 1,
},
{
name: 'Medium',
value: 2
value: 2,
},
{
name: 'High',
@ -192,7 +192,7 @@ export const alertFields = [
],
},
},
description: 'Date and time when the alert was raised default=now'
description: 'Date and time when the alert was raised default=now',
},
{
displayName: 'Tags',
@ -200,7 +200,7 @@ export const alertFields = [
type: 'string',
required: true,
default: '',
placeholder:'tag,tag2,tag3...',
placeholder: 'tag,tag2,tag3...',
displayOptions: {
show: {
resource: [
@ -211,7 +211,7 @@ export const alertFields = [
],
},
},
description: 'Case Tags'
description: 'Case Tags',
},
{
displayName: 'TLP',
@ -221,20 +221,20 @@ export const alertFields = [
default: 2,
options: [
{
name:'White',
value:TLP.white,
name: 'White',
value: TLP.white,
},
{
name:'Green',
value:TLP.green,
name: 'Green',
value: TLP.green,
},
{
name:'Amber',
value:TLP.amber,
},{
name:'Red',
value:TLP.red,
}
name: 'Amber',
value: TLP.amber,
}, {
name: 'Red',
value: TLP.red,
},
],
displayOptions: {
show: {
@ -246,14 +246,14 @@ export const alertFields = [
],
},
},
description: 'Traffict Light Protocol (TLP). Default=Amber'
description: 'Traffict Light Protocol (TLP). Default=Amber',
},
{
displayName: 'Status',
name: 'status',
type: 'options',
required: true,
options:[
options: [
{
name: 'New',
value: 'New',
@ -264,7 +264,7 @@ export const alertFields = [
},
{
name: 'Ignored',
value: 'Ignored'
value: 'Ignored',
},
{
name: 'Imported',
@ -300,7 +300,7 @@ export const alertFields = [
],
},
},
description: 'Type of the alert'
description: 'Type of the alert',
},
{
displayName: 'Source',
@ -318,7 +318,7 @@ export const alertFields = [
],
},
},
description: 'Source of the alert'
description: 'Source of the alert',
},
{
displayName: 'SourceRef',
@ -336,7 +336,7 @@ export const alertFields = [
],
},
},
description: 'Source reference of the alert'
description: 'Source reference of the alert',
},
{
displayName: 'Follow',
@ -446,7 +446,7 @@ export const alertFields = [
],
},
],
description: 'Artifact attributes'
description: 'Artifact attributes',
},
// required for responder execution
{
@ -461,7 +461,7 @@ export const alertFields = [
],
loadOptionsMethod: 'loadResponders',
},
displayOptions:{
displayOptions: {
show: {
resource: [
'alert',
@ -496,13 +496,13 @@ export const alertFields = [
],
},
},
options:[
options: [
{
displayName: 'Case Template',
name: 'caseTemplate',
type:'string',
type: 'string',
default: '',
description: `Case template to use when a case is created from this alert`,
description: `Case template to use when a case is created from this alert.`,
},
],
},
@ -557,7 +557,6 @@ export const alertFields = [
value: 'file',
},
],
description: '',
},
{
displayName: 'Data',
@ -571,7 +570,6 @@ export const alertFields = [
},
},
default: '',
description: '',
},
{
displayName: 'Binary Property',
@ -585,21 +583,18 @@ export const alertFields = [
},
},
default: 'data',
description: '',
},
{
displayName: 'Message',
name: 'message',
type: 'string',
default: '',
description: '',
},
{
displayName: 'Case Tags',
name: 'tags',
type: 'string',
default: '',
description: '',
},
],
},
@ -611,7 +606,7 @@ export const alertFields = [
type: 'string',
required: false,
default: '',
description: `Case template to use when a case is created from this alert`,
description: `Case template to use when a case is created from this alert.`,
},
{
displayName: 'Description',
@ -619,20 +614,20 @@ export const alertFields = [
type: 'string',
required: false,
default: '',
description: 'Description of the alert',
description: 'Description of the alert.',
},
{
displayName: 'Follow',
name: 'follow',
type: 'boolean',
default: true,
description: 'if true, the alert becomes active when updated default=true',
description: 'if true, the alert becomes active when updated default=true.',
},
{
displayName: 'Severity',
name: ' severity',
type: 'options',
options:[
options: [
{
name: 'Low',
value: 1,
@ -653,22 +648,22 @@ export const alertFields = [
displayName: 'Status',
name: 'status',
type: 'options',
options:[
options: [
{
name: 'New',
value: 'New',
},
{
name:'Updated',
value:'Updated',
name: 'Updated',
value: 'Updated',
},
{
name: 'Ignored',
value:'Ignored',
value: 'Ignored',
},
{
name:'Imported',
value:'Imported',
name: 'Imported',
value: 'Imported',
},
],
default: 'New',
@ -678,7 +673,7 @@ export const alertFields = [
name: 'tags',
type: 'string',
default: '',
placeholder:'tag,tag2,tag3...',
placeholder: 'tag,tag2,tag3...',
},
{
displayName: 'Title',
@ -686,7 +681,7 @@ export const alertFields = [
type: 'string',
required: false,
default: '',
description: 'Title of the alert'
description: 'Title of the alert.',
},
{
displayName: 'TLP',
@ -712,7 +707,7 @@ export const alertFields = [
value: TLP.red,
},
],
description: 'Traffict Light Protocol (TLP). Default=Amber'
description: 'Traffict Light Protocol (TLP). Default=Amber',
},
],
},
@ -752,7 +747,7 @@ export const alertFields = [
displayOptions: {
show: {
resource: [
'alert'
'alert',
],
operation: [
'getAll',
@ -760,13 +755,13 @@ export const alertFields = [
],
},
},
options:[
options: [
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Description of the alert',
description: 'Description of the alert.',
},
{
displayName: 'Follow',
@ -782,15 +777,15 @@ export const alertFields = [
options: [
{
name: 'Low',
value: 1
value: 1,
},
{
name: 'Medium',
value: 2
value: 2,
},
{
name: 'High',
value: 3
value: 3,
},
],
default: 2,
@ -816,24 +811,24 @@ export const alertFields = [
default: 2,
options: [
{
name:'White',
value:TLP.white,
name: 'White',
value: TLP.white,
},
{
name:'Green',
value:TLP.green,
name: 'Green',
value: TLP.green,
},
{
name:'Amber',
value:TLP.amber,
name: 'Amber',
value: TLP.amber,
},
{
name:'Red',
value:TLP.red,
}
name: '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',
@ -385,15 +385,15 @@ export const caseFields = [
options: [
{
name: 'No Impact',
value: 'NoImpact'
value: 'NoImpact',
},
{
name: 'With Impact',
value: 'WithImpact'
value: 'WithImpact',
},
{
name: 'Not Applicable',
value: 'NotApplicable'
value: 'NotApplicable',
},
],
description: 'Impact status of the case',
@ -419,23 +419,23 @@ export const caseFields = [
options: [
{
value: 'Indeterminate',
name: 'Indeterminate'
name: 'Indeterminate',
},
{
value: 'False Positive',
name: 'FalsePositive'
name: 'FalsePositive',
},
{
value: 'True Positive',
name: 'TruePositive'
name: 'TruePositive',
},
{
value: 'Other',
name: 'Other'
name: 'Other',
},
{
value: 'Duplicated',
name: 'Duplicated'
name: 'Duplicated',
},
],
description: 'Resolution status of the case',
@ -447,15 +447,15 @@ export const caseFields = [
options: [
{
name: 'Low',
value: 1
value: 1,
},
{
name: 'Medium',
value: 2
value: 2,
},
{
name: 'High',
value: 3
value: 3,
},
],
default: 2,
@ -493,7 +493,7 @@ export const caseFields = [
name: 'summary',
type: 'string',
default: '',
description: 'Summary of the case, to be provided when closing a case'
description: 'Summary of the case, to be provided when closing a case',
},
{
displayName: 'Tags',
@ -531,7 +531,7 @@ export const caseFields = [
value: TLP.red,
},
],
description: 'Traffict Light Protocol (TLP). Default=Amber'
description: 'Traffict Light Protocol (TLP). Default=Amber',
},
],
},
@ -574,7 +574,7 @@ export const caseFields = [
displayOptions: {
show: {
resource: [
'case'
'case',
],
operation: [
'getAll',
@ -665,15 +665,15 @@ export const caseFields = [
options: [
{
name: 'Low',
value: 1
value: 1,
},
{
name: 'Medium',
value: 2
value: 2,
},
{
name: 'High',
value: 3
value: 3,
},
],
default: 2,

View file

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

View file

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

View file

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

View file

@ -1,44 +1,44 @@
import {
IDataObject
}from 'n8n-workflow'
export enum AlertStatus{
NEW="New",
UPDATED="Updated",
IGNORED="Ignored",
IMPORTED="Imported",
IDataObject,
} from 'n8n-workflow';
export enum AlertStatus {
NEW = 'New',
UPDATED = 'Updated',
IGNORED = 'Ignored',
IMPORTED = 'Imported',
}
export enum TLP{
white,
green,
amber,
red
export enum TLP {
white,
green,
amber,
red,
}
export interface IAlert{
// Required attributes
id?:string;
title?:string;
description?:string;
severity?:number;
date?:Date;
tags?:string[];
tlp?:TLP;
status?:AlertStatus;
type?:string;
source?:string;
sourceRef?:string;
artifacts?:IDataObject[];
follow?:boolean;
export interface IAlert {
// Required attributes
id?: string;
title?: string;
description?: string;
severity?: number;
date?: Date;
tags?: string[];
tlp?: TLP;
status?: AlertStatus;
type?: string;
source?: string;
sourceRef?: string;
artifacts?: IDataObject[];
follow?: boolean;
// Optional attributes
caseTemplate?:string;
// Optional attributes
caseTemplate?: string;
// Backend generated attributes
lastSyncDate?:Date;
case?:string;
// Backend generated attributes
lastSyncDate?: Date;
case?: string;
createdBy?:string;
createdAt?:Date;
updatedBy?:string;
upadtedAt?:Date;
createdBy?: string;
createdAt?: Date;
updatedBy?: string;
upadtedAt?: Date;
}

View file

@ -1,53 +1,53 @@
import { IDataObject } from "n8n-workflow";
import { IDataObject } from 'n8n-workflow';
import { TLP } from './AlertInterface';
export interface ICase{
// Required attributes
id?:string;
title?:string;
description?:string;
severity?:number;
startDate?:Date;
owner?:string;
flag?:boolean;
tlp?:TLP;
tags?:string[];
export interface ICase {
// Required attributes
id?: string;
title?: string;
description?: string;
severity?: number;
startDate?: Date;
owner?: string;
flag?: boolean;
tlp?: TLP;
tags?: string[];
// Optional attributes
resolutionStatus?:CaseResolutionStatus;
impactStatus?:CaseImpactStatus;
summary?:string;
endDate?:Date;
metrics?:IDataObject;
// Optional attributes
resolutionStatus?: CaseResolutionStatus;
impactStatus?: CaseImpactStatus;
summary?: string;
endDate?: Date;
metrics?: IDataObject;
// Backend generated attributes
status?:CaseStatus;
caseId?:number; // auto-generated attribute
mergeInto?:string;
mergeFrom?:string[];
// Backend generated attributes
status?: CaseStatus;
caseId?: number; // auto-generated attribute
mergeInto?: string;
mergeFrom?: string[];
createdBy?:string;
createdAt?:Date;
updatedBy?:string;
upadtedAt?:Date;
createdBy?: string;
createdAt?: Date;
updatedBy?: string;
upadtedAt?: Date;
}
export enum CaseStatus{
OPEN="Open",
RESOLVED="Resolved",
DELETED="Deleted",
export enum CaseStatus {
OPEN = 'Open',
RESOLVED = 'Resolved',
DELETED = 'Deleted',
}
export enum CaseResolutionStatus{
INDETERMINATE="Indeterminate",
FALSEPOSITIVE="FalsePositive",
TRUEPOSITIVE="TruePositive",
OTHER="Other",
DUPLICATED="Duplicated",
export enum CaseResolutionStatus {
INDETERMINATE = 'Indeterminate',
FALSEPOSITIVE = 'FalsePositive',
TRUEPOSITIVE = 'TruePositive',
OTHER = 'Other',
DUPLICATED = 'Duplicated',
}
export enum CaseImpactStatus{
NOIMPACT="NoImpact",
WITHIMPACT="WithImpact",
NOTAPPLICABLE="NotApplicable",
}
export enum CaseImpactStatus {
NOIMPACT = 'NoImpact',
WITHIMPACT = 'WithImpact',
NOTAPPLICABLE = 'NotApplicable',
}

View file

@ -1,23 +1,22 @@
import { IDataObject } from "n8n-workflow";
import {IAttachment} from "./ObservableInterface";
export enum LogStatus{
OK="Ok",
DELETED="Deleted"
import { IAttachment } from './ObservableInterface';
export enum LogStatus {
OK = 'Ok',
DELETED = 'Deleted',
}
export interface ILog{
// Required attributes
id?:string;
message?:string;
startDate?:Date;
status?:LogStatus;
// Optional attributes
attachment?:IAttachment;
// Backend generated attributes
export interface ILog {
// Required attributes
id?: string;
message?: string;
startDate?: Date;
status?: LogStatus;
createdBy?:string;
createdAt?:Date;
updatedBy?:string;
upadtedAt?:Date;
}
// Optional attributes
attachment?: IAttachment;
// Backend generated attributes
createdBy?: string;
createdAt?: Date;
updatedBy?: string;
upadtedAt?: Date;
}

View file

@ -1,54 +1,52 @@
import {
TLP
}from './AlertInterface'
import { IDataObject } from 'n8n-workflow';
TLP
} from './AlertInterface';
export enum ObservableStatus{
OK="Ok",
DELETED="Deleted",
export enum ObservableStatus {
OK = 'Ok',
DELETED = 'Deleted',
}
export enum ObservableDataType{
"domain"= "domain",
"file"= "file",
"filename"= "filename",
"fqdn"= "fqdn",
"hash"= "hash",
"ip"= "ip",
"mail"= "mail",
"mail_subject"= "mail_subject",
"other"= "other",
"regexp"= "regexp",
"registry"= "registry",
"uri_path"= "uri_path",
"url"= "url",
"user-agent"= "user-agent"
export enum ObservableDataType {
'domain' = 'domain',
'file' = 'file',
'filename' = 'filename',
'fqdn' = 'fqdn',
'hash' = 'hash',
'ip' = 'ip',
'mail' = 'mail',
'mail_subject' = 'mail_subject',
'other' = 'other',
'regexp' = 'regexp',
'registry' = 'registry',
'uri_path' = 'uri_path',
'url' = 'url',
'user-agent' = 'user-agent',
}
export interface IAttachment{
name?:string;
size?:number;
id?:string;
contentType?:string;
hashes:string[];
export interface IAttachment {
name?: string;
size?: number;
id?: string;
contentType?: string;
hashes: string[];
}
export interface IObservable{
// Required attributes
id?:string;
data?:string;
attachment?:IAttachment;
dataType?:ObservableDataType;
message?:string;
startDate?:Date;
tlp?:TLP;
ioc?:boolean;
status?:ObservableStatus;
// Optional attributes
tags:string[];
// Backend generated attributes
createdBy?:string;
createdAt?:Date;
updatedBy?:string;
upadtedAt?:Date;
export interface IObservable {
// Required attributes
id?: string;
data?: string;
attachment?: IAttachment;
dataType?: ObservableDataType;
message?: string;
startDate?: Date;
tlp?: TLP;
ioc?: boolean;
status?: ObservableStatus;
// Optional attributes
tags: string[];
// Backend generated attributes
createdBy?: string;
createdAt?: Date;
updatedBy?: string;
upadtedAt?: Date;
}

View file

@ -1,25 +1,25 @@
export interface ITask{
// Required attributes
id?:string;
title?:string;
status?:TaskStatus;
flag?:boolean;
// Optional attributes
owner?:string;
description?:string;
startDate?:Date;
endDate?:Date;
// Backend generated attributes
export interface ITask {
// Required attributes
id?: string;
title?: string;
status?: TaskStatus;
flag?: boolean;
// Optional attributes
owner?: string;
description?: string;
startDate?: Date;
endDate?: Date;
// Backend generated attributes
createdBy?:string;
createdAt?:Date;
updatedBy?:string;
upadtedAt?:Date;
createdBy?: string;
createdAt?: Date;
updatedBy?: string;
upadtedAt?: Date;
}
export enum TaskStatus{
WAITING="Waiting",
INPROGRESS="InProgress",
COMPLETED="Completed",
CANCEL="Cancel",
export enum TaskStatus {
WAITING = 'Waiting',
INPROGRESS = 'InProgress',
COMPLETED = 'Completed',
CANCEL = 'Cancel',
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 819 B