pull:初次提交
This commit is contained in:
168
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/GenericFunctions.ts
Executable file
168
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/GenericFunctions.ts
Executable file
@@ -0,0 +1,168 @@
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError, jsonParse } from 'n8n-workflow';
|
||||
import { URL } from 'url';
|
||||
|
||||
import type { MispCredentials } from './types';
|
||||
|
||||
export async function mispApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
) {
|
||||
const { baseUrl, allowUnauthorizedCerts } = await this.getCredentials<MispCredentials>('mispApi');
|
||||
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: `${baseUrl}${endpoint}`,
|
||||
json: true,
|
||||
rejectUnauthorized: !allowUnauthorizedCerts,
|
||||
};
|
||||
|
||||
if (!Object.keys(body).length) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
if (!Object.keys(qs).length) {
|
||||
delete options.qs;
|
||||
}
|
||||
|
||||
try {
|
||||
return await this.helpers.requestWithAuthentication.call(this, 'mispApi', options);
|
||||
} catch (error) {
|
||||
// MISP API wrongly returns 403 for malformed requests
|
||||
if (error.statusCode === 403) {
|
||||
error.statusCode = 400;
|
||||
}
|
||||
|
||||
const errors = error?.error?.errors;
|
||||
|
||||
if (errors) {
|
||||
const key = Object.keys(errors as IDataObject)[0];
|
||||
|
||||
if (key !== undefined) {
|
||||
let message = errors[key].join();
|
||||
|
||||
if (message.includes(' nter')) {
|
||||
message = message.replace(' nter', ' enter');
|
||||
}
|
||||
|
||||
error.error.message = `${error.error.message}: ${message}`;
|
||||
}
|
||||
}
|
||||
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
export async function mispApiRequestAllItems(this: IExecuteFunctions, endpoint: string) {
|
||||
const responseData = await mispApiRequest.call(this, 'GET', endpoint);
|
||||
const returnAll = this.getNodeParameter('returnAll', 0);
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', 0);
|
||||
return responseData.slice(0, limit);
|
||||
}
|
||||
|
||||
return responseData;
|
||||
}
|
||||
|
||||
export async function mispApiRestSearch(
|
||||
this: IExecuteFunctions,
|
||||
resource: 'attributes' | 'events' | 'objects',
|
||||
itemIndex: number,
|
||||
) {
|
||||
let body: IDataObject = {};
|
||||
const useJson = this.getNodeParameter('useJson', itemIndex) as boolean;
|
||||
|
||||
if (useJson) {
|
||||
const json = this.getNodeParameter('jsonOutput', itemIndex);
|
||||
if (typeof json === 'string') {
|
||||
body = jsonParse(json);
|
||||
} else {
|
||||
body = json as IDataObject;
|
||||
}
|
||||
} else {
|
||||
const value = this.getNodeParameter('value', itemIndex) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', itemIndex);
|
||||
|
||||
body.value = value;
|
||||
|
||||
if (Object.keys(additionalFields).length) {
|
||||
if (additionalFields.tags) {
|
||||
additionalFields.tags = (additionalFields.tags as string)
|
||||
.split(',')
|
||||
.map((tag) => tag.trim());
|
||||
}
|
||||
Object.assign(body, additionalFields);
|
||||
}
|
||||
}
|
||||
|
||||
const endpoint = `/${resource}/restSearch`;
|
||||
const { response } = await mispApiRequest.call(this, 'POST', endpoint, body);
|
||||
|
||||
if (response) {
|
||||
if (resource === 'attributes') {
|
||||
return response.Attribute;
|
||||
}
|
||||
|
||||
if (resource === 'events') {
|
||||
return (response as IDataObject[]).map((event) => event.Event);
|
||||
}
|
||||
|
||||
if (resource === 'objects') {
|
||||
return (response as IDataObject[]).map((obj) => obj.Object);
|
||||
}
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export function throwOnEmptyUpdate(
|
||||
this: IExecuteFunctions,
|
||||
resource: string,
|
||||
updateFields: IDataObject,
|
||||
) {
|
||||
if (!Object.keys(updateFields).length) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Please enter at least one field to update for the ${resource}.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const SHARING_GROUP_OPTION_ID = 4;
|
||||
|
||||
export function throwOnMissingSharingGroup(this: IExecuteFunctions, fields: IDataObject) {
|
||||
if (fields.distribution === SHARING_GROUP_OPTION_ID && !fields.sharing_group_id) {
|
||||
throw new NodeOperationError(this.getNode(), 'Please specify a sharing group');
|
||||
}
|
||||
}
|
||||
|
||||
const isValidUrl = (str: string) => {
|
||||
try {
|
||||
new URL(str);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export function throwOnInvalidUrl(this: IExecuteFunctions, str: string) {
|
||||
if (!isValidUrl(str)) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
'Please specify a valid URL, protocol included. Example: https://site.com',
|
||||
);
|
||||
}
|
||||
}
|
||||
18
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/Misp.node.json
Executable file
18
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/Misp.node.json
Executable file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.misp",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Development"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/misp/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.misp/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
791
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/Misp.node.ts
Executable file
791
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/Misp.node.ts
Executable file
@@ -0,0 +1,791 @@
|
||||
import {
|
||||
type IExecuteFunctions,
|
||||
type ILoadOptionsFunctions,
|
||||
type IDataObject,
|
||||
type INodeExecutionData,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
attributeFields,
|
||||
attributeOperations,
|
||||
eventFields,
|
||||
eventOperations,
|
||||
eventTagFields,
|
||||
eventTagOperations,
|
||||
feedFields,
|
||||
feedOperations,
|
||||
galaxyFields,
|
||||
galaxyOperations,
|
||||
noticelistFields,
|
||||
noticelistOperations,
|
||||
objectOperations,
|
||||
objectFields,
|
||||
organisationFields,
|
||||
organisationOperations,
|
||||
tagFields,
|
||||
tagOperations,
|
||||
userFields,
|
||||
userOperations,
|
||||
warninglistFields,
|
||||
warninglistOperations,
|
||||
} from './descriptions';
|
||||
import {
|
||||
mispApiRequest,
|
||||
mispApiRequestAllItems,
|
||||
mispApiRestSearch,
|
||||
throwOnEmptyUpdate,
|
||||
throwOnInvalidUrl,
|
||||
throwOnMissingSharingGroup,
|
||||
} from './GenericFunctions';
|
||||
import type { LoadedOrgs, LoadedSharingGroups, LoadedTags, LoadedUsers } from './types';
|
||||
|
||||
export class Misp implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'MISP',
|
||||
name: 'misp',
|
||||
icon: 'file:misp.svg',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Consume the MISP API',
|
||||
defaults: {
|
||||
name: 'MISP',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'mispApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Attribute',
|
||||
value: 'attribute',
|
||||
},
|
||||
{
|
||||
name: 'Event',
|
||||
value: 'event',
|
||||
},
|
||||
{
|
||||
name: 'Event Tag',
|
||||
value: 'eventTag',
|
||||
},
|
||||
{
|
||||
name: 'Feed',
|
||||
value: 'feed',
|
||||
},
|
||||
{
|
||||
name: 'Galaxy',
|
||||
value: 'galaxy',
|
||||
},
|
||||
{
|
||||
name: 'Noticelist',
|
||||
value: 'noticelist',
|
||||
},
|
||||
{
|
||||
name: 'Object',
|
||||
value: 'object',
|
||||
},
|
||||
{
|
||||
name: 'Organisation',
|
||||
value: 'organisation',
|
||||
},
|
||||
{
|
||||
name: 'Tag',
|
||||
value: 'tag',
|
||||
},
|
||||
{
|
||||
name: 'User',
|
||||
value: 'user',
|
||||
},
|
||||
{
|
||||
name: 'Warninglist',
|
||||
value: 'warninglist',
|
||||
},
|
||||
],
|
||||
default: 'attribute',
|
||||
},
|
||||
...attributeOperations,
|
||||
...attributeFields,
|
||||
...eventOperations,
|
||||
...eventFields,
|
||||
...eventTagOperations,
|
||||
...eventTagFields,
|
||||
...feedOperations,
|
||||
...feedFields,
|
||||
...galaxyOperations,
|
||||
...galaxyFields,
|
||||
...noticelistOperations,
|
||||
...noticelistFields,
|
||||
...objectOperations,
|
||||
...objectFields,
|
||||
...organisationOperations,
|
||||
...organisationFields,
|
||||
...tagOperations,
|
||||
...tagFields,
|
||||
...userOperations,
|
||||
...userFields,
|
||||
...warninglistOperations,
|
||||
...warninglistFields,
|
||||
],
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
async getOrgs(this: ILoadOptionsFunctions) {
|
||||
const responseData = (await mispApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/organisations',
|
||||
)) as LoadedOrgs;
|
||||
return responseData.map((i) => ({ name: i.Organisation.name, value: i.Organisation.id }));
|
||||
},
|
||||
|
||||
async getSharingGroups(this: ILoadOptionsFunctions) {
|
||||
const responseData = (await mispApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/sharing_groups',
|
||||
)) as LoadedSharingGroups;
|
||||
return responseData.response.map((i) => ({
|
||||
name: i.SharingGroup.name,
|
||||
value: i.SharingGroup.id,
|
||||
}));
|
||||
},
|
||||
|
||||
async getTags(this: ILoadOptionsFunctions) {
|
||||
const responseData = (await mispApiRequest.call(this, 'GET', '/tags')) as LoadedTags;
|
||||
return responseData.Tag.map((i) => ({ name: i.name, value: i.id }));
|
||||
},
|
||||
|
||||
async getUsers(this: ILoadOptionsFunctions) {
|
||||
const responseData = (await mispApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/admin/users',
|
||||
)) as LoadedUsers;
|
||||
return responseData.map((i) => ({ name: i.User.email, value: i.User.id }));
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
let responseData;
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
try {
|
||||
if (resource === 'attribute') {
|
||||
// **********************************************************************
|
||||
// attribute
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------------
|
||||
// attribute: create
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {
|
||||
type: this.getNodeParameter('type', i),
|
||||
value: this.getNodeParameter('value', i),
|
||||
};
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
|
||||
throwOnMissingSharingGroup.call(this, additionalFields);
|
||||
|
||||
if (Object.keys(additionalFields)) {
|
||||
Object.assign(body, additionalFields);
|
||||
}
|
||||
|
||||
const eventId = this.getNodeParameter('eventId', i);
|
||||
const endpoint = `/attributes/add/${eventId}`;
|
||||
responseData = await mispApiRequest.call(this, 'POST', endpoint, body);
|
||||
responseData = responseData.Attribute;
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// attribute: delete
|
||||
// ----------------------------------------
|
||||
|
||||
const attributeId = this.getNodeParameter('attributeId', i);
|
||||
const endpoint = `/attributes/delete/${attributeId}`;
|
||||
responseData = await mispApiRequest.call(this, 'DELETE', endpoint);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// attribute: get
|
||||
// ----------------------------------------
|
||||
|
||||
const attributeId = this.getNodeParameter('attributeId', i);
|
||||
const endpoint = `/attributes/view/${attributeId}`;
|
||||
responseData = await mispApiRequest.call(this, 'GET', endpoint);
|
||||
responseData = responseData.Attribute;
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// attribute: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = await mispApiRequestAllItems.call(this, '/attributes');
|
||||
} else if (operation === 'search') {
|
||||
// ----------------------------------------
|
||||
// attribute: search
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = await mispApiRestSearch.call(this, 'attributes', i);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// attribute: update
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {};
|
||||
const updateFields = this.getNodeParameter('updateFields', i);
|
||||
|
||||
throwOnEmptyUpdate.call(this, resource, updateFields);
|
||||
throwOnMissingSharingGroup.call(this, updateFields);
|
||||
|
||||
Object.assign(body, updateFields);
|
||||
|
||||
const attributeId = this.getNodeParameter('attributeId', i);
|
||||
const endpoint = `/attributes/edit/${attributeId}`;
|
||||
responseData = await mispApiRequest.call(this, 'PUT', endpoint, body);
|
||||
responseData = responseData.Attribute;
|
||||
}
|
||||
} else if (resource === 'event') {
|
||||
// **********************************************************************
|
||||
// event
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------------
|
||||
// event: create
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {
|
||||
org_id: this.getNodeParameter('org_id', i),
|
||||
info: this.getNodeParameter('information', i),
|
||||
};
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
|
||||
throwOnMissingSharingGroup.call(this, additionalFields);
|
||||
|
||||
if (Object.keys(additionalFields)) {
|
||||
Object.assign(body, additionalFields);
|
||||
}
|
||||
|
||||
responseData = await mispApiRequest.call(this, 'POST', '/events', body);
|
||||
responseData = responseData.Event;
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// event: delete
|
||||
// ----------------------------------------
|
||||
|
||||
const eventId = this.getNodeParameter('eventId', i);
|
||||
const endpoint = `/events/delete/${eventId}`;
|
||||
responseData = await mispApiRequest.call(this, 'DELETE', endpoint);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// event: get
|
||||
// ----------------------------------------
|
||||
|
||||
const eventId = this.getNodeParameter('eventId', i);
|
||||
const endpoint = `/events/view/${eventId}`;
|
||||
responseData = await mispApiRequest.call(this, 'GET', endpoint);
|
||||
responseData = responseData.Event;
|
||||
delete responseData.Attribute; // prevent excessive payload size
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// event: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = await mispApiRequestAllItems.call(this, '/events');
|
||||
} else if (operation === 'search') {
|
||||
// ----------------------------------------
|
||||
// event: search
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = await mispApiRestSearch.call(this, 'events', i);
|
||||
} else if (operation === 'publish') {
|
||||
// ----------------------------------------
|
||||
// event: publish
|
||||
// ----------------------------------------
|
||||
|
||||
const eventId = this.getNodeParameter('eventId', i);
|
||||
const endpoint = `/events/publish/${eventId}`;
|
||||
responseData = await mispApiRequest.call(this, 'POST', endpoint);
|
||||
} else if (operation === 'unpublish') {
|
||||
// ----------------------------------------
|
||||
// event: unpublish
|
||||
// ----------------------------------------
|
||||
|
||||
const eventId = this.getNodeParameter('eventId', i);
|
||||
|
||||
const endpoint = `/events/unpublish/${eventId}`;
|
||||
responseData = await mispApiRequest.call(this, 'POST', endpoint);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// event: update
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {};
|
||||
const updateFields = this.getNodeParameter('updateFields', i);
|
||||
|
||||
throwOnEmptyUpdate.call(this, resource, updateFields);
|
||||
throwOnMissingSharingGroup.call(this, updateFields);
|
||||
|
||||
Object.assign(body, updateFields);
|
||||
|
||||
const eventId = this.getNodeParameter('eventId', i);
|
||||
const endpoint = `/events/edit/${eventId}`;
|
||||
responseData = await mispApiRequest.call(this, 'PUT', endpoint, body);
|
||||
responseData = responseData.Event;
|
||||
delete responseData.Attribute; // prevent excessive payload size
|
||||
}
|
||||
} else if (resource === 'eventTag') {
|
||||
if (operation === 'add') {
|
||||
// ----------------------------------------
|
||||
// eventTag: add
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {
|
||||
event: this.getNodeParameter('eventId', i),
|
||||
tag: this.getNodeParameter('tagId', i),
|
||||
};
|
||||
|
||||
const endpoint = '/events/addTag';
|
||||
responseData = await mispApiRequest.call(this, 'POST', endpoint, body);
|
||||
} else if (operation === 'remove') {
|
||||
// ----------------------------------------
|
||||
// eventTag: remove
|
||||
// ----------------------------------------
|
||||
|
||||
const eventId = this.getNodeParameter('eventId', i);
|
||||
const tagId = this.getNodeParameter('tagId', i);
|
||||
|
||||
const endpoint = `/events/removeTag/${eventId}/${tagId}`;
|
||||
responseData = await mispApiRequest.call(this, 'POST', endpoint);
|
||||
}
|
||||
} else if (resource === 'feed') {
|
||||
// **********************************************************************
|
||||
// feed
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------------
|
||||
// feed: create
|
||||
// ----------------------------------------
|
||||
|
||||
const url = this.getNodeParameter('url', i) as string;
|
||||
|
||||
throwOnInvalidUrl.call(this, url);
|
||||
|
||||
const body = {
|
||||
name: this.getNodeParameter('name', i),
|
||||
provider: this.getNodeParameter('provider', i),
|
||||
url,
|
||||
};
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
|
||||
if (Object.keys(additionalFields)) {
|
||||
Object.assign(body, additionalFields);
|
||||
}
|
||||
|
||||
responseData = await mispApiRequest.call(this, 'POST', '/feeds/add', body);
|
||||
responseData = responseData.Feed;
|
||||
} else if (operation === 'disable') {
|
||||
// ----------------------------------------
|
||||
// feed: disable
|
||||
// ----------------------------------------
|
||||
|
||||
const feedId = this.getNodeParameter('feedId', i);
|
||||
|
||||
const endpoint = `/feeds/disable/${feedId}`;
|
||||
responseData = await mispApiRequest.call(this, 'POST', endpoint);
|
||||
} else if (operation === 'enable') {
|
||||
// ----------------------------------------
|
||||
// feed: enable
|
||||
// ----------------------------------------
|
||||
|
||||
const feedId = this.getNodeParameter('feedId', i);
|
||||
const endpoint = `/feeds/enable/${feedId}`;
|
||||
responseData = await mispApiRequest.call(this, 'POST', endpoint);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// feed: get
|
||||
// ----------------------------------------
|
||||
|
||||
const feedId = this.getNodeParameter('feedId', i);
|
||||
responseData = await mispApiRequest.call(this, 'GET', `/feeds/view/${feedId}`);
|
||||
responseData = responseData.Feed;
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// feed: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = (await mispApiRequestAllItems.call(this, '/feeds')) as Array<{
|
||||
Feed: unknown;
|
||||
}>;
|
||||
responseData = responseData.map((entry) => entry.Feed);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// feed: update
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {};
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject & {
|
||||
url: string;
|
||||
};
|
||||
|
||||
throwOnEmptyUpdate.call(this, resource, updateFields);
|
||||
|
||||
if (updateFields.url) {
|
||||
throwOnInvalidUrl.call(this, updateFields.url);
|
||||
}
|
||||
|
||||
Object.assign(body, updateFields);
|
||||
|
||||
const feedId = this.getNodeParameter('feedId', i);
|
||||
responseData = await mispApiRequest.call(this, 'PUT', `/feeds/edit/${feedId}`, body);
|
||||
responseData = responseData.Feed;
|
||||
}
|
||||
} else if (resource === 'galaxy') {
|
||||
// **********************************************************************
|
||||
// galaxy
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// galaxy: delete
|
||||
// ----------------------------------------
|
||||
|
||||
const galaxyId = this.getNodeParameter('galaxyId', i);
|
||||
const endpoint = `/galaxies/delete/${galaxyId}`;
|
||||
responseData = await mispApiRequest.call(this, 'DELETE', endpoint);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// galaxy: get
|
||||
// ----------------------------------------
|
||||
|
||||
const galaxyId = this.getNodeParameter('galaxyId', i);
|
||||
const endpoint = `/galaxies/view/${galaxyId}`;
|
||||
responseData = await mispApiRequest.call(this, 'GET', endpoint);
|
||||
responseData = responseData.Galaxy;
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// galaxy: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = (await mispApiRequestAllItems.call(this, '/galaxies')) as Array<{
|
||||
Galaxy: unknown;
|
||||
}>;
|
||||
responseData = responseData.map((entry) => entry.Galaxy);
|
||||
}
|
||||
} else if (resource === 'noticelist') {
|
||||
// **********************************************************************
|
||||
// noticelist
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// noticelist: get
|
||||
// ----------------------------------------
|
||||
|
||||
const noticelistId = this.getNodeParameter('noticelistId', i);
|
||||
const endpoint = `/noticelists/view/${noticelistId}`;
|
||||
responseData = await mispApiRequest.call(this, 'GET', endpoint);
|
||||
responseData = responseData.Noticelist;
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// noticelist: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = (await mispApiRequestAllItems.call(this, '/noticelists')) as Array<{
|
||||
Noticelist: unknown;
|
||||
}>;
|
||||
responseData = responseData.map((entry) => entry.Noticelist);
|
||||
}
|
||||
} else if (resource === 'object') {
|
||||
// **********************************************************************
|
||||
// object
|
||||
// **********************************************************************
|
||||
if (operation === 'search') {
|
||||
// ----------------------------------------
|
||||
// attribute: search
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = await mispApiRestSearch.call(this, 'objects', i);
|
||||
}
|
||||
} else if (resource === 'organisation') {
|
||||
// **********************************************************************
|
||||
// organisation
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------------
|
||||
// organisation: create
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {
|
||||
name: this.getNodeParameter('name', i),
|
||||
};
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
|
||||
if (Object.keys(additionalFields)) {
|
||||
Object.assign(body, additionalFields);
|
||||
}
|
||||
|
||||
const endpoint = '/admin/organisations/add';
|
||||
responseData = await mispApiRequest.call(this, 'POST', endpoint, body);
|
||||
responseData = responseData.Organisation;
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// organisation: delete
|
||||
// ----------------------------------------
|
||||
|
||||
const organisationId = this.getNodeParameter('organisationId', i);
|
||||
const endpoint = `/admin/organisations/delete/${organisationId}`;
|
||||
responseData = await mispApiRequest.call(this, 'DELETE', endpoint);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// organisation: get
|
||||
// ----------------------------------------
|
||||
|
||||
const organisationId = this.getNodeParameter('organisationId', i);
|
||||
const endpoint = `/organisations/view/${organisationId}`;
|
||||
responseData = await mispApiRequest.call(this, 'GET', endpoint);
|
||||
responseData = responseData.Organisation;
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// organisation: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = (await mispApiRequestAllItems.call(this, '/organisations')) as Array<{
|
||||
Organisation: unknown;
|
||||
}>;
|
||||
responseData = responseData.map((entry) => entry.Organisation);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// organisation: update
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {};
|
||||
const updateFields = this.getNodeParameter('updateFields', i);
|
||||
throwOnEmptyUpdate.call(this, resource, updateFields);
|
||||
Object.assign(body, updateFields);
|
||||
|
||||
const organisationId = this.getNodeParameter('organisationId', i);
|
||||
const endpoint = `/admin/organisations/edit/${organisationId}`;
|
||||
responseData = await mispApiRequest.call(this, 'PUT', endpoint, body);
|
||||
responseData = responseData.Organisation;
|
||||
}
|
||||
} else if (resource === 'tag') {
|
||||
// **********************************************************************
|
||||
// tag
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------------
|
||||
// tag: create
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {
|
||||
name: this.getNodeParameter('name', i),
|
||||
};
|
||||
|
||||
const { colour } = this.getNodeParameter('additionalFields', i) as {
|
||||
name?: string;
|
||||
colour?: string;
|
||||
};
|
||||
|
||||
if (colour) {
|
||||
Object.assign(body, {
|
||||
colour: !colour.startsWith('#') ? `#${colour}` : colour,
|
||||
});
|
||||
}
|
||||
|
||||
responseData = await mispApiRequest.call(this, 'POST', '/tags/add', body);
|
||||
responseData = responseData.Tag;
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// tag: delete
|
||||
// ----------------------------------------
|
||||
|
||||
const tagId = this.getNodeParameter('tagId', i);
|
||||
responseData = await mispApiRequest.call(this, 'POST', `/tags/delete/${tagId}`);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// tag: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = (await mispApiRequest.call(this, 'GET', '/tags')) as LoadedTags;
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', 0);
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', 0);
|
||||
responseData = responseData.Tag.slice(0, limit);
|
||||
}
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// tag: update
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {};
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as {
|
||||
colour?: string;
|
||||
name?: string;
|
||||
};
|
||||
throwOnEmptyUpdate.call(this, resource, updateFields);
|
||||
Object.assign(body, updateFields);
|
||||
|
||||
const { colour, name } = updateFields;
|
||||
|
||||
Object.assign(body, {
|
||||
...(name && { name }),
|
||||
...(colour && { colour: !colour.startsWith('#') ? `#${colour}` : colour }),
|
||||
});
|
||||
|
||||
const tagId = this.getNodeParameter('tagId', i);
|
||||
responseData = await mispApiRequest.call(this, 'POST', `/tags/edit/${tagId}`, body);
|
||||
responseData = responseData.Tag;
|
||||
}
|
||||
} else if (resource === 'user') {
|
||||
// **********************************************************************
|
||||
// user
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------------
|
||||
// user: create
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {
|
||||
email: this.getNodeParameter('email', i),
|
||||
role_id: this.getNodeParameter('role_id', i),
|
||||
};
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
|
||||
if (Object.keys(additionalFields)) {
|
||||
Object.assign(body, additionalFields);
|
||||
}
|
||||
|
||||
responseData = await mispApiRequest.call(this, 'POST', '/admin/users/add', body);
|
||||
responseData = responseData.User;
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// user: delete
|
||||
// ----------------------------------------
|
||||
|
||||
const userId = this.getNodeParameter('userId', i);
|
||||
const endpoint = `/admin/users/delete/${userId}`;
|
||||
responseData = await mispApiRequest.call(this, 'DELETE', endpoint);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// user: get
|
||||
// ----------------------------------------
|
||||
|
||||
const userId = this.getNodeParameter('userId', i);
|
||||
const endpoint = `/admin/users/view/${userId}`;
|
||||
responseData = await mispApiRequest.call(this, 'GET', endpoint);
|
||||
responseData = responseData.User;
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// user: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = (await mispApiRequestAllItems.call(this, '/admin/users')) as Array<{
|
||||
User: unknown;
|
||||
}>;
|
||||
responseData = responseData.map((entry) => entry.User);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// user: update
|
||||
// ----------------------------------------
|
||||
|
||||
const body = {};
|
||||
const updateFields = this.getNodeParameter('updateFields', i);
|
||||
throwOnEmptyUpdate.call(this, resource, updateFields);
|
||||
Object.assign(body, updateFields);
|
||||
|
||||
const userId = this.getNodeParameter('userId', i);
|
||||
const endpoint = `/admin/users/edit/${userId}`;
|
||||
responseData = await mispApiRequest.call(this, 'PUT', endpoint, body);
|
||||
responseData = responseData.User;
|
||||
}
|
||||
} else if (resource === 'warninglist') {
|
||||
// **********************************************************************
|
||||
// warninglist
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// warninglist: get
|
||||
// ----------------------------------------
|
||||
|
||||
const warninglistId = this.getNodeParameter('warninglistId', i);
|
||||
const endpoint = `/warninglists/view/${warninglistId}`;
|
||||
responseData = await mispApiRequest.call(this, 'GET', endpoint);
|
||||
responseData = responseData.Warninglist;
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// warninglist: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
responseData = (await mispApiRequest.call(this, 'GET', '/warninglists')) as {
|
||||
Warninglists: Array<{ Warninglist: unknown }>;
|
||||
};
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', 0);
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', 0);
|
||||
responseData = responseData.Warninglists.slice(0, limit).map(
|
||||
(entry) => entry.Warninglist,
|
||||
);
|
||||
} else {
|
||||
responseData = responseData.Warninglists.map((entry) => entry.Warninglist);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,328 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { searchProperties } from './common.descriptions';
|
||||
import { updateDisplayOptions } from '../../../utils/utilities';
|
||||
|
||||
const searchDisplayOptions = {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
operation: ['search'],
|
||||
},
|
||||
};
|
||||
|
||||
const searchDescription = updateDisplayOptions(searchDisplayOptions, searchProperties);
|
||||
|
||||
export const attributeOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
action: 'Create an attribute',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
action: 'Delete an attribute',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
action: 'Get an attribute',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get many attributes',
|
||||
},
|
||||
{
|
||||
name: 'Search',
|
||||
value: 'search',
|
||||
action: 'Get a filtered list of attributes',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
action: 'Update an attribute',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const attributeFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// attribute: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Event UUID',
|
||||
name: 'eventId',
|
||||
description: 'UUID of the event to attach the attribute to',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Text',
|
||||
value: 'text',
|
||||
},
|
||||
{
|
||||
name: 'URL',
|
||||
value: 'url',
|
||||
},
|
||||
{
|
||||
name: 'Comment',
|
||||
value: 'comment',
|
||||
},
|
||||
],
|
||||
required: true,
|
||||
default: 'text',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Distribution',
|
||||
name: 'distribution',
|
||||
type: 'options',
|
||||
default: 0,
|
||||
description: 'Who will be able to see this event once published',
|
||||
options: [
|
||||
{
|
||||
name: 'All Communities',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
name: 'Connected Communities',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Inherit Event',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
name: 'Sharing Group',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
name: 'This Community Only',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Your Organization Only',
|
||||
value: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Sharing Group Name or ID',
|
||||
name: 'sharing_group_id',
|
||||
type: 'options',
|
||||
default: '',
|
||||
description:
|
||||
'Use only for when <code>Sharing Group</code> is selected in <code>Distribution</code>. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSharingGroups',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// attribute: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Attribute ID',
|
||||
name: 'attributeId',
|
||||
description: 'UUID or numeric ID of the attribute',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// attribute: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Attribute ID',
|
||||
name: 'attributeId',
|
||||
description: 'UUID or numeric ID of the attribute',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// attribute: search
|
||||
// ----------------------------------------
|
||||
...searchDescription,
|
||||
|
||||
// ----------------------------------------
|
||||
// attribute: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Attribute ID',
|
||||
name: 'attributeId',
|
||||
description: 'ID of the attribute to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['attribute'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Distribution',
|
||||
name: 'distribution',
|
||||
type: 'options',
|
||||
default: 0,
|
||||
description: 'Who will be able to see this event once published',
|
||||
options: [
|
||||
{
|
||||
name: 'All Communities',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
name: 'Connected Communities',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Inherit Event',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
name: 'Sharing Group',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
name: 'This Community Only',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Your Organization Only',
|
||||
value: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Sharing Group Name or ID',
|
||||
name: 'sharing_group_id',
|
||||
type: 'options',
|
||||
default: '',
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. Use only for when <code>Sharing Group</code> is selected in <code>Distribution</code>.',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSharingGroups',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
449
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/EventDescription.ts
Executable file
449
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/EventDescription.ts
Executable file
@@ -0,0 +1,449 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { searchProperties } from './common.descriptions';
|
||||
import { updateDisplayOptions } from '../../../utils/utilities';
|
||||
|
||||
const searchDisplayOptions = {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['search'],
|
||||
},
|
||||
};
|
||||
|
||||
const searchDescription = updateDisplayOptions(searchDisplayOptions, searchProperties);
|
||||
|
||||
export const eventOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
action: 'Create an event',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
action: 'Delete an event',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
action: 'Get an event',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get many events',
|
||||
},
|
||||
{
|
||||
name: 'Publish',
|
||||
value: 'publish',
|
||||
action: 'Publish an event',
|
||||
},
|
||||
{
|
||||
name: 'Search',
|
||||
value: 'search',
|
||||
action: 'Get a filtered list of events',
|
||||
},
|
||||
{
|
||||
name: 'Unpublish',
|
||||
value: 'unpublish',
|
||||
action: 'Unpublish an event',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
action: 'Update an event',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const eventFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// event: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Organization Name or ID',
|
||||
name: 'org_id',
|
||||
type: 'options',
|
||||
default: '',
|
||||
required: true,
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getOrgs',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Information',
|
||||
name: 'information',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
description: 'Information on the event - max 65535 characters',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Analysis',
|
||||
name: 'analysis',
|
||||
type: 'options',
|
||||
default: 0,
|
||||
description: 'Analysis maturity level of the event',
|
||||
options: [
|
||||
{
|
||||
name: 'Initial',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
name: 'Ongoing',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Complete',
|
||||
value: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Distribution',
|
||||
name: 'distribution',
|
||||
type: 'options',
|
||||
default: 0,
|
||||
description: 'Who will be able to see this event once published',
|
||||
options: [
|
||||
{
|
||||
name: 'All Communities',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
name: 'Connected Communities',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Inherit Event',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
name: 'Sharing Group',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
name: 'This Community Only',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Your Organization Only',
|
||||
value: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Sharing Group Name or ID',
|
||||
name: 'sharing_group_id',
|
||||
type: 'options',
|
||||
default: '',
|
||||
description:
|
||||
'Use only for when <code>Sharing Group</code> is selected in <code>Distribution</code>. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSharingGroups',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Threat Level ID',
|
||||
name: 'threat_level_id',
|
||||
type: 'options',
|
||||
default: 1,
|
||||
options: [
|
||||
{
|
||||
name: 'High',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Medium',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Low',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
name: 'Undefined',
|
||||
value: 4,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// event: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Event ID',
|
||||
name: 'eventId',
|
||||
description: 'UUID or numeric ID of the event',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// event: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Event ID',
|
||||
name: 'eventId',
|
||||
description: 'UUID or numeric ID of the event',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// event: publish
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Event ID',
|
||||
name: 'eventId',
|
||||
description: 'UUID or numeric ID of the event',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['publish'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// event: unpublish
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Event ID',
|
||||
name: 'eventId',
|
||||
description: 'UUID or numeric ID of the event',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['unpublish'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// event: search
|
||||
// ----------------------------------------
|
||||
...searchDescription,
|
||||
|
||||
// ----------------------------------------
|
||||
// event: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Event ID',
|
||||
name: 'eventId',
|
||||
description: 'UUID or numeric ID of the event',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['event'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Analysis',
|
||||
name: 'analysis',
|
||||
type: 'options',
|
||||
default: 0,
|
||||
description: 'Analysis maturity level of the event',
|
||||
options: [
|
||||
{
|
||||
name: 'Initial',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
name: 'Ongoing',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Complete',
|
||||
value: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Distribution',
|
||||
name: 'distribution',
|
||||
type: 'options',
|
||||
default: 0,
|
||||
description: 'Who will be able to see this event once published',
|
||||
options: [
|
||||
{
|
||||
name: 'All Communities',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
name: 'Connected Communities',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Inherit Event',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
name: 'Sharing Group',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
name: 'This Community Only',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Your Organization Only',
|
||||
value: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Information',
|
||||
name: 'information',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Information on the event - max 65535 characters',
|
||||
},
|
||||
{
|
||||
displayName: 'Sharing Group Name or ID',
|
||||
name: 'sharing_group_id',
|
||||
type: 'options',
|
||||
default: '',
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. Use only for when <code>Sharing Group</code> is selected in <code>Distribution</code>.',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSharingGroups',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Threat Level ID',
|
||||
name: 'threat_level_id',
|
||||
type: 'options',
|
||||
default: 1,
|
||||
options: [
|
||||
{
|
||||
name: 'High',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Medium',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Low',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
name: 'Undefined',
|
||||
value: 4,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,102 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const eventTagOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['eventTag'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Add',
|
||||
value: 'add',
|
||||
action: 'Add a tag to an event',
|
||||
},
|
||||
{
|
||||
name: 'Remove',
|
||||
value: 'remove',
|
||||
action: 'Remove a tag from an event',
|
||||
},
|
||||
],
|
||||
default: 'add',
|
||||
},
|
||||
];
|
||||
|
||||
export const eventTagFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// eventTag: add
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Event ID',
|
||||
name: 'eventId',
|
||||
description: 'UUID or numeric ID of the event',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['eventTag'],
|
||||
operation: ['add'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Name or ID',
|
||||
name: 'tagId',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
type: 'options',
|
||||
required: true,
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['eventTag'],
|
||||
operation: ['add'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// eventTag: remove
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Event ID',
|
||||
name: 'eventId',
|
||||
description: 'UUID or numeric ID of the event',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['eventTag'],
|
||||
operation: ['remove'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Name or ID',
|
||||
name: 'tagId',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
type: 'options',
|
||||
required: true,
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['eventTag'],
|
||||
operation: ['remove'],
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
324
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/FeedDescription.ts
Executable file
324
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/FeedDescription.ts
Executable file
@@ -0,0 +1,324 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const feedOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
action: 'Create a feed',
|
||||
},
|
||||
{
|
||||
name: 'Disable',
|
||||
value: 'disable',
|
||||
action: 'Disable a feed',
|
||||
},
|
||||
{
|
||||
name: 'Enable',
|
||||
value: 'enable',
|
||||
action: 'Enable a feed',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
action: 'Get a feed',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get many feeds',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
action: 'Update a feed',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const feedFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// feed: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Provider',
|
||||
name: 'provider',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'URL',
|
||||
name: 'url',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'https://example.com',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Distribution',
|
||||
name: 'distribution',
|
||||
type: 'options',
|
||||
default: 0,
|
||||
description: 'Who will be able to see this event once published',
|
||||
options: [
|
||||
{
|
||||
name: 'All Communities',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
name: 'Connected Communities',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Inherit Event',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
name: 'Sharing Group',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
name: 'This Community Only',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Your Organization Only',
|
||||
value: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Rules',
|
||||
name: 'json',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Filter rules for the feed',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// feed: disable
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Feed ID',
|
||||
name: 'feedId',
|
||||
description: 'UUID or numeric ID of the feed',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
operation: ['disable'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// feed: enable
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Feed ID',
|
||||
name: 'feedId',
|
||||
description: 'UUID or numeric ID of the feed',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
operation: ['enable'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// feed: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Feed ID',
|
||||
name: 'feedId',
|
||||
description: 'UUID or numeric ID of the feed',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// feed: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Feed ID',
|
||||
name: 'feedId',
|
||||
description: 'ID of the feed to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['feed'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Distribution',
|
||||
name: 'distribution',
|
||||
type: 'options',
|
||||
default: 0,
|
||||
description: 'Who will be able to see this event once published',
|
||||
options: [
|
||||
{
|
||||
name: 'All Communities',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
name: 'Connected Communities',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Inherit Event',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
name: 'Sharing Group',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
name: 'This Community Only',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Your Organization Only',
|
||||
value: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Provider',
|
||||
name: 'provider',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Rules',
|
||||
name: 'rules',
|
||||
type: 'json',
|
||||
default: '',
|
||||
description: 'Filter rules for the feed',
|
||||
},
|
||||
{
|
||||
displayName: 'URL',
|
||||
name: 'url',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
105
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/GalaxyDescription.ts
Executable file
105
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/GalaxyDescription.ts
Executable file
@@ -0,0 +1,105 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const galaxyOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['galaxy'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
action: 'Delete a galaxy',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
action: 'Get a galaxy',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get many galaxies',
|
||||
},
|
||||
],
|
||||
default: 'get',
|
||||
},
|
||||
];
|
||||
|
||||
export const galaxyFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// galaxy: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Galaxy ID',
|
||||
name: 'galaxyId',
|
||||
description: 'UUID or numeric ID of the galaxy',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['galaxy'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// galaxy: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Galaxy ID',
|
||||
name: 'galaxyId',
|
||||
description: 'UUID or numeric ID of the galaxy',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['galaxy'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// galaxy: getAll
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['galaxy'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['galaxy'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const noticelistOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['noticelist'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
action: 'Get a noticelist',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get many noticelists',
|
||||
},
|
||||
],
|
||||
default: 'get',
|
||||
},
|
||||
];
|
||||
|
||||
export const noticelistFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// noticelist: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Noticelist ID',
|
||||
name: 'noticelistId',
|
||||
description: 'Numeric ID of the noticelist',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['noticelist'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['noticelist'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['noticelist'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,42 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { searchProperties } from './common.descriptions';
|
||||
import { updateDisplayOptions } from '../../../utils/utilities';
|
||||
|
||||
const searchDisplayOptions = {
|
||||
show: {
|
||||
resource: ['object'],
|
||||
operation: ['search'],
|
||||
},
|
||||
};
|
||||
|
||||
const searchDescription = updateDisplayOptions(searchDisplayOptions, searchProperties);
|
||||
|
||||
export const objectOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['object'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Search',
|
||||
value: 'search',
|
||||
action: 'Get a filtered list of objects',
|
||||
},
|
||||
],
|
||||
default: 'search',
|
||||
},
|
||||
];
|
||||
|
||||
export const objectFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// event: search
|
||||
// ----------------------------------------
|
||||
...searchDescription,
|
||||
];
|
||||
@@ -0,0 +1,245 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const organisationOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organisation'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
action: 'Create an organization',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
action: 'Delete an organization',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
action: 'Get an organization',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get many organizations',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
action: 'Update an organization',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const organisationFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// organisation: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organisation'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organisation'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Created by Email',
|
||||
name: 'created_by_email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Nationality',
|
||||
name: 'nationality',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Sector',
|
||||
name: 'sector',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'User Count',
|
||||
name: 'usercount',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// organisation: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Organisation ID',
|
||||
name: 'organisationId',
|
||||
description: 'UUID or numeric ID of the organisation',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organisation'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// organisation: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Organisation ID',
|
||||
name: 'organisationId',
|
||||
description: 'UUID or numeric ID of the organisation',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organisation'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organisation'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organisation'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// organisation: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Organisation ID',
|
||||
name: 'organisationId',
|
||||
description: 'ID of the organisation to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organisation'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['organisation'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Nationality',
|
||||
name: 'nationality',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Sector',
|
||||
name: 'sector',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
177
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/TagDescription.ts
Executable file
177
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/TagDescription.ts
Executable file
@@ -0,0 +1,177 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const tagOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['tag'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
action: 'Create a tag',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
action: 'Delete a tag',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get many tags',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
action: 'Update a tag',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const tagFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// tag: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['tag'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['tag'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Color',
|
||||
description: 'Hex color code for the tag',
|
||||
name: 'colour',
|
||||
type: 'color',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// tag: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Tag ID',
|
||||
name: 'tagId',
|
||||
description: 'Numeric ID of the attribute',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['tag'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// tag: getAll
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['tag'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['tag'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// tag: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Tag ID',
|
||||
name: 'tagId',
|
||||
description: 'ID of the tag to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['tag'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['tag'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Color',
|
||||
description: 'Hex color code for the tag',
|
||||
name: 'colour',
|
||||
type: 'color',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
255
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/UserDescription.ts
Executable file
255
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/UserDescription.ts
Executable file
@@ -0,0 +1,255 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const userOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
action: 'Create a user',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
action: 'Delete a user',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
action: 'Get a user',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get many users',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
action: 'Update a user',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const userFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// user: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Role ID',
|
||||
name: 'role_id',
|
||||
type: 'string',
|
||||
description: 'Role IDs are available in the MISP dashboard at /roles/index',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'GPG Key',
|
||||
name: 'gpgkey',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
|
||||
displayName: 'Inviter Email or ID',
|
||||
name: 'invited_by',
|
||||
type: 'options',
|
||||
default: '',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Organization Name or ID',
|
||||
name: 'org_id',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getOrgs',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// user: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
description: 'Numeric ID of the user',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// user: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
description: 'Numeric ID of the user',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// user: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
description: 'ID of the user to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'GPG Key',
|
||||
name: 'gpgkey',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Inviter Name or ID',
|
||||
name: 'invited_by',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Organization Name or ID',
|
||||
name: 'org_id',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getOrgs',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,82 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const warninglistOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['warninglist'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
action: 'Get a warninglist',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get many warninglists',
|
||||
},
|
||||
],
|
||||
default: 'get',
|
||||
},
|
||||
];
|
||||
|
||||
export const warninglistFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// warninglist: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Warninglist ID',
|
||||
name: 'warninglistId',
|
||||
description: 'Numeric ID of the warninglist',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['warninglist'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// warninglist: getAll
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['warninglist'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['warninglist'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,102 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const searchProperties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Use JSON to Specify Fields',
|
||||
name: 'useJson',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to use JSON to specify the fields for the search request',
|
||||
},
|
||||
{
|
||||
displayName: 'JSON',
|
||||
name: 'jsonOutput',
|
||||
type: 'json',
|
||||
description:
|
||||
'Get more info at {YOUR_BASE_URL_SPECIFIED_IN_CREDENTIALS}/api/openapi#operation/restSearchAttributes',
|
||||
typeOptions: {
|
||||
rows: 5,
|
||||
},
|
||||
default: '{\n "value": "search value",\n "type": "text"\n}\n',
|
||||
validateType: 'object',
|
||||
displayOptions: {
|
||||
show: {
|
||||
useJson: [true],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
required: true,
|
||||
placeholder: 'e.g. 127.0.0.1',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
useJson: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
useJson: [false],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Category',
|
||||
name: 'category',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. Internal reference',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Deleted',
|
||||
name: 'deleted',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Search All',
|
||||
name: 'searchall',
|
||||
type: 'string',
|
||||
description:
|
||||
'Search by matching any tag names, event descriptions, attribute values or attribute comments',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
'/resource': ['attribute'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Tags',
|
||||
name: 'tags',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. tag1,tag2',
|
||||
hint: 'Comma-separated list of tags',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'string',
|
||||
placeholder: 'e.g. text',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Published',
|
||||
name: 'published',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
11
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/index.ts
Executable file
11
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/descriptions/index.ts
Executable file
@@ -0,0 +1,11 @@
|
||||
export * from './AttributeDescription';
|
||||
export * from './EventDescription';
|
||||
export * from './EventTagDescription';
|
||||
export * from './FeedDescription';
|
||||
export * from './GalaxyDescription';
|
||||
export * from './NoticelistDescription';
|
||||
export * from './ObjectDescription';
|
||||
export * from './OrganisationDescription';
|
||||
export * from './TagDescription';
|
||||
export * from './UserDescription';
|
||||
export * from './WarninglistDescription';
|
||||
1
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/misp.svg
Executable file
1
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/misp.svg
Executable file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="235 200 115 115"><g clip-path="url(#clipPath312-7)" transform="matrix(.62542 0 0 -.62542 101.247 567.973)"><path d="M0 0h-5.184v-56.985c0-8.879-5.16-16.902-15.523-16.902h-101.465v-2.709c0-7.851 8.922-15.763 18.084-15.763h77.581l29.678-17.449-4.31 17.449H0c9.156 0 13.287 7.906 13.287 15.763v63.068C13.287-5.683 9.156 0 0 0" style="fill:#2fa1db;fill-opacity:1;fill-rule:nonzero;stroke:none" transform="translate(385.579 529.593)"/><path d="M0 0h-117.85c-10.369 0-22.301-9.211-22.301-18.09v-71.424c0-8.177 10.11-14.082 19.807-14.987l-6.311-23.958 40.441 23.786H0c10.363 0 19.937 6.286 19.937 15.159v71.424C19.937-9.211 10.363 0 0 0m-99.871-60.292c-5.88 0-10.645 4.766-10.645 10.646S-105.751-39-99.871-39c5.874 0 10.646-4.766 10.646-10.646s-4.772-10.646-10.646-10.646m39.764 0c-5.88 0-10.646 4.766-10.646 10.646S-65.987-39-60.107-39s10.646-4.766 10.646-10.646-4.766-10.646-10.646-10.646m39.77 0c-5.881 0-10.652 4.766-10.652 10.646S-26.218-39-20.337-39c5.868 0 10.645-4.766 10.645-10.646s-4.777-10.646-10.645-10.646" style="fill:#2fa1db;fill-opacity:1;fill-rule:nonzero;stroke:none" transform="translate(349.725 569.184)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
23
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/types.ts
Executable file
23
n8n-n8n-1.109.2/packages/nodes-base/nodes/Misp/types.ts
Executable file
@@ -0,0 +1,23 @@
|
||||
export type MispCredentials = {
|
||||
baseUrl: string;
|
||||
apiKey: string;
|
||||
allowUnauthorizedCerts: boolean;
|
||||
};
|
||||
|
||||
export type LoadedOrgs = Array<{
|
||||
Organisation: { id: string; name: string };
|
||||
}>;
|
||||
|
||||
export type LoadedTags = {
|
||||
Tag: Array<{ id: string; name: string }>;
|
||||
};
|
||||
|
||||
export type LoadedUsers = Array<{
|
||||
User: { id: string; email: string };
|
||||
}>;
|
||||
|
||||
export type LoadedSharingGroups = {
|
||||
response: Array<{
|
||||
SharingGroup: { id: string; name: string };
|
||||
}>;
|
||||
};
|
||||
Reference in New Issue
Block a user