2020-12-02 02:24:25 -08:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
import {
TLP ,
2020-12-02 02:54:10 -08:00
} from './AnalyzerInterface' ;
2020-12-02 02:24:25 -08:00
2021-12-03 00:44:16 -08:00
export const analyzersOperations : INodeProperties [ ] = [
2020-12-02 02:24:25 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-12-02 02:24:25 -08:00
required : true ,
description : 'Choose an operation' ,
displayOptions : {
show : {
resource : [
'analyzer' ,
] ,
} ,
} ,
default : 'execute' ,
options : [
{
name : 'Execute' ,
value : 'execute' ,
description : 'Execute Analyzer' ,
2022-07-10 13:50:51 -07:00
action : 'Execute an analyzer' ,
2020-12-02 02:24:25 -08:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-12-02 02:24:25 -08:00
2020-12-02 02:54:10 -08:00
export const analyzerFields : INodeProperties [ ] = [
2020-12-02 02:24:25 -08:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Analyzer Type Name or ID' ,
2020-12-02 02:24:25 -08:00
name : 'analyzer' ,
type : 'options' ,
required : true ,
typeOptions : {
loadOptionsMethod : 'loadActiveAnalyzers' ,
} ,
2020-12-02 02:54:10 -08:00
displayOptions : {
2020-12-02 02:24:25 -08:00
show : {
resource : [
'analyzer' ,
] ,
2020-12-02 02:54:10 -08:00
operation : [
2020-12-02 02:24:25 -08:00
'execute' ,
] ,
} ,
} ,
2022-07-14 13:05:11 -07:00
description : 'Choose the analyzer. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-12-02 02:24:25 -08:00
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Observable Type Name or ID' ,
2020-12-02 02:24:25 -08:00
name : 'observableType' ,
type : 'options' ,
required : true ,
2020-12-02 02:54:10 -08:00
displayOptions : {
2020-12-02 02:24:25 -08:00
show : {
resource : [
'analyzer' ,
] ,
2020-12-02 02:54:10 -08:00
operation : [
2020-12-02 02:24:25 -08:00
'execute' ,
] ,
} ,
2020-12-02 02:54:10 -08:00
hide : {
analyzer : [
2020-12-02 02:24:25 -08:00
'' ,
] ,
} ,
} ,
2020-12-02 02:54:10 -08:00
typeOptions : {
2020-12-02 02:24:25 -08:00
loadOptionsMethod : 'loadObservableOptions' ,
loadOptionsDependsOn : [
'analyzer' ,
] ,
} ,
default : '' ,
2022-07-14 13:05:11 -07:00
description : 'Choose the observable type. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-12-02 02:24:25 -08:00
} ,
// Observable type != file
{
displayName : 'Observable Value' ,
name : 'observableValue' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
resource : [
'analyzer' ,
] ,
2020-12-02 02:54:10 -08:00
operation : [
2020-12-02 02:24:25 -08:00
'execute' ,
] ,
} ,
2020-12-02 02:54:10 -08:00
hide : {
2020-12-02 02:24:25 -08:00
observableType : [
'file' ,
] ,
2020-12-02 02:54:10 -08:00
analyzer : [
2020-12-02 02:24:25 -08:00
'' ,
] ,
} ,
} ,
default : '' ,
description : 'Enter the observable value' ,
} ,
{
displayName : 'Binary Property' ,
name : 'binaryPropertyName' ,
type : 'string' ,
default : 'data' ,
required : true ,
displayOptions : {
show : {
observableType : [
'file' ,
] ,
resource : [
'analyzer' ,
] ,
operation : [
'execute' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Name of the binary property to which to write the data of the read file' ,
2020-12-02 02:24:25 -08:00
} ,
{
displayName : 'TLP' ,
name : 'tlp' ,
type : 'options' ,
2020-12-02 02:54:10 -08:00
displayOptions : {
2020-12-02 02:24:25 -08:00
show : {
resource : [
'analyzer' ,
] ,
operation : [
'execute' ,
] ,
} ,
2020-12-02 02:54:10 -08:00
hide : {
2020-12-02 02:24:25 -08:00
observableType : [
'' ,
] ,
analyzer : [
'' ,
] ,
} ,
} ,
options : [
{
name : 'White' ,
value : TLP.white ,
} ,
{
name : 'Green' ,
value : TLP.green ,
} ,
{
name : 'Amber' ,
value : TLP.amber ,
2020-12-02 02:54:10 -08:00
} , {
2020-12-02 02:24:25 -08:00
name : 'Red' ,
value : TLP.red ,
2020-12-02 02:54:10 -08:00
} ,
2020-12-02 02:24:25 -08:00
] ,
default : 2 ,
description : 'The TLP of the analyzed observable' ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'analyzer' ,
] ,
operation : [
'execute' ,
] ,
} ,
} ,
options : [
{
displayName : 'Force' ,
name : 'force' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to force bypassing the cache' ,
2020-12-02 02:24:25 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Timeout (Seconds)' ,
2020-12-02 02:24:25 -08:00
name : 'timeout' ,
type : 'number' ,
default : 3 ,
description : 'Timeout to wait for the report in case it is not available at the time the query was made' ,
} ,
] ,
} ,
] ;