wiseService/wiseService.js
/**
   * Add for each source config definition for the UI to use.
   *
   * @param {string} sourceName - The source name
   * @param {WISESourceAPI~SourceConfig} config - The configuration of this source type
   */
Add for each source config definition for the UI to use.
@param {string} sourceName - The source name
@param {WISESourceAPI~SourceConfig} config - The configuration of this source type
Add for each source config definition for the UI to use . @param { string } sourceName - The source name @param { WISESourceAPI~SourceConfig } config - The configuration of this source type
addSourceConfigDef (sourceName, configDef) {
    if (internals.configDefs[sourceName] === undefined) {
      const types = configDef.types || internals.type2Name;
      for (let i = 0; i < types.length; i++) {
        const type = types[i];
        let excludeName;
        if (type === 'url') {
          excludeName = 'excludeURLs';
        } else if (type === 'ip') {
          configDef.fields = configDef.fields.concat([
            { name: 'excludeIPs', required: false, multiline: ';', help: 'List of IPs or CIDRs to exclude in WISE lookups' },
            { name: 'onlyIPs', required: false, multiline: ';', help: 'If set, only IPs that match the list of IPs or CIDRs will be looked up by WISE' }
          ]);
          if (configDef.singleton === false && types.length > 0) {
            Object.assign(configDef.fields[configDef.fields.length - 2], { ifField: 'type', ifValue: type });
            Object.assign(configDef.fields[configDef.fields.length - 1], { ifField: 'type', ifValue: type });
          }
          continue;
        } else {
          excludeName = 'exclude' + type[0].toUpperCase() + type.slice(1) + 's';
        }
        configDef.fields = configDef.fields.concat(
          [{ name: excludeName, required: false, multiline: ';', help: 'List of modified glob patterns to exclude in WISE lookups' }]
        );
        if (configDef.singleton === false && types.length > 0) {
          Object.assign(configDef.fields[configDef.fields.length - 1], { ifField: 'type', ifValue: type });
        }
      }
      if (configDef.cacheable !== false) {
        configDef.fields = configDef.fields.concat(
          [{ name: 'cacheAgeMin', required: false, help: 'Minutes to cache items from previous lookup. (defaults to 60)', regex: '^[0-9]+$' }]
        );
      }
      if (configDef.singleton === false && types.length > 0) {
        configDef.fields = configDef.fields.concat([
          { name: 'fields', required: false, multiline: '\\n', help: 'Create a list of fields in Arkime, this may also be defined in the input file. See the Tagger Format docs for more information. In general they look like field:[EXPRESSION];db:[ES FIELD NAME];kind:[FIELD TYPE];friendly:[UI NAME];help:[HELP TEXT];shortcut:[JSON FIELD PATH or CSV column number]' },
          { name: 'view', required: false, multiline: '\\n', help: 'The view to show in session detail when opening up a session with unique fields, this also may be done in the input file. The value for view can either be written in simplified format or in more powerful pug format. For the pug format see Tagger Format in the docs for more information. Simple format looks like require:[toplevel db name];title:[title string];fields:[field1],[field2],[fieldN]' }
        ]);
      }
      internals.configDefs[sourceName] = configDef;
    }
  }
addSourceConfigDef ( sourceName , configDef ) { if ( internals . configDefs [ sourceName ] === undefined ) { const types = configDef . types || internals . type2Name ; for ( let i = 0 ; i < types . length ; i ++ ) { const type = types [ i ] ; let excludeName ; if ( type === 'url' ) { excludeName = 'excludeURLs' ; } else if ( type === 'ip' ) { configDef . fields = configDef . fields . concat ( [ { name : 'excludeIPs' , required : false , multiline : ';' , help : 'List of IPs or CIDRs to exclude in WISE lookups' } , { name : 'onlyIPs' , required : false , multiline : ';' , help : 'If set, only IPs that match the list of IPs or CIDRs will be looked up by WISE' } ] ) ; if ( configDef . singleton === false && types . length > 0 ) { Object . assign ( configDef . fields [ configDef . fields . length - 2 ] , { ifField : 'type' , ifValue : type } ) ; Object . assign ( configDef . fields [ configDef . fields . length - 1 ] , { ifField : 'type' , ifValue : type } ) ; } continue ; } else { excludeName = 'exclude' + type [ 0 ] . toUpperCase ( ) + type . slice ( 1 ) + 's' ; } configDef . fields = configDef . fields . concat ( [ { name : excludeName , required : false , multiline : ';' , help : 'List of modified glob patterns to exclude in WISE lookups' } ] ) ; if ( configDef . singleton === false && types . length > 0 ) { Object . assign ( configDef . fields [ configDef . fields . length - 1 ] , { ifField : 'type' , ifValue : type } ) ; } } if ( configDef . cacheable !== false ) { configDef . fields = configDef . fields . concat ( [ { name : 'cacheAgeMin' , required : false , help : 'Minutes to cache items from previous lookup. (defaults to 60)' , regex : '^[0-9]+$' } ] ) ; } if ( configDef . singleton === false && types . length > 0 ) { configDef . fields = configDef . fields . concat ( [ { name : 'fields' , required : false , multiline : '\\n' , help : 'Create a list of fields in Arkime, this may also be defined in the input file. See the Tagger Format docs for more information. In general they look like field:[EXPRESSION];db:[ES FIELD NAME];kind:[FIELD TYPE];friendly:[UI NAME];help:[HELP TEXT];shortcut:[JSON FIELD PATH or CSV column number]' } , { name : 'view' , required : false , multiline : '\\n' , help : 'The view to show in session detail when opening up a session with unique fields, this also may be done in the input file. The value for view can either be written in simplified format or in more powerful pug format. For the pug format see Tagger Format in the docs for more information. Simple format looks like require:[toplevel db name];title:[title string];fields:[field1],[field2],[fieldN]' } ] ) ; } internals . configDefs [ sourceName ] = configDef ; } }
Add for each source config definition for the UI to use.
Add for each source config definition for the UI to use .
// ALW - should really merge all the types somehow here instead of type2Name