MISP V3

Malware information sharing platform and threat sharing.

Data Enrichment & Threat Intelligence · MISP

Details

IDMISP V3
ProviderOpen Source
CategoryData Enrichment & Threat Intelligence
From Version5.5.0
Docker Imagedemisto/pymisp2:2.5.34.1.10133006
Supported ModulesAgentix XSIAM

README

Malware information sharing platform and threat sharing.

Some changes have been made that might affect your existing content.
If you are upgrading from a previous version of this integration, see Breaking Changes.

Configure MISP V3 in Cortex

Parameter Description Required
MISP server URL (e.g., https://192.168.0.1)   True
API Key   False
Client Certificate   False
Private Key   False
Use IDS flag This is to enable checking the boolean flag to_ids. The flag allows you to indicate if an attribute should be actionable or not. False
ORG names to use for reputation checks Comma-separated list of allowed TI providers (orgc in MISP events). False
Use system proxy settings   False
Trust any certificate (not secure)   False
Malicious tag IDs Comma-separated list of event’s or attribute’s malicious tag IDs. Malicious tags are stronger than suspicious tags. False
Suspicious tag IDs Comma-separated list of event’s or attribute’s suspicious tag IDs. Malicious tags are stronger than suspicious tags. False
Benign tag IDs Comma-separated list of event’s or attribute’s benign tag IDs. Malicious and suspicious tags are stronger than benign tags. False
Search warninglists Should the warninglists be considered when searching for an attribute.` False
Source Reliability Reliability of the source providing the intelligence data. True
Maximum attributes to be returned This field limits the number of attributes that will be written to the context for every reputation command. Raising the number of attributes may result in high memory and disk usage. False

Commands

You can execute these commands from the 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.

misp-search-events


Search for events in MISP. This search command will return only information about the matched events. To get information about attributes, use the misp-search-attributes command.

Base Command

misp-search-events

Input

Argument Name Description Required
type Search for events that include the specified attribute type. Use any valid MISP attribute type. For example: “md5”, “sha1”, “email”, “url”. Optional
value Search for events that include the specified attribute value. For example: “1.2.3.4” (and other IP addresses), “google.com” (and other domains), “www.example.com” (and other URLs). Optional
category Search for events that include the specified attribute category. Use any valid MISP attribute category. For example: “Other”, “Person”, “Attribution”, “Payload type”. Optional
org Search by creator organization by supplying the organization ID. Optional
tags A comma-separated list of tags to include in the results. To exclude a tag, prefix the tag name with “!”. Can be: “AND”, “OR”, and “NOT” followed by “:”. To chain logical operators use “;”. For example, “AND:tag1,tag2;OR:tag3”. Optional
from Event search start date in the format yyyy-mm-dd. For example, 2015-02-15. This date refers to the event creation date. Optional
to Event search end date in the format yyyy-mm-dd. For example, 2015-02-15. This date refers to the event creation date. Optional
last Events published within the last “x” amount of time. Valid time values are days, hours, and minutes. For example, “5d”, “12h”, “30m”. This filter uses the published timestamp of the event. Optional
event_id A comma-separated list of event IDs to be returned by the search. Optional
uuid The event UUID to be returned by the search. For example, 59523300-4be8-4fa6-8867-0037ac110002. Optional
page If a limit is set, sets the page to be returned. For example, page 3, limit 100 will return records 201->300. Default is 1. Optional
limit Limit the number of events returned. Default is 50. Optional
include_feed_correlations Whether to return the event related feeds. Possible values are: true, false. Note: Only if this argument set to “true” the response will include attributes’ feed hits values. Optional

Context Output

Path Type Description
MISP.Event.ID string MISP event ID.
MISP.Event.Distribution string MISP event distribution.
MISP.Event.ThreatLevelID string Threat level of the MISP event (1 High, 2 Medium, 3 Low, 4 Undefined).
MISP.Event.PublishTimestamp number Timestamp of the publish time (if published).
MISP.Event.EventCreatorEmail string Email address of the event creator.
MISP.Event.Info string Event name.
MISP.Event.AttributeCount string Number of attributes of the event.
MISP.Event.OrganizationID string Event organization ID.
MISP.Event.CreationDate date Event creation date.
MISP.Event.Locked boolean Is the event locked.
MISP.Event.Organization.ID number Organization ID.
MISP.Event.Organization.Name string Organization name.
MISP.Event.Organization.UUID string Organization UUID.
MISP.Event.Organization.local boolean Is the organization local.
MISP.Event.OwnerOrganization.ID number Owner organization ID.
MISP.Event.OwnerOrganization.Name string Owner organization name.
MISP.Event.OwnerOrganization.UUID string Owner organization UUID.
MISP.Event.OwnerOrganization.local boolean Is the owner organization local.
MISP.Event.ProposalEmailLock boolean Is email lock proposed.
MISP.Event.LastChanged date Last change event timestamp.
MISP.Event.Galaxy.Description string Event’s galaxy description.
MISP.Event.Galaxy.Name string Galaxy name.
MISP.Event.Galaxy.Type string Galaxy type.
MISP.Event.Published boolean Is the event published.
MISP.Event.DisableCorrelation boolean Is correlation disabled.
MISP.Event.UUID string Event UUID.
MISP.Event.Analysis string Event analysis (0 Initial, 1 Ongoing, 2 Completed).
MISP.Event.SharingGroupID string Event sharing group ID.
MISP.Event.Tag.Name string All tag names in the event.
MISP.Event.Tag.is_galaxy boolean Is the tag galaxy.
MISP.Event.Object.Name String Name of the object.
MISP.Event.Object.Description String Description of the object.
MISP.Event.Object.ID Number ID of the object.
MISP.Event.Object.UUID String UUID of the object.
MISP.Event.Feed.ID String Feed id.
MISP.Event.Feed.Name String Feed name.
MISP.Event.Feed.Provider String Feed provider.
MISP.Event.Feed.SourceFormat String Feed source format (MISP for example).
MISP.Event.Feed.URL String Feed url.
MISP.Event.Feed.EventUUIDS Unknown List of event uuids include the feed.
MISP.Event.Attribute.Feed.ID String Attribute feed id.
MISP.Event.Attribute.Feed.Name String Attribute feed name.
MISP.Event.Attribute.Feed.Provider String Attribute feed provider.
MISP.Event.Attribute.Feed.SourceFormat String Attribute feed source format (MISP for example).
MISP.Event.Attribute.Feed.URL String Attribute feed url.
MISP.Event.Attribute.Feed.EventUUIDS Unknown List of event uuids include the attribute feed.
MISP.Event.Attribute.ID String MISP attribute ID.
MISP.Event.Attribute.Value String MISP attribute value.

Command Example

!misp-search-events category="Other" limit=3 page=1

Context Example

{
    "MISP": {
        "Event": [
            {
                "Analysis": "2",
                "AttributeCount": "147",
                "CreationDate": "2019-03-18",
                "DisableCorrelation": false,
                "Distribution": "1",
                "Galaxy": [],
                "ID": "238",
                "Info": "New Targets Enterprise Wireless Presentation & Display Systems",
                "LastChanged": "2021-07-18T13:10:09Z",
                "Locked": false,
                "Object": [
                    {
                        "Description": "url object describes an url along with its normalized field (like extracted using faup parsing library) and its metadata.",
                        "ID": "16142",
                        "Name": "url",
                        "UUID": "c139891b-ba75-469f-b814-bda63942003c"
                    },
                    {
                        "Description": "A domain/hostname and IP address seen as a tuple in a specific time frame.",
                        "ID": "16341",
                        "Name": "domain-ip",
                        "UUID": "a9e1a62c-9a61-4edc-b097-d15f7d000c06"
                    },
                    {
                        "Description": "url object describes an url along with its normalized field (like extracted using faup parsing library) and its metadata.",
                        "ID": "16348",
                        "Name": "url",
                        "UUID": "8a6021bd-ff01-43e2-9057-2e4df06440af"
                    },
                    {
                        "Description": "An IP address (or domain or hostname) and a port seen as a tuple (or as a triple) in a specific time frame.",
                        "ID": "16374",
                        "Name": "ip-port",
                        "UUID": "76db4ff4-f808-442a-a029-ec4d568d6427"
                    },
                    {
                        "Description": "Vehicle object template to describe a vehicle information and registration",
                        "ID": "16381",
                        "Name": "vehicle",
                        "UUID": "9e5d6801-6c7d-41f3-aace-734bcefed248"
                    },
                    {
                        "Description": "File object describing a file with meta-information",
                        "ID": "16403",
                        "Name": "file",
                        "UUID": "26be8488-3fa0-45d7-a95e-96045d4d2dc7"
                    }
                ],
                "Organization": {
                    "ID": "1",
                    "Name": "ORGNAME",
                    "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                    "local": true
                },
                "OrganizationID": "1",
                "OwnerOrganization": {
                    "ID": "7",
                    "Name": "CUDESO",
                    "UUID": "56c42374-fdb8-4544-a218-41ffc0a8ab16",
                    "local": false
                },
                "OwnerOrganization.ID": "7",
                "ProposalEmailLock": false,
                "PublishTimestamp": "2021-06-23T13:50:21Z",
                "Published": false,
                "RelatedEvent": [],
                "SharingGroupID": "0",
                "Tag": [
                    {
                        "Name": "tlp:white",
                        "is_galaxy": false
                    }
                ],
                "ThreatLevelID": "3",
                "UUID": "5c93d7f7-7de4-4548-ae4c-403ec0a8ab16"
            },
            {
                "Analysis": "2",
                "AttributeCount": "9",
                "CreationDate": "2020-04-06",
                "DisableCorrelation": false,
                "Distribution": "1",
                "Galaxy": [],
                "ID": "239",
                "Info": "New RedLine Stealer Distributed Using Coronavirus-themed Email Campaign",
                "LastChanged": "2021-07-01T12:34:41Z",
                "Locked": false,
                "Object": [
                    {
                        "Description": "url object describes an url along with its normalized field (like extracted using faup parsing library) and its metadata.",
                        "ID": "16141",
                        "Name": "url",
                        "UUID": "a7ed8921-e22b-450e-bc84-8fd8932d2a32"
                    }
                ],
                "Organization": {
                    "ID": "1",
                    "Name": "ORGNAME",
                    "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                    "local": true
                },
                "OrganizationID": "1",
                "OwnerOrganization": {
                    "ID": "7",
                    "Name": "CUDESO",
                    "UUID": "56c42374-fdb8-4544-a218-41ffc0a8ab16",
                    "local": false
                },
                "OwnerOrganization.ID": "7",
                "ProposalEmailLock": false,
                "PublishTimestamp": "2021-06-23T13:50:22Z",
                "Published": false,
                "RelatedEvent": [],
                "SharingGroupID": "0",
                "Tag": [
                    {
                        "Name": "tlp:white",
                        "is_galaxy": false
                    }
                ],
                "ThreatLevelID": "2",
                "UUID": "5e8b8ba5-df0c-4e7b-bfb4-b27ec0a8ab16"
            },
            {
                "Analysis": "2",
                "AttributeCount": "22",
                "CreationDate": "2021-04-17",
                "DisableCorrelation": false,
                "Distribution": "1",
                "Galaxy": [],
                "ID": "241",
                "Info": "Detecting and Preventing Malicious Domains Proactively with DNS Security",
                "LastChanged": "2021-05-04T18:49:48Z",
                "Locked": false,
                "Object": [
                    {
                        "Description": "JA3 is a new technique for creating SSL client fingerprints that are easy to produce.",
                        "ID": "11131",
                        "Name": "ja3",
                        "UUID": "f95b8b4f-d31a-4b41-b30f-5f0bfe9ae788"
                    }
                ],
                "Organization": {
                    "ID": "1",
                    "Name": "ORGNAME",
                    "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                    "local": true
                },
                "OrganizationID": "1",
                "OwnerOrganization": {
                    "ID": "7",
                    "Name": "CUDESO",
                    "UUID": "56c42374-fdb8-4544-a218-41ffc0a8ab16",
                    "local": false
                },
                "OwnerOrganization.ID": "7",
                "ProposalEmailLock": false,
                "PublishTimestamp": "2021-06-23T13:50:23Z",
                "Published": true,
                "RelatedEvent": [],
                "SharingGroupID": "0",
                "Tag": [
                    {
                        "Name": "tlp:white",
                        "is_galaxy": false
                    }
                ],
                "ThreatLevelID": "3",
                "UUID": "e74cba52-0314-43c2-9958-43a55619fcf5"
            }
        ]
    }
}

Human Readable Output

MISP search-events returned 3 events

Current page size: 3
Showing page 1 out others that may exist

Event Distribution Event ID Event Info Event Objects Event Org ID Event Orgc ID Event Tags Event UUID Publish Timestamp
1 238 New Targets Enterprise Wireless Presentation & Display Systems 16142,
16341,
16348,
16374,
16381,
16403
1 7 tlp:white 5c93d7f7-7de4-4548-ae4c-403ec0a8ab16 2021-06-23T13:50:21Z
1 239 New RedLine Stealer Distributed Using Coronavirus-themed Email Campaign 16141 1 7 tlp:white 5e8b8ba5-df0c-4e7b-bfb4-b27ec0a8ab16 2021-06-23T13:50:22Z
1 241 Detecting and Preventing Malicious Domains Proactively with DNS Security 11131 1 7 tlp:white e74cba52-0314-43c2-9958-43a55619fcf5 2021-06-23T13:50:23Z

domain


Checks the reputation of the given domain.

Notice: Submitting indicators using this command might make the indicator data publicly available. See the vendor’s documentation for more details.

Base Command

domain

Input

Argument Name Description Required
domain Domain to search. Required

Context Output

Path Type Description
Domain.Name String The domain of the indicator.
DBotScore.Indicator String The indicator that was tested.
DBotScore.Type String The indicator type.
DBotScore.Vendor String The vendor used to calculate the score.
DBotScore.Score Number The actual score.
DBotScore.Reliability String Reliability of the source providing the intelligence data.
MISP.Attribute.Distribution string Attribute distribution.
MISP.Attribute.Value string Attribute value.
MISP.Attribute.EventID string Attribute event ID.
MISP.Attribute.last_seen string Attribute last_seen timestamp.
MISP.Attribute.first_seen string Attribute first_seen timestamp.
MISP.Attribute.LastChanged date Attribute last changed timestamp.
MISP.Attribute.ObjectID string Attribute object ID.
MISP.Attribute.Deleted boolean Is the attribute deleted.
MISP.Attribute.DisableCorrelation boolean Is attribute correlation disabled.
MISP.Attribute.Type string Attribute type.
MISP.Attribute.ID string Attribute ID.
MISP.Attribute.UUID string Attribute UUID.
MISP.Attribute.ToIDs boolean Is the Intrusion Detection System flag set.
MISP.Attribute.Category string Attribute category.
MISP.Attribute.SharingGroupID string Attribute sharing group ID.
MISP.Attribute.Comment string Attribute comment.
MISP.Attribute.Event.ID string MISP event ID.
MISP.Attribute.Event.Distribution string MISP event distribution.
MISP.Attribute.Event.Info string MISP event name.
MISP.Attribute.Event.LastChanged string Last change event timestamp.
MISP.Attribute.Event.Published boolean Is the event published.
MISP.Attribute.Event.CreationDate date Event creation date.
MISP.Attribute.Event.ThreatLevelID string Threat level of the MISP event (1 High, 2 Medium, 3 Low, 4 Undefined).
MISP.Attribute.Event.PublishTimestamp string Timestamp of the publish time (if published).
MISP.Attribute.Event.OrganizationID string MISP event organization ID.
MISP.Attribute.Event.OwnerOrganization.ID string Owner organization ID.
MISP.Attribute.Event.OwnerOrganization.Name string Owner organization name.
MISP.Attribute.Event.OwnerOrganization.UUID string Owner organization UUID.
MISP.Attribute.Event.OwnerOrganization.local boolean Is owner organization local.
MISP.Attribute.Event.UUID string MISP event UUID.
MISP.Attribute.Event.Analysis string Event analysis (0 Initial, 1 Ongoing, 2 Completed).
MISP.Attribute.Event.SharingGroupID string Event sharing group ID.
MISP.Attribute.Event.Tag.Name string Event tag name.
MISP.Attribute.Event.Tag.ID string Event tag ID.
MISP.Attribute.Tag.Name string Attribute tag name.
MISP.Attribute.Tag.ID string Attribute tag ID.
MISP.Attribute.Sighting.Type string Attribute’s sighting type.

Command Example

!domain domain=ahaaa0.com

Context Example

{
    "DBotScore": {
        "Indicator": "ahaaa0.com",
        "Reliability": "B - Usually reliable",
        "Score": 3,
        "Type": "domain",
        "Vendor": "MISP V3"
    },
    "Domain": {
        "Malicious": {
            "Description": "Match found in MISP",
            "Vendor": "MISP V3"
        },
        "Name": "ahaaa0.com"
    },
    "MISP": {
        "Attribute": {
            "Category": "Network activity",
            "Comment": "",
            "DecayScore": [
                {
                    "DecayingModel": {
                        "ID": "3",
                        "Name": "test3"
                    },
                    "base_score": 0,
                    "decayed": true,
                    "score": 0
                }
            ],
            "Deleted": false,
            "DisableCorrelation": false,
            "Distribution": "5",
            "Event": {
                "Analysis": "2",
                "CreationDate": "2014-11-13",
                "Distribution": "1",
                "ID": "1208",
                "Info": "OSINT Expansion on campaign",
                "LastChanged": "2014-11-13T14:32:53Z",
                "OrganizationID": "1",
                "OwnerOrganization": {
                    "ID": "3",
                    "Name": "example.be",
                    "UUID": "55f6ea5f-fd34-43b8-ac1d-40cb950d210f",
                    "local": false
                },
                "OwnerOrganization.ID": "3",
                "PublishTimestamp": "2021-07-20T08:18:45Z",
                "Published": true,
                "SharingGroupID": "0",
                "Tag": [
                    {
                        "ID": "5",
                        "Name": "type:OSINT"
                    },
                    {
                        "ID": "3",
                        "Name": "tlp:green"
                    }
                ],
                "ThreatLevelID": "2",
                "UUID": "5464bf96-1f14-43f1-af86-08ce950d210b",
                "extends_uuid": ""
            },
            "EventID": "1208",
            "ID": "111718",
            "LastChanged": "2014-11-13T14:30:17Z",
            "ObjectID": "0",
            "ObjectRelation": null,
            "SharingGroupID": "0",
            "Sighting": [],
            "Tag": [
                {
                    "ID": "5",
                    "Name": "type:OSINT"
                },
                {
                    "ID": "3",
                    "Name": "tlp:green"
                }
            ],
            "ToIDs": true,
            "Type": "domain",
            "UUID": "5464c079-3a08-4195-8bc9-491c950d210b",
            "Value": "ahaaa0.com",
            "first_seen": null,
            "last_seen": null
        }
    }
}

Human Readable Output

Results found in MISP for value: ahaaa0.com

Attribute Category Attribute Type Attribute Value Dbot Score
Network activity domain ahaaa0.com 3

Related events

Event ID Event Name Threat Level ID
1208 OSINT Expansion on Rotten Tomato campaign 2

email


Checks the reputation of the given email address.

Base Command

email

Input

Argument Name Description Required
email Email address to search. Required

Context Output

Path Type Description
Email.Address String The email address of the indicator.
DBotScore.Indicator String The indicator that was tested.
DBotScore.Type String The indicator type.
DBotScore.Vendor String The vendor used to calculate the score.
DBotScore.Score Number The actual score.
DBotScore.Reliability String Reliability of the source providing the intelligence data.
MISP.Attribute.Distribution string Attribute distribution.
MISP.Attribute.Value string Attribute value.
MISP.Attribute.EventID string Attribute event ID.
MISP.Attribute.last_seen string Attribute last_seen timestamp.
MISP.Attribute.first_seen string Attribute first_seen timestamp.
MISP.Attribute.LastChanged date Attribute last changed timestamp.
MISP.Attribute.ObjectID string Attribute object ID.
MISP.Attribute.Deleted boolean Is the attribute deleted.
MISP.Attribute.DisableCorrelation boolean Is attribute correlation disabled.
MISP.Attribute.Type string Attribute type.
MISP.Attribute.ID string Attribute ID.
MISP.Attribute.UUID string Attribute UUID.
MISP.Attribute.ToIDs boolean Is the Intrusion Detection System flag set.
MISP.Attribute.Category string Attribute category.
MISP.Attribute.SharingGroupID string Attribute sharing group ID.
MISP.Attribute.Comment string Attribute comment.
MISP.Attribute.Event.ID string MISP event ID.
MISP.Attribute.Event.Distribution string MISP event distribution.
MISP.Attribute.Event.Info string MISP event name.
MISP.Attribute.Event.LastChanged string Last change event timestamp.
MISP.Attribute.Event.Published boolean Is the event published.
MISP.Attribute.Event.CreationDate date Event creation date.
MISP.Attribute.Event.ThreatLevelID string Threat level of the MISP event (1 High, 2 Medium, 3 Low, 4 Undefined).
MISP.Attribute.Event.PublishTimestamp string Timestamp of the publish time (if published).
MISP.Attribute.Event.OrganizationID string MISP event organization ID.
MISP.Attribute.Event.OwnerOrganization.ID string Owner organization ID.
MISP.Attribute.Event.OwnerOrganization.Name string Owner organization name.
MISP.Attribute.Event.OwnerOrganization.UUID string Owner organization UUID.
MISP.Attribute.Event.OwnerOrganization.local boolean Is owner organization local.
MISP.Attribute.Event.UUID string MISP event UUID.
MISP.Attribute.Event.Analysis string Event analysis (0 Initial, 1 Ongoing, 2 Completed).
MISP.Attribute.Event.SharingGroupID string Event sharing group ID.
MISP.Attribute.Event.Tag.Name string Event tag name.
MISP.Attribute.Event.Tag.ID string Event tag ID.
MISP.Attribute.Tag.Name string Attribute tag name.
MISP.Attribute.Tag.ID string Attribute tag ID.
MISP.Attribute.Sighting.Type string Attribute’s sighting type.

Command Example

!email email=example@gmail.com

Context Example

{
    "DBotScore": {
        "Indicator": "example@gmail.com",
        "Reliability": "B - Usually reliable",
        "Score": 3,
        "Type": "email",
        "Vendor": "MISP V3"
    },
    "Email": {
        "Address": "example@gmail.com"
    },
    "MISP": {
        "Attribute": {
            "Category": "Network activity",
            "Comment": "",
            "Deleted": false,
            "DisableCorrelation": false,
            "Distribution": "5",
            "Event": {
                "Analysis": "0",
                "CreationDate": "2021-07-29",
                "Distribution": "1",
                "ID": "1655",
                "Info": "TestEvent",
                "LastChanged": "2021-07-29T13:57:06Z",
                "OrganizationID": "1",
                "OwnerOrganization": {
                    "ID": "1",
                    "Name": "ORGNAME",
                    "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                    "local": true
                },
                "OwnerOrganization.ID": "1",
                "PublishTimestamp": "1970-01-01T00:00:00Z",
                "Published": false,
                "SharingGroupID": "0",
                "Tag": [],
                "ThreatLevelID": "1",
                "UUID": "ce083018-0b85-430b-a202-f60bbffcd26b",
                "extends_uuid": ""
            },
            "EventID": "1655",
            "ID": "116534",
            "LastChanged": "2021-07-29T13:56:53Z",
            "ObjectID": "0",
            "ObjectRelation": null,
            "SharingGroupID": "0",
            "Sighting": [
                {
                    "EventID": "1655",
                    "ID": "1895",
                    "Organisation": {
                        "ID": "1",
                        "Name": "ORGNAME",
                        "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                    },
                    "OrganizationID": "1",
                    "Type": "1",
                    "UUID": "77491938-9024-4eb4-8d29-dbc6dd866c1e",
                    "attribute_id": "116534",
                    "attribute_uuid": "c286a1f8-441e-479b-b10d-b10add2b6739",
                    "date_sighting": "1627567009",
                    "source": ""
                }
            ],
            "ToIDs": false,
            "Type": "email",
            "UUID": "c286a1f8-441e-479b-b10d-b10add2b6739",
            "Value": "example@gmail.com",
            "first_seen": null,
            "last_seen": null
        }
    }
}

Human Readable Output

Results found in MISP for value: example@gmail.com

Attribute Category Attribute Type Attribute Value Dbot Score
Network activity email example@gmail.com 3

Related events

Event ID Event Name Threat Level ID
1655 TestEvent 1

file


Checks the file reputation of the given hash.

Base Command

file

Input

Argument Name Description Required
file Hash of the file to query. Supports MD5, SHA-1, and SHA-256. Required

Context Output

Path Type Description
File.SHA1 String The SHA1 hash of the file.
File.SHA256 String The SHA256 hash of the file.
File.MD5 String The MD5 hash of the file.
DBotScore.Indicator String The indicator that was tested.
DBotScore.Type String The indicator type.
DBotScore.Vendor String The vendor used to calculate the score.
DBotScore.Score Number The actual score.
DBotScore.Reliability String Reliability of the source providing the intelligence data.
MISP.Attribute.Distribution string Attribute distribution.
MISP.Attribute.Value string Attribute value.
MISP.Attribute.EventID string Attribute event ID.
MISP.Attribute.last_seen string Attribute last_seen timestamp.
MISP.Attribute.first_seen string Attribute first_seen timestamp.
MISP.Attribute.LastChanged date Attribute last changed timestamp.
MISP.Attribute.ObjectID string Attribute object ID.
MISP.Attribute.Deleted boolean Is the attribute deleted.
MISP.Attribute.DisableCorrelation boolean Is attribute correlation disabled.
MISP.Attribute.Type string Attribute type.
MISP.Attribute.ID string Attribute ID.
MISP.Attribute.UUID string Attribute UUID.
MISP.Attribute.ToIDs boolean Is the Intrusion Detection System flag set.
MISP.Attribute.Category string Attribute category.
MISP.Attribute.SharingGroupID string Attribute sharing group ID.
MISP.Attribute.Comment string Attribute comment.
MISP.Attribute.Event.ID string MISP event ID.
MISP.Attribute.Event.Distribution string MISP event distribution.
MISP.Attribute.Event.Info string MISP event name.
MISP.Attribute.Event.LastChanged string Last change event timestamp.
MISP.Attribute.Event.Published boolean Is the event published.
MISP.Attribute.Event.CreationDate date Event creation date.
MISP.Attribute.Event.ThreatLevelID string Threat level of the MISP event (1 High, 2 Medium, 3 Low, 4 Undefined).
MISP.Attribute.Event.PublishTimestamp string Timestamp of the publish time (if published).
MISP.Attribute.Event.OrganizationID string MISP event organization ID.
MISP.Attribute.Event.OwnerOrganization.ID string Owner organization ID.
MISP.Attribute.Event.OwnerOrganization.Name string Owner organization name.
MISP.Attribute.Event.OwnerOrganization.UUID string Owner organization UUID.
MISP.Attribute.Event.OwnerOrganization.local boolean Is owner organization local.
MISP.Attribute.Event.UUID string MISP event UUID.
MISP.Attribute.Event.Analysis string Event analysis (0 Initial, 1 Ongoing, 2 Completed).
MISP.Attribute.Event.SharingGroupID string Event sharing group ID.
MISP.Attribute.Event.Tag.Name string Event tag name.
MISP.Attribute.Event.Tag.ID string Event tag ID.
MISP.Attribute.Tag.Name string Attribute tag name.
MISP.Attribute.Tag.ID string Attribute tag ID.
MISP.Attribute.Sighting.Type string Attribute’s sighting type.

Command Example

!file file=6c73d338ec64e0e44bd54ea61b6988b2

Context Example

{
    "DBotScore": {
        "Indicator": "6c73d338ec64e0e44bd54ea61b6988b2",
        "Reliability": "B - Usually reliable",
        "Score": 3,
        "Type": "file",
        "Vendor": "MISP V3"
    },
    "File": {
        "MD5": "6c73d338ec64e0e44bd54ea61b6988b2",
        "Malicious": {
            "Description": "Match found in MISP",
            "Vendor": "MISP V3"
        }
    },
    "MISP": {
        "Attribute": [
            {
                "Category": "Payload delivery",
                "Comment": "",
                "Deleted": false,
                "DisableCorrelation": false,
                "Distribution": "5",
                "Event": {
                    "Analysis": "0",
                    "CreationDate": "2020-03-13",
                    "Distribution": "3",
                    "ID": "149",
                    "Info": "Capitalizing on Coronavirus Panic, Threat Actors Target Victims Worldwide",
                    "LastChanged": "2021-07-20T11:50:07Z",
                    "OrganizationID": "1",
                    "OwnerOrganization": {
                        "ID": "8",
                        "Name": "CERT.be",
                        "UUID": "5cf66e53-b5f8-43e7-be9a-49880a3b4631",
                        "local": false
                    },
                    "OwnerOrganization.ID": "8",
                    "PublishTimestamp": "2021-07-19T14:10:30Z",
                    "Published": false,
                    "SharingGroupID": "0",
                    "Tag": [
                        {
                            "ID": "123",
                            "Name": "Recorded Future"
                        },
                        {
                            "ID": "74",
                            "Name": "osint:source-type=\"technical-report\""
                        },
                        {
                            "ID": "2",
                            "Name": "tlp:white"
                        },
                        {
                            "ID": "124",
                            "Name": "Phishing"
                        },
                        {
                            "ID": "125",
                            "Name": "misp-galaxy:target-information=\"United States\""
                        },
                        {
                            "ID": "128",
                            "Name": "misp-galaxy:target-information=\"China\""
                        },
                        {
                            "ID": "129",
                            "Name": "misp-galaxy:target-information=\"Iran\""
                        },
                        {
                            "ID": "130",
                            "Name": "misp-galaxy:target-information=\"Italy\""
                        },
                        {
                            "ID": "131",
                            "Name": "misp-galaxy:target-information=\"Ukraine\""
                        }
                    ],
                    "ThreatLevelID": "1",
                    "UUID": "5e6b322a-9f80-4e2f-9f2a-3cab0a3b4631",
                    "extends_uuid": ""
                },
                "EventID": "149",
                "ID": "70942",
                "LastChanged": "2021-07-18T08:06:40Z",
                "ObjectID": "0",
                "ObjectRelation": null,
                "SharingGroupID": "0",
                "Sighting": [
                    {
                        "EventID": "149",
                        "ID": "406",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "5efbf8b2-88de-40a5-8b47-bdd6ffd4cb43",
                        "attribute_id": "70942",
                        "attribute_uuid": "5e6b336e-5224-445f-b1b3-457dd7dd9f6d",
                        "date_sighting": "1625043306",
                        "source": ""
                    }
                ],
                "Tag": [
                    {
                        "ID": "279",
                        "Name": "misp-galaxy:financial-fraud=\"Scam\""
                    },
                    {
                        "ID": "104",
                        "Name": "test1"
                    },
                    {
                        "ID": "123",
                        "Name": "Recorded Future"
                    },
                    {
                        "ID": "74",
                        "Name": "osint:source-type=\"technical-report\""
                    },
                    {
                        "ID": "2",
                        "Name": "tlp:white"
                    },
                    {
                        "ID": "124",
                        "Name": "Phishing"
                    },
                    {
                        "ID": "125",
                        "Name": "misp-galaxy:target-information=\"United States\""
                    },
                    {
                        "ID": "128",
                        "Name": "misp-galaxy:target-information=\"China\""
                    },
                    {
                        "ID": "129",
                        "Name": "misp-galaxy:target-information=\"Iran\""
                    },
                    {
                        "ID": "130",
                        "Name": "misp-galaxy:target-information=\"Italy\""
                    },
                    {
                        "ID": "131",
                        "Name": "misp-galaxy:target-information=\"Ukraine\""
                    }
                ],
                "ToIDs": true,
                "Type": "md5",
                "UUID": "5e6b336e-5224-445f-b1b3-457dd7dd9f6d",
                "Value": "6c73d338ec64e0e44bd54ea61b6988b2",
                "first_seen": null,
                "last_seen": null
            },
            {
                "Category": "Payload delivery",
                "Comment": "",
                "Deleted": false,
                "DisableCorrelation": false,
                "Distribution": "5",
                "Event": {
                    "Analysis": "2",
                    "CreationDate": "2016-01-04",
                    "Distribution": "1",
                    "ID": "145",
                    "Info": "DDOS.TF",
                    "LastChanged": "2021-06-28T07:33:03Z",
                    "OrganizationID": "1",
                    "OwnerOrganization": {
                        "ID": "7",
                        "Name": "CUDESO",
                        "UUID": "56c42374-fdb8-4544-a218-41ffc0a8ab16",
                        "local": false
                    },
                    "OwnerOrganization.ID": "7",
                    "PublishTimestamp": "2021-06-24T12:31:10Z",
                    "Published": false,
                    "SharingGroupID": "0",
                    "Tag": [
                        {
                            "ID": "2",
                            "Name": "tlp:white"
                        }
                    ],
                    "ThreatLevelID": "2",
                    "UUID": "56d76936-0d34-44ff-a8c5-5280c0a8ab16",
                    "extends_uuid": ""
                },
                "EventID": "145",
                "ID": "71742",
                "LastChanged": "2021-06-28T07:33:03Z",
                "ObjectID": "0",
                "ObjectRelation": null,
                "SharingGroupID": "0",
                "Sighting": [],
                "Tag": [
                    {
                        "ID": "247",
                        "Name": "passivetotal:class=\"suspicious\""
                    },
                    {
                        "ID": "278",
                        "Name": "misp-galaxy:mitre-attack-pattern"
                    },
                    {
                        "ID": "2",
                        "Name": "tlp:white"
                    }
                ],
                "ToIDs": false,
                "Type": "md5",
                "UUID": "ec686712-d0a5-4dd8-8736-330da8abefa6",
                "Value": "6c73d338ec64e0e44bd54ea61b6988b2",
                "first_seen": null,
                "last_seen": null
            },
            {
                "Category": "Payload delivery",
                "Comment": "",
                "Deleted": false,
                "DisableCorrelation": false,
                "Distribution": "5",
                "Event": {
                    "Analysis": "2",
                    "CreationDate": "2017-05-03",
                    "Distribution": "1",
                    "ID": "144",
                    "Info": "Snake: Coming soon in Mac OS X flavour",
                    "LastChanged": "2021-07-14T08:20:25Z",
                    "OrganizationID": "1",
                    "OwnerOrganization": {
                        "ID": "7",
                        "Name": "CUDESO",
                        "UUID": "56c42374-fdb8-4544-a218-41ffc0a8ab16",
                        "local": false
                    },
                    "OwnerOrganization.ID": "7",
                    "PublishTimestamp": "2021-06-15T08:31:04Z",
                    "Published": false,
                    "SharingGroupID": "0",
                    "Tag": [
                        {
                            "ID": "2",
                            "Name": "tlp:white"
                        },
                        {
                            "ID": "280",
                            "Name": "misp-galaxy:mitre-attack-pattern"
                        }
                    ],
                    "ThreatLevelID": "3",
                    "UUID": "590c76a9-0bac-4d1e-b8af-416ac0a8ab16",
                    "extends_uuid": ""
                },
                "EventID": "144",
                "ID": "71741",
                "LastChanged": "2021-07-14T08:20:25Z",
                "ObjectID": "0",
                "ObjectRelation": null,
                "SharingGroupID": "0",
                "Sighting": [],
                "Tag": [
                    {
                        "ID": "247",
                        "Name": "passivetotal:class=\"suspicious\""
                    },
                    {
                        "ID": "2",
                        "Name": "tlp:white"
                    },
                ],
                "ToIDs": true,
                "Type": "md5",
                "UUID": "f6b054cf-3dbb-4c7b-aab1-a37193e5e841",
                "Value": "6c73d338ec64e0e44bd54ea61b6988b2",
                "first_seen": null,
                "last_seen": null
            }
        ]
    }
}

Human Readable Output

Results found in MISP for value: 6c73d338ec64e0e44bd54ea61b6988b2

Attribute Category Attribute Type Attribute Value Dbot Score Events with the scored tag Scored Tag ID Scored Tag Name
Payload delivery md5 6c73d338ec64e0e44bd54ea61b6988b2 3 {‘Event_ID’: ‘145’, ‘Event_Name’: ‘DDOS.TF’},
{‘Event_ID’: ‘144’, ‘Event_Name’: ‘Snake: Coming soon in Mac OS X flavour’}
247 passivetotal:class=”suspicious”

Related events

Event ID Event Name Threat Level ID
149 Capitalizing on Coronavirus Panic, Threat Actors Target Victims Worldwide 1
145 DDOS.TF 2
144 Snake: Coming soon in Mac OS X flavour 3

url


Checks the reputation of the given URL.

Notice: Submitting indicators using this command might make the indicator data publicly available. See the vendor’s documentation for more details.

Base Command

url

Input

Argument Name Description Required
url URL to check. Required

Context Output

Path Type Description
URL.Data String The URL of the indicator.
DBotScore.Indicator String The indicator that was tested.
DBotScore.Type String The indicator type.
DBotScore.Vendor String The vendor used to calculate the score.
DBotScore.Score Number The actual score.
DBotScore.Reliability String Reliability of the source providing the intelligence data.
MISP.Attribute.Distribution string Attribute distribution.
MISP.Attribute.Value string Attribute value.
MISP.Attribute.EventID string Attribute event ID.
MISP.Attribute.last_seen string Attribute last_seen timestamp.
MISP.Attribute.first_seen string Attribute first_seen timestamp.
MISP.Attribute.LastChanged date Attribute last changed timestamp.
MISP.Attribute.ObjectID string Attribute object ID.
MISP.Attribute.Deleted boolean Is the attribute deleted.
MISP.Attribute.DisableCorrelation boolean Is attribute correlation disabled.
MISP.Attribute.Type string Attribute type.
MISP.Attribute.ID string Attribute ID.
MISP.Attribute.UUID string Attribute UUID.
MISP.Attribute.ToIDs boolean Is the Intrusion Detection System flag set.
MISP.Attribute.Category string Attribute category.
MISP.Attribute.SharingGroupID string Attribute sharing group ID.
MISP.Attribute.Comment string Attribute comment.
MISP.Attribute.Event.ID string MISP event ID.
MISP.Attribute.Event.Distribution string MISP event distribution.
MISP.Attribute.Event.Info string MISP event name.
MISP.Attribute.Event.LastChanged string Last change event timestamp.
MISP.Attribute.Event.Published boolean Is the event published.
MISP.Attribute.Event.CreationDate date Event creation date.
MISP.Attribute.Event.ThreatLevelID string Threat level of the MISP event (1 High, 2 Medium, 3 Low, 4 Undefined).
MISP.Attribute.Event.PublishTimestamp string Timestamp of the publish time (if published).
MISP.Attribute.Event.OrganizationID string MISP event organization ID.
MISP.Attribute.Event.OwnerOrganization.ID string Owner organization ID.
MISP.Attribute.Event.OwnerOrganization.Name string Owner organization name.
MISP.Attribute.Event.OwnerOrganization.UUID string Owner organization UUID.
MISP.Attribute.Event.OwnerOrganization.local boolean Is owner organization local.
MISP.Attribute.Event.UUID string MISP event UUID.
MISP.Attribute.Event.Analysis string Event analysis (0 Initial, 1 Ongoing, 2 Completed).
MISP.Attribute.Event.SharingGroupID string Event sharing group ID.
MISP.Attribute.Event.Tag.Name string Event tag name.
MISP.Attribute.Event.Tag.ID string Event tag ID.
MISP.Attribute.Tag.Name string Attribute tag name.
MISP.Attribute.Tag.ID string Attribute tag ID.
MISP.Attribute.Sighting.Type string Attribute’s sighting type.

Command Example

!url url=www.example.com

Context Example

{
    "DBotScore": {
        "Indicator": "www.example.com",
        "Reliability": "B - Usually reliable",
        "Score": 3,
        "Type": "url",
        "Vendor": "MISP V3"
    },
    "MISP": {
        "Attribute": [
            {
                "Category": "Network activity",
                "Comment": "",
                "Deleted": false,
                "DisableCorrelation": false,
                "Distribution": "5",
                "Event": {
                    "Analysis": "2",
                    "CreationDate": "2019-03-18",
                    "Distribution": "1",
                    "ID": "238",
                    "Info": "New Targets Enterprise Wireless Presentation & Display Systems",
                    "LastChanged": "2021-07-18T13:10:09Z",
                    "OrganizationID": "1",
                    "OwnerOrganization": {
                        "ID": "7",
                        "Name": "CUDESO",
                        "UUID": "56c42374-fdb8-4544-a218-41ffc0a8ab16",
                        "local": false
                    },
                    "OwnerOrganization.ID": "7",
                    "PublishTimestamp": "2021-06-23T13:50:21Z",
                    "Published": false,
                    "SharingGroupID": "0",
                    "Tag": [
                        {
                            "ID": "2",
                            "Name": "tlp:white"
                        }
                    ],
                    "ThreatLevelID": "3",
                    "UUID": "5c93d7f7-7de4-4548-ae4c-403ec0a8ab16",
                    "extends_uuid": ""
                },
                "EventID": "238",
                "ID": "105988",
                "LastChanged": "2021-07-18T13:10:09Z",
                "Object": {
                    "Distribution": "5",
                    "ID": "16348",
                    "SharingGroupID": "0"
                },
                "ObjectID": "16348",
                "ObjectRelation": "url",
                "SharingGroupID": "0",
                "Sighting": [
                    {
                        "EventID": "238",
                        "ID": "645",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "a8713fe9-c01a-4f64-986f-4837dd05ddc1",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1625559050",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "662",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "ce0bee18-34cc-4ac7-be2e-9a02d007d207",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1625562799",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "678",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "9a5f8e9d-695f-4abd-8358-f46d325ba8ec",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1625562959",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "683",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "279b8b3a-b6fc-4712-ad5c-99da8a4924aa",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1625563255",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "693",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "24d35e0e-75d8-4b70-a5a4-2d653c39d608",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1625565094",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "705",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "0151d3ec-9f4c-46b0-8527-94d840bd6733",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1625565220",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "717",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "497c607e-b66a-44d5-a745-4eb321eb878c",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1625565618",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "726",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "6f0d1e4f-7080-4af4-9f99-8caae323f889",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1625565779",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "737",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "094ca68a-e148-4b33-8bd8-e244e8a169ea",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1625565824",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "745",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "e0288f76-709e-4226-99aa-776a24787b8b",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1625570192",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "1147",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "f3435f97-0d64-40e0-9de2-45edbec03557",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1626267334",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "1154",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "0ea8d703-be63-4d91-8246-a8f3906bc77d",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1626267453",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "1169",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "e2b7f418-6759-430c-b630-f59f52d71cbd",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1626268114",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "1182",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "be61a059-59cf-4bfe-b4f3-18ceed2b40f8",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1626268277",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "1270",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "ac03faba-9086-41b2-9ff8-6697add1c3aa",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1626331820",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "1285",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "0ecb835e-c06a-4c74-92d0-e755dc04611b",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1626332445",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "1299",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "89473477-0ded-42d2-9165-9eebfb7b517b",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1626332523",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "1303",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "1aace9d2-037b-490d-964c-af96cda2b547",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1626332919",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "1407",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "7e3d7387-afa9-4e0c-8ed6-bd999972f36f",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1626613339",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "1427",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "1afc5b0b-1050-418d-9bf6-845e37ba6252",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1626613534",
                        "source": ""
                    },
                    {
                        "EventID": "238",
                        "ID": "1438",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "9806ad50-4506-4de6-b1e3-dd39d6db3dda",
                        "attribute_id": "105988",
                        "attribute_uuid": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                        "date_sighting": "1626613815",
                        "source": ""
                    }
                ],
                "Tag": [
                    {
                        "ID": "2",
                        "Name": "tlp:white"
                    }
                ],
                "ToIDs": true,
                "Type": "url",
                "UUID": "dc8cdcff-110f-4c6e-b92d-4609ef50c788",
                "Value": "www.example.com",
                "first_seen": null,
                "last_seen": null
            },
            {
                "Category": "Other",
                "Comment": "",
                "Deleted": false,
                "DisableCorrelation": false,
                "Distribution": "5",
                "Event": {
                    "Analysis": "2",
                    "CreationDate": "2019-03-18",
                    "Distribution": "1",
                    "ID": "238",
                    "Info": "New Targets Enterprise Wireless Presentation & Display Systems",
                    "LastChanged": "2021-07-18T13:10:09Z",
                    "OrganizationID": "1",
                    "OwnerOrganization": {
                        "ID": "7",
                        "Name": "CUDESO",
                        "UUID": "56c42374-fdb8-4544-a218-41ffc0a8ab16",
                        "local": false
                    },
                    "OwnerOrganization.ID": "7",
                    "PublishTimestamp": "2021-06-23T13:50:21Z",
                    "Published": false,
                    "SharingGroupID": "0",
                    "Tag": [
                        {
                            "ID": "2",
                            "Name": "tlp:white"
                        }
                    ],
                    "ThreatLevelID": "3",
                    "UUID": "5c93d7f7-7de4-4548-ae4c-403ec0a8ab16",
                    "extends_uuid": ""
                },
                "EventID": "238",
                "ID": "105989",
                "LastChanged": "2021-07-06T07:50:18Z",
                "Object": {
                    "Distribution": "5",
                    "ID": "16348",
                    "SharingGroupID": "0"
                },
                "ObjectID": "16348",
                "ObjectRelation": "resource_path",
                "SharingGroupID": "0",
                "Sighting": [],
                "Tag": [
                    {
                        "ID": "2",
                        "Name": "tlp:white"
                    }
                ],
                "ToIDs": false,
                "Type": "text",
                "UUID": "cc4a2000-b453-412e-8bdd-e5c562d15c78",
                "Value": "www.example.com",
                "first_seen": null,
                "last_seen": null
            }
        ]
    },
    "URL": {
        "Data": "www.example.com",
        "Malicious": {
            "Description": "Match found in MISP",
            "Vendor": "MISP V3"
        }
    }
}

Human Readable Output

Results found in MISP for value: www.example.com

Attribute Category Attribute Type Attribute Value Dbot Score
Network activity url www.example.com 3

Related events

Event ID Event Name Threat Level ID
238 New Targets Enterprise Wireless Presentation & Display Systems 3

ip


Checks the reputation of an IP address.

Base Command

ip

Input

Argument Name Description Required
ip IP address to check. Required

Context Output

Path Type Description
IP.Address String The IP address.
DBotScore.Indicator String The indicator that was tested.
DBotScore.Type String The indicator type.
DBotScore.Vendor String The vendor used to calculate the score.
DBotScore.Score Number The actual score.
DBotScore.Reliability String Reliability of the source providing the intelligence data.
MISP.Attribute.Distribution string Attribute distribution.
MISP.Attribute.Value string Attribute value.
MISP.Attribute.EventID string Attribute event ID.
MISP.Attribute.last_seen string Attribute last_seen timestamp.
MISP.Attribute.first_seen string Attribute first_seen timestamp.
MISP.Attribute.LastChanged date Attribute last changed timestamp.
MISP.Attribute.ObjectID string Attribute object ID.
MISP.Attribute.Deleted boolean Is the attribute deleted.
MISP.Attribute.DisableCorrelation boolean Is attribute correlation disabled.
MISP.Attribute.Type string Attribute type.
MISP.Attribute.ID string Attribute ID.
MISP.Attribute.UUID string Attribute UUID.
MISP.Attribute.ToIDs boolean Is the Intrusion Detection System flag set.
MISP.Attribute.Category string Attribute category.
MISP.Attribute.SharingGroupID string Attribute sharing group ID.
MISP.Attribute.Comment string Attribute comment.
MISP.Attribute.Event.ID string MISP event ID.
MISP.Attribute.Event.Distribution string MISP event distribution.
MISP.Attribute.Event.Info string MISP event name.
MISP.Attribute.Event.LastChanged string Last change event timestamp.
MISP.Attribute.Event.Published boolean Is the event published.
MISP.Attribute.Event.CreationDate date Event creation date.
MISP.Attribute.Event.ThreatLevelID string Threat level of the MISP event (1 High, 2 Medium, 3 Low, 4 Undefined).
MISP.Attribute.Event.PublishTimestamp string Timestamp of the publish time (if published).
MISP.Attribute.Event.OrganizationID string MISP event organization ID.
MISP.Attribute.Event.OwnerOrganization.ID string Owner organization ID.
MISP.Attribute.Event.OwnerOrganization.Name string Owner organization name.
MISP.Attribute.Event.OwnerOrganization.UUID string Owner organization UUID.
MISP.Attribute.Event.OwnerOrganization.local boolean Is owner organization local.
MISP.Attribute.Event.UUID string MISP event UUID.
MISP.Attribute.Event.Analysis string Event analysis (0 Initial, 1 Ongoing, 2 Completed).
MISP.Attribute.Event.SharingGroupID string Event sharing group ID.
MISP.Attribute.Event.Tag.Name string Event tag name.
MISP.Attribute.Event.Tag.ID string Event tag ID.
MISP.Attribute.Tag.Name string Attribute tag name.
MISP.Attribute.Tag.ID string Attribute tag ID.
MISP.Attribute.Sighting.Type string Attribute’s sighting type.

Command Example

!ip ip=1.2.3.4

Context Example

{
    "DBotScore": {
        "Indicator": "1.2.3.4",
        "Reliability": "B - Usually reliable",
        "Score": 3,
        "Type": "ip",
        "Vendor": "MISP V3"
    },
    "IP": {
        "Address": "1.2.3.4",
        "Malicious": {
            "Description": "Match found in MISP",
            "Vendor": "MISP V3"
        }
    },
    "MISP": {
        "Attribute": [
            {
                "Category": "External analysis",
                "Comment": "adda",
                "Deleted": false,
                "DisableCorrelation": false,
                "Distribution": "5",
                "Event": {
                    "Analysis": "1",
                    "CreationDate": "2021-06-29",
                    "Distribution": "2",
                    "ID": "488",
                    "Info": "final create test",
                    "LastChanged": "2021-07-18T13:05:31Z",
                    "OrganizationID": "1",
                    "OwnerOrganization": {
                        "ID": "1",
                        "Name": "ORGNAME",
                        "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                        "local": true
                    },
                    "OwnerOrganization.ID": "1",
                    "PublishTimestamp": "1970-01-01T00:00:00Z",
                    "Published": false,
                    "SharingGroupID": "0",
                    "Tag": [
                        {
                            "ID": "283",
                            "Name": "test234"
                        },
                        {
                            "ID": "284",
                            "Name": "test2345"
                        }
                    ],
                    "ThreatLevelID": "3",
                    "UUID": "2bf3a888-f2e0-40e9-944c-e87590b637b9",
                    "extends_uuid": ""
                },
                "EventID": "488",
                "ID": "80040",
                "LastChanged": "2021-07-18T13:05:31Z",
                "ObjectID": "0",
                "ObjectRelation": null,
                "SharingGroupID": "0",
                "Sighting": [
                    {
                        "EventID": "488",
                        "ID": "387",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "b7f5e0d2-6436-4609-b19d-2cee79239e61",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1624966956",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "616",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "92f032a5-f696-4065-aed7-eb9a1c9adabd",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1625496709",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "638",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "ebe00dbf-10d6-40e6-ac3c-575cdd0ad917",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1625559050",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "660",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "69b77f1c-41c7-4fbf-80e2-4af131ae0ac0",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1625562799",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "669",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "354cd85a-8bb7-4c9d-80e1-d2bfff499b28",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1625562959",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "687",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "107a0b06-1ced-4a09-a9aa-de033f28683b",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1625563256",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "698",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "99ea6831-3f4b-4907-8a99-08ad259d30ba",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1625565095",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "703",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "dbbd4b5d-7122-43c5-9db7-caaa9d8b6d47",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1625565220",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "713",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "a11dc840-30c4-4eb6-b469-1f2f1db2c044",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1625565618",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "729",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "3058290e-bbff-4748-9ca7-55c3ef6a6fe4",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1625565779",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "738",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "a049c84a-de5b-4996-b149-45fd5075a387",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1625565824",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "750",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "190f829a-16fa-4985-8154-39c754ced744",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1625570192",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "1168",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "bfd5b4de-c2df-482c-95cf-375ac5998815",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1626268114",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "1181",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "3e6b84c4-ff5e-4012-9845-13bdc511b929",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1626268276",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "1267",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "99b904f8-cbb2-4626-a1c5-3d8f6aaa2887",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1626331820",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "1282",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "ba3be4ba-e228-4358-ba27-382484049460",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1626332445",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "1289",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "b117864b-cee5-4396-b140-198464adf3ed",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1626332522",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "1308",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "06a08a98-4a09-4085-a1fe-15f95719c53d",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1626332919",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "1401",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "4e69267d-6625-4792-999b-d90f24dc30c3",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1626613339",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "1415",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "f58a95cc-21ea-496c-b87f-bc4a4de2ed4c",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1626613442",
                        "source": ""
                    },
                    {
                        "EventID": "488",
                        "ID": "1422",
                        "Organisation": {
                            "ID": "1",
                            "Name": "ORGNAME",
                            "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002"
                        },
                        "OrganizationID": "1",
                        "Type": "0",
                        "UUID": "dda6512b-a373-4ad0-b198-2813e96f67a1",
                        "attribute_id": "80040",
                        "attribute_uuid": "f8d0501b-1c59-444a-be0c-52af8815a304",
                        "date_sighting": "1626613534",
                        "source": ""
                    }
                ],
                "Tag": [
                    {
                        "ID": "283",
                        "Name": "test234"
                    },
                    {
                        "ID": "285",
                        "Name": "test222"
                    },
                    {
                        "ID": "80",
                        "Name": "certsi:critical-sector=\"energy\""
                    },
                    {
                        "ID": "283",
                        "Name": "test234"
                    },
                    {
                        "ID": "284",
                        "Name": "test2345"
                    }
                ],
                "ToIDs": false,
                "Type": "other",
                "UUID": "f8d0501b-1c59-444a-be0c-52af8815a304",
                "Value": "1.2.3.4",
                "first_seen": null,
                "last_seen": null
            },
            {
                "Category": "Network activity",
                "Comment": "",
                "DecayScore": [
                    {
                        "DecayingModel": {
                            "ID": "2",
                            "Name": "test2"
                        },
                        "base_score": 0,
                        "decayed": true,
                        "score": 0
                    },
                    {
                        "DecayingModel": {
                            "ID": "3",
                            "Name": "test3"
                        },
                        "base_score": 0,
                        "decayed": true,
                        "score": 0
                    }
                ],
                "Deleted": false,
                "DisableCorrelation": false,
                "Distribution": "5",
                "Event": {
                    "Analysis": "1",
                    "CreationDate": "2021-06-29",
                    "Distribution": "2",
                    "ID": "488",
                    "Info": "final create test",
                    "LastChanged": "2021-07-18T13:05:31Z",
                    "OrganizationID": "1",
                    "OwnerOrganization": {
                        "ID": "1",
                        "Name": "ORGNAME",
                        "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                        "local": true
                    },
                    "OwnerOrganization.ID": "1",
                    "PublishTimestamp": "1970-01-01T00:00:00Z",
                    "Published": false,
                    "SharingGroupID": "0",
                    "Tag": [
                        {
                            "ID": "283",
                            "Name": "test234"
                        },
                        {
                            "ID": "284",
                            "Name": "test2345"
                        }
                    ],
                    "ThreatLevelID": "3",
                    "UUID": "2bf3a888-f2e0-40e9-944c-e87590b637b9",
                    "extends_uuid": ""
                },
                "EventID": "488",
                "ID": "104119",
                "LastChanged": "2021-06-30T07:37:32Z",
                "Object": {
                    "Distribution": "5",
                    "ID": "16035",
                    "SharingGroupID": "0"
                },
                "ObjectID": "16035",
                "ObjectRelation": "ip",
                "SharingGroupID": "0",
                "Sighting": [],
                "Tag": [
                    {
                        "ID": "283",
                        "Name": "test234"
                    },
                    {
                        "ID": "284",
                        "Name": "test2345"
                    }
                ],
                "ToIDs": true,
                "Type": "ip-dst",
                "UUID": "d777a0f6-5aa7-4798-b193-bd7da635dc42",
                "Value": "1.2.3.4",
                "first_seen": null,
                "last_seen": null
            }
        ]
    }
}

Human Readable Output

Results found in MISP for value: 1.2.3.4

Attribute Category Attribute Type Attribute Value Dbot Score
External analysis other 1.2.3.4 3

Related events

Event ID Event Name Threat Level ID
488 final create test 3

misp-create-event


Creates a new MISP event.

Base Command

misp-create-event

Input

Argument Name Description Required
type Attribute type to be created as part of the new event. For example: “md5”, “sha1”, “email”, “url”. Default is other. Optional
category Attribute category to be created as part of the new event. For example: “Other”, “Person”, “Attribution”, “Payload type”. Default is External analysis. Optional
to_ids Whether to create the event’s attribute with the Intrusion Detection System flag. Possible values are: true, false. Default is true. Optional
distribution Where to distribute the event. Possible values: “Your_organization_only”, “This_community_only”, “Connected_communities”, “All_communities”, “Sharing_group” and “Inherit_event”. Possible values are: Your_organization_only, This_community_only, Connected_communities, All_communities, Sharing_group, Inherit_event. Default is Your_organization_only. Optional
comment Attribute comment to be created as part of the new event. Optional
value Attribute value to be created as part of the new event. For example: “1.2.3.4” (and other IP addresses), “google.com” (and other domains), “www.example.com” (and other URLs). Required
info Event name. Required
published Whether to publish the event. Possible values: “false” and “true”. Possible values are: false, true. Default is false. Optional
threat_level_id MISP Threat level ID. Possible values: “High”, “Medium”, “Low”, and “Unknown”. Possible values are: High, Medium, Low, Unknown. Default is High. Optional
analysis The analysis event level. Possible values: “initial”, “ongoing”, and “completed”. Possible values are: initial, ongoing, completed. Default is initial. Optional
sharing_group_id Sharing group ID. Mandatory when Sharing_group distribution is set. Optional
creation_date Set the creation date for the event in the format YYYY-MM-DD. Optional

Context Output

Path Type Description
MISP.Event.ID string MISP event ID.
MISP.Event.Distribution string MISP event distribution.
MISP.Event.ThreatLevelID string Threat level of the MISP event (1 High, 2 Medium, 3 Low, 4 Undefined).
MISP.Event.PublishTimestamp number Timestamp of the publish time (if published).
MISP.Event.EventCreatorEmail string Email address of the event creator.
MISP.Event.Info string Event name.
MISP.Event.AttributeCount string Number of attributes of the event.
MISP.Event.OrganizationID string Event organization ID.
MISP.Event.CreationDate date Event creation date.
MISP.Event.Locked boolean Is the event locked.
MISP.Event.Organization.ID number Organization ID.
MISP.Event.Organization.Name string Organization name.
MISP.Event.Organization.UUID string Organization UUID.
MISP.Event.Organization.local boolean Is the organization local.
MISP.Event.OwnerOrganization.ID number Owner organization ID.
MISP.Event.OwnerOrganization.Name string Owner organization name.
MISP.Event.OwnerOrganization.UUID string Owner organization UUID.
MISP.Event.OwnerOrganization.local boolean Is the owner organization local.
MISP.Event.ProposalEmailLock boolean If email lock is proposed.
MISP.Event.LastChanged date Last change event timestamp.
MISP.Event.Galaxy.Description string Event’s galaxy description.
MISP.Event.Galaxy.Name string Galaxy name.
MISP.Event.Galaxy.Type string Galaxy type.
MISP.Event.Published boolean Is the event published.
MISP.Event.DisableCorrelation boolean Is correlation disabled.
MISP.Event.UUID string Event UUID.
MISP.Event.Analysis string Event analysis (0 Initial, 1 Ongoing, 2 Completed).
MISP.Event.SharingGroupID string Event sharing group ID.
MISP.Event.Tag.Name string All tag names in the event.
MISP.Event.Tag.is_galaxy boolean Is the tag galaxy.
MISP.Event.Object.Name String Name of the object.
MISP.Event.Object.Description String Description of the object.
MISP.Event.Object.ID Number ID of the object.
MISP.Event.Object.UUID String UUID of the object.

Command Example

!misp-create-event info="New Event" value=example1.com

Context Example

{
    "MISP": {
        "Event": {
            "Analysis": "0",
            "AttributeCount": "1",
            "CreationDate": "2021-07-29",
            "DisableCorrelation": false,
            "Distribution": "0",
            "EventCreatorEmail": "admin@admin.test",
            "Galaxy": [],
            "ID": "1656",
            "Info": "New Event",
            "LastChanged": "2021-07-29T13:56:45Z",
            "Locked": false,
            "Object": [],
            "Organization": {
                "ID": "1",
                "Name": "ORGNAME",
                "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                "local": true
            },
            "OrganizationID": "1",
            "OwnerOrganization": {
                "ID": "1",
                "Name": "ORGNAME",
                "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                "local": true
            },
            "OwnerOrganization.ID": "1",
            "ProposalEmailLock": false,
            "PublishTimestamp": "1970-01-01T00:00:00Z",
            "Published": false,
            "RelatedEvent": [],
            "SharingGroupID": "0",
            "ThreatLevelID": "1",
            "UUID": "0298d272-d1a1-4375-85fd-a7fe87d6aef2"
        }
    }
}

Human Readable Output

MISP create event

New event with ID: 1656 has been successfully created.

misp-add-attribute


Adds an attribute to an existing MISP event.

Base Command

misp-add-attribute

Input

Argument Name Description Required
event_id MISP event ID. Required
type Attribute type. For example: “md5”, “sha1”, “email”, “url”. Default is other. Optional
category Attribute category. For example: “Other”, “Person”, “Attribution”, “Payload type”. Default is External analysis. Optional
to_ids Whether to create the attribute with the Intrusion Detection System flag. Possible values are: true, false. Default is true. Optional
distribution Where to distribute the event. Possible values: “Your_organization_only”, “This_community_only”, “Connected_communities”, “Sharing_group”, “All_communities”, and “Inherit_event”. Possible values are: Your_organization_only, This_community_only, Connected_communities, All_communities, Sharing_group, Inherit_event. Default is Inherit_event. Optional
comment Comment for the attribute. Optional
value Attribute value. For example: “1.2.3.4” (and other IP addresses), “google.com” (and other domains), “www.example.com” (and other URLs). Required
sharing_group_id Sharing group ID. Mandatory when Sharing_group distribution is set. Optional

Context Output

Path Type Description
MISP.Attribute.Distribution string Attribute distribution.
MISP.Attribute.Value string Attribute value.
MISP.Attribute.EventID string Attribute event ID.
MISP.Attribute.last_seen string Attribute last_seen timestamp.
MISP.Attribute.first_seen string Attribute first_seen timestamp.
MISP.Attribute.LastChanged date Attribute last changed timestamp.
MISP.Attribute.Deleted boolean Is the attribute deleted.
MISP.Attribute.DisableCorrelation boolean Is attribute correlation disabled.
MISP.Attribute.Type string Attribute type.
MISP.Attribute.ID string Attribute ID.
MISP.Attribute.UUID string Attribute UUID.
MISP.Attribute.ToIDs boolean Is the Intrusion Detection System flag set.
MISP.Attribute.Category string Attribute category.
MISP.Attribute.SharingGroupID string Attribute sharing group ID.
MISP.Attribute.Comment string Attribute comment.
MISP.Attribute.Event.ID string MISP event ID.
MISP.Attribute.Event.Distribution string MISP event distribution.
MISP.Attribute.Event.Info string MISP event name.
MISP.Attribute.Event.OrganizationID string MISP event organization ID.
MISP.Attribute.Event.OwnerOrganization.ID string Event owner organization ID.
MISP.Attribute.Event.UUID string MISP event UUID.

Command Example

!misp-add-attribute event_id=1655 value=1.1.1.2 distribution=All_communities comment=test

Context Example

{
    "MISP": {
        "Attribute": {
            "Category": "External analysis",
            "Comment": "test",
            "Deleted": false,
            "DisableCorrelation": false,
            "Distribution": "3",
            "Event": {
                "Distribution": "1",
                "ID": "1655",
                "Info": "TestEvent",
                "OrganizationID": "1",
                "OwnerOrganization.ID": "1",
                "UUID": "ce083018-0b85-430b-a202-f60bbffcd26b"
            },
            "EventID": "1655",
            "ID": "116536",
            "LastChanged": "2021-07-29T13:56:47Z",
            "ObjectID": "0",
            "ObjectRelation": null,
            "SharingGroupID": "0",
            "ToIDs": true,
            "Type": "other",
            "UUID": "188bfa6a-eca7-4ea1-a37b-5fe86b6f38fd",
            "Value": "1.1.1.2",
            "first_seen": null,
            "last_seen": null
        }
    }
}

Human Readable Output

MISP add attribute

New attribute: 1.1.1.2 was added to event id 1655.

misp-delete-event


Deletes an event according to the given event ID.

Base Command

misp-delete-event

Input

Argument Name Description Required
event_id Event ID to delete. Required

Context Output

There is no context output for this command.

Command Example

!misp-delete-event event_id=1655

Human Readable Output

Event 1655 has been deleted

misp-remove-tag-from-event


Removes a tag from the given UUID event .

Base Command

misp-remove-tag-from-event

Input

Argument Name Description Required
uuid UUID of the event. For example, 59575300-4be8-4ff6-8767-0037ac110032. Required
tag Tag to remove from the event. Required

Context Output

Path Type Description
MISP.Event.ID string MISP event ID.
MISP.Event.Distribution string MISP event distribution.
MISP.Event.ThreatLevelID string Threat level of the MISP event (1 High, 2 Medium, 3 Low, 4 Undefined).
MISP.Event.PublishTimestamp number Timestamp of the publish time (if published).
MISP.Event.EventCreatorEmail string Email address of the event creator.
MISP.Event.Info string Event name.
MISP.Event.AttributeCount string Number of attributes of the event.
MISP.Event.OrganizationID string Event organization ID.
MISP.Event.CreationDate date Event creation date.
MISP.Event.Locked boolean Is the event locked.
MISP.Event.Organization.ID number Organization ID.
MISP.Event.Organization.Name string Organization name.
MISP.Event.Organization.UUID string Organization UUID.
MISP.Event.Organization.local boolean Is the organization local.
MISP.Event.OwnerOrganization.ID number Owner organization ID.
MISP.Event.OwnerOrganization.Name string Owner organization name.
MISP.Event.OwnerOrganization.UUID string Owner organization UUID.
MISP.Event.OwnerOrganization.local boolean Is the owner organization local.
MISP.Event.ProposalEmailLock boolean If email lock proposed.
MISP.Event.LastChanged date Last change event timestamp.
MISP.Event.Galaxy.Description string Event’s galaxy description.
MISP.Event.Galaxy.Name string Galaxy name.
MISP.Event.Galaxy.Type string Galaxy type.
MISP.Event.Published boolean Is the event published.
MISP.Event.DisableCorrelation boolean Is correlation disabled.
MISP.Event.UUID string Event UUID.
MISP.Event.Analysis string Event analysis (0 Initial, 1 Ongoing, 2 Completed).
MISP.Event.SharingGroupID string Event sharing group ID.
MISP.Event.Tag.Name string All tag names in the event.
MISP.Event.Tag.is_galaxy boolean Is the tag galaxy.
MISP.Event.Object.Name String Name of the object.
MISP.Event.Object.Description String Description of the object.
MISP.Event.Object.ID Number ID of the object.
MISP.Event.Object.UUID String UUID of the object.

Command Example

!misp-remove-tag-from-event tag="test" uuid="ce083018-0b85-430b-a202-f60bbffcd26b"

Context Example

{
    "MISP": {
        "Event": {
            "Analysis": "0",
            "AttributeCount": "2",
            "CreationDate": "2021-07-29",
            "DisableCorrelation": false,
            "Distribution": "1",
            "EventCreatorEmail": "admin@admin.test",
            "Galaxy": [],
            "ID": "1655",
            "Info": "TestEvent",
            "LastChanged": "2021-07-29T13:56:50Z",
            "Locked": false,
            "Object": [],
            "Organization": {
                "ID": "1",
                "Name": "ORGNAME",
                "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                "local": true
            },
            "OrganizationID": "1",
            "OwnerOrganization": {
                "ID": "1",
                "Name": "ORGNAME",
                "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                "local": true
            },
            "OwnerOrganization.ID": "1",
            "ProposalEmailLock": false,
            "PublishTimestamp": "1970-01-01T00:00:00Z",
            "Published": false,
            "RelatedEvent": [],
            "SharingGroupID": "0",
            "ThreatLevelID": "1",
            "UUID": "ce083018-0b85-430b-a202-f60bbffcd26b"
        }
    }
}

Human Readable Output

Tag test has been successfully removed from the event ce083018-0b85-430b-a202-f60bbffcd26b

misp-add-tag-to-event


Adds a tag to the given UUID event .

Base Command

misp-add-tag-to-event

Required Permissions

perm_tagger

perm_tag_editor

When adding local tags, make sure to have the following:

  1. Host Organization Requirement: The most important requirement is that the user (or the API key) you are authenticating with must belong to the organization that is set as the MISP.host_org_id on your MISP instance. If this is not met, you will get a permission error even if you have perm_tagger and perm_tag_editor.
  2. Tag Existence: If the local tag you are trying to add does not already exist on your MISP instance, your user will also need the perm_tag_editor permission for it to be created. If it already exists, perm_tagger is sufficient.

Input

Argument Name Description Required
uuid UUID of the event. For example, 59575300-4be8-4ff6-8767-0037ac110032. Required
tag Tag to add to the event. Required
is_local Whether to add the tag as a local tag. Optional

Context Output

Path Type Description
MISP.Event.ID string MISP event ID.
MISP.Event.Distribution string MISP event distribution.
MISP.Event.ThreatLevelID string Threat level of the MISP event (1 High, 2 Medium, 3 Low, 4 Undefined).
MISP.Event.PublishTimestamp number Timestamp of the publish time (if published).
MISP.Event.EventCreatorEmail string Email address of the event creator.
MISP.Event.Info string Event name.
MISP.Event.AttributeCount string Number of attributes of the event.
MISP.Event.OrganizationID string Event organization ID.
MISP.Event.CreationDate date Event creation date.
MISP.Event.Locked boolean Is the event locked.
MISP.Event.Organization.ID number Organization ID.
MISP.Event.Organization.Name string Organization name.
MISP.Event.Organization.UUID string Organization UUID.
MISP.Event.Organization.local boolean Is the organization local.
MISP.Event.OwnerOrganization.ID number Owner organization ID.
MISP.Event.OwnerOrganization.Name string Owner organization name.
MISP.Event.OwnerOrganization.UUID string Owner organization UUID.
MISP.Event.OwnerOrganization.local boolean Is the owner organization local.
MISP.Event.ProposalEmailLock boolean If email lock proposed.
MISP.Event.LastChanged date Last change event timestamp.
MISP.Event.Galaxy.Description string Event’s galaxy description.
MISP.Event.Galaxy.Name string Galaxy name.
MISP.Event.Galaxy.Type string Galaxy type.
MISP.Event.Published boolean Is the event published.
MISP.Event.DisableCorrelation boolean Is correlation disabled.
MISP.Event.UUID string Event UUID.
MISP.Event.Analysis string Event analysis (0 Initial, 1 Ongoing, 2 Completed).
MISP.Event.SharingGroupID string Event sharing group ID.
MISP.Event.Tag.Name string All tag names in the event.
MISP.Event.Tag.is_galaxy boolean Is the tag galaxy.
MISP.Event.Object.Name String Name of the object.
MISP.Event.Object.Description String Description of the object.
MISP.Event.Object.ID Number ID of the object.
MISP.Event.Object.UUID String UUID of the object.

Command Example

!misp-add-tag-to-event uuid="ce083018-0b85-430b-a202-f60bbffcd26b" tag="test"

Context Example

{
    "MISP": {
        "Event": {
            "Analysis": "0",
            "AttributeCount": "2",
            "CreationDate": "2021-07-29",
            "DisableCorrelation": false,
            "Distribution": "1",
            "EventCreatorEmail": "admin@admin.test",
            "Galaxy": [],
            "ID": "1655",
            "Info": "TestEvent",
            "LastChanged": "2021-07-29T13:56:50Z",
            "Locked": false,
            "Object": [],
            "Organization": {
                "ID": "1",
                "Name": "ORGNAME",
                "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                "local": true
            },
            "OrganizationID": "1",
            "OwnerOrganization": {
                "ID": "1",
                "Name": "ORGNAME",
                "UUID": "5ce29ac4-3b54-459e-a6ee-00acac110002",
                "local": true
            },
            "OwnerOrganization.ID": "1",
            "ProposalEmailLock": false,
            "PublishTimestamp": "1970-01-01T00:00:00Z",
            "Published": false,
            "RelatedEvent": [],
            "SharingGroupID": "0",
            "Tag": [
                {
                    "Name": "test",
                    "is_galaxy": false
                }
            ],
            "ThreatLevelID": "1",
            "UUID": "ce083018-0b85-430b-a202-f60bbffcd26b"
        }
    }
}

Human Readable Output

Tag test has been successfully added to event ce083018-0b85-430b-a202-f60bbffcd26b

misp-add-tag-to-attribute


Adds a tag to the given UUID attribute.

Base Command

misp-add-tag-to-attribute

Required Permissions

perm_tagger

perm_tag_editor

When adding local tags, make sure to have the following:

  1. Host Organization Requirement: The most important requirement is that the user (or the API key) you are authenticating with must belong to the organization that is set as the MISP.host_org_id on your MISP instance. If this is not met, you will get a permission error even if you have perm_tagger and perm_tag_editor.
  2. Tag Existence: If the local tag you are trying to add does not already exist on your MISP instance, your user will also need the perm_tag_editor permission for it to be created. If it already exists, perm_tagger is sufficient.

Input

Argument Name Description Required
uuid UUID of the attribute. For example, 59575300-4be8-4ff6-8767-0037ac110032. Required
tag Tag to add to the attribute. Required
is_local Whether to add the tag as a local tag. Optional

Context Output

Path Type Description
MISP.Attribute.Distribution string Attribute distribution.
MISP.Attribute.Value string Attribute value.
MISP.Attribute.EventID string Attribute event ID.
MISP.Attribute.last_seen string Attribute last_seen timestamp.
MISP.Attribute.first_seen string Attribute first_seen timestamp.
MISP.Attribute.LastChanged date Attribute last changed timestamp.
MISP.Attribute.ObjectID string Attribute object ID.
MISP.Attribute.Deleted boolean Is the attribute deleted.
MISP.Attribute.DisableCorrelation boolean Is attribute correlation disabled.
MISP.Attribute.Type string Attribute type.
MISP.Attribute.ID string Attribute ID.
MISP.Attribute.UUID string Attribute UUID.
MISP.Attribute.ToIDs boolean Is the Intrusion Detection System flag set.
MISP.Attribute.Category string Attribute category.
MISP.Attribute.SharingGroupID string Attribute sharing group ID.
MISP.Attribute.Comment string Attribute comment.
MISP.Attribute.Event.ID string MISP event ID.
MISP.Attribute.Event.Distribution string MISP event distribution.
MISP.Attribute.Event.Info string MISP event name.
MISP.Attribute.Event.OrganizationID string MISP event organization ID.
MISP.Attribute.Event.OwnerOrganization.ID string Event owner organization ID.
MISP.Attribute.Event.UUID string MISP event UUID.
MISP.Attribute.Tag.Name string Attribute tag name.
MISP.Attribute.Tag.is_galaxy string Is the tag galaxy.

Command Example

!misp-add-tag-to-attribute tag=test uuid="c286a1f8-441e-479b-b10d-b10add2b6739"

Context Example

{
    "MISP": {
        "Attribute": {
            "Category": "Network activity",
            "Comment": "",
            "Deleted": false,
            "DisableCorrelation": false,
            "Distribution": "5",
            "Event": {
                "Distribution": "1",
                "ID": "1655",
                "Info": "TestEvent",
                "OrganizationID": "1",
                "OwnerOrganization.ID": "1",
                "UUID": "ce083018-0b85-430b-a202-f60bbffcd26b"
            },
            "EventID": "1655",
            "ID": "116534",
            "LastChanged": "2021-07-29T13:56:53Z",
            "ObjectID": "0",
            "ObjectRelation": null,
            "SharingGroupID": "0",
            "Tag": [
                {
                    "Name": "test",
                    "is_galaxy": null
                }
            ],
            "ToIDs": false,
            "Type": "email",
            "UUID": "c286a1f8-441e-479b-b10d-b10add2b6739",
            "Value": "example@gmail.com",
            "first_seen": null,
            "last_seen": null
        }
    }
}

Human Readable Output

Tag test has been successfully added to attribute c286a1f8-441e-479b-b10d-b10add2b6739

misp-remove-tag-from-attribute


Removes a tag from the given UUID attribute.

Base Command

misp-remove-tag-from-attribute

Input

Argument Name Description Required
uuid UUID of the attribute. For example, 59575300-4be8-4ff6-8767-0037ac110032. Required
tag Tag to remove from the attribute. Required

Context Output

Path Type Description
MISP.Attribute.Distribution string Attribute distribution.
MISP.Attribute.Value string Attribute value.
MISP.Attribute.EventID string Attribute event ID.
MISP.Attribute.last_seen string Attribute last_seen timestamp.
MISP.Attribute.first_seen string Attribute first_seen timestamp.
MISP.Attribute.LastChanged date Attribute last changed timestamp.
MISP.Attribute.ObjectID string Attribute object ID.
MISP.Attribute.Deleted boolean Is the attribute deleted.
MISP.Attribute.DisableCorrelation boolean Is attribute correlation disabled.
MISP.Attribute.Type string Attribute type.
MISP.Attribute.ID string Attribute ID.
MISP.Attribute.UUID string Attribute UUID.
MISP.Attribute.ToIDs boolean Is the Intrusion Detection System flag set.
MISP.Attribute.Category string Attribute category.
MISP.Attribute.SharingGroupID string Attribute sharing group ID.
MISP.Attribute.Comment string Attribute comment.
MISP.Attribute.Event.ID string MISP event ID.
MISP.Attribute.Event.Distribution string MISP event distribution.
MISP.Attribute.Event.Info string MISP event name.
MISP.Attribute.Event.OrganizationID string MISP event organization ID.
MISP.Attribute.Event.OwnerOrganization.ID string Event owner organization ID.
MISP.Attribute.Event.UUID string MISP event UUID.
MISP.Attribute.Tag.Name string Attribute tag name.
MISP.Attribute.Tag.is_galaxy string Is the tag galaxy.

Command Example

!misp-remove-tag-from-attribute tag=test uuid="c286a1f8-441e-479b-b10d-b10add2b6739"

Context Example

{
    "MISP": {
        "Attribute": {
            "Category": "Network activity",
            "Comment": "",
            "Deleted": false,
            "DisableCorrelation": false,
            "Distribution": "5",
            "Event": {
                "Distribution": "1",
                "ID": "1655",
                "Info": "TestEvent",
                "OrganizationID": "1",
                "OwnerOrganization.ID": "1",
                "UUID": "ce083018-0b85-430b-a202-f60bbffcd26b"
            },
            "EventID": "1655",
            "ID": "116534",
            "LastChanged": "2021-07-29T13:56:53Z",
            "ObjectID": "0",
            "ObjectRelation": null,
            "SharingGroupID": "0",
            "ToIDs": false,
            "Type": "email",
            "UUID": "c286a1f8-441e-479b-b10d-b10add2b6739",
            "Value": "example@gmail.com",
            "first_seen": null,
            "last_seen": null
        }
    }
}

Human Readable Output

Tag test has been successfully removed from the attribute c286a1f8-441e-479b-b10d-b10add2b6739

misp-add-sighting


Add sighting to an attribute.

Base Command

misp-add-sighting

Input

Argument Name Description Required
type Type of sighting to add. Possible values: “sighting”, “false_positive”, and “expiration”. Possible values are: sighting, false_positive, expiration. Required
id ID of attribute to add sighting to (Must be filled if UUID or value is empty). Can be retrieved from the misp-search commands. Optional
uuid UUID of the attribute to add sighting to (Must be filled if ID or value is empty). Can be retrieved from the misp-search commands. Optional
value Value of the attribute to add sighting to. (Must be filled if ID or UUID is empty). Adds sighting to all attributes with this value. Takes precedence over (UU)ID. Can be retrieved from the misp-search commands. Optional
source Sighting source. Optional

Context Output

There is no context output for this command.

Command Example

!misp-add-sighting uuid="c286a1f8-441e-479b-b10d-b10add2b6739" type=false_positive

Human Readable Output

Sighting ‘false_positive’ has been successfully added to attribute c286a1f8-441e-479b-b10d-b10add2b6739

misp-add-events-from-feed


Adds an OSINT feed. Only feeds from format misp are allowed (i.e have manifest.json).

Base Command

misp-add-events-from-feed

Input

Argument Name Description Required
feed URL of the feed to add. Possible values are: CIRCL, Botvrij.eu. Required
limit Maximum number of files to add. Default is 2. Optional

Context Output

Path Type Description
MISP.Event.ID string IDs of newly created events.

Command Example

!misp-add-events-from-feed limit=1 feed=Botvrij.eu

Human Readable Output

Total of 0 events was added to MISP

No entries.

misp-add-file-object


Adds an file object to the specified event ID.

Base Command

misp-add-file-object

Input

Argument Name Description Required
entry_id Entry ID of the file. Required
event_id Event ID to which add object to. Required

Context Output

Path Type Description
MISP.Event.ID number MISP event ID.
MISP.Event.Object.MetaCategory String Object meta category.
MISP.Event.Object.Distribution Number Distribution of object.
MISP.Event.Object.Name String Name of the object.
MISP.Event.Object.TemplateVersion Number Template version of the object.
MISP.Event.Object.EventID Number ID of the event in which the object was first created.
MISP.Event.Object.TemplateUUID String UUID of the template.
MISP.Event.Object.LastChanged String Timestamp when the object was created.
MISP.Event.Object.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.ID Number ID of the object.
MISP.Event.Object.UUID String UUID of the object.
MISP.Event.Object.Attribute.Value String Value of the attribute.
MISP.Event.Object.Attribute.EventID Number ID of the first event from which the object originated.
MISP.Event.Object.Attribute.LastChanged Date Timestamp when the object was created.
MISP.Event.Object.Attribute.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.Attribute.ObjectID Number ID of the object.
MISP.Event.Object.Attribute.DisableCorrelation Boolean Whether correlation is disabled.
MISP.Event.Object.Attribute.ID Unknown ID of the attribute.
MISP.Event.Object.Attribute.ObjectRelation String Relation of the object.
MISP.Event.Object.Attribute.Type String Object type.
MISP.Event.Object.Attribute.UUID String UUID of the attribute.
MISP.Event.Object.Attribute.ToIDs Boolean Whether the to_ids flag is on.
MISP.Event.Object.Attribute.Category String Category of the attribute.
MISP.Event.Object.Attribute.SharingGroupID Number ID of the sharing group.
MISP.Event.Object.Attribute.Comment String Comment of the attribute.
MISP.Event.Object.Description String Description of the object.

Command Example

!misp-add-file-object entry_id=${File.EntryID} event_id=1655

Human Readable Output

Object has been added to MISP event ID 1655

misp-add-domain-object


Adds a domain object to MISP.

Base Command

misp-add-domain-object

Input

Argument Name Description Required
event_id ID of an MISP event. Required
name The domain name. For example, “google.com”. Required
ip A comma-separated list of IP addresses resolved by DNS. Required
text A description of the domain. Optional

Context Output

Path Type Description
MISP.Event.ID number MISP event ID.
MISP.Event.Object.MetaCategory String Object meta category.
MISP.Event.Object.Distribution Number Distribution of the object.
MISP.Event.Object.Name String Name of the object.
MISP.Event.Object.TemplateVersion Number Template version of the object.
MISP.Event.Object.EventID Number ID of the event in which the object was first created.
MISP.Event.Object.TemplateUUID String UUID of the template.
MISP.Event.Object.LastChanged String Timestamp when the object was last changed.
MISP.Event.Object.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.ID Number ID of the object.
MISP.Event.Object.UUID String UUID of the object.
MISP.Event.Object.Attribute.Value String Value of the attribute.
MISP.Event.Object.Attribute.EventID Number ID of the first event from which the object originated.
MISP.Event.Object.Attribute.LastChanged Date Attribute last changed timestamp.
MISP.Event.Object.Attribute.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.Attribute.ObjectID Number ID of the object.
MISP.Event.Object.Attribute.DisableCorrelation Boolean Whether correlation is disabled.
MISP.Event.Object.Attribute.ID Unknown ID of the attribute.
MISP.Event.Object.Attribute.ObjectRelation String Relation of the object.
MISP.Event.Object.Attribute.Type String Object type.
MISP.Event.Object.Attribute.UUID String UUID of the attribute.
MISP.Event.Object.Attribute.ToIDs Boolean Whether the to_ids flag is on.
MISP.Event.Object.Attribute.Category String Category of the attribute.
MISP.Event.Object.Attribute.SharingGroupID Number ID of the sharing group.
MISP.Event.Object.Attribute.Comment String Comment of the attribute.
MISP.Event.Object.Description String Description of the object.

Command Example

!misp-add-domain-object ip="5.6.4.4" event_id=1655 name=v.com text=new

Context Example

{
    "MISP": {
        "Event": {
            "ID": "1655",
            "Object": {
                "Attribute": [
                    {
                        "Category": "Network activity",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": false,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116537",
                        "LastChanged": "2021-07-29T13:57:00Z",
                        "ObjectID": "18091",
                        "ObjectRelation": "ip",
                        "SharingGroupID": "0",
                        "ToIDs": true,
                        "Type": "ip-dst",
                        "UUID": "ec8bd634-b428-41cf-b26f-f3fd5d640b73",
                        "Value": "5.6.4.4",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "5.6.4.4",
                        "value2": ""
                    },
                    {
                        "Category": "Network activity",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": false,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116538",
                        "LastChanged": "2021-07-29T13:57:00Z",
                        "ObjectID": "18091",
                        "ObjectRelation": "domain",
                        "SharingGroupID": "0",
                        "ToIDs": true,
                        "Type": "domain",
                        "UUID": "dc21f4c9-c167-4de8-a25b-1d2519b1e826",
                        "Value": "v.com",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "v.com",
                        "value2": ""
                    },
                    {
                        "Category": "Other",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": true,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116539",
                        "LastChanged": "2021-07-29T13:57:00Z",
                        "ObjectID": "18091",
                        "ObjectRelation": "text",
                        "SharingGroupID": "0",
                        "ToIDs": false,
                        "Type": "text",
                        "UUID": "1c787478-7c67-4e29-996b-5ee1d8fe9ee2",
                        "Value": "new",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "new",
                        "value2": ""
                    }
                ],
                "Comment": "",
                "Deleted": false,
                "Description": "A domain/hostname and IP address seen as a tuple in a specific time frame.",
                "Distribution": "5",
                "EventID": "1655",
                "ID": "18091",
                "LastChanged": "2021-07-29T13:57:00Z",
                "MetaCategory": "network",
                "Name": "domain-ip",
                "SharingGroupID": "0",
                "TemplateUUID": "43b3b146-77eb-4931-b4cc-b66c60f28734",
                "TemplateVersion": "9",
                "UUID": "29a96e5b-beb6-4fa2-9b19-4d1bc4e651d9",
                "first_seen": null,
                "last_seen": null
            }
        }
    }
}

Human Readable Output

Object has been added to MISP event ID 1655

misp-add-email-object


Adds an email object to MISP.

Base Command

misp-add-email-object

Input

Argument Name Description Required
event_id ID of an MISP event. Required
entry_id Entry ID of the email (only supports .eml files). Required

Context Output

Path Type Description
MISP.Event.ID number MISP event ID.
MISP.Event.Object.MetaCategory String Object meta category.
MISP.Event.Object.Distribution Number Distribution of the object.
MISP.Event.Object.Name String Name of the object.
MISP.Event.Object.TemplateVersion Number Template version of the object.
MISP.Event.Object.EventID Number ID of the event in which the object was first created.
MISP.Event.Object.TemplateUUID String UUID of the template.
MISP.Event.Object.LastChanged String Timestamp when the object was last changed.
MISP.Event.Object.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.ID Number ID of the object.
MISP.Event.Object.UUID String UUID of the object.
MISP.Event.Object.Attribute.Value String Value of the attribute.
MISP.Event.Object.Attribute.EventID Number ID of the first event from which the object originated.
MISP.Event.Object.Attribute.LastChanged Date Attribute last changed date.
MISP.Event.Object.Attribute.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.Attribute.ObjectID Number ID of the object.
MISP.Event.Object.Attribute.DisableCorrelation Boolean Whether correlation is disabled.
MISP.Event.Object.Attribute.ID Unknown ID of the attribute.
MISP.Event.Object.Attribute.ObjectRelation String Relation of the object.
MISP.Event.Object.Attribute.Type String Object type.
MISP.Event.Object.Attribute.UUID String UUID of the attribute.
MISP.Event.Object.Attribute.ToIDs Boolean Whether the to_ids flag is on.
MISP.Event.Object.Attribute.Category String Category of the attribute.
MISP.Event.Object.Attribute.SharingGroupID Number ID of the sharing group.
MISP.Event.Object.Attribute.Comment String Comment of the attribute.
MISP.Event.Object.Description String Description of the object.

Command Example

!misp-add-email-object ip="678@6" event_id=743

Context Example

{
    "MISP.Event": {
        "ID": "743",
        "Object": {
            "Attribute": [
                {
                    "Category": "External analysis", 
                    "Comment": "", 
                    "UUID": "52d1d881-a1fb-4a2c-b5bc-047fb0073c2f", 
                    "ObjectID": "3231", 
                    "Deleted": false, 
                    "LastChanged": "2022-07-07T13:50:06Z",
                    "ToIDs": false, 
                    "Value": "Full email.eml", 
                    "ID": "26175", 
                    "SharingGroupID": "0", 
                    "ObjectRelation": "eml", 
                    "EventID": "743", 
                    "value1": "Full email.eml", 
                    "DisableCorrelation": true, 
                    "Type": "attachment", 
                    "Distribution": "5", 
                    "value2": ""
                }
                {
                    "Category": "Payload delivery", 
                    "Comment": "", 
                    "UUID": "5ddaae1c-ce54-4191-9d61-907d2c101103", 
                    "ObjectID": "3231", 
                    "Deleted": false,
                    "LastChanged": "2022-07-07T13:50:06Z", 
                    "ToIDs": false, 
                    "Value": "<example.gmail.com>", 
                    "ID": "26177", 
                    "SharingGroupID": "0", 
                    "ObjectRelation": "message-id", 
                    "EventID": "743", 
                    "value1": "<example.gmail.com>", 
                    "DisableCorrelation": true, 
                    "Type": "email-message-id", 
                    "Distribution": "5", 
                    "value2": ""
                }, 
                {
                    "Category": "Network activity", 
                    "Comment": "", 
                    "UUID": "26daac8a-730e-4951-bad1-d8134feba2cb", 
                    "ObjectID": "3231", 
                    "Deleted": false, 
                    "LastChanged": "2022-07-07T13:50:06Z",
                    "ToIDs": true, 
                    "Value": "\"Example Demisto (ca)\" <example@demisto.com>", 
                    "ID": "26178", 
                    "SharingGroupID": "0", 
                    "ObjectRelation": "to", 
                    "EventID": "743", 
                    "value1": "\"Example Demisto (ca)\" <example.>", 
                    "DisableCorrelation": true, 
                    "Type": "email-dst", 
                    "Distribution": "5", 
                    "value2": ""
                }, 
                {
                    "Category": "Payload delivery", 
                    "Comment": "", 
                    "UUID": "d6ca6b5f-edba-4d46-9a9f-15fec4f6bd2b", 
                    "ObjectID": "3231", 
                    "Deleted": false,
                    "LastChanged": "2022-07-07T13:50:06Z", 
                    "ToIDs": false, 
                    "Value": "[TEST][DEMISTO] CASO 1 EMAIL DA SISTEMA DEMISTO | ZIP+PASSWORD", 
                    "ID": "26179", 
                    "SharingGroupID": "0", 
                    "ObjectRelation": "subject", 
                    "EventID": "743", 
                    "value1": "[TEST][DEMISTO] CASO 1 EMAIL DA SISTEMA DEMISTO | ZIP+PASSWORD", 
                    "DisableCorrelation": false, 
                    "Type": "email-subject", 
                    "Distribution": "5", 
                    "value2": ""
                }, 
                {
                    "Category": "Payload delivery", 
                    "Comment": "", 
                    "UUID": "983eaba4-a94e-49ab-ae18-40151778a9ba", 
                    "ObjectID": "3231", 
                    "Deleted": false, 
                    "LastChanged": "2022-07-07T13:50:06Z", 
                    "ToIDs": true, 
                    "Value": "\"Example Demisto (ca)\" <example@demisto.com>", 
                    "ID": "26180", 
                    "SharingGroupID": "0", 
                    "ObjectRelation": "from", 
                    "EventID": "743", 
                    "value1": "\"Example Demisto (ca)\" <example@demisto.com>", 
                    "DisableCorrelation": false, 
                    "Type": "email-src", 
                    "Distribution": "5", 
                    "value2": ""
                }, 
                {
                    "Category": "Payload delivery", 
                    "Comment": "", 
                    "UUID": "c432d6c7-5d34-4b64-a6b4-5813d1874bd2", 
                    "ObjectID": "3231", 
                    "Deleted": false,
                    "LastChanged": "2022-07-07T13:50:06Z", 
                    "ToIDs": true, 
                    "Value": "example@demisto.com", 
                    "ID": "26181", 
                    "SharingGroupID": "0", 
                    "ObjectRelation": "return-path", 
                    "EventID": "743", 
                    "value1": "example@demisto.com", 
                    "DisableCorrelation": false, 
                    "Type": "email-src", 
                    "Distribution": "5", 
                    "value2": ""
                }
            ],
            "Comment": "", 
            "EventID": "743", 
            "LastChanged": "2022-07-07T13:50:06Z",
            "Description": "Email object describing an email with meta-information", 
            "UUID": "e00e6a2c-682b-48b3-bb01-aee21832ebf0", 
            "Deleted": false,  
            "TemplateUUID": "a0c666e0-fc65-4be8-b48f-3423d788b552", 
            "TemplateVersion": "12", 
            "SharingGroupID": "0", 
            "MetaCategory": "network", 
            "Distribution": "5", 
            "ID": "3231", 
            "Name": "email",
            "first_seen": null,
            "last_seen": null
        }
    }
}

Human Readable Output

Object has been added to MISP event ID 743

misp-add-url-object


Adds a URL object to an MISP event.

Base Command

misp-add-url-object

Input

Argument Name Description Required
url Full URL to add to the event. Required
first_seen Date that this URL was first seen. For example, 2019-02-03. Optional
text Description of the URL. Optional
last_seen Date that this URL was last seen. For example, 2019-02-03. Optional
event_id ID of a MISP event. Required

Context Output

Path Type Description
MISP.Event.ID number MISP event ID.
MISP.Event.Object.MetaCategory String Object meta category.
MISP.Event.Object.Distribution Number Distribution of the object.
MISP.Event.Object.Name String Name of the object.
MISP.Event.Object.TemplateVersion Number Template version of the object.
MISP.Event.Object.EventID Number ID of the event in which the object was first created.
MISP.Event.Object.TemplateUUID String UUID of the template.
MISP.Event.Object.LastChanged String Timestamp when the object was last changed.
MISP.Event.Object.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.ID Number ID of the object.
MISP.Event.Object.UUID String UUID of the object.
MISP.Event.Object.Attribute.Value String Value of the attribute.
MISP.Event.Object.Attribute.EventID Number ID of the first event from which the object originated.
MISP.Event.Object.Attribute.LastChanged Date Attribute last changed timestamp.
MISP.Event.Object.Attribute.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.Attribute.ObjectID Number ID of the object.
MISP.Event.Object.Attribute.DisableCorrelation Boolean Whether correlation is disabled.
MISP.Event.Object.Attribute.ID Unknown ID of the attribute.
MISP.Event.Object.Attribute.ObjectRelation String Relation of the object.
MISP.Event.Object.Attribute.Type String Object type.
MISP.Event.Object.Attribute.UUID String UUID of the attribute.
MISP.Event.Object.Attribute.ToIDs Boolean Whether the to_ids flag is on.
MISP.Event.Object.Attribute.Category String Category of the attribute.
MISP.Event.Object.Attribute.SharingGroupID Number ID of the sharing group.
MISP.Event.Object.Attribute.Comment String Comment of the attribute.
MISP.Event.Object.Description String Description of the object.

Command Example

!misp-add-url-object event_id=1655 url=d.com

Context Example

{
    "MISP": {
        "Event": {
            "ID": "1655",
            "Object": {
                "Attribute": [
                    {
                        "Category": "Network activity",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": false,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116545",
                        "LastChanged": "2021-07-29T13:57:04Z",
                        "ObjectID": "18093",
                        "ObjectRelation": "url",
                        "SharingGroupID": "0",
                        "ToIDs": true,
                        "Type": "url",
                        "UUID": "b684192d-9285-49ec-b74b-8ab8ec40b71f",
                        "Value": "d.com",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "d.com",
                        "value2": ""
                    },
                    {
                        "Category": "Other",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": false,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116546",
                        "LastChanged": "2021-07-29T13:57:04Z",
                        "ObjectID": "18093",
                        "ObjectRelation": "resource_path",
                        "SharingGroupID": "0",
                        "ToIDs": false,
                        "Type": "text",
                        "UUID": "0f82e991-25f8-40df-bd8c-13d285f39ea4",
                        "Value": "d.com",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "d.com",
                        "value2": ""
                    }
                ],
                "Comment": "",
                "Deleted": false,
                "Description": "url object describes an url along with its normalized field (like extracted using faup parsing library) and its metadata.",
                "Distribution": "5",
                "EventID": "1655",
                "ID": "18093",
                "LastChanged": "2021-07-29T13:57:04Z",
                "MetaCategory": "network",
                "Name": "url",
                "SharingGroupID": "0",
                "TemplateUUID": "60efb77b-40b5-4c46-871b-ed1ed999fce5",
                "TemplateVersion": "9",
                "UUID": "ab5d001f-8832-4078-8e96-97cf7e83e536",
                "first_seen": null,
                "last_seen": null
            }
        }
    }
}

Human Readable Output

Object has been added to MISP event ID 1655

misp-add-object


Adds any other object to MISP.

Base Command

misp-add-object

Input

Argument Name Description Required
event_id ID of the event to add the object to. Required
template Template name. (Can be found at https://www.misp-project.org/objects.html). For example, ‘vehicle’. Required
attributes Attributes. For example, {“description”: “Manager Ferrari”, “make”: “Ferrari”, “model”: “308 GTS”}. Required

Context Output

Path Type Description
MISP.Event.ID number MISP event ID.
MISP.Event.Object.MetaCategory String Object meta category.
MISP.Event.Object.Distribution Number Distribution of the object.
MISP.Event.Object.Name String Name of the object.
MISP.Event.Object.TemplateVersion Number Template version of the object.
MISP.Event.Object.EventID Number ID of the event in which the object was first created.
MISP.Event.Object.TemplateUUID String UUID of the template.
MISP.Event.Object.LastChanged String Timestamp when the object was last changed.
MISP.Event.Object.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.ID Number ID of the object.
MISP.Event.Object.UUID String UUID of the object.
MISP.Event.Object.Attribute.Value String Value of the attribute.
MISP.Event.Object.Attribute.EventID Number ID of the first event from which the object originated.
MISP.Event.Object.Attribute.LastChanged Date Attribute last changed timestamp.
MISP.Event.Object.Attribute.Deleted Boolean Whether the object was deleted?
MISP.Event.Object.Attribute.ObjectID Number ID of the object.
MISP.Event.Object.Attribute.DisableCorrelation Boolean Whether correlation is disabled.
MISP.Event.Object.Attribute.ID Unknown ID of the attribute.
MISP.Event.Object.Attribute.ObjectRelation String Relation of the object.
MISP.Event.Object.Attribute.Type String Object type.
MISP.Event.Object.Attribute.UUID String UUID of the attribute.
MISP.Event.Object.Attribute.ToIDs Boolean Whether the to_ids flag is on.
MISP.Event.Object.Attribute.Category String Category of the attribute.
MISP.Event.Object.Attribute.SharingGroupID Number ID of the sharing group.
MISP.Event.Object.Attribute.Comment String Comment of the attribute.
MISP.Event.Object.Description String Description of the object.

Command Example

!misp-add-object attributes="{'description':'Manager','make': 'Test', 'model': '308 GTS'}" template=vehicle event_id=1655

Context Example

{
    "MISP": {
        "Event": {
            "ID": "1655",
            "Object": {
                "Attribute": [
                    {
                        "Category": "Other",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": true,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116547",
                        "LastChanged": "2021-07-29T13:57:06Z",
                        "ObjectID": "18094",
                        "ObjectRelation": "description",
                        "SharingGroupID": "0",
                        "ToIDs": false,
                        "Type": "text",
                        "UUID": "d000b825-4610-4fe7-82c4-57cd93d87081",
                        "Value": "Manager",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "Manager",
                        "value2": ""
                    },
                    {
                        "Category": "Other",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": true,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116548",
                        "LastChanged": "2021-07-29T13:57:06Z",
                        "ObjectID": "18094",
                        "ObjectRelation": "make",
                        "SharingGroupID": "0",
                        "ToIDs": false,
                        "Type": "text",
                        "UUID": "172df931-af26-4644-976b-c442ca0ae002",
                        "Value": "Test",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "Test",
                        "value2": ""
                    },
                    {
                        "Category": "Other",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": true,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116549",
                        "LastChanged": "2021-07-29T13:57:06Z",
                        "ObjectID": "18094",
                        "ObjectRelation": "model",
                        "SharingGroupID": "0",
                        "ToIDs": false,
                        "Type": "text",
                        "UUID": "539cd3a0-9c34-48d6-97f8-cba7b3955947",
                        "Value": "308 GTS",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "308 GTS",
                        "value2": ""
                    }
                ],
                "Comment": "",
                "Deleted": false,
                "Description": "Vehicle object template to describe a vehicle information and registration",
                "Distribution": "5",
                "EventID": "1655",
                "ID": "18094",
                "LastChanged": "2021-07-29T13:57:06Z",
                "MetaCategory": "misc",
                "Name": "vehicle",
                "SharingGroupID": "0",
                "TemplateUUID": "683c076c-f695-4ff2-8efa-e98a418049f4",
                "TemplateVersion": "3",
                "UUID": "10d9d305-1518-4712-a1e6-385d546e2b27",
                "first_seen": null,
                "last_seen": null
            }
        }
    }
}

Human Readable Output

Object has been added to MISP event ID 1655

misp-add-custom-object


Adds custom objects to MISP.

Base Command

misp-add-custom-object

Input

Argument Name Description Required
event_id ID of the event to add the object to. Required
template Custom Template name. Required
attributes Attributes. For example, {“description”: “Manager Ferrari”, “make”: “Ferrari”, “model”: “308 GTS”}. Required

Context Output

Path Type Description
MISP.Event.ID number MISP event ID.
MISP.Event.Object.MetaCategory String Object meta category.
MISP.Event.Object.Distribution Number Distribution of the object.
MISP.Event.Object.Name String Name of the object.
MISP.Event.Object.TemplateVersion Number Template version of the object.
MISP.Event.Object.EventID Number ID of the event in which the object was first created.
MISP.Event.Object.TemplateUUID String UUID of the template.
MISP.Event.Object.LastChanged String Timestamp when the object was last changed.
MISP.Event.Object.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.ID Number ID of the object.
MISP.Event.Object.UUID String UUID of the object.
MISP.Event.Object.Attribute.Value String Value of the attribute.
MISP.Event.Object.Attribute.EventID Number ID of the first event from which the object originated.
MISP.Event.Object.Attribute.LastChanged Date Attribute last changed timestamp.
MISP.Event.Object.Attribute.Deleted Boolean Whether the object was deleted?.
MISP.Event.Object.Attribute.ObjectID Number ID of the object.
MISP.Event.Object.Attribute.DisableCorrelation Boolean Whether correlation is disabled.
MISP.Event.Object.Attribute.ID Unknown ID of the attribute.
MISP.Event.Object.Attribute.ObjectRelation String Relation of the object.
MISP.Event.Object.Attribute.Type String Object type.
MISP.Event.Object.Attribute.UUID String UUID of the attribute.
MISP.Event.Object.Attribute.ToIDs Boolean Whether the to_ids flag is on.
MISP.Event.Object.Attribute.Category String Category of the attribute.
MISP.Event.Object.Attribute.SharingGroupID Number ID of the sharing group.
MISP.Event.Object.Attribute.Comment String Comment of the attribute.
MISP.Event.Object.Description String Description of the object.

Command Example

!misp-add-custom-object event_id="1572" template="corporate-asset" attributes="{\"asset-type\":\"Server\",\"asset-id\":\"12\",\"text\":\"Asset Details\"}"

misp-add-ip-object


Adds an IP object to the MISP event. The following arguments are optional, but at least one must be supplied for the command to run successfully: “ip”, “dst_port”, “src_port”, “domain”, “hostname”, “ip_src”, and “ip_dst”.

Base Command

misp-add-ip-object

Input

Argument Name Description Required
event_id ID of a MISP event. Required
ip A comma-separated list of IP addresses. Optional
dst_port Destination port number. Optional
src_port Source port number. Optional
domain Domain name. Optional
hostname Hostname. For example, ‘mail123.example.com’. Optional
ip_src IP source address. Optional
ip_dst IP destination address. Optional
first_seen Date when the IP address was first seen. For example, 2019-02-03. Optional
last_seen Date when the IP address was last seen. For example, 2019-02-03. Optional
comment Description of the object to be set as a text attribute. Optional

Context Output

Path Type Description
MISP.Event.ID number MISP event ID.
MISP.Event.Object.MetaCategory String Object meta category.
MISP.Event.Object.Distribution Number Distribution of the object.
MISP.Event.Object.Name String Name of the object.
MISP.Event.Object.TemplateVersion Number Template version of the object.
MISP.Event.Object.EventID Number ID of the event in which the object was first created.
MISP.Event.Object.TemplateUUID String UUID of the template.
MISP.Event.Object.LastChanged String Timestamp when the object was last changed.
MISP.Event.Object.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.ID Number ID of the object.
MISP.Event.Object.UUID String UUID of the object.
MISP.Event.Object.Attribute.Value String Value of the attribute.
MISP.Event.Object.Attribute.EventID Number ID of the first event from which the object originated.
MISP.Event.Object.Attribute.LastChanged Date Attribute last changed timestamp.
MISP.Event.Object.Attribute.Deleted Boolean Whether the object was deleted.
MISP.Event.Object.Attribute.ObjectID Number ID of the object.
MISP.Event.Object.Attribute.DisableCorrelation Boolean Whether correlation is disabled.
MISP.Event.Object.Attribute.ID Unknown ID of the attribute.
MISP.Event.Object.Attribute.ObjectRelation String Relation of the object.
MISP.Event.Object.Attribute.Type String Object type.
MISP.Event.Object.Attribute.UUID String UUID of the attribute.
MISP.Event.Object.Attribute.ToIDs Boolean Whether the to_ids flag is on.
MISP.Event.Object.Attribute.Category String Category of the attribute.
MISP.Event.Object.Attribute.SharingGroupID Number ID of the sharing group.
MISP.Event.Object.Attribute.Comment String Comment of the attribute.
MISP.Event.Object.Description String Description of the object.

Command Example

!misp-add-ip-object event_id=1655 dst_port=4545 ip_src=1.2.4.4 ip_dst=1.5.52.1 src_port=1001 comment=nice

Context Example

{
    "MISP": {
        "Event": {
            "ID": "1655",
            "Object": {
                "Attribute": [
                    {
                        "Category": "Network activity",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": true,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116540",
                        "LastChanged": "2021-07-29T13:57:02Z",
                        "ObjectID": "18092",
                        "ObjectRelation": "dst-port",
                        "SharingGroupID": "0",
                        "ToIDs": false,
                        "Type": "port",
                        "UUID": "81128f06-1691-4674-bfe2-ffc5f91e4757",
                        "Value": "4545",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "4545",
                        "value2": ""
                    },
                    {
                        "Category": "Network activity",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": false,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116541",
                        "LastChanged": "2021-07-29T13:57:02Z",
                        "ObjectID": "18092",
                        "ObjectRelation": "src-port",
                        "SharingGroupID": "0",
                        "ToIDs": false,
                        "Type": "port",
                        "UUID": "02845721-f842-4df8-9513-17ecb2b95c08",
                        "Value": "1001",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "1001",
                        "value2": ""
                    },
                    {
                        "Category": "Network activity",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": false,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116542",
                        "LastChanged": "2021-07-29T13:57:02Z",
                        "ObjectID": "18092",
                        "ObjectRelation": "ip-src",
                        "SharingGroupID": "0",
                        "ToIDs": true,
                        "Type": "ip-src",
                        "UUID": "4656d257-3ee9-417b-89bd-443fb6b61071",
                        "Value": "1.2.4.4",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "1.2.4.4",
                        "value2": ""
                    },
                    {
                        "Category": "Network activity",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": false,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116543",
                        "LastChanged": "2021-07-29T13:57:02Z",
                        "ObjectID": "18092",
                        "ObjectRelation": "ip-dst",
                        "SharingGroupID": "0",
                        "ToIDs": true,
                        "Type": "ip-dst",
                        "UUID": "bc64f4e0-1f16-4c74-b629-bd3df8b10bea",
                        "Value": "1.5.52.1",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "1.5.52.1",
                        "value2": ""
                    },
                    {
                        "Category": "Other",
                        "Comment": "",
                        "Deleted": false,
                        "DisableCorrelation": true,
                        "Distribution": "5",
                        "EventID": "1655",
                        "ID": "116544",
                        "LastChanged": "2021-07-29T13:57:02Z",
                        "ObjectID": "18092",
                        "ObjectRelation": "text",
                        "SharingGroupID": "0",
                        "ToIDs": false,
                        "Type": "text",
                        "UUID": "32c161c2-075c-4eff-9b42-c9dce44334f8",
                        "Value": "nice",
                        "first_seen": null,
                        "last_seen": null,
                        "value1": "nice",
                        "value2": ""
                    }
                ],
                "Comment": "",
                "Deleted": false,
                "Description": "An IP address (or domain or hostname) and a port seen as a tuple (or as a triple) in a specific time frame.",
                "Distribution": "5",
                "EventID": "1655",
                "ID": "18092",
                "LastChanged": "2021-07-29T13:57:02Z",
                "MetaCategory": "network",
                "Name": "ip-port",
                "SharingGroupID": "0",
                "TemplateUUID": "9f8cea74-16fe-4968-a2b4-026676949ac6",
                "TemplateVersion": "8",
                "UUID": "f42d7ca9-de2e-4e62-8814-d95f1e6efa94",
                "first_seen": null,
                "last_seen": null
            }
        }
    }
}

Human Readable Output

Object has been added to MISP event ID 1655

misp-add-user


Add a new user to MISP.

Base Command

misp-add-user

Input

Argument Name Description Required
email The email address of the new user to be added. Required
org_id ID number indicating which organization the new user will be added to. In order to get the org_id, use the command misp-get-organization-info. Required
role_id Role of the new user to be added. In order to get the role_id, use the command misp-get-role-info. Required
password A password for the new user. Ensure that the password is at least 12 characters long, contains at least one upper-case, includes a digit or a special character, and at least one lower-case character. Required

Context Output

Path Type Description
MISP.User.id string MISP user ID.
MISP.User.password string MISP user password.
MISP.User.org_id string MISP user organisation ID.
MISP.User.server_id string MISP user server ID.
MISP.User.email string MISP user email.
MISP.User.autoalert boolean MISP user auto alert.
MISP.User.authkey string MISP User auth key.
MISP.User.invited_by string MISP user invited by.
MISP.User.gpgkey string MISP user GPG key.
MISP.User.certif_public string MISP User public certificate.
MISP.User.nids_sid string MISP user Network Intrusion Detection System (NIDS) Signature ID (SID).
MISP.User.termsaccepted boolean Whether MISP user terms were accepted.
MISP.User.newsread string MISP user news read.
MISP.User.role_id string MISP user role ID.
MISP.User.change_pw boolean Whether the MISP user password was changed.
MISP.User.contactalert boolean MISP user contact alert.
MISP.User.disabled boolean Whether the MISP user was disabled.
MISP.User.expiration string MISP user expiration.
MISP.User.current_login string MISP user current login.
MISP.User.last_login string MISP user last login.
MISP.User.force_logout boolean MISP user force logout.
MISP.User.date_created string MISP user created date.
MISP.User.date_modified string MISP user modified date.

Input

Argument Name Description Required
email The email address of the new user to be added Required
org_id ID number indicating which organization the new user will be added to. Required
role_id Role of the new user to be added. Required
password A password for the new user Required

Context Output

Path Type Description
MISP.User.email string MISP User Email.

Command Example

!misp-add-user email="example@example.com" org_id=1 role_id=1 password=123456789++Qq!

Human Readable Output

MISP add user New user was added to MISP. Email:example@example.com

misp-search-attributes


Search for attributes in MISP.

Base Command

misp-search-attributes

Input

Argument Name Description Required
type The attribute type. Use any valid MISP attribute type. For example: “md5”, “sha1”, “email”, “url”. Optional
value Search for the specified value in the attribute’s value field. For example: “1.2.3.4” (and other IP addresses), “google.com” (and other domains), “www.example.com” (and other URLs). Optional
category The attribute category. Use any valid MISP attribute category. For example: “Other”, “Person”, “Attribution”, “Payload type”. Optional
uuid Return attributes with the given UUID. Alternatively, return all the attributes that are part of the given UUID’s event. For example, 59523300-4be8-4fa6-8867-0037ac110002. Optional
to_ids Whether to return only the attributes set with the “to_ids” flag. The default is to return all attributes with and with out to_ids flag. Possible values are: true, false. Optional
last Search attributes of events published within the last “x” amount of time. Valid time values are days, hours, and minutes. For example, “5d”, “12h”, “30m”. This filter uses the published timestamp of the event. Optional
include_decay_score Whether to return the decay score at the attribute level. Possible values are: true, false. Optional
org Search by the creator organization by supplying the organization identifier. Optional
tags A comma-separated list of tags to include in the results. To exclude a tag, prefix the tag name with “!”. Can be: “AND”, “OR”, and “NOT” followed by “:”. To chain logical operators use “;”. For example, “AND:tag1,tag2;OR:tag3”. Optional
from Events with the date set to a date after the one specified. This filter will use the date of the event. Optional
to Events with the date set to a date before the one specified. This filter will use the date of the event. Optional
event_id A comma-separated list of event IDs. Returns the attributes that are part of the given event IDs. Optional
include_sightings Whether to include the the sightings of the matching attributes. Default is false. Possible values are: true, false. Optional
include_correlations Whether to include the full correlations of the matching attributes. Possible values are: true, false. Default is false. Optional
page If a limit is set, sets the page to be returned. For example, page 3, limit 100 will return records 201->300. Default is 1. Optional
limit Limit the number of attributes returned. Default is 50. Default is 50. Optional
enforceWarninglist Whether to return only the values that are not on the warninglists. Possible values are: true, false. Optional
compact Whether to return only the attribute’s values that match the search query. In case you want to get the full attributes data, set this argument to false. Possible values are: true, false. Default is false. Optional
with_attachments Whether to download attachments from MISP. Possible values are: true, false. Default “false”. Optional

Context Output

Path Type Description
MISP.Attribute.Distribution string Attribute distribution.
MISP.Attribute.last_seen string Attribute last_seen timestamp.
MISP.Attribute.first_seen string Attribute first_seen timestamp.
MISP.Attribute.Value string Attribute value.
MISP.Attribute.EventID string Attribute event ID.
MISP.Attribute.LastChanged date Attribute last changed timestamp.
MISP.Attribute.Deleted boolean Is the attribute deleted.
MISP.Attribute.DisableCorrelation boolean Is attribute correlation disabled.
MISP.Attribute.Type string Attribute type.
MISP.Attribute.ObjectID string Attribute’s object ID.
MISP.Attribute.ID string Attribute ID.
MISP.Attribute.UUID string Attribute UUID.
MISP.Attribute.ObjectRelation string Attribute’s object relation.
MISP.Attribute.ShadowAttribute Unknown Attribute shadow attribute.
MISP.Attribute.ToIDs boolean Is the Intrusion Detection System flag set.
MISP.Attribute.Category string Attribute category.
MISP.Attribute.SharingGroupID number Attribute sharing group ID.
MISP.Attribute.Comment string Attribute comment.
MISP.Attribute.Event.ID string MISP event ID.
MISP.Attribute.Event.Distribution string MISP event distribution.
MISP.Attribute.Event.Info string MISP event name.
MISP.Attribute.Event.OrganizationID string MISP event organization ID.
MISP.Attribute.Event.OwnerOrganization.ID string MISP event owner organization ID.
MISP.Attribute.Event.UUID string Event UUID.
MISP.Attribute.Object.Distribution Number Distribution of object.
MISP.Attribute.Object.ID Number ID of the object.
MISP.Attribute.Object.SharingGroupID String Object sharing group ID.
MISP.Attribute.Tag.Name string All tag names in the attribute.
MISP.Attribute.Tag.is_galaxy Boolean Is the tag is a galaxy.
MISP.Attribute.Sighting.Type String Sighting type.

Command Example

!misp-search-attributes tags="COVID-19"

Context Example

{
    "MISP": {
        "Attribute": [
            {
                "Category": "Payload delivery",
                "Comment": "",
                "Deleted": false,
                "DisableCorrelation": false,
                "Distribution": "5",
                "Event": {
                    "Distribution": "3",
                    "ID": "149",
                    "Info": "Capitalizing on Coronavirus Panic, Threat Actors Target Victims Worldwide",
                    "OrganizationID": "1",
                    "OwnerOrganization.ID": "8",
                    "UUID": "5e6b322a-9f80-4e2f-9f2a-3cab0a3b4631"
                },
                "EventID": "149",
                "ID": "71703",
                "LastChanged": "2021-07-19T12:44:27Z",
                "ObjectID": "0",
                "ObjectRelation": null,
                "SharingGroupID": "0",
                "Tag": [
                    {
                        "Name": "COVID-19",
                        "is_galaxy": null
                    },
                    {
                        "Name": "misp-galaxy:financial-fraud=\"Cash Recovery Scam\"",
                        "is_galaxy": null
                    }
                ],
                "ToIDs": true,
                "Type": "sha256",
                "UUID": "7f78d940-c1f1-4a75-87a5-11b0fcd61e53",
                "Value": "c8466c386261facf38ce62e75a8c6414affbfaed439e91fa00e515e079702fe0",
                "first_seen": null,
                "last_seen": null
            },
            {
                "Category": "Network activity",
                "Comment": "",
                "Deleted": false,
                "DisableCorrelation": false,
                "Distribution": "5",
                "Event": {
                    "Distribution": "1",
                    "ID": "143",
                    "Info": "Recent Qakbot (Qbot) activity",
                    "OrganizationID": "1",
                    "OwnerOrganization.ID": "7",
                    "UUID": "5fd0c599-ab6c-4ba1-a69a-df9ec0a8ab16"
                },
                "EventID": "143",
                "ID": "71740",
                "LastChanged": "2021-06-21T12:35:10Z",
                "ObjectID": "0",
                "ObjectRelation": null,
                "SharingGroupID": "0",
                "Tag": [
                    {
                        "Name": "COVID-19",
                        "is_galaxy": null
                    },
                    {
                        "Name": "misp-galaxy:financial-fraud=\"Compromised Personally Identifiable Information (PII)\"",
                        "is_galaxy": null
                    }
                ],
                "ToIDs": true,
                "Type": "ip-dst",
                "UUID": "de95a690-97b9-491c-bd94-1ab7ee885622",
                "Value": "1.2.4.4",
                "first_seen": null,
                "last_seen": null
            }
        ]
    }
}

Human Readable Output

MISP search-attributes returned 2 attributes

Current page size: 50
Showing page 1

Attribute Category Attribute ID Attribute Tags Attribute Type Attribute Value Event Distribution Event ID Event Info Event Organization ID Event UUID To IDs
Payload delivery 71703 COVID-19,
misp-galaxy:financial-fraud=”Cash Recovery Scam”
sha256 c8466c386261facf38ce62e75a8c6414affbfaed439e91fa00e515e079702fe0 3 149 Capitalizing on Coronavirus Panic, Threat Actors Target Victims Worldwide 1 5e6b322a-9f80-4e2f-9f2a-3cab0a3b4631 true
Network activity 71740 COVID-19,
misp-galaxy:financial-fraud=”Compromised Personally Identifiable Information (PII)”
ip-dst 1.2.4.4 1 143 Recent Qakbot (Qbot) activity 1 5fd0c599-ab6c-4ba1-a69a-df9ec0a8ab16 true

Breaking changes from the previous version of this integration - MISP v3

Reputation commands

The main change in this version is that searching indicators (reputation commands) is implemented with search-attributes (and not with search-events as in previous version).
Please see the new commands (ip, file, url…) context output for details.

Commands

The following commands were removed in this version

  • misp-add-tag - replaced by both misp-add-tag-to-event and misp-add-tag-to-attribute.
  • misp-download-sample - removed as download sample is not supported by the new PYMISP version.
  • misp-upload-sample - removed as upload sample is not supported by the new PYMISP version.

Arguments

The following arguments were removed in this version

  • In the misp-create-event command, the id argument was replaced by event_id.

  • In the misp-add-domain-object command, the dns argument was replaced by ip.

The behavior of the following arguments was changed

  • In the misp-add-events-from-feed command:
    • feed - is now required.
    • limit - the default value was changed from ‘0’ to ‘2’.
  • In the misp-create-event command, the default value of the to_ids argument was changed from ‘false’ to ‘true’.

Additional Considerations for this version

Indicator Scoring

In MISP V3, indicator scoring is calculated depending on MISP’s tags. In case no tags were found, the score
is calculated by the event’s threat level ID.

  • Indicators of attributes and events that have tags that are configured as malicious will be scored 3 (i.e., malicious).
  • Indicators of attributes and events that have tags that are configured as suspicious will be scored 2 (i.e., suspicious).
  • Indicators of attributes and events that have tags that are configured as benign will be scored 1 (i.e., benign).
  • Indicators of attributes and events that don’t have any tags that are configured as suspicious nor malicious will be scored by their events’ threat level ID.
  • Threat level ID with a value of 1, 2, or 3 will be scored 3 (i.e., malicious).
  • Threat level ID with a value of 4 will be scored 0 (i.e., unknown).

When configuring an instance, you should set:

  • Malicious tag IDs with tag IDs that would be calculated as malicious.
  • Suspicious tag IDs with tag IDs that would be calculated as suspicious.
  • Benign tag IDs with tag IDs that would be calculated as benign.

misp-update-attribute


Update an attribute of an existing MISP event.

Base Command

misp-update-attribute

Input

Argument Name Description Required
attribute_uuid UUID of the attribute to be updated. Required
type Attribute type. For example: “md5”, “sha1”, “email”, “url”. Optional
category Attribute category. For example: “Other”, “Person”, “Attribution”, “Payload type”. Optional
distribution Where to distribute the event. Possible values: “Your_organization_only”, “This_community_only”, “Connected_communities”, “All_communities”, and “Inherit_event”. Possible values are: Your_organization_only, This_community_only, Connected_communities, All_communities, Inherit_event. Optional
comment Comment for the attribute. Optional
value Attribute value. For example: “1.2.3.4” (and other IP addresses), “google.com” (and other domains), “www.example.com” (and other URLs). Optional
first_seen Updated date when the attribute was first seen. For example, 2019-02-03. Optional
last_seen Updated date when the attribute was last seen. For example, 2019-02-03. Optional

Context Output

Path Type Description
MISP.Attribute.Distribution string Attribute distribution.
MISP.Attribute.Value string Attribute value.
MISP.Attribute.EventID string Attribute event ID.
MISP.Attribute.last_seen string Attribute last_seen timestamp.
MISP.Attribute.first_seen string Attribute first_seen timestamp.
MISP.Attribute.LastChanged date Attribute last changed timestamp.
MISP.Attribute.Deleted boolean Is the attribute deleted.
MISP.Attribute.DisableCorrelation boolean Is attribute correlation disabled.
MISP.Attribute.Type string Attribute type.
MISP.Attribute.ID string Attribute ID.
MISP.Attribute.UUID string Attribute UUID.
MISP.Attribute.ToIDs boolean Is the Intrusion Detection System flag set.
MISP.Attribute.Category string Attribute category.
MISP.Attribute.SharingGroupID string Attribute sharing group ID.
MISP.Attribute.Comment string Attribute comment.

Command Example

!misp-update-attribute attribute_uuid=c0ba7147-d99a-418a-a23a-d9be62590c33 category=Other

Human Readable Output

MISP update attribute

Attribute: c0ba7147-d99a-418a-a23a-d9be62590c33 was updated.

misp-delete-attribute


Delete an attribute according to the given attribute ID.

Base Command

misp-delete-attribute

Input

Argument Name Description Required
attribute_id Attribute ID to delete. Required

Context Output

There is no context output for this command.

Command example

!misp-delete-attribute attribute_id=3f5917b3-100c-4e21-91c3-48b265337232

Human Readable Output

Attribute 3f5917b3-100c-4e21-91c3-48b265337232 has been deleted

misp-publish-event


Publish an event.

Base Command

misp-publish-event

Input

Argument Name Description Required
event_id Event ID to be published. Required
alert Whether to send an email. The default is to not send a mail. Possible values are: true, false. Optional

Context Output

There is no context output for this command.

Command example

!misp-publish-event event_id=20536

Human Readable Output

Event 20536 has been published

misp-set-event-attributes


Set event attributes according to the given attributes data.

Base Command

misp-set-event-attributes

Input

Argument Name Description Required
event_id Event ID to set attributes for. Required
attribute_data Adjust current attributes of an event to match the given attribute data. Has to be json formated list with attributes that should be part of the event. E.g.: [{“type”:”domain”,”value”:”target.domain”},{“type”:”ip-dst”,”value”:”1.2.3.4”}]. Required

Context Output

There is no context output for this command.

misp-check-warninglist


Check a list of indicator values against the MISP warninglist.

Base Command

misp-check-warninglist

Input

Argument Name Description Required
value Indicator values to check against the MISP warninglist. Required

Context Output

Path Type Description
MISP.Warninglist.Count number Count on how many warninglists the value was found.
MISP.Warninglist.Value string Value checked.
MISP.Warninglist.Lists string Name of warninglists where the value was found.

misp-get-organization-info


Display the organization IDs and names.

Base Command

misp-get-organization-info

Input

| Argument Name | Description | Required |
| — | — | — |

Context Output

Path Type Description
MISP.Organization.org_id string MISP organization ID.
MISP.Organization.org_name string MISP organization name.

misp-get-role-info


Display role names and role ids.

Base Command

misp-get-role-info

Input

| Argument Name | Description | Required |
| — | — | — |

Context Output

Path Type Description
MISP.Role.role_id string MISP role ID.
MISP.Role.role_name string MISP role name.

Command Example


#### Human Readable Output

>### MISP Roles
>
>|id|name|
>|---|---|
>| 1 | rolename |

### misp-get-warninglists

***
Gets all warninglists from MISP

#### Base Command

`misp-get-warninglists`

#### Input

| **Argument Name** | **Description** | **Required** |
| --- | --- | --- |

#### Context Output

| **Path** | **Type** | **Description** |
| --- | --- | --- |
| MISP.Warninglist.ID | number | The ID of the warninglist. |
| MISP.Warninglist.Name | string | The warninglist's name. |
| MISP.Warninglist.Type | string | MISP warninglist type. |
| MISP.Warninglist.Description | string | Description of the warninglist. |
| MISP.Warninglist.Version | number | The warninglist version number. |
| MISP.Warninglist.Enabled | boolean | Whether the warninglist is enabled. |
| MISP.Warninglist.Default | boolean | Whether the warninglist is set as default. |
| MISP.Warninglist.Entries | dict | The warninglist entries. |
| MISP.Warninglist.Attributes | dict | The valid attribute types for this warninglist. |

#### Command Example

```!misp-get-warninglists```

#### Human Readable Output

>### MISP
>
>|ID|Name|Type|Description|Version|Enabled|Default|Category|Attributes|
>|---|---|---|---|---|---|---|---|---|---|
>| 1 | List | string | An example list | 1 | true | true | false_positive | hostname |
>| 2 | Another list | cidr | An example of another list | 42 | false | false | false_positive | url |

### misp-change-warninglist

***
Changes a warninglist in MISP.
This command only changes the values supplied through the parameters of this command (in a non idempotent way).

#### Base Command

`misp-change-warninglist`

#### Input

| **Argument Name** | **Description** | **Required** |
| --- | --- | --- |
| id | ID of the warninglist to update. | Required |
| name | Updated name of the warninglist. | Optional |
| type | Updated type of the warninglist. | Optional |
| description | Updated description of the warninglist. | Optional |
| version | Updated version number of the warninglist. | Optional |
| default | Whether the warninglist should be set as default. | Optional |

#### Context Output

| **Path** | **Type** | **Description** |
| --- | --- | --- |
| MISP.Warninglist.ID | number | The ID of the warninglist. |
| MISP.Warninglist.Name | string | The warninglist's name. |
| MISP.Warninglist.Type | string | MISP warninglist type. |
| MISP.Warninglist.Description | string | Description of the warninglist. |
| MISP.Warninglist.Version | number | The warninglist version number. |
| MISP.Warninglist.Enabled | boolean | Whether the warninglist is enabled. |
| MISP.Warninglist.Default | boolean | Whether the warninglist is set as default. |
| MISP.Warninglist.Category | string | The category of the MISP warninglist. |
| MISP.Warninglist.Entries | dict | The warninglist entries. |
| MISP.Warninglist.Attributes | dict | The valid attribute types for this warninglist. |

#### Command Example

```!misp-change-warninglist id=1234 name="Changed list name" values="1.2.3.4,5.6.7.8" types="ip-src,ip-dst"```

```json
{
    "MISP": {
        "Warninglist": [ 
            {
                "ID": 1234,
                "Name": "Changed list name",
                "Type": "string",
                "Description": "The entries in this list have been changed",
                "Version": 42,
                "Enabled": false,
                "Default": false,
                "Category": "false_positive",
                "Attributes": [
                    "ip-src",
                    "ip-dst"
                ],
                "Entries": [
                    {
                        "Comment": null,
                        "ID": null,
                        "Value": "1.2.3.4",
                        "WarninglistID": null
                    },
                    {
                        "Comment": null,
                        "ID": null,
                        "Value": "5.6.7.8",
                        "WarninglistID": null
                    }
                ]
            }
        ]
    }
}

Human Readable Output

MISP Warninglist

ID Name Type Description Version Enabled Default Category Attributes
1234 Changed list name string An example of an existing description 1 true true false_positive ip-src, ip-dst

Entries in MISP Warninglist

Value
1.2.3.4
5.6.7.8

misp-get-warninglist


Get a specific warninglist by its ID.

Base Command

misp-get-warninglist

Input

Argument Name Description Required
id ID of the warninglist. Required

Context Output

Path Type Description
MISP.Warninglist.ID number The ID of the warninglist.
MISP.Warninglist.Name string The warninglist’s name.
MISP.Warninglist.Type string MISP warninglist type.
MISP.Warninglist.Description string Description of the warninglist.
MISP.Warninglist.Version number The warninglist version number.
MISP.Warninglist.Enabled boolean Whether the warninglist is enabled.
MISP.Warninglist.Default boolean Whether the warninglist is set as default.
MISP.Warninglist.Category string The category of the MISP warninglist.
MISP.Warninglist.Entries unknown The warninglist entries.
MISP.Warninglist.Attributes unknown The valid attribute types for this warninglist.

Command Example

!misp-get-warninglist id=1234

Context Example

{
    "MISP": {
        "Warninglist": [ 
            {
                "ID": 1234,
                "Name": "Hello XSOAR!",
                "Type": "string",
                "Description": "The Quick Brown Fox Jumped Over The Lazy Dog",
                "Version": 1,
                "Enabled": false,
                "Default": false,
                "Category": "false_positive",
                "Attributes": [
                    "attrib1",
                    "attrib2"
                ],
                "Entries": [
                    {
                        "ID": 12345,
                        "Value": "test",
                        "WarninglistID": 1,
                        "Comment": null
                    },
                    {
                        "ID": 56789,
                        "Value": "another-test",
                        "WarninglistID": 1,
                        "Comment": null
                    }
                ]
            }
        ]
    }
}

Human Readable Output

MISP Warninglist

ID Name Type Description Version Enabled Default Category Attributes
1234 Example List Name string An example of a warninglist in MISP 1 true true false_positive hostname

Entries in MISP Warninglist

ID Value Description
123 hostname.example.local An example of a hostname

Configuration parameters

  • url — MISP server URL (e.g., https://192.168.0.1) (required)
  • credentials
  • certificate — Client Certificate
  • check_to_ids — Use IDS flag
  • allowed_orgs — ORG names to use for reputation checks
  • proxy — Use system proxy settings
  • insecure — Trust any certificate (not secure)
  • malicious_tag_ids — Malicious tag IDs
  • suspicious_tag_ids — Suspicious tag IDs
  • benign_tag_ids — Benign tag IDs
  • search_warninglists — Should the warninglists be considered when searching for an attribute
  • integrationReliability — Source Reliability (required)
  • attributes_limit — Maximum attributes to be returned

Commands (34)

  • domain

    Checks the reputation of the given domain.

  • email

    Checks the reputation of the given email address.

  • file

    Checks the file reputation of the given hash.

  • ip

    Checks the reputation of an IP address.

  • misp-add-attribute

    Adds an attribute to an existing MISP event.

  • misp-add-custom-object

    Adds custom objects to MISP.

  • misp-add-domain-object

    Adds a domain object to MISP.

  • misp-add-email-object

    Adds an email object to the specified event ID.

  • misp-add-events-from-feed

    Adds an OSINT feed. Only feeds in the misp format are allowed. For example have manifest.json.

  • misp-add-file-object

    Adds a file object to the specified event ID.

  • misp-add-ip-object

    Adds an IP object to the MISP event. The following arguments are optional, but at least one must be supplied for the command to run successfully: "ip", "dst_port", "src_port", "domain", "hostname", "ip_src", and "ip_dst".

  • misp-add-object

    Adds any other object to MISP.

  • misp-add-sighting

    Add sighting to an attribute.

  • misp-add-tag-to-attribute

    Adds a tag to the given UUID attribute.

  • misp-add-tag-to-event

    Adds a tag to the given UUID event .

  • misp-add-url-object

    Adds a URL object to an MISP event.

  • misp-add-user

    Add a new user to MISP.

  • misp-change-warninglist

    Changes a warninglist in MISP.

  • misp-check-warninglist

    Check a list of indicator values against the MISP warninglist.

  • misp-create-event

    Creates a new MISP event.

  • misp-delete-attribute

    Delete an attribute according to the given attribute ID.

  • misp-delete-event

    Deletes an event according to the given event ID.

  • misp-get-organization-info

    Display the organization IDs and names.

  • misp-get-role-info

    Display role names and role IDs.

  • misp-get-warninglist

    Get a specific warninglist by its ID.

  • misp-get-warninglists

    Gets all warninglists from MISP

  • misp-publish-event

    Publish an event.

  • misp-remove-tag-from-attribute

    Removes a tag from the given UUID attribute.

  • misp-remove-tag-from-event

    Removes a tag from the given UUID event .

  • misp-search-attributes

    Search for attributes in MISP.

  • misp-search-events

    Search for events in MISP. This search command will return only information about the matched events. To get information about attributes, use the misp-search-attributes command.

  • misp-set-event-attributes

    Set event attributes according to the given attributes data.

  • misp-update-attribute

    Update an attribute of an existing MISP event.

  • url

    Checks the reputation of the given URL.

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401

import urllib3
import copy

from urllib.parse import urlparse
from pymisp import ExpandedPyMISP, PyMISPError, MISPObject, MISPSighting, MISPEvent, MISPAttribute, MISPUser, MISPServerError
from pymisp.tools import GenericObjectGenerator, EMailObject
from pymisp.tools import FileObject
from base64 import b64decode
import tempfile

logging.getLogger("pymisp").setLevel(logging.CRITICAL)


class TempFile:
    def __init__(self, data):
        _, self.path = tempfile.mkstemp()
        with open(self.path, "w") as temp_file:
            temp_file.write(data)

    def __del__(self):
        import os

        os.remove(self.path)


def handle_connection_errors(error):
    if "SSLError" in error:
        return_error(
            "Unable to connect to MISP because of a SSLCertVerificationError, "
            "Please try to use the Trust any certificate option."
        )
    if "NewConnectionError" in error:
        return_error(
            "Unable to connect to MISP because of a NewConnectionError, Please make sure your MISP server url is correct."
        )
    if "Please make sure the API key and the URL are correct" in error:
        return_error("Unable to connect to MISP, Please make sure the API key is correct.")
    return_error(error)


def warn(*args, **kwargs):
    """
    Do nothing with warnings
    """


# Disable requests warnings
urllib3.disable_warnings()

# Disable python warnings
warnings.warn = warn

""" GLOBALS/PARAMS """
params = demisto.params()
if not params.get("credentials") or not (MISP_API_KEY := params.get("credentials", {}).get("password")):
    raise DemistoException("Missing API Key. Fill in a valid key in the integration configuration.")
MISP_URL = params.get("url")
TO_IDS = params.get("check_to_ids")
ALLOWED_ORGS = argToList(params.get("allowed_orgs"), ",")
VERIFY = not params.get("insecure")
CERTIFICATE = replace_spaces_in_credential(params.get("certificate", {}).get("identifier"))
PRIVATE_KEY = replace_spaces_in_credential(params.get("certificate", {}).get("password"))
cert = TempFile(CERTIFICATE) if CERTIFICATE else None
key = TempFile(PRIVATE_KEY) if PRIVATE_KEY else None
misp_client_cert = (cert.path, key.path) if cert and key else None

PROXIES = handle_proxy()  # type: ignore
try:
    PYMISP = ExpandedPyMISP(url=MISP_URL, key=MISP_API_KEY, ssl=VERIFY, proxies=PROXIES, cert=misp_client_cert)
except PyMISPError as e:
    handle_connection_errors(e.message)

PREDEFINED_FEEDS = {
    "CIRCL": {
        "name": "CIRCL OSINT Feed",
        "url": "https://www.circl.lu/doc/misp/feed-osint",
        "format": "misp",
        "input": "network",
    },
    "Botvrij.eu": {
        "name": "The Botvrij.eu Data",
        "url": "http://www.botvrij.eu/data/feed-osint",
        "format": "misp",
        "input": "network",
    },
}

THREAT_LEVELS_TO_ID = {"High": 1, "Medium": 2, "Low": 3, "Unknown": 4}
BAD_THREAT_LEVEL_IDS = ["1", "2", "3"]

MISP_ENTITIES_TO_CONTEXT_DATA = {
    "deleted": "Deleted",
    "category": "Category",
    "comment": "Comment",
    "uuid": "UUID",
    "sharing_group_id": "SharingGroupID",
    "timestamp": "LastChanged",
    "to_ids": "ToIDs",
    "value": "Value",
    "event_id": "EventID",
    "ShadowAttribute": "ShadowAttribute",
    "disable_correlation": "DisableCorrelation",
    "distribution": "Distribution",
    "type": "Type",
    "id": "ID",
    "date": "CreationDate",
    "info": "Info",
    "published": "Published",
    "attribute_count": "AttributeCount",
    "proposal_email_lock": "ProposalEmailLock",
    "locked": "Locked",
    "publish_timestamp": "PublishTimestamp",
    "event_creator_email": "EventCreatorEmail",
    "name": "Name",
    "analysis": "Analysis",
    "threat_level_id": "ThreatLevelID",
    "old_id": "OldID",
    "org_id": "OrganizationID",
    "Org": "Organization",
    "Orgc": "OwnerOrganization",
    "orgc_uuid": "OwnerOrganization.UUID",
    "orgc_id": "OwnerOrganization.ID",
    "orgc_name": "OwnerOrganization.Name",
    "event_uuid": "EventUUID",
    "proposal_to_delete": "ProposalToDelete",
    "description": "Description",
    "version": "Version",
    "Object": "Object",
    "object_id": "ObjectID",
    "object_relation": "ObjectRelation",
    "template_version": "TemplateVersion",
    "template_uuid": "TemplateUUID",
    "meta-category": "MetaCategory",
    "decay_score": "DecayScore",
    "first_seen": "first_seen",
    "last_seen": "last_seen",
    "provider": "Provider",
    "source_format": "SourceFormat",
    "url": "URL",
    "event_uuids": "EventUUIDS",
}

MISP_ANALYSIS_TO_IDS = {"initial": 0, "ongoing": 1, "completed": 2}

MISP_DISTRIBUTION_TO_IDS = {
    "Your_organization_only": 0,
    "This_community_only": 1,
    "Connected_communities": 2,
    "All_communities": 3,
    "Sharing_group": 4,
    "Inherit_event": 5,
}

SIGHTING_TYPE_NAME_TO_ID = {"sighting": 0, "false_positive": 1, "expiration": 2}

SIGHTING_TYPE_ID_TO_NAME = {"0": "sighting", "1": "false_positive", "2": "expiration"}

INDICATOR_TYPE_TO_DBOT_SCORE = {
    "FILE": DBotScoreType.FILE,
    "URL": DBotScoreType.URL,
    "DOMAIN": DBotScoreType.DOMAIN,
    "IP": DBotScoreType.IP,
    "EMAIL": DBotScoreType.EMAIL,
}

DOMAIN_REGEX = (
    r"([a-z¡-\uffff0-9](?:[a-z¡-\uffff0-9-]{0,61}"
    "[a-z¡-\uffff0-9])?(?:\\.(?!-)[a-z¡-\uffff0-9-]{1,63}(?<!-))*"
    "\\.(?!-)(?!(jpg|jpeg|exif|tiff|tif|png|gif|otf|ttf|fnt|dtd|xhtml|css"
    "|html)$)(?:[a-z¡-\uffff-]{2,63}|xn--[a-z0-9]{1,59})(?<!-)\\.?$"
    "|localhost)"
)
MISP_SEARCH_ARGUMENTS = [
    "value",
    "type",
    "category",
    "org",
    "tags",
    "from",
    "to",
    "event_id",
    "uuid",
    "to_ids",
    "last",
    "include_decay_score",
    "include_sightings",
    "include_correlations",
    "limit",
    "page",
    "enforceWarninglist",
    "include_feed_correlations",
    "eventinfo",
    "with_attachments",
]

EVENT_FIELDS = [
    "id",
    "orgc_id",
    "org_id",
    "date",
    "threat_level_id",
    "info",
    "published",
    "uuid",
    "analysis",
    "attribute_count",
    "timestamp",
    "distribution",
    "proposal_email_lock",
    "locked",
    "publish_timestamp",
    "sharing_group_id",
    "disable_correlation",
    "event_creator_email",
    "Org",
    "Orgc",
    "RelatedEvent",
    "Galaxy",
    "Tag",
    "decay_score",
    "Object",
    "Feed",
    "Attribute",
]

ATTRIBUTE_FIELDS = [
    "id",
    "event_id",
    "object_id",
    "object_relation",
    "category",
    "type",
    "to_ids",
    "uuid",
    "timestamp",
    "distribution",
    "sharing_group_id",
    "comment",
    "deleted",
    "disable_correlation",
    "first_seen",
    "last_seen",
    "value",
    "Event",
    "Object",
    "Galaxy",
    "Tag",
    "decay_score",
    "Sighting",
]


WARNINGLIST_HEADERS = ["ID", "Name", "Type", "Description", "Version", "Enabled", "Default", "Category", "Attributes"]
WARNINGLIST_ENTRY_HEADERS = ["ID", "Value", "Comment"]
WARNINGLIST_TYPE_HEADERS = ["ID", "Type"]


def extract_error(error: list) -> list[dict]:
    """
    Extracting errors raised by PYMISP into readable response, for more information and examples
    please see UT: test_extract_error.

    Args:
        error: list of responses from error section

    Returns:
        List[Dict[str, any]]: filtered response
    """
    return [{"code": err[0], "message": err[1].get("message"), "errors": err[1].get("errors")} for err in error]


def dict_to_generic_object_format(args: dict) -> list[dict]:
    """
    Converts args dict into a list, please see GenericObjectGenerator Class in Pymisp.
    Args:
        args: dictionary describes MISP object

    Returns:
        list: list containing dicts that GenericObjectGenerator can take.

    Examples:
        >>> {'ip': '8.8.8.8', 'domain': 'google.com'}
        [{'ip': '8.8.8.8'}, {'domain': 'google.com'}]
    """
    return [{k: v} for k, v in args.items()]


def build_generic_object(template_name: str, args: list[dict]) -> GenericObjectGenerator:
    """

    Args:
        template_name: template name as described in https://github.com/MISP/misp-objects
        args: arguments to create the generic object

    Returns:
        GenericObjectGenerator: object created in MISP

    Example:
        args should look like:
             [{'analysis_submitted_at': '2018-06-15T06:40:27'},
             {'threat_score': {value=95, to_ids=False}},
             {'permalink': 'https://panacea.threatgrid.com/mask/samples/2e445ef5389d8b'},
             {'heuristic_raw_score': 7.8385159793597}, {'heuristic_score': 96},
             {'original_filename': 'juice.exe'}, {'id':  '2e445ef5389d8b'}] # guardrails-disable-line
    """
    misp_object = GenericObjectGenerator(template_name)
    misp_object.generate_attributes(args)
    return misp_object


def build_custom_object(template_name: str, args: list[dict]):
    obj = PYMISP.object_templates()
    for entry in obj:
        if str(entry.get("ObjectTemplate", {}).get("name")).lower() == template_name:  # type: ignore[union-attr]
            custom_obj = PYMISP.get_raw_object_template(template_name)

            if not os.path.exists(f"/tmp/{template_name}"):
                os.mkdir(f"/tmp/{template_name}")
            open(f"/tmp/{template_name}/definition.json", "w").write(json.dumps(custom_obj))

            misp_object = MISPObject(name=template_name, misp_objects_path_custom="/tmp")

            for arg in args:
                for key, value in arg.items():
                    misp_object.add_attribute(key, value)

            return misp_object

    return False


def misp_convert_timestamp_to_date_string(timestamp: str | int) -> str:
    """
    Gets a timestamp from MISP response (1546713469) and converts it to human readable format
    """
    return datetime.utcfromtimestamp(int(timestamp)).strftime("%Y-%m-%dT%H:%M:%SZ") if timestamp else ""


def replace_keys_from_misp_to_context_data(obj_to_build: dict | list | str) -> dict | list | str:
    """
    Replacing keys from MISP's format to Demisto's (as appear in ENTITIESDICT)

    Args:
        obj_to_build (Union[dict, list, str]): object to replace keys in

    Returns:
        Union[dict, list, str]: same object type that got in
    """
    if isinstance(obj_to_build, list):
        return [replace_keys_from_misp_to_context_data(item) for item in obj_to_build]
    if isinstance(obj_to_build, dict):
        return {
            (MISP_ENTITIES_TO_CONTEXT_DATA.get(key, key)): replace_keys_from_misp_to_context_data(value)
            for key, value in obj_to_build.items()
        }
    return obj_to_build


def reputation_command_to_human_readable(outputs, score, events_to_human_readable):
    found_tag_id, found_tag_name = "", ""
    for event in events_to_human_readable:
        # removing those fields as they are shared by the events
        found_tag_id = event.pop("Tag_ID")
        found_tag_name = event.pop("Tag_Name")
    return {
        "Attribute Type": outputs[0].get("Type"),
        "Dbot Score": score,
        "Attribute Value": outputs[0].get("Value"),
        "Attribute Category": outputs[0].get("Category"),
        "Timestamp": outputs[0].get("Timestamp"),
        "Events with the scored tag": events_to_human_readable,
        "Scored Tag ID": found_tag_id,
        "Scored Tag Name": found_tag_name,
    }


def limit_tag_output_to_id_and_name(attribute_dict, is_event_level):
    """
    As tag list can be full of in unnecessary data, we want to limit this list to include only the ID and Name fields.
    In addition, returns set of the found tag ids.

    Some tags have a field called inherited. When it is set to 1 it says that it is an event's tag.
    Otherwise (if it is set to 0 or not exists) it says that it is an attribute's tag.
    If the data is event's (is_event_level = true) we would like to add to tag_set_ids all the tags
    (event ones and the event's attribute tags ones as it is part of the event scope).
    If the data is attribute's (is_event_level = false), and the tag is only related to an attribute
    we would like to add it to tag_set_ids. In any other case, we won't add the tag.

    Args:
        attribute_dict (dict): The dictionary that includes the tag list.
        is_event_level (bool): Whether the attribute_dict was received from an event object,
        meaning the tags are event's ones. Otherwise, the data is attribute's (attribute tags).
    """
    output = []
    tag_set_ids = set()
    tags_list = attribute_dict.get("Tag", [])
    for tag in tags_list:
        is_event_tag = tag.get("inherited", 0)  # field doesn't exist when this is an attribute level, default is '0'
        tag_id = tag.get("id")
        if is_event_level:
            tag_set_ids.add(str(tag_id))
        else:  # attribute level
            if not is_event_tag:
                tag_set_ids.add(str(tag_id))
        output.append({"ID": tag_id, "Name": tag.get("name")})
    return output, tag_set_ids


def parse_response_reputation_command(
    misp_response: dict, malicious_tag_ids: set, suspicious_tag_ids: set, benign_tag_ids: set, attributes_limit: int
):
    """
    After getting all the attributes which match the required indicator value, this function parses the response.
    This function goes over all the attributes that found (after limit the attributes amount to the given limit)
    and by sub-functions calculated the score of the indicator.
    For the context data outputs, for every attribute we remove the "Related Attribute" list and limits the tags and
    galaxies lists. Eventually, the outputs will be a list of attributes along with their events objects.
    Note: When limits the attributes amount, we sort the attributes list by the event ids as the greater event ids are
    the newer ones.

    Returns:
        response (dict): The parsed outputs to context data (array of attributes).
        score: the indicator score
        found_tag: the tag (id) which made the indicator to get that score
        found_related_events (dict): contains info (name, id, threat level id) about all the events that include
        the indicator

    Please see an example for a response in test_data/reputation_command_response.json
    Please see an example for a parsed output in test_data/reputation_command_outputs.json
    """
    response = copy.deepcopy(misp_response)
    attributes_list = response.get("Attribute")
    if not attributes_list:
        return None
    attributes_list = sorted(attributes_list, key=lambda attribute_item: attribute_item["event_id"], reverse=True)[
        :attributes_limit
    ]
    found_related_events, attributes_tag_ids, event_tag_ids = prepare_attributes_array_to_context_data(attributes_list)
    attribute_in_event_with_bad_threat_level = found_event_with_bad_threat_level_id(found_related_events)
    score, found_tag = get_score(
        attribute_tags_ids=attributes_tag_ids,
        event_tags_ids=event_tag_ids,
        malicious_tag_ids=malicious_tag_ids,
        suspicious_tag_ids=suspicious_tag_ids,
        benign_tag_ids=benign_tag_ids,
        is_attribute_in_event_with_bad_threat_level=attribute_in_event_with_bad_threat_level,
    )
    formatted_response = replace_keys_from_misp_to_context_data({"Attribute": attributes_list})
    return formatted_response, score, found_tag, found_related_events


def prepare_attributes_array_to_context_data(attributes_list):
    attributes_tag_ids, event_tag_ids = set(), set()
    found_related_events = {}
    if not attributes_list:
        return None
    for attribute in attributes_list:
        attribute.pop("RelatedAttribute")  # get rid of this useless list
        event = attribute.get("Event")
        convert_timestamp_to_readable(attribute, event)
        found_related_events[event.get("id")] = {
            "Event Name": event.get("info"),
            "Threat Level ID": event.get("threat_level_id"),
            "Event ID": event.get("id"),
        }
        if event.get("Tag"):
            limit_tag_output, tag_ids = limit_tag_output_to_id_and_name(event, True)
            event["Tag"] = limit_tag_output
            event_tag_ids.update(tag_ids)
        if attribute.get("Tag"):
            limit_tag_output, tag_ids = limit_tag_output_to_id_and_name(attribute, False)
            attribute["Tag"] = limit_tag_output
            attributes_tag_ids.update(tag_ids)
    return found_related_events, attributes_tag_ids, event_tag_ids


def convert_timestamp_to_readable(attribute, event):
    if attribute.get("timestamp"):
        attribute["timestamp"] = misp_convert_timestamp_to_date_string(attribute.get("timestamp"))
    if event:
        if event.get("timestamp"):
            attribute["Event"]["timestamp"] = misp_convert_timestamp_to_date_string(event.get("timestamp"))
        if event.get("publish_timestamp"):
            attribute["Event"]["publish_timestamp"] = misp_convert_timestamp_to_date_string(event.get("publish_timestamp"))


def found_event_with_bad_threat_level_id(found_related_events):
    return any(str(event["Threat Level ID"]) in BAD_THREAT_LEVEL_IDS for event in found_related_events.values())


def get_score(
    attribute_tags_ids,
    event_tags_ids,
    malicious_tag_ids,
    suspicious_tag_ids,
    benign_tag_ids,
    is_attribute_in_event_with_bad_threat_level,
):
    """
    Calculates the indicator score by following logic. Indicators of attributes and Events that:
    * have tags which configured as malicious will be scored 3 (i.e malicious).
    * have tags which configured as suspicious will be scored 2 (i.e suspicious).
    * don't have any tags configured as suspicious nor malicious will be scored by their event's threat level id. In
    such case, the score will be BAD if the threat level id is in [1,2,3]. Otherwise, the threat level is 4 = Unknown.
    note:
    - In case the same tag appears in both Malicious tag ids and Suspicious tag ids lists the indicator will
      be scored as malicious.
    - Attributes tags (both malicious and suspicious) are stronger than events' tags.
    """
    found_tag = None
    is_attribute_tag_malicious = any((found_tag := tag) in attribute_tags_ids for tag in malicious_tag_ids)
    if is_attribute_tag_malicious:
        return Common.DBotScore.BAD, found_tag

    is_attribute_tag_suspicious = any((found_tag := tag) in attribute_tags_ids for tag in suspicious_tag_ids)
    if is_attribute_tag_suspicious:
        return Common.DBotScore.SUSPICIOUS, found_tag

    is_attribute_tag_benign = any((found_tag := tag) in attribute_tags_ids for tag in benign_tag_ids)
    if is_attribute_tag_benign:
        return Common.DBotScore.GOOD, found_tag

    is_event_tag_malicious = any((found_tag := tag) in event_tags_ids for tag in malicious_tag_ids)
    if is_event_tag_malicious:
        return Common.DBotScore.BAD, found_tag

    is_event_tag_suspicious = any((found_tag := tag) in event_tags_ids for tag in suspicious_tag_ids)
    if is_event_tag_suspicious:
        return Common.DBotScore.SUSPICIOUS, found_tag

    is_event_tag_benign = any((found_tag := tag) in event_tags_ids for tag in benign_tag_ids)
    if is_event_tag_benign:
        return Common.DBotScore.GOOD, found_tag

    # no tag was found
    if is_attribute_in_event_with_bad_threat_level:
        return Common.DBotScore.BAD, None

    return Common.DBotScore.NONE, None


def get_new_misp_event_object(args):
    """
    Create a new MISP event object and set the event's details.
    """
    event = MISPEvent()
    event.distribution = MISP_DISTRIBUTION_TO_IDS[args.get("distribution")]

    sharing_group_id = args.get("sharing_group_id")
    if event.distribution == 4 and not sharing_group_id:
        raise DemistoException(
            "Error: When setting distribution to be 'Sharing_group', you have to specify the 'sharing_group_id' argument."
        )
    if sharing_group_id:
        event.sharing_group_id = arg_to_number(sharing_group_id)  # type: ignore[assignment]

    threat_level_id_arg = args.get("threat_level_id")
    if threat_level_id_arg:
        event.threat_level_id = THREAT_LEVELS_TO_ID[threat_level_id_arg]

    analysis_arg = args.get("analysis")
    event.analysis = MISP_ANALYSIS_TO_IDS.get(analysis_arg, analysis_arg)
    event.info = args.get("info") if args.get("info") else "Event from XSOAR"
    event.date = datetime.strptime(args.get("creation_date"), "%Y-%m-%d") if args.get("creation_date") else datetime.today()
    event.published = argToBoolean(args.get("published", "False"))
    return event


def create_event_command(demisto_args: dict):
    """Creating event in MISP with the given attribute args"""
    new_event = get_new_misp_event_object(demisto_args)
    new_event = PYMISP.add_event(new_event, True)

    if isinstance(new_event, dict):
        if new_event.get("errors"):
            raise DemistoException(f"Errors:{new_event.get('errors')}")
        raise DemistoException(f"Unknown event type:{type(new_event)}.")
    event_id = new_event.id
    add_attribute(event_id=event_id, internal=True, new_event=new_event, demisto_args=demisto_args)
    event = PYMISP.search(eventid=event_id)
    human_readable = f"## MISP create event\nNew event with ID: {event_id} has been successfully created.\n"

    return CommandResults(
        readable_output=human_readable,
        outputs_prefix="MISP.Event",
        outputs_key_field="ID",
        outputs=build_events_search_response(event),  # type: ignore[arg-type]
        raw_response=event,
    )


def add_user_to_misp(demisto_args: dict = {}):
    """Adding a new user to MISP.

    Args:
        demisto_args (dict): Demisto args
    """
    new_user = MISPUser()
    new_user.email = demisto_args["email"]
    new_user.org_id = demisto_args.get("org_id")
    new_user.role_id = demisto_args.get("role_id")
    new_user.password = demisto_args.get("password")
    response = PYMISP.add_user(new_user)
    if "errors" in response:
        raise DemistoException(f"Failed to add user.\nError message: {response}")
    else:
        human_readable = f"## MISP add user\nNew user was added to MISP.\nEmail:{new_user.email}"
        response = response.get("User", {})
        return CommandResults(readable_output=human_readable, raw_response=response, outputs=response, outputs_prefix="MISP.User")


def get_organizations_info():
    """
    Display organization ids and names.
    """
    organizations = PYMISP.organisations()
    org_info = []
    for organization in organizations:
        org_id = organization.get("Organisation", {}).get("id")  # type: ignore[union-attr]
        org_name = organization.get("Organisation", {}).get("name")  # type: ignore[union-attr]
        if org_id and org_name:
            org_info.append({"name": org_name, "id": org_id})
    if org_info:
        human_readable = tableToMarkdown("MISP Organizations", org_info, headers=["id", "name"], removeNull=True)
    else:
        human_readable = "There are no organization ids and names"
    return CommandResults(
        readable_output=human_readable, outputs_prefix="MISP.Organization", outputs=org_info, raw_response=org_info
    )


def get_role_info():
    """
    Display role ids and names.
    """
    roles = PYMISP.roles()
    role_info = []
    for role in roles:
        role_name = role.get("Role", {}).get("name")  # type: ignore[union-attr]
        role_id = role.get("Role", {}).get("id")  # type: ignore[union-attr]
        if role_name and role_id:
            role_info.append({"name": role_name, "id": role_id})
    if role_info:
        human_readable = tableToMarkdown("MISP Roles", role_info, headers=["id", "name"], removeNull=True)
    else:
        human_readable = "There are no role ids and names"
    return CommandResults(readable_output=human_readable, outputs_prefix="MISP.Role", outputs=role_info, raw_response=role_info)


def add_attribute(
    event_id: int | None = None, internal: bool = False, demisto_args: dict = {}, new_event: MISPEvent | None = None
):
    """Adding attribute to a given MISP event object
    This function can be called as an independence command or as part of another command (create event for example)

    Args:
        event_id (int): Event ID to add attribute to
        internal (bool): if set to True, will not post results to Demisto
        demisto_args (dict): Demisto args
        new_event (MISPEvent): When this function was called from create event command, the attribute will be added to
        that existing event.
    """
    value = demisto_args.get("value")
    attributes_args = {
        "id": demisto_args.get("event_id"),  # misp event id
        "type": demisto_args.get("type", "other"),
        "category": demisto_args.get("category", "External analysis"),
        "to_ids": argToBoolean(demisto_args.get("to_ids", True)),
        "comment": demisto_args.get("comment"),
        "value": argToList(value),
    }
    event_id = event_id if event_id else arg_to_number(demisto_args.get("event_id"), "event_id")
    attributes_args.update({"id": event_id}) if event_id else None

    distribution = demisto_args.get("distribution")
    attributes_args.update({"distribution": MISP_DISTRIBUTION_TO_IDS[distribution]}) if distribution else None

    sharing_group_id = demisto_args.get("sharing_group_id")
    attributes_args.update({"sharing_group_id": sharing_group_id}) if sharing_group_id else None

    if not new_event:
        response = PYMISP.search(eventid=event_id, pythonify=True, metadata=True)
        if not response:
            raise DemistoException(
                f"Error: An event with the given id: {event_id} was not found in MISP. please check it once again"
            )
        new_event = response[0]  # type: ignore[assignment,index]
        # response[0] is MISP event

    if not isinstance(new_event, MISPEvent):
        raise TypeError(f"Expected instance of MISPEvent, but got {type(new_event).__name__}: {new_event}")
    new_event.add_attribute(**attributes_args)
    PYMISP.update_event(event=new_event)
    if internal:
        return None

    value = attributes_args.get("value")
    updated_event = PYMISP.search(eventid=new_event.id, controller="attributes", value=value)
    human_readable = f"## MISP add attribute\nNew attribute: {value} was added to event id {new_event.id}.\n"
    return CommandResults(
        readable_output=human_readable,
        outputs_prefix="MISP.Attribute",
        outputs_key_field="ID",
        outputs=build_attributes_search_response(updated_event),  # type: ignore[arg-type]
        raw_response=updated_event,
    )


def generic_reputation_command(
    demisto_args,
    reputation_type,
    dbot_type,
    malicious_tag_ids,
    suspicious_tag_ids,
    benign_tag_ids,
    reliability,
    attributes_limit,
    search_warninglists: bool = False,
):
    reputation_value_list = argToList(demisto_args.get(reputation_type), ",")
    command_results = []
    for value in reputation_value_list:
        command_results.append(
            get_indicator_results(
                value,
                dbot_type,
                malicious_tag_ids,
                suspicious_tag_ids,
                benign_tag_ids,
                reliability,
                attributes_limit,
                search_warninglists,
            )
        )
    return command_results


def reputation_value_validation(value, dbot_type):
    if dbot_type == "FILE":
        # hashFormat will be used only in output
        hash_format = get_hash_type(value)
        if hash_format == "Unknown":
            raise DemistoException("Invalid hash length, enter file hash of format MD5, SHA-1 or SHA-256")
    if dbot_type == "IP" and not is_ip_valid(value):
        raise DemistoException(f"Error: The given IP address: {value} is not valid")
    if dbot_type == "DOMAIN" and not re.compile(DOMAIN_REGEX, regexFlags).match(value):
        raise DemistoException(f"Error: The given domain: {value} is not valid")
    if dbot_type == "URL" and not re.compile(urlRegex, regexFlags).match(value):
        raise DemistoException(f"Error: The given url: {value} is not valid")
    if dbot_type == "EMAIL" and not re.compile(emailRegex, regexFlags).match(value):
        raise DemistoException(f"Error: The given email address: {value} is not valid")


def get_indicator_results(
    value: str,
    dbot_type: str,
    malicious_tag_ids: set,
    suspicious_tag_ids: set,
    benign_tag_ids: set,
    reliability: DBotScoreReliability,
    attributes_limit: int,
    search_warninglists: bool = False,
):
    """
    This function searches for the given attribute value in MISP and then calculates it's dbot score.
    The score is calculated by the tags ids (attribute tags and event tags).
    Args:
        value (str): The indicator value (an IP address, email address, domain, url or file hash).
        dbot_type (str): Indicator type (file, url, domain, email or ip).
        malicious_tag_ids (set): Tag ids should be recognised as malicious.
        suspicious_tag_ids (set): Tag ids should be recognised as suspicious
        benign_tag_ids (set): Tag ids should be recognised as benign
        reliability (DBotScoreReliability): integration reliability score.
        attributes_limit (int) : Limits the number of attributes that will be written to the context
        search_warninglists: (optional, bool): Should the warninglists be included?

    Returns:
        CommandResults includes all the indicator results.
    """
    reputation_value_validation(value, dbot_type)
    # if ALLOWED_ORGS is empty, then it equals to any. When specified, then it filters out all other orgs that are not requested
    if TO_IDS:
        # to_ids flag represents whether the attribute is meant to be actionable
        # Actionable defined attributes can be used in automated processes as a pattern for detection
        misp_response = PYMISP.search(
            value=value,
            controller="attributes",
            include_context=True,
            include_correlations=True,
            include_event_tags=True,
            enforce_warninglist=not search_warninglists,
            include_decay_score=True,
            includeSightings=True,
            to_ids=TO_IDS,
            org=ALLOWED_ORGS,
        )
    else:
        misp_response = PYMISP.search(
            value=value,
            controller="attributes",
            include_context=True,
            include_correlations=True,
            include_event_tags=True,
            enforce_warninglist=not search_warninglists,
            include_decay_score=True,
            includeSightings=True,
            org=ALLOWED_ORGS,
        )

    indicator_type = INDICATOR_TYPE_TO_DBOT_SCORE[dbot_type]
    is_indicator_found = misp_response and misp_response.get("Attribute")  # type: ignore[union-attr]
    if is_indicator_found:
        outputs, score, found_tag, found_related_events = parse_response_reputation_command(
            misp_response,  # type: ignore[arg-type]
            malicious_tag_ids,
            suspicious_tag_ids,
            benign_tag_ids,
            attributes_limit,
        )
        dbot = Common.DBotScore(
            indicator=value,
            indicator_type=indicator_type,
            score=score,
            reliability=reliability,
            malicious_description="Match found in MISP",
        )
        indicator = get_dbot_indicator(dbot_type, dbot, value)
        all_attributes = outputs.get("Attribute")
        events_to_human_readable = get_events_related_to_scored_tag(all_attributes, found_tag)
        attribute_highlights = reputation_command_to_human_readable(all_attributes, score, events_to_human_readable)
        readable_output = tableToMarkdown(f"Results found in MISP for value: {value}", attribute_highlights, removeNull=True)
        readable_output += tableToMarkdown("Related events", list(found_related_events.values()))
        return CommandResults(
            indicator=indicator,
            raw_response=misp_response,
            outputs=all_attributes,
            outputs_prefix="MISP.Attribute",
            outputs_key_field="ID",
            readable_output=readable_output,
        )

    else:
        if search_warninglists:
            res: list = []
            human_readable: str = ""
            misp_warninglists_response = PYMISP.values_in_warninglist([value])
            if "errors" in misp_warninglists_response:
                raise DemistoException(
                    f"Unable to validate against MISP warninglists!\nError message: {misp_warninglists_response}"
                )
            if (
                misp_warninglists_response
                and isinstance(misp_warninglists_response, dict)
                and len(misp_warninglists_response.items()) > 0
            ):
                lists = list(misp_warninglists_response.values())[0]
                list_names: str = ",".join([x["name"] for x in lists])
                dbot = Common.DBotScore(
                    indicator=value,
                    indicator_type=indicator_type,
                    score=Common.DBotScore.GOOD,
                    reliability=reliability,
                    malicious_description=f"Match found in MISP warninglist{list_names}",
                )
                res.append(
                    {
                        "Value": value,
                        "Count": len(lists),
                        "Lists": list_names,
                    }
                )
                human_readable = tableToMarkdown(
                    "MISP Warninglist matchings:",
                    res,
                    headers=["Value", "Lists", "Count"],
                )
                warninglist_indicator: Optional[Common.Indicator] = get_dbot_indicator(dbot_type, dbot, value)
                if not warninglist_indicator:
                    raise DemistoException(f"The indicator type {dbot_type} is unknown!")
                return CommandResults(
                    indicator=warninglist_indicator,
                    raw_response=misp_warninglists_response,
                    outputs="",
                    outputs_prefix="MISP.Attribute",
                    outputs_key_field="ID",
                    readable_output=human_readable,
                )

        dbot = Common.DBotScore(
            indicator=value,
            indicator_type=indicator_type,
            score=Common.DBotScore.NONE,
            reliability=reliability,
            malicious_description="No results were found in MISP",
        )
        indicator = get_dbot_indicator(dbot_type, dbot, value)
        return CommandResults(indicator=indicator, readable_output=f"No attributes found in MISP for value: {value}")


def get_events_related_to_scored_tag(all_attributes, found_tag):
    """
    This function searches for all the events that have the tag (i.e found_tag) which caused the indicator to be scored
    as malicious or suspicious.
    Args:
        all_attributes (dict): The parsed response from the MISP search attribute request
        found_tag (str): The tag that was scored as malicious or suspicious. If no tag was found, then the score is
        Unknown so no events should be found.

    Returns:
        list includes all the events that were detected as related to the tag.
    """
    scored_events = []
    if found_tag:
        for attribute in all_attributes:
            event = attribute.get("Event", {})
            event_name = event.get("Info")
            scored_events.extend(search_events_with_scored_tag(event, found_tag, event_name))
            scored_events.extend(search_events_with_scored_tag(attribute, found_tag, event_name))
    return remove_duplicated_related_events(scored_events)


def remove_duplicated_related_events(related_events):
    related_events_no_duplicates = []
    for i in range(len(related_events)):
        if related_events[i] not in related_events[i + 1 :]:
            related_events_no_duplicates.append(related_events[i])
    return related_events_no_duplicates


def search_events_with_scored_tag(object_data_dict, found_tag, event_name):
    """
    By the given object we go over all the tags and search if found_tag is one of it's tags. If so, the event will be
    added to related_events list
    Args:
        object_data_dict (dict): Event or attribute dict which includes tags list.
        found_tag (str): The tag that was scored as malicious or suspicious.
        event_name (str): Name of the event
    """
    related_events = []
    object_tags_list = object_data_dict.get("Tag", [])
    for tag in object_tags_list:
        if (tag_id := tag.get("ID")) and str(tag_id) == found_tag:
            event_id = get_event_id(object_data_dict)
            tag_name = tag.get("Name")
            related_events.append({"Event_ID": event_id, "Event_Name": event_name, "Tag_Name": tag_name, "Tag_ID": tag.get("ID")})
    return related_events


def get_event_id(data_dict):
    if data_dict.get("EventID"):
        return data_dict.get("EventID")
    elif data_dict.get("ID"):
        return data_dict.get("ID")
    return data_dict.get("Event", {}).get("ID")


def get_dbot_indicator(dbot_type: str, dbot_score: Common.DBotScore, value: Any) -> Optional[Common.Indicator]:
    """Converts dbot indicator information to an indicator object

    Args:
        dbot_type (str): The object type
        dbot_score (Common.DBotScore): The score of the indicator
        value (Any): The value of the indicator

    Returns:
        Optional[Common.Indicator]: The indicator object
    """

    if dbot_type == "FILE":
        hash_type = get_hash_type(value)
        if hash_type == "md5":
            return Common.File(dbot_score=dbot_score, md5=value)
        if hash_type == "sha1":
            return Common.File(dbot_score=dbot_score, sha1=value)
        if hash_type == "sha256":
            return Common.File(dbot_score=dbot_score, sha256=value)
    if dbot_type == "IP":
        return Common.IP(ip=value, dbot_score=dbot_score)
    if dbot_type == "DOMAIN":
        return Common.Domain(domain=value, dbot_score=dbot_score)
    if dbot_type == "EMAIL":
        return Common.EMAIL(address=value, dbot_score=dbot_score)
    if dbot_type == "URL":
        return Common.URL(url=value, dbot_score=dbot_score)
    return None


def build_misp_complex_filter(demisto_query: str):
    """
    Examples are available in UT: test_build_misp_complex_filter.
    For more information please see build_complex_query in pymisp/api.py

    Args:
        demisto_query: complex query contains saved words: 'AND:', 'OR:' and 'NOT:'
            using ',' as delimiter for parameters and ';' as delimiter for operators.
            using the operators is optional.
            if 'demisto_query' does not contains any of the complex operators the original
            input will be returned

    Returns:
        str: dictionary created for misp to perform complex query
        or if no complex query found returns the original input
    """

    regex_and = r"(AND:)([^\;]+)(;)?"
    regex_or = r"(OR:)([^\;]+)(;)?"
    regex_not = r"(NOT:)([^\;]+)(;)?"
    misp_query_params: Dict[Any, Any] = {}

    match_and = re.search(regex_and, demisto_query, re.MULTILINE)
    match_or = re.search(regex_or, demisto_query, re.MULTILINE)
    match_not = re.search(regex_not, demisto_query, re.MULTILINE)

    is_complex_and_operator = is_misp_complex_search_helper(match_and, misp_query_params, "and_parameters")
    is_complex_or_operator = is_misp_complex_search_helper(match_or, misp_query_params, "or_parameters")
    is_complex_not_operator = is_misp_complex_search_helper(match_not, misp_query_params, "not_parameters")
    is_complex_search = is_complex_and_operator or is_complex_or_operator or is_complex_not_operator
    if is_complex_search:
        return PYMISP.build_complex_query(**misp_query_params)
    return demisto_query


def is_misp_complex_search_helper(match_operator, misp_query_params, operator_key):
    is_complex_search = False
    if match_operator is not None:
        misp_query_params[operator_key] = match_operator.group(2).split(",")
        is_complex_search = True
    return is_complex_search


def prepare_args_to_search(controller):
    demisto_args = demisto.args()
    args_to_misp_format = {arg: demisto_args[arg] for arg in MISP_SEARCH_ARGUMENTS if arg in demisto_args}
    # Replacing keys and values from Demisto to Misp's keys
    if "type" in args_to_misp_format:
        args_to_misp_format["type_attribute"] = args_to_misp_format.pop("type").split(",")
    if "to_ids" in args_to_misp_format:
        args_to_misp_format["to_ids"] = 1 if demisto_args.get("to_ids") == "true" else 0
    if "from" in args_to_misp_format:
        args_to_misp_format["date_from"] = args_to_misp_format.pop("from")
    if "to" in args_to_misp_format:
        args_to_misp_format["date_to"] = args_to_misp_format.pop("to")
    if "event_id" in args_to_misp_format:
        args_to_misp_format["eventid"] = argToList(args_to_misp_format.pop("event_id"))
    if "last" in args_to_misp_format:
        args_to_misp_format["publish_timestamp"] = args_to_misp_format.pop("last")
    if "include_decay_score" in args_to_misp_format:
        args_to_misp_format["include_decay_score"] = 1 if demisto_args.get("include_decay_score") == "true" else 0
    if "include_sightings" in args_to_misp_format:
        args_to_misp_format["include_sightings"] = 1 if demisto_args.get("include_sightings") == "true" else 0
    if "include_correlations" in args_to_misp_format:
        args_to_misp_format["include_correlations"] = 1 if demisto_args.get("include_correlations") == "true" else 0
    if "enforceWarninglist" in args_to_misp_format:
        args_to_misp_format["enforceWarninglist"] = 1 if demisto_args.get("enforceWarninglist") == "true" else 0
    if "include_feed_correlations" in args_to_misp_format:
        args_to_misp_format["includeFeedCorrelations"] = 1 if demisto_args.get("include_feed_correlations") == "true" else 0
        args_to_misp_format.pop("include_feed_correlations")
    if "limit" not in args_to_misp_format:
        args_to_misp_format["limit"] = "50"
    if "tags" in args_to_misp_format:
        args_to_misp_format["tags"] = build_misp_complex_filter(args_to_misp_format["tags"])
    if args_to_misp_format.get("with_attachments") == "true":
        args_to_misp_format["with_attachments"] = 1
    else:
        args_to_misp_format["with_attachments"] = 0
        args_to_misp_format["controller"] = controller
    demisto.debug(f"[MISP V3]: args for {demisto.command()} command are {args_to_misp_format}")
    return args_to_misp_format


def build_attributes_search_response(response: dict | requests.Response, include_correlations=False) -> dict:
    """
    Convert the response of attribute search returned from MISP to the context output format.
    """
    response_object = copy.deepcopy(response)
    if include_correlations:
        # return full related attributes only if the user wants to get them back
        ATTRIBUTE_FIELDS.append("RelatedAttribute")

    if isinstance(response_object, str):
        response_object = json.loads(json.dumps(response_object))
    if isinstance(response_object, dict):
        attributes = response_object.get("Attribute")
    else:  # Response
        attributes = response_object.json().get("Attribute")
    return get_limit_attribute_search_outputs(attributes)


def get_limit_attribute_search_outputs(attributes):
    for i in range(len(attributes)):
        attributes[i] = {key: attributes[i].get(key) for key in ATTRIBUTE_FIELDS if key in attributes[i]}
        build_galaxy_output(attributes[i])
        build_tag_output(attributes[i])
        build_sighting_output_from_attribute_search_response(attributes[i])
        convert_timestamp_to_readable(attributes[i], None)
    formatted_attributes = replace_keys_from_misp_to_context_data(attributes)
    return formatted_attributes


def build_galaxy_output(given_object):
    """given_object is attribute or event, depends on the called function"""
    if given_object.get("Galaxy"):
        given_object["Galaxy"] = [
            {"name": star.get("name"), "type": star.get("type"), "description": star.get("description")}
            for star in given_object["Galaxy"]
        ]


def build_object_output(event):
    if event.get("Object"):
        event["Object"] = [
            {
                "name": event_object.get("name"),
                "uuid": event_object.get("uuid"),
                "description": event_object.get("description"),
                "id": event_object.get("id"),
            }
            for event_object in event["Object"]
        ]


def build_tag_output(given_object):
    """given_object is attribute or event, depends on the called function"""
    if given_object.get("Tag"):
        given_object["Tag"] = [{"Name": tag.get("name"), "is_galaxy": tag.get("is_galaxy")} for tag in given_object.get("Tag")]


def build_sighting_output_from_attribute_search_response(attribute):
    if attribute.get("Sighting"):
        attribute["Sighting"] = [{"type": sighting.get("type")} for sighting in attribute.get("Sighting")]


def build_attributes_search_response_return_only_values(response_object: dict | requests.Response) -> list:
    """returns list of attributes' values that match the search query when user set the arg 'compact' to True"""
    if isinstance(response_object, str):
        response_object = json.loads(json.dumps(response_object))
    if isinstance(response_object, dict):
        attributes = response_object.get("Attribute", [])
    else:  # Response
        attributes = response_object.json().get("Attribute", [])
    return [attribute.get("value") for attribute in attributes]


def pagination_args_validation(page, limit):
    if page and page < 0:
        raise DemistoException("page should be zero or a positive number")
    if limit and limit < 0:
        raise DemistoException("limit should be zero or a positive number")


def attribute_response_to_markdown_table(response: dict):
    attribute_highlights = []
    for attribute in response:
        event = attribute.get("Event", {})
        attribute_tags = [tag.get("Name") for tag in attribute.get("Tag")] if attribute.get("Tag") else None
        attribute_sightings = (
            [SIGHTING_TYPE_ID_TO_NAME[sighting.get("Type")] for sighting in attribute.get("Sighting")]
            if attribute.get("Sighting")
            else None
        )
        attribute_highlights.append(
            {
                "Attribute ID": attribute.get("ID"),
                "Event ID": attribute.get("EventID"),
                "Attribute Category": attribute.get("Category"),
                "Attribute Type": attribute.get("Type"),
                "Attribute Comment": attribute.get("Comment"),
                "Attribute Value": attribute.get("Value"),
                "Attribute Tags": attribute_tags,
                "Attribute Sightings": attribute_sightings,
                "To IDs": attribute.get("ToIDs"),
                "Timestamp": attribute.get("Timestamp"),
                "Event Info": event.get("Info"),
                "Event Organization ID": event.get("OrganizationID"),
                "Event Distribution": event.get("Distribution"),
                "Event UUID": event.get("UUID"),
            }
        )
    return attribute_highlights


def search_attributes(demisto_args: dict) -> CommandResults:
    """Execute a MISP search over 'attributes'"""
    args = prepare_args_to_search("attributes")
    outputs_should_include_only_values = argToBoolean(demisto_args.get("compact", False))
    include_correlations = argToBoolean(demisto_args.get("include_correlations", False))
    page = arg_to_number(demisto_args.get("page", 1), "page", required=True)
    limit = arg_to_number(demisto_args.get("limit", 50), "limit", required=True)
    pagination_args_validation(page, limit)

    response = PYMISP.search(**args)

    if response:
        response_for_context_list = []
        response_for_context_dict = {}

        if args.get("with_attachments", 0) == 1 and isinstance(response, list):
            for attachment in response:
                for objects in attachment.get("Event", {}).get("Object", []):
                    for object in objects.get("Attribute", []):
                        if args.get("value") == object.get("value"):
                            for object in objects.get("Attribute"):
                                if data := object.get("data"):
                                    res = fileResult("{}.zip".format(args.get("value")), b64decode(data))
                                    demisto.results(res)

            demisto.args()["with_attachments"] = "false"
            return search_attributes(demisto_args)

        if outputs_should_include_only_values:
            response_for_context_list = build_attributes_search_response_return_only_values(response)  # type: ignore[arg-type]
            number_of_results = len(response_for_context_list)
            md = tableToMarkdown(
                f"MISP search-attributes returned {number_of_results} attributes",
                response_for_context_list[:number_of_results],
                ["Value"],
            )
        else:
            response_for_context_dict = build_attributes_search_response(response, include_correlations)  # type: ignore[arg-type]
            attribute_highlights = attribute_response_to_markdown_table(response_for_context_dict)

            pagination_message = f"Current page size: {limit}\n"
            if len(response_for_context_dict) == limit:
                pagination_message += f"Showing page {page} out others that may exist"
            else:
                pagination_message += f"Showing page {page}"
            md = tableToMarkdown(
                f"MISP search-attributes returned {len(response_for_context_dict)} attributes\n {pagination_message}",
                attribute_highlights,
                removeNull=True,
            )

        response_for_context = response_for_context_list or response_for_context_dict

        return CommandResults(
            raw_response=response,
            readable_output=md,
            outputs=response_for_context,
            outputs_prefix="MISP.Attribute",
            outputs_key_field="ID",
        )

    else:
        return CommandResults(readable_output=f"No attributes found in MISP for the given filters: {args}")


def build_events_search_response(response: dict | requests.Response, demisto_args={}) -> dict:
    """
    Convert the response of event search returned from MISP to the context output format.
    please note: attributes are excluded from search-events output as the information is too big. User can use the
    command search-attributes in order to get the information about the attributes.
    Note: following the issue: 42650 we will return only attributes' feed hits on this command, for more info
    please read the issue.
    """
    response_object = copy.deepcopy(response)
    if isinstance(response_object, str):
        response_object = json.loads(json.dumps(response_object))
    if isinstance(response_object, requests.Response):
        events = [event.get("Event") for event in response_object.json()]
    else:  # dict
        events = [event.get("Event") for event in response_object]
    for i in range(0, len(events)):
        # Filter object from keys in event_args
        events[i] = {key: events[i].get(key) for key in EVENT_FIELDS if key in events[i]}
        events[i]["RelatedEvent"] = []  # there is no need in returning related event when searching for an event
        build_galaxy_output(events[i])
        build_tag_output(events[i])
        build_object_output(events[i])
        build_attribute_feed_hit(events[i], demisto_args)
        events[i]["timestamp"] = misp_convert_timestamp_to_date_string(events[i].get("timestamp"))
        events[i]["publish_timestamp"] = misp_convert_timestamp_to_date_string(events[i].get("publish_timestamp"))

    formatted_events = replace_keys_from_misp_to_context_data(events)  # type: ignore
    return formatted_events  # type: ignore


def build_attribute_feed_hit(event: dict, demisto_args):
    """
    We want to have the attributes data as part of the search-events context results only if the user asked for
    include_feed_correlations. The data we return includes some finite fields:
    * A list of event_uuids, feed ID, name, provider, source format and a url. None of these fields doesn't include
    some heavy data which can cause performance issues.
    Otherwise, we don't want to return attributes data at all.
    """
    if argToBoolean(demisto_args.get("include_feed_correlations", False)):
        if event.get("Attribute"):
            event["Attribute"] = [
                {"id": attribute.get("id"), "value": attribute.get("value"), "Feed": attribute.get("Feed")}
                for attribute in event["Attribute"]
            ]
    else:
        event.pop("Attribute")


def event_to_human_readable_tag_list(event):
    event_tags = event.get("Tag", [])
    if event_tags:
        return [tag.get("Name") for tag in event_tags]
    return None


def event_to_human_readable_galaxy_list(event):
    event_galaxies = event.get("Galaxy", [])
    if event_galaxies:
        return [galaxy.get("Name") for galaxy in event.get("Galaxy")]
    return None


def event_to_human_readable_object_list(event):
    event_objects = event.get("Object", [])
    if event_objects:
        return [event_object.get("ID") for event_object in event.get("Object")]
    return None


def event_to_human_readable(response: dict):
    event_highlights = []
    for event in response:
        event_tags = event_to_human_readable_tag_list(event)
        event_galaxies = event_to_human_readable_galaxy_list(event)
        event_objects = event_to_human_readable_object_list(event)
        event_highlights.append(
            {
                "Event ID": event.get("ID"),
                "Event Tags": event_tags,
                "Event Galaxies": event_galaxies,
                "Event Objects": event_objects,
                "Publish Timestamp": event.get("PublishTimestamp"),
                "Event Info": event.get("Info"),
                "Event Org ID": event.get("OrganizationID"),
                "Event Orgc ID": event.get("OwnerOrganization.ID"),
                "Event Distribution": event.get("Distribution"),
                "Event UUID": event.get("UUID"),
            }
        )
    return event_highlights


def search_events(demisto_args: dict) -> CommandResults:
    """
    Execute a MISP search using the 'event' controller.
    """
    args = prepare_args_to_search("events")
    page = arg_to_number(demisto_args.get("page", 1), "page", required=True)
    limit = arg_to_number(demisto_args.get("limit", 50), "limit", required=True)
    pagination_args_validation(page, limit)

    response = PYMISP.search(**args)
    if response:
        response_for_context = build_events_search_response(response, demisto_args)  # type: ignore[arg-type]
        event_outputs_to_human_readable = event_to_human_readable(response_for_context)

        pagination_message = f"Current page size: {limit}\n"
        if len(response_for_context) == limit:
            pagination_message += f"Showing page {page} out others that may exist"
        else:
            pagination_message += f"Showing page {page}"
        md = tableToMarkdown(
            f"MISP search-events returned {len(response_for_context)} events.\n {pagination_message}",
            event_outputs_to_human_readable,
            removeNull=True,
        )

        return CommandResults(
            raw_response=response,
            readable_output=md,
            outputs=response_for_context,
            outputs_prefix="MISP.Event",
            outputs_key_field="ID",
        )
    else:
        return CommandResults(readable_output=f"No events found in MISP for the given filters: {args}")


def delete_event(demisto_args: dict):
    """
    Gets an event id and deletes it.
    """
    event_id = demisto_args["event_id"]
    response = PYMISP.delete_event(event_id)
    if "errors" in response:
        raise DemistoException(f"Event ID: {event_id} has not found in MISP: \nError message: {response}")
    else:
        human_readable = f"Event {event_id} has been deleted"
        return CommandResults(readable_output=human_readable, raw_response=response)


def add_tag(demisto_args: dict, is_attribute=False):
    """
    Function will add tag to given UUID of event or attribute.
    is_attribute (bool): if the given UUID belongs to an attribute (True) or event (False).
    """
    uuid = demisto_args["uuid"]
    tag = demisto_args["tag"]
    is_local_tag = argToBoolean(demisto_args.get("is_local", False))
    disable_output = argToBoolean(demisto_args.get("disable_output", False))
    try:
        res = PYMISP.tag(uuid, tag, local=is_local_tag)  # add the tag
    except PyMISPError:
        raise DemistoException("Adding the required tag was failed. Please make sure the UUID exists.")
    if "errors" in res:
        raise DemistoException(f"Got error from MISP API: {res}")
    if is_attribute:
        response = None
        success_msg = f"Tag {tag} has been successfully added to attribute {uuid}"
        if not disable_output:
            response = PYMISP.search(uuid=uuid, controller="attributes")
            return CommandResults(
                readable_output=success_msg,
                outputs_prefix="MISP.Attribute",
                outputs_key_field="ID",
                outputs=build_attributes_search_response(response),  # type: ignore[arg-type]
                raw_response=response,
            )
        else:
            return CommandResults(readable_output=success_msg, raw_response=success_msg)

    # event's uuid
    response = PYMISP.search(uuid=uuid)
    human_readable = f"Tag {tag} has been successfully added to event {uuid}"
    return CommandResults(
        readable_output=human_readable,
        outputs_prefix="MISP.Event",
        outputs_key_field="ID",
        outputs=build_events_search_response(response),  # type: ignore[arg-type]
        raw_response=response,
    )


def remove_tag(demisto_args: dict, is_attribute=False):
    """
    Function will remove tag to given UUID of event or attribute.
    is_attribute (bool): if the given UUID is an attribute's one. Otherwise it's event's.
    """
    uuid = demisto_args["uuid"]
    tag = demisto_args["tag"]
    try:
        response = PYMISP.untag(uuid, tag)
        if response and response.get("errors"):  # type: ignore[union-attr]
            raise DemistoException(f"Error in `{demisto.command()}` command: {response}")
    except PyMISPError:
        raise DemistoException("Removing the required tag was failed. Please make sure the UUID and tag exist.")

    if is_attribute:
        response = PYMISP.search(uuid=uuid, controller="attributes")  # type: ignore[assignment]
        human_readable = f"Tag {tag} has been successfully removed from the attribute {uuid}"
        return CommandResults(
            readable_output=human_readable,
            outputs_prefix="MISP.Attribute",
            outputs_key_field="ID",
            outputs=build_attributes_search_response(response),  # type: ignore[arg-type]
            raw_response=response,
        )
    # event's uuid
    response = PYMISP.search(uuid=uuid)  # type: ignore[assignment]
    human_readable = f"Tag {tag} has been successfully removed from the event {uuid}"
    return CommandResults(
        readable_output=human_readable,
        outputs_prefix="MISP.Event",
        outputs_key_field="ID",
        outputs=build_events_search_response(response),  # type: ignore[arg-type]
        raw_response=response,
    )


def add_sighting(demisto_args: dict):
    """Adds sighting to MISP attribute"""
    attribute_id = demisto_args.get("id")
    attribute_uuid = demisto_args.get("uuid")
    attribute_value = demisto_args.get("value")
    sighting_source = demisto_args.get("source")
    sighting_type = demisto_args["type"]  # mandatory arg
    att_id = attribute_id or attribute_uuid
    if not (att_id or attribute_value):
        raise DemistoException("ID, UUID or value not specified")
    sighting_args = {
        "id": attribute_id,
        "uuid": attribute_uuid,
        "type": SIGHTING_TYPE_NAME_TO_ID[sighting_type],
        "source": sighting_source,
        "value": attribute_value,
    }
    sigh_obj = MISPSighting()
    sigh_obj.from_dict(**sighting_args)

    if attribute_value:
        response = PYMISP.add_sighting(sigh_obj)
    else:
        response = PYMISP.add_sighting(sigh_obj, att_id)
    if response.get("message"):
        raise DemistoException(f"An error was occurred: {response.get('message')}")
    elif response.get("Sighting"):
        human_readable = f"Sighting '{sighting_type}' has been successfully added to attribute {attribute_value or att_id}"
        return CommandResults(readable_output=human_readable)
    raise DemistoException(f"An error was occurred: {json.dumps(response)}")


def test(malicious_tag_ids, suspicious_tag_ids, attributes_limit):
    """
    Test module.
    """
    is_tag_list_valid(malicious_tag_ids)
    is_tag_list_valid(suspicious_tag_ids)
    if attributes_limit < 0:
        raise DemistoException("Attribute limit has to be a positive number.")
    response = PYMISP._prepare_request("GET", "servers/getPyMISPVersion.json")
    if PYMISP._check_json_response(response):
        return "ok"
    else:
        raise DemistoException("MISP has not connected.")


def build_feed_url(demisto_args):
    url = demisto_args.get("feed")
    url = url[:-1] if url.endswith("/") else url
    if PREDEFINED_FEEDS.get(url):
        url = PREDEFINED_FEEDS[url].get("url")  # type: ignore
    return url


def add_events_from_feed(demisto_args: dict, use_ssl: bool, proxies: dict):
    """Gets an OSINT feed from url and publishing them to MISP
    urls with feeds for example: https://www.misp-project.org/feeds/
    feed format must be MISP.
    """
    headers = {"Accept": "application/json"}
    url = build_feed_url(demisto_args)
    osint_url = f"{url}/manifest.json"
    limit = arg_to_number(demisto_args.get("limit", 2), "limit", required=True)
    try:
        uri_list = requests.get(osint_url, verify=use_ssl, headers=headers, proxies=proxies).json()
        events_ids = []  # type: List[Dict[str, int]]
        for _index, uri in enumerate(uri_list, 1):
            response = requests.get(f"{url}/{uri}.json", verify=use_ssl, headers=headers, proxies=proxies).json()
            misp_new_event = MISPEvent()
            misp_new_event.load(response)
            add_event_response = PYMISP.add_event(misp_new_event)
            event_object = add_event_response.get("Event")
            if event_object and "id" in event_object:
                events_ids.append({"ID": event_object["id"]})
            if limit == len(events_ids):
                break
        human_readable = tableToMarkdown(f"Total of {len(events_ids)} events was added to MISP.", events_ids)
        return CommandResults(
            readable_output=human_readable,
            outputs_prefix="MISP.Event",
            outputs_key_field="ID",
            outputs=events_ids,
        )
    except ValueError as e:
        raise DemistoException(f"URL [{url}] is not a valid MISP feed. error: {e}")


def add_object(event_id: str, obj: MISPObject):
    """Sending object to MISP and returning outputs

    Args:
        obj: object to add to MISP
        event_id: ID of event
    """
    try:
        response = PYMISP.add_object(event_id, misp_object=obj)
    except MISPServerError as error:
        raise DemistoException(f"Error in `{demisto.command()}` error: {error}")
    if "errors" in response:
        raise DemistoException(f"Error in `{demisto.command()}` command: {response}")
    for ref in obj.ObjectReference:
        response = PYMISP.add_object_reference(ref)  # type: ignore[assignment]
    for attribute in response.get("Object", {}).get("Attribute", []):
        convert_timestamp_to_readable(attribute, None)
    response["Object"]["timestamp"] = misp_convert_timestamp_to_date_string(response.get("Object", {}).get("timestamp"))
    formatted_response = replace_keys_from_misp_to_context_data(response)  # type: ignore[assignment, arg-type]
    if isinstance(formatted_response, str):
        formatted_response = f"{formatted_response} ID:{event_id}"
    elif isinstance(formatted_response, dict):
        formatted_response.update({"ID": event_id})
    else:
        formatted_response.append({"ID": event_id})

    human_readable = f"Object has been added to MISP event ID {event_id}"
    return CommandResults(
        readable_output=human_readable,
        outputs_prefix="MISP.Event",
        outputs_key_field="ID",
        outputs=formatted_response,
    )


def add_file_object(demisto_args: dict):
    entry_id = demisto_args.get("entry_id")
    event_id = demisto_args.get("event_id", "")
    file_path = demisto.getFilePath(entry_id).get("path")
    obj = FileObject(file_path)
    return add_object(event_id, obj)


def add_email_object(demisto_args: dict):
    entry_id = demisto_args.get("entry_id")
    event_id = demisto_args.get("event_id", "")
    email_path = demisto.getFilePath(entry_id).get("path")
    name = demisto.getFilePath(entry_id).get("name", "")
    if name.endswith(".msg"):
        raise DemistoException(
            "misp-add-email-object command does not support *.msg files, please use an *.eml file type instead."
        )
    obj = EMailObject(email_path)
    return add_object(event_id, obj)


def add_domain_object(demisto_args: dict):
    """Adds a domain object to MISP
    domain-ip description: https://www.misp-project.org/objects.html#_domain_ip
    """
    text = demisto_args.get("text")
    event_id = demisto_args.get("event_id", "")
    domain = demisto_args.get("name")
    obj = MISPObject("domain-ip")
    ips = argToList(demisto_args.get("ip"))
    for ip in ips:
        obj.add_attribute("ip", value=ip)
    obj.add_attribute("domain", value=domain)
    if text:
        obj.add_attribute("text", value=text)
    return add_object(event_id, obj)


def add_url_object(demisto_args: dict):
    """Building url object in MISP scheme
    Scheme described https://www.misp-project.org/objects.html#_url
    """
    url_args = ["text", "last_seen", "first_seen"]
    event_id = demisto_args.get("event_id", "")
    url = demisto_args.get("url")
    url_parse = urlparse(url)
    url_obj = [{"url": url}]
    url_obj.append({"scheme": url_parse.scheme}) if url_parse.scheme else None
    url_obj.append({"resource_path": url_parse.path}) if url_parse.path else None
    url_obj.append({"query_string": url_parse.query}) if url_parse.query else None
    url_obj.append({"domain": url_parse.netloc}) if url_parse.netloc else None
    url_obj.append({"fragment": url_parse.fragment}) if url_parse.fragment else None
    url_obj.append({"port": url_parse.port}) if url_parse.port else None
    url_obj.append(
        {"credential": (url_parse.username, url_parse.password)}
    ) if url_parse.username and url_parse.password else None
    url_obj.extend(convert_arg_to_misp_args(demisto_args, url_args))

    g_object = build_generic_object("url", url_obj)
    return add_object(event_id, g_object)


def add_generic_object_command(demisto_args: dict):
    event_id = demisto_args.get("event_id", "")
    template = demisto_args.get("template", "")
    attributes = demisto_args.get("attributes", "").replace("'", '"')
    try:
        args = json.loads(attributes)
        if not isinstance(args, list):
            args = dict_to_generic_object_format(args)
        obj = build_generic_object(template, args)
        return add_object(event_id, obj)
    except ValueError as e:
        raise DemistoException(
            f"`attribute` parameter could not be decoded, may not a valid JSON\nattribute: {attributes}", str(e)
        )


def add_custom_object_command(demisto_args: dict):
    event_id = demisto_args.get("event_id", "")
    template = demisto_args.get("template", "")
    attributes = demisto_args.get("attributes", "").replace("'", '"')

    try:
        args = json.loads(attributes)
        if not isinstance(args, list):
            args = dict_to_generic_object_format(args)

        obj = build_custom_object(template, args)
        if obj is not False:
            return add_object(event_id, obj)
        else:
            raise DemistoException(f"Unable to find custom template {template}")

    except ValueError as e:
        raise DemistoException(
            f"`attribute` parameter could not be decoded, may not a valid JSON\nattribute: {attributes}", str(e)
        )


def convert_arg_to_misp_args(demisto_args, args_names):
    return [{arg.replace("_", "-"): demisto_args.get(arg)} for arg in args_names if demisto_args.get(arg)]


def add_ip_object(demisto_args: dict):
    event_id = demisto_args.get("event_id", "")
    ip_object_args = ["dst_port", "src_port", "domain", "hostname", "ip_src", "ip_dst"]
    # converting args to MISP's arguments types
    misp_attributes_args = convert_arg_to_misp_args(demisto_args, ip_object_args)
    ips = argToList(demisto_args.get("ip"))
    for ip in ips:
        misp_attributes_args.append({"ip": ip})
    if misp_attributes_args:
        non_req_args = [
            "first_seen",
            "last_seen",
        ]
        misp_attributes_args.extend(convert_arg_to_misp_args(demisto_args, non_req_args))
        misp_attributes_args.append({"text": demisto_args.get("comment")}) if demisto_args.get("comment") else None
        obj = build_generic_object("ip-port", misp_attributes_args)
        return add_object(event_id, obj)
    else:
        raise DemistoException(
            f"None of required arguments presents. command {demisto.command()} requires one of {ip_object_args}"
        )


def handle_tag_duplication_ids(malicious_tag_ids: list, suspicious_tag_ids: list, benign_tag_ids: list):
    """
    Gets 2 sets which include tag ids. If there is an id that exists in both sets, it will be removed from the
    suspicious tag ids set and will be stayed only in the malicious one (as a tag that was configured to be malicious is
    stronger than recognised as suspicious).
    """
    common_ids = set(malicious_tag_ids) & set(suspicious_tag_ids)
    common_ids_sus = set(suspicious_tag_ids) & set(benign_tag_ids)
    common_ids_mal = set(malicious_tag_ids) & set(benign_tag_ids)
    suspicious_tag_ids = list({tag_id for tag_id in suspicious_tag_ids if tag_id not in common_ids})
    benign_tag_ids = list({tag_id for tag_id in benign_tag_ids if tag_id not in common_ids_sus and tag_id not in common_ids_mal})
    return malicious_tag_ids, suspicious_tag_ids, benign_tag_ids


def is_tag_list_valid(tag_ids):
    """Gets a list ot tag ids (each one is str), and verify all the tags are valid positive integers."""
    for tag in tag_ids:
        try:
            tag = int(tag)
            if tag <= 0:
                raise DemistoException(f"Tag id has to be a positive integer, please change the given: '{tag}' id.")
        except ValueError:
            raise DemistoException(f"Tag id has to be a positive integer, please change the given: '{tag}' id.")


def create_updated_attribute_instance(demisto_args: dict, attribute_uuid: str) -> MISPAttribute:
    attribute_type = demisto_args.get("type")
    distribution = demisto_args.get("distribution")
    category = demisto_args.get("category")
    comment = demisto_args.get("comment")
    value = demisto_args.get("value")
    first_seen = demisto_args.get("first_seen")
    last_seen = demisto_args.get("last_seen")

    attribute_instance = MISPAttribute()
    attribute_instance.uuid = attribute_uuid
    if attribute_type:
        attribute_instance.type = attribute_type
    if distribution:
        attribute_instance.distribution = MISP_DISTRIBUTION_TO_IDS[distribution]
    if category:
        attribute_instance.category = category
    if value:
        attribute_instance.value = value
    if comment:
        attribute_instance.comment = comment
    if first_seen:
        attribute_instance.first_seen = first_seen
    if last_seen:
        attribute_instance.last_seen = last_seen
    return attribute_instance


def update_attribute_command(demisto_args: dict) -> CommandResults:
    attribute_uuid = demisto_args.get("attribute_uuid", "")
    attribute_instance = create_updated_attribute_instance(demisto_args, attribute_uuid)
    attribute_instance_response = PYMISP.update_attribute(attribute=attribute_instance, attribute_id=attribute_uuid)
    if isinstance(attribute_instance_response, dict) and attribute_instance_response.get("errors"):
        raise DemistoException(attribute_instance_response.get("errors"))

    human_readable = f"## MISP update attribute\nAttribute: {attribute_uuid} was updated.\n"
    attribute = attribute_instance_response.get("Attribute")
    convert_timestamp_to_readable(attribute, None)
    parsed_attribute_data = replace_keys_from_misp_to_context_data(attribute)  # type: ignore[arg-type]

    return CommandResults(
        readable_output=human_readable,
        outputs_prefix="MISP.Attribute",
        outputs_key_field="ID",
        outputs=parsed_attribute_data,
    )


def delete_attribute_command(demisto_args: dict) -> CommandResults:
    """
    Gets an attribute id and deletes it.
    """
    attribute_id = demisto_args["attribute_id"]
    response = PYMISP.delete_attribute(attribute_id)
    if "errors" in response:
        raise DemistoException(f"Attribute ID: {attribute_id} has not found in MISP: \nError message: {response}")
    else:
        human_readable = f"Attribute {attribute_id} has been deleted"
        return CommandResults(readable_output=human_readable, raw_response=response)


def publish_event_command(demisto_args: dict) -> CommandResults:
    """
    Gets an event id and publishes it.
    """
    event_id = demisto_args["event_id"]
    alert = argToBoolean(demisto_args.get("alert", False))
    response = PYMISP.publish(event_id, alert=alert)
    if "errors" in response:
        raise DemistoException(f"Event ID: {event_id} has not found in MISP: \nError message: {response}")
    else:
        human_readable = f"Event {event_id} has been published"
        return CommandResults(readable_output=human_readable, raw_response=response)


def set_event_attributes_command(demisto_args: dict) -> CommandResults:
    """
    Set the attributes of an event according to given alert_data.
    """
    changed = False
    event_id = demisto_args["event_id"]
    event = PYMISP.get_event(event_id, pythonify=True)
    if "errors" in event:
        raise DemistoException(f"Event ID: {event_id} has not found in MISP: \nError message: {event}")
    try:
        attribute_data = json.loads(demisto_args.get("attribute_data", ""))
    except Exception as e:
        raise DemistoException(f"Invalid attribute_data: \nError message: {str(e)}")

    if not isinstance(event, MISPEvent):
        raise TypeError(f"Expected instance of MISPEvent, but got {type(event).__name__}: {event}")
    for event_attribute in event.attributes:
        if event_attribute["value"] not in [x["value"] for x in attribute_data]:
            event_attribute.delete()
            changed = True
    for attribute in attribute_data:
        if attribute["value"] not in [x["value"] for x in event.attributes]:
            event.add_attribute(attribute["type"], attribute["value"])
            changed = True
    if changed:
        event_update = PYMISP.update_event(event=event)
        if "errors" in event_update:
            raise DemistoException(f"Event ID: {event_id} could not be updated: \nError message: {event_update}")
        else:
            human_readable = f"Attributes of Event {event_id} were set to match attribute data."
            return CommandResults(readable_output=human_readable, raw_response=event_update)
    else:
        return CommandResults(readable_output="No changes to event.")


def warninglist_command(demisto_args: dict) -> CommandResults:
    """
    Check values against MISP warninglists.
    """
    res = []
    values = argToList(demisto_args["value"])
    response = PYMISP.values_in_warninglist(values)
    if "errors" in response:
        raise DemistoException(f"Unable to validate against MISPwarninglist!\nError message: {response}")
    if not response:
        return CommandResults(
            readable_output="No value is on a MISP warning list!",
            raw_response=response,
        )
    for value, lists in response.items():  # type: ignore[union-attr]
        if len(lists) > 0:
            res.append(
                {
                    "Value": value,
                    "Count": len(lists),
                    "Lists": ",".join([x["name"] for x in lists]),
                }
            )
    human_readable = tableToMarkdown(
        "MISP Warninglist matchings:",
        sorted(res, key=lambda x: x["Count"], reverse=True),
        headers=["Value", "Lists", "Count"],
    )
    return CommandResults(
        outputs=res,
        outputs_prefix="MISP.Warninglist",
        outputs_key_field=["Value"],
        readable_output=human_readable,
        raw_response=response,
    )


def get_warninglists_command(demisto_args: dict) -> CommandResults:
    """
    Gets warninglists from MISP
    Args:
        demisto_args: dict of arguments.

    Returns:
        CommandResults.
    """
    try:
        logging.log(logging.DEBUG, f"{demisto.command()} Sending request to get warninglists")
        if response := PYMISP.warninglists():
            warninglists_output = []
            for item in response:
                # Ensure item is a dict and has the 'Warninglist' key
                if warninglist := item.get("Warninglist") if isinstance(item, dict) else None:
                    res = {
                        "ID": warninglist.get("id"),
                        "Name": warninglist.get("name"),
                        "Type": warninglist.get("type"),
                        "Description": warninglist.get("description"),
                        "Version": warninglist.get("version"),
                        "Enabled": warninglist.get("enabled"),
                        "Default": warninglist.get("default"),
                        "Category": warninglist.get("category"),
                    }
                    valid_attributes = warninglist.get("valid_attributes")
                    if valid_attributes and isinstance(valid_attributes, str):
                        res["Attributes"] = valid_attributes.split(",")

                    warninglists_output.append(res)

            human_readable = tableToMarkdown(
                "MISP Warninglists", warninglists_output, headers=WARNINGLIST_HEADERS, removeNull=True
            )

            return CommandResults(
                outputs_prefix="MISP.Warninglist",
                outputs_key_field=["ID"],
                outputs=warninglists_output,
                readable_output=human_readable,
                raw_response=response,
            )
        else:
            return CommandResults(
                outputs_prefix="MISP.Warninglist",
                outputs_key_field=["ID"],
                outputs=[],
                readable_output="No warninglists found in MISP",
                raw_response=[],
            )
    except Exception as e:
        raise DemistoException(f"Error in `{demisto.command()}` command: {e}")


def get_warninglist_command(demisto_args: dict) -> CommandResults:
    """
    Returns the values of a specific MISP warninglist based on ID
    """
    warninglist_id = demisto_args["id"]

    try:
        logging.log(logging.DEBUG, f"{demisto.command()} Sending request to get warninglist {warninglist_id}")
        response = PYMISP.get_warninglist(warninglist_id)

        warninglist_output = {}
        if entity := response.get("Warninglist", {}):
            warninglist_attributes = [f"{t['type']}" for t in (entity.get("WarninglistType"))]
            warninglist_output = {
                "ID": entity["id"],
                "Name": entity["name"],
                "Type": entity["type"],
                "Description": entity["description"],
                "Version": entity["version"],
                "Enabled": entity["enabled"],
                "Default": entity["default"],
                "Category": entity["category"],
                "Attributes": warninglist_attributes,
            }
            # Parse valid attributes from the "valid_attributes" field if present
            warninglist_output["Entries"] = [
                {
                    "ID": entry["id"],
                    "Value": entry.get("value"),
                    "WarninglistID": entry.get("warninglist_id"),
                    "Comment": entry.get("comment"),
                }
                for entry in (entity["WarninglistEntry"])
            ]

        human_readable = tableToMarkdown("MISP Warninglist", warninglist_output, headers=WARNINGLIST_HEADERS, removeNull=True)
        human_readable += tableToMarkdown(
            "Entries in MISP Warninglist",
            warninglist_output["Entries"],
            headers=WARNINGLIST_ENTRY_HEADERS,
            removeNull=True,
        )

        return CommandResults(
            outputs=warninglist_output,
            outputs_prefix="MISP.Warninglist",
            outputs_key_field=["ID"],
            readable_output=human_readable,
            raw_response=response,
        )
    except Exception as e:
        raise DemistoException(f"Error in `{demisto.command()}` command: {e}")


def change_warninglist_command(demisto_args: dict) -> CommandResults:
    """
    Appends new values to supplied warninglist
    """
    warninglist_id = demisto_args["id"]
    warninglist_name = demisto_args.get("name")
    warninglist_type = demisto_args.get("type")
    warninglist_description = demisto_args.get("description")
    warninglist_enabled = demisto_args.get("enabled")
    warninglist_default = demisto_args.get("default")
    warninglist_category = demisto_args.get("category")
    warninglist_values = argToList(demisto_args.get("values"))
    warninglist_types = argToList(demisto_args.get("types"))

    data = {}
    if warninglist_name:
        data["name"] = warninglist_name
    if warninglist_type:
        data["type"] = warninglist_type
    if warninglist_description:
        data["description"] = warninglist_description
    if warninglist_enabled:
        data["enabled"] = warninglist_enabled
    if warninglist_default:
        data["default"] = warninglist_default
    if warninglist_category:
        data["category"] = warninglist_category
    if warninglist_values:
        for value in warninglist_values:
            value_dict = {"value": value}
            warninglist_values[warninglist_values.index(value)] = value_dict
        data["WarninglistEntry"] = warninglist_values
    if warninglist_types:
        data["matching_attributes"] = warninglist_types
    try:
        logging.log(logging.DEBUG, f"{demisto.command()} Sending request to edit warninglist {warninglist_id}: {data}")
        response = PYMISP._prepare_request("POST", f"warninglists/edit/{warninglist_id}", data=data)
        logging.log(logging.DEBUG, f"{demisto.command()}Status {response.status_code}: warninglists/edit/{warninglist_id}")
        response = response.json()
        warninglist_output = {}
        if entity := response.get("Warninglist", {}):  # type: ignore[attr-defined]
            warninglist_output = {
                "ID": entity["id"],
                "Name": entity["name"],
                "Type": entity["type"],
                "Description": entity["description"],
                "Version": entity["version"],
                "Enabled": entity["enabled"],
                "Default": entity["default"],
                "Category": entity["category"],
            }
            warninglist_output["Attributes"] = [f"{t['type']}" for t in (response.get("WarninglistType"))]  # type: ignore[attr-defined]
            warninglist_output["Entries"] = [
                {
                    "ID": entry.get("id"),
                    "Value": entry.get("value"),
                    "WarninglistID": entry.get("warninglist_id"),
                    "Comment": entry.get("comment"),
                }
                for entry in (response["WarninglistEntry"])  # type: ignore[index]
            ]

        human_readable = tableToMarkdown("MISP Warninglist", warninglist_output, headers=WARNINGLIST_HEADERS, removeNull=True)
        human_readable += tableToMarkdown(
            "Entries in MISP Warninglist",
            warninglist_output["Entries"],
            headers=WARNINGLIST_ENTRY_HEADERS,
            removeNull=True,
        )
        return CommandResults(
            readable_output=human_readable,
            outputs_prefix="MISP.Warninglist",
            outputs_key_field="ID",
            outputs=warninglist_output,
            raw_response=response,
        )

    except Exception as e:
        raise DemistoException(f"Error in `{demisto.command()}` command: {e}")


def main():
    params = demisto.params()
    malicious_tag_ids = argToList(params.get("malicious_tag_ids"))
    suspicious_tag_ids = argToList(params.get("suspicious_tag_ids"))
    benign_tag_ids = argToList(params.get("benign_tag_ids"))
    search_warninglists: bool = argToBoolean(params.get("search_warninglists", False))
    reliability = params.get("integrationReliability", "B - Usually reliable")
    if DBotScoreReliability.is_valid_type(reliability):
        reliability = DBotScoreReliability.get_dbot_score_reliability_from_str(reliability)
    else:
        Exception("MISP V3 error: Please provide a valid value for the Source Reliability parameter")
    attributes_limit = arg_to_number(params.get("attributes_limit", 20), "attributes_limit", required=True)
    command = demisto.command()
    demisto.debug(f"[MISP V3]: command is {command}")
    args = demisto.args()

    try:
        malicious_tag_ids, suspicious_tag_ids, benign_tag_ids = handle_tag_duplication_ids(
            malicious_tag_ids, suspicious_tag_ids, benign_tag_ids
        )
        if command == "test-module":
            return_results(
                test(
                    malicious_tag_ids=malicious_tag_ids, suspicious_tag_ids=suspicious_tag_ids, attributes_limit=attributes_limit
                )
            )
        elif command == "misp-create-event":
            return_results(create_event_command(args))
        elif command == "misp-add-attribute":
            return_results(add_attribute(demisto_args=args))
        elif command == "misp-search-events":
            return_results(search_events(args))
        elif command == "misp-search-attributes":
            return_results(search_attributes(args))
        elif command == "misp-delete-event":
            return_results(delete_event(args))
        elif command == "misp-add-sighting":
            return_results(add_sighting(args))
        elif command == "misp-add-tag-to-event":
            return_results(add_tag(args))
        elif command == "misp-add-tag-to-attribute":
            return_results(add_tag(demisto_args=args, is_attribute=True))
        elif command == "misp-remove-tag-from-event":
            return_results(remove_tag(args))
        elif command == "misp-remove-tag-from-attribute":
            return_results(remove_tag(demisto_args=args, is_attribute=True))
        elif command == "misp-add-events-from-feed":
            return_results(add_events_from_feed(demisto_args=args, use_ssl=VERIFY, proxies=PROXIES))
        elif command == "file":
            return_results(
                generic_reputation_command(
                    args,
                    "file",
                    "FILE",
                    malicious_tag_ids,
                    suspicious_tag_ids,
                    benign_tag_ids,
                    reliability,
                    attributes_limit,
                    search_warninglists,
                )
            )
        elif command == "url":
            return_results(
                generic_reputation_command(
                    args,
                    "url",
                    "URL",
                    malicious_tag_ids,
                    suspicious_tag_ids,
                    benign_tag_ids,
                    reliability,
                    attributes_limit,
                    search_warninglists,
                )
            )
        elif command == "ip":
            return_results(
                generic_reputation_command(
                    args,
                    "ip",
                    "IP",
                    malicious_tag_ids,
                    suspicious_tag_ids,
                    benign_tag_ids,
                    reliability,
                    attributes_limit,
                    search_warninglists,
                )
            )
        elif command == "domain":
            return_results(
                generic_reputation_command(
                    args,
                    "domain",
                    "DOMAIN",
                    malicious_tag_ids,
                    suspicious_tag_ids,
                    benign_tag_ids,
                    reliability,
                    attributes_limit,
                    search_warninglists,
                )
            )
        elif command == "email":
            return_results(
                generic_reputation_command(
                    args,
                    "email",
                    "EMAIL",
                    malicious_tag_ids,
                    suspicious_tag_ids,
                    benign_tag_ids,
                    reliability,
                    attributes_limit,
                    search_warninglists,
                )
            )
        elif command == "misp-add-file-object":
            return_results(add_file_object(args))
        elif command == "misp-add-email-object":
            return_results(add_email_object(args))
        elif command == "misp-add-domain-object":
            return_results(add_domain_object(args))
        elif command == "misp-add-url-object":
            return_results(add_url_object(args))
        elif command == "misp-add-ip-object":
            return_results(add_ip_object(args))
        elif command == "misp-add-object":
            return_results(add_generic_object_command(args))
        elif command == "misp-add-custom-object":
            return_results(add_custom_object_command(args))
        elif command == "misp-update-attribute":
            return_results(update_attribute_command(args))
        elif command == "misp-delete-attribute":
            return_results(delete_attribute_command(args))
        elif command == "misp-publish-event":
            return_results(publish_event_command(args))
        elif command == "misp-set-event-attributes":
            return_results(set_event_attributes_command(args))
        elif command == "misp-check-warninglist":
            return_results(warninglist_command(args))
        elif command == "misp-get-warninglists":
            return_results(get_warninglists_command(args))
        elif command == "misp-get-warninglist":
            return_results(get_warninglist_command(args))
        elif command == "misp-change-warninglist":
            return_results(change_warninglist_command(args))
        elif command == "misp-add-user":
            return_results(add_user_to_misp(args))
        elif command == "misp-get-organization-info":
            return_results(get_organizations_info())
        elif command == "misp-get-role-info":
            return_results(get_role_info())
    except PyMISPError as e:
        return_error(e.message)
    except Exception as e:
        return_error(str(e))


if __name__ in ["__main__", "__builtin__", "builtins"]:
    main()