MongoDB Key Value Store

Manipulates key/value pairs according to an incident utilizing the MongoDB collection.

Database · MongoDB

Details

IDMongoDB Key Value Store
ProviderMongoDB Inc.
CategoryDatabase
From Version5.0.0
Docker Imagedemisto/py3-tools:1.0.0.114656
Supported ModulesAgentix XSIAM

README

Overview


Manipulates key/value pairs according to an incident utilizing the MongoDB collection.
This integration was integrated and tested with version v4.2.3 of MongoDB.

The account user must have appropriate permissions - root role to execute the API calls.

Configure MongoDB Key Value Store on Cortex XSOAR


  1. Navigate to Settings > Integrations > Servers & Services.
  2. Search for MongoDB Key Value Store.
  3. Click Add instance to create and configure a new integration instance.
    • Name: a textual name for the integration instance.
    • MongoDB username
    • URI (mongodb://IP/FQDN:Port Number)
    • MongoDB database name
    • MongoDB collection name
    • Use an SSL/TLS secured connection
    • Trust any certificate (not secure)
  4. Click Test to validate the URLs, token, and connection.

Commands


You can execute these commands from the Cortex XSOAR CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

  1. mongodb-write-key-value
  2. mongodb-get-key-value
  3. mongodb-list-key-values
  4. mongodb-delete-key
  5. mongodb-purge-entries
  6. mongodb-get-keys-number
  7. mongodb-list-incidents

1. mongodb-write-key-value


Adds a key/value record for the incident. If the key exists, the existing value is overwritten.*

Base Command

mongodb-write-key-value

Input
Argument Name Description Required
id The XSOAR incident number. Optional
key Name/Key. Required
value Assigns a value to the name/key. Required
Context Output
Path Type Description
MongoDB.Entry.ID String Entry ID.
MongoDB.Entry.Incident String Incident ID.
MongoDB.Entry.Key String Incident key.
MongoDB.Entry.Value String Incident value.
MongoDB.Entry.Modified Date Incident modified date.
Command Example

!mongodb-write-key-value key=demisto value=test5

Context Example
{
    "MongoDB.Entry": {
        "Incident": "6e1807d3-b0ae-40a0-8e82-dad33539c587", 
        "Value": "test5", 
        "ID": "5e92db8a225a4976e096eeb9", 
        "Key": "demisto", 
        "Modified": "2020-04-12T09:12:42+00:00"
    }
}
Human Readable Output

Incident “6e1807d3-b0ae-40a0-8e82-dad33539c587” - key/value collection - 1 document added

2. mongodb-get-key-value


Returns the value of the specified name/key of an incident.

Base Command

mongodb-get-key-value

Input
Argument Name Description Required
id The XSOAR incident number. Optional
key Name/Key. Required
Context Output
Path Type Description
MongoDB.Entry.Incident String Incident ID.
MongoDB.Entry.Key String Incident key.
MongoDB.Entry.Value String The value of the key.
Command Example

!mongodb-get-key-value key=demisto

Context Example
{
    "MongoDB.Entry": {
        "Incident": "6e1807d3-b0ae-40a0-8e82-dad33539c587", 
        "Value": "test5", 
        "Modified": "2020-04-12T09:12:42+00:00", 
        "Key": "demisto"
    }
}
Human Readable Output

The key and value that is stored for the incident

Incident Key Modified Value
6e1807d3-b0ae-40a0-8e82-dad33539c587 demisto 2020-04-12T09:12:42+00:00 test5

3. mongodb-list-key-values


Lists the keys and their values for the specified incident.

Base Command

mongodb-list-key-values

Input
Argument Name Description Required
id The XSOAR incident number. Optional
Context Output
Path Type Description
MongoDB.Incident.Incident String Incident ID.
MongoDB.Incident.Key String Incident key.
MongoDB.Incident.Value String The value of the key.
Command Example

!mongodb-list-key-values id=1234

Context Example
{
    "MongoDB.Incident": [
        {
            "Incident": "1234", 
            "Value": "test2", 
            "Key": "test"
        }, 
        {
            "Incident": "1234", 
            "Value": "test", 
            "Key": "demisto"
        }, 
        {
            "Incident": "1234", 
            "Value": "world", 
            "Key": "hello"
        }
    ]
}
Human Readable Output

The key/value paires stored in incident 1234

Key Value
test test2
demisto test
hello world

4. mongodb-delete-key


Deletes the key/value record for an incident.

Base Command

mongodb-delete-key

Input
Argument Name Description Required
id The XSOAR incident number. Optional
key Name/Key. Required
Context Output

There is no context output for this command.

Command Example

!mongodb-delete-key key=hello id=1234

Human Readable Output

Incident “1234” - key/value collection - 1 document deleted

5. mongodb-purge-entries


Purges all keys/values for an incident. A common use case for this command is when closing an incident. This command clears the entries for the closed incident from the database.

Base Command

mongodb-purge-entries

Input
Argument Name Description Required
id The XSOAR incident number. Optional
Context Output

There is no context output for this command.

Command Example

!mongodb-purge-entries id=2468

Human Readable Output

Incident “2468” key/value pairs purged - 1 document/record deleted

6. mongodb-get-keys-number


Returns the number of key/value pairs for an incident.

Base Command

mongodb-get-keys-number

Input
Argument Name Description Required
id The XSOAR incident number. Optional
Context Output

There is no context output for this command.

Command Example

!mongodb-get-keys-number id=1234

Human Readable Output

The count of the key/value pairs for the incident - 2

7. mongodb-list-incidents


Lists all incidents in the collection.

Base Command

mongodb-list-incidents

Input

There are no input arguments for this command.

Context Output

There is no context output for this command.

Command Example

!mongodb-list-incidents

Human Readable Output

List of incidents in collecion generic

Incidents
2468
1234
014f5f87-a1bf-4eac-8d36-2ec3b69693ef
6e1807d3-b0ae-40a0-8e82-dad33539c587

Configuration parameters

  • credentials — MongoDB username (required)
  • uri — URI (mongodb://<IP/FQDN>:<Port Number>) (required)
  • database — MongoDB database name (required)
  • collection — MongoDB collection name (required)
  • use_ssl — Use an SSL/TLS secured connection
  • insecure — Trust any certificate (not secure)

Commands (7)

  • mongodb-delete-key

    Deletes the key/value record for an incident.

  • mongodb-get-key-value

    Returns the value of the specified name/key of an incident.

  • mongodb-get-keys-number

    Returns the number of key/value pairs for an incident.

  • mongodb-list-incidents

    Lists all incidents in the collection.

  • mongodb-list-key-values

    Lists the keys and their values for the specified incident.

  • mongodb-purge-entries

    Purges all keys/values for an incident. A common use case for this command is when closing an incident. This command clears the entries for the closed incident from the database.

  • mongodb-write-key-value

    Adds a key/value record for the incident. If the key exists, the existing value is overwritten.

category: Database
provider: MongoDB Inc.
fromversion: 5.0.0
commonfields:
  id: MongoDB Key Value Store
  version: -1
configuration:
- display: MongoDB username
  name: credentials
  required: true
  type: 9
- display: URI (mongodb://<IP/FQDN>:<Port Number>)
  name: uri
  required: true
  type: 0
- display: MongoDB database name
  name: database
  required: true
  type: 0
- defaultvalue: generic
  display: MongoDB collection name
  name: collection
  required: true
  type: 0
- display: Use an SSL/TLS secured connection
  name: use_ssl
  type: 8
  required: false
- display: Trust any certificate (not secure)
  name: insecure
  type: 8
  required: false
description: Manipulates key/value pairs according to an incident utilizing the MongoDB collection.
display: MongoDB Key Value Store
name: MongoDB Key Value Store
script:
  commands:
  - arguments:
    - description: The Demisto incident number.
      name: id
    - description: Name/Key.
      name: key
      required: true
    - description: Assigns a value to the name/key.
      name: value
      required: true
    description: Adds a key/value record for the incident. If the key exists, the existing value is overwritten.
    name: mongodb-write-key-value
    outputs:
    - contextPath: MongoDB.Entry.ID
      description: Entry ID.
      type: String
    - contextPath: MongoDB.Entry.Incident
      description: Incident ID.
      type: String
    - contextPath: MongoDB.Entry.Key
      description: Incident key.
      type: String
    - contextPath: MongoDB.Entry.Value
      description: Incident value.
      type: String
    - contextPath: MongoDB.Entry.Modified
      description: Incident modified date.
      type: Date
  - arguments:
    - description: The Demisto incident number.
      name: id
    - description: Name/Key.
      name: key
      required: true
    description: Returns the value of the specified name/key of an incident.
    name: mongodb-get-key-value
    outputs:
    - contextPath: MongoDB.Entry.Incident
      description: Incident ID.
      type: String
    - contextPath: MongoDB.Entry.Key
      description: Incident key.
      type: String
    - contextPath: MongoDB.Entry.Value
      description: The value of the key.
      type: String
  - arguments:
    - description: The Demisto incident number.
      name: id
    description: Lists the keys and their values for the specified incident.
    name: mongodb-list-key-values
    outputs:
    - contextPath: MongoDB.Incident.Incident
      description: Incident ID.
      type: String
    - contextPath: MongoDB.Incident.Key
      description: Incident key.
      type: String
    - contextPath: MongoDB.Incident.Value
      description: The value of the key.
      type: String
  - arguments:
    - description: The Demisto incident number.
      name: id
    - description: Name/Key.
      name: key
      required: true
    description: Deletes the key/value record for an incident.
    name: mongodb-delete-key
  - arguments:
    - description: The Demisto incident number.
      name: id
    description: Purges all keys/values for an incident. A common use case for this command is when closing an incident. This command clears the entries for the closed incident from the database.
    name: mongodb-purge-entries
  - arguments:
    - description: The Demisto incident number.
      name: id
    description: Returns the number of key/value pairs for an incident.
    name: mongodb-get-keys-number
  - description: Lists all incidents in the collection.
    name: mongodb-list-incidents
  dockerimage: demisto/py3-tools:1.0.0.114656
  runonce: false
  script: '-'
  type: python
  subtype: python3
tests:
- MongoDB KeyValueStore - Test