{
  "version": "Notebook/1.0",
  "items": [
    {
      "type": 9,
      "content": {
        "version": "KqlParameterItem/1.0",
        "crossComponentResources": [
          "value::selected"
        ],
        "parameters": [
          {
            "id": "a4b4e975-fa7c-46a3-b669-850aacc88134",
            "version": "KqlParameterItem/1.0",
            "name": "Help",
            "label": "🔎 Guide",
            "type": 10,
            "isRequired": true,
            "typeSettings": {
              "additionalResourceOptions": [],
              "showDefault": false
            },
            "jsonData": "[\r\n    {\"value\": \"Yes\", \"label\": \"Yes\", \"selected\":true},\r\n    {\"value\": \"No\", \"label\": \"No\"}\r\n]"
          },
          {
            "id": "15b2c181-7397-43c1-900a-28e175ae8a6f",
            "version": "KqlParameterItem/1.0",
            "name": "TimeRange",
            "type": 4,
            "isRequired": true,
            "value": {
              "durationMs": 604800000
            },
            "typeSettings": {
              "selectableValues": [
                {
                  "durationMs": 86400000
                },
                {
                  "durationMs": 172800000
                },
                {
                  "durationMs": 604800000
                }
              ],
              "allowCustom": true
            },
            "timeContextFromParameter": "TimeRange"
          }
        ],
        "style": "pills",
        "queryType": 1,
        "resourceType": "microsoft.resourcegraph/resources"
      },
      "name": "Parameter Selectors"
    },
    {
      "type": 1,
      "content": {
        "json": "# [Cofense Intelligence Threat Indicators](https://www.threathq.com)\n---\n\nCofense Intelligence is a human-vetted phishing-threat intelligence service that provides accurate and timely alerts and in-depth analysis to strengthen your enterprise's ability to quickly identify and respond to phishing attacks in progress."
      },
      "conditionalVisibility": {
        "parameterName": "Help",
        "comparison": "isEqualTo",
        "value": "Yes"
      },
      "customWidth": "79",
      "name": "Workbook Overview"
    },
    {
      "type": 1,
      "content": {
        "json": "![Cofense Intelligence Logo](https://cdn.splunkbase.splunk.com/media/public/icons/da85629e-b54b-11ec-90ee-aa325d5405c9.svg?width=200&height=100)"
      },
      "conditionalVisibility": {
        "parameterName": "Help",
        "comparison": "isEqualTo",
        "value": "Yes"
      },
      "customWidth": "20",
      "name": "Microsoft Sentinel Logo"
    },
    {
      "type": 12,
      "content": {
        "version": "NotebookGroup/1.0",
        "groupType": "editable",
        "items": [
          {
            "type": 3,
            "content": {
              "version": "KqlItem/1.0",
              "query": "ThreatIntelligenceIndicator\r\n// Select cofense indicators from the table\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n// latest data of cofense indicator to avoid duplicates\r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n// Create a new column to identify the type of indicator, IP, Domain, URL, File, or Other\r\n| extend IndicatorType = iif(isnotempty(EmailSourceIpAddress) or isnotempty(NetworkDestinationIP) or isnotempty(NetworkIP) or isnotempty(NetworkSourceIP) or isnotempty(NetworkCidrBlock), \"IP\",\r\n                        iff(isnotempty(Url), \"URL\",\r\n                        iff(isnotempty(EmailRecipient) or isnotempty(EmailSenderAddress), \"Email\",\r\n                        iff(isnotempty(FileHashValue), \"File\",\r\n                         iff(isnotempty(DomainName) or isnotempty(EmailSourceDomain), \"Domain\",\r\n                        \"Other\")))))\r\n// Summarize and order the data, then render the chart\r\n| summarize CountOfIndicators = count() by IndicatorType, bin(TimeGenerated, 1h),SourceSystem\r\n| order by CountOfIndicators desc \r\n| render barchart kind=stacked ",
              "size": 0,
              "showAnalytics": true,
              "title": "Number of Cofense Intelligence Indicators Imported into Sentinel by Indicator Type and Date",
              "timeContextFromParameter": "TimeRange",
              "showExportToExcel": true,
              "queryType": 0,
              "resourceType": "microsoft.operationalinsights/workspaces",
              "gridSettings": {
                "sortBy": [
                  {
                    "itemKey": "SourceSystem",
                    "sortOrder": 1
                  }
                ]
              },
              "sortBy": [
                {
                  "itemKey": "SourceSystem",
                  "sortOrder": 1
                }
              ]
            },
            "customWidth": "50",
            "name": "query - 1"
          },
          {
            "type": 3,
            "content": {
              "version": "KqlItem/1.0",
              "query": "ThreatIntelligenceIndicator\r\n// Select Cofense indicators from the table\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n// latest data of cofense indicator to avoid duplicates\r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n// Summarize and order the data, then render the chart\r\n| summarize CountOfIndicators = count() by SourceSystem, bin(TimeGenerated, 1h)\r\n| render barchart kind=stacked",
              "size": 0,
              "showAnalytics": true,
              "title": "Number of Cofense Intelligence Indicators Imported into Sentinel by Indicator Provider and Date",
              "timeContextFromParameter": "TimeRange",
              "showExportToExcel": true,
              "queryType": 0,
              "resourceType": "microsoft.operationalinsights/workspaces"
            },
            "customWidth": "50",
            "name": "query - 3"
          },
          {
            "type": 3,
            "content": {
              "version": "KqlItem/1.0",
              "query": "ThreatIntelligenceIndicator\r\n// Select Cofense indicators from the table\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n// latest data of cofense indicator to avoid duplicates\r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n| where TimeGenerated < now()\r\n// Select only indicators that have not expired\r\n    and ExpirationDateTime > now()\r\n// Select only indicators that are marked active\r\n    and Active == true\r\n// Select only the most recently ingested copy of an indicator\r\n| summarize arg_max(TimeGenerated, *) by IndicatorId\r\n// Create a new column to identify the type of indicator, IP, Domain, URL, File, or Other\r\n| extend IndicatorType = iif(isnotempty(EmailSourceIpAddress) or isnotempty(NetworkDestinationIP) or isnotempty(NetworkIP) or isnotempty(NetworkSourceIP) or isnotempty(NetworkCidrBlock), \"IP\",\r\n                        iff(isnotempty(Url), \"URL\",\r\n                        iff(isnotempty(EmailRecipient) or isnotempty(EmailSenderAddress), \"Email\",\r\n                        iff(isnotempty(FileHashValue), \"File\",\r\n                         iff(isnotempty(DomainName) or isnotempty(EmailSourceDomain), \"Domain\",\r\n                        \"Other\")))))\r\n// Summarize and order the data, then render the chart\r\n| summarize CountOfIndicators = count() by IndicatorType\r\n| order by CountOfIndicators desc \r\n| render barchart kind=unstacked",
              "size": 0,
              "showAnalytics": true,
              "title": "Number of Active Cofense Intelligence Indicators by Indicator Type",
              "timeContextFromParameter": "TimeRange",
              "showExportToExcel": true,
              "queryType": 0,
              "resourceType": "microsoft.operationalinsights/workspaces"
            },
            "customWidth": "50",
            "name": "query - 5"
          },
          {
            "type": 3,
            "content": {
              "version": "KqlItem/1.0",
              "query": "ThreatIntelligenceIndicator\r\n// Select Cofense indicators from the table\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n// latest data of cofense indicator to avoid duplicates\r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n| where TimeGenerated < now()\r\n// Select only indicators that have not expired\r\n    and ExpirationDateTime > now()\r\n// Select only indicators that are marked active\r\n    and Active == true\r\n// Select only the most recently ingested copy of an indicator\r\n| summarize arg_max(TimeGenerated, *) by IndicatorId\r\n// Summarize and order the data, then render the chart\r\n| summarize CountOfIndicators = count() by SourceSystem\r\n| order by CountOfIndicators desc \r\n| render barchart kind=unstacked",
              "size": 0,
              "showAnalytics": true,
              "title": "Number of Active Cofense Intelligence Indicators by Indicator Source",
              "timeContextFromParameter": "TimeRange",
              "showExportToExcel": true,
              "queryType": 0,
              "resourceType": "microsoft.operationalinsights/workspaces"
            },
            "customWidth": "50",
            "name": "query - 7"
          },
          {
            "type": 3,
            "content": {
              "version": "KqlItem/1.0",
              "query": "ThreatIntelligenceIndicator\r\n// Select Cofense indicators from the table\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n// latest data of cofense indicator to avoid duplicates\r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n| where TimeGenerated < now()\r\n// Select only indicators that have not expired\r\n    and ExpirationDateTime > now()\r\n// Select only indicators that are marked active\r\n    and Active == true\r\n// Select only the most recently ingested copy of an indicator\r\n| summarize arg_max(TimeGenerated, *) by IndicatorId\r\n// Summarize and order the data, then render the chart\r\n| where ConfidenceScore != \"\"\r\n| summarize CountOfIndicators = count() by tostring(ConfidenceScore)\r\n| order by CountOfIndicators desc \r\n| render piechart",
              "size": 3,
              "showAnalytics": true,
              "title": "Number of Active Cofense Intelligence Indicators by Confidence Score",
              "timeContextFromParameter": "TimeRange",
              "showExportToExcel": true,
              "queryType": 0,
              "resourceType": "microsoft.operationalinsights/workspaces"
            },
            "customWidth": "50",
            "name": "query - 10"
          },
          {
            "type": 3,
            "content": {
              "version": "KqlItem/1.0",
              "query": "let DomainQuery=view() { \r\nThreatIntelligenceIndicator\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n// latest data of cofense indicator to avoid duplicates\r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n| summarize arg_max(TimeGenerated, *) by IndicatorId\r\n| where isnotempty(DomainName)\r\n| summarize SourceSystemArray=make_set(SourceSystem) by DomainName\r\n| summarize count() by tostring(SourceSystemArray)\r\n| project SourceSystemArray, count_, EntryType=\"DomainEntry\"\r\n};\r\nlet UrlQuery=view(){\r\nThreatIntelligenceIndicator\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n// latest data of cofense indicator to avoid duplicates\r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n| summarize arg_max(TimeGenerated, *) by IndicatorId\r\n| where isnotempty(Url)\r\n| summarize SourceSystemArray=make_set(SourceSystem) by Url\r\n| summarize count() by tostring(SourceSystemArray)\r\n| project SourceSystemArray, count_, EntryType=\"UrlEntry\"\r\n};\r\nlet FileHashQuery=view(){\r\nThreatIntelligenceIndicator\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n// latest data of cofense indicator to avoid duplicates\r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n| summarize arg_max(TimeGenerated, *) by IndicatorId\r\n| where isnotempty(FileHashValue)\r\n| summarize SourceSystemArray=make_set(SourceSystem) by FileHashValue\r\n| summarize count() by tostring(SourceSystemArray)\r\n| project SourceSystemArray, count_, EntryType=\"FileHashEntry\"\r\n};\r\nlet IPQuery=view(){\r\nThreatIntelligenceIndicator\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n// latest data of cofense indicator to avoid duplicates\r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n| summarize arg_max(TimeGenerated, *) by IndicatorId\r\n| where isnotempty(NetworkIP) or isnotempty(NetworkSourceIP)\r\n| summarize SourceSystemArray=make_set(SourceSystem) by NetworkIP, NetworkSourceIP\r\n| summarize count() by tostring(SourceSystemArray)\r\n| project SourceSystemArray, count_, EntryType=\"IPEntry\"\r\n};\r\nlet EmailAddressQuery=view(){\r\nThreatIntelligenceIndicator\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n// latest data of cofense indicator to avoid duplicates\r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n| summarize arg_max(TimeGenerated, *) by IndicatorId\r\n| where isnotempty(EmailSenderAddress)\r\n| summarize SourceSystemArray=make_set(SourceSystem) by EmailSenderAddress\r\n| summarize count() by tostring(SourceSystemArray)\r\n| project SourceSystemArray, count_, EntryType=\"EmailAddressEntry\"\r\n};\r\nlet EmailMessageQuery=view(){\r\nThreatIntelligenceIndicator\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n// latest data of cofense indicator to avoid duplicates\r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n| summarize arg_max(TimeGenerated, *) by IndicatorId\r\n| where isnotempty(EmailSubject)\r\n| summarize SourceSystemArray=make_set(SourceSystem) by EmailSubject\r\n| summarize count() by tostring(SourceSystemArray)\r\n| project SourceSystemArray, count_, EntryType=\"EmailMessageEntry\"\r\n};\r\nlet SingleSourceIndicators=view(){\r\n    DomainQuery\r\n    | union UrlQuery\r\n    | union FileHashQuery\r\n    | union IPQuery\r\n    | union EmailAddressQuery\r\n    | union EmailMessageQuery\r\n    | where array_length(todynamic(SourceSystemArray))==1\r\n    | summarize sum(count_) by SourceSystemArray\r\n    | extend counter=1 \r\n};\r\nlet MultipleSourceIndicators=view(){\r\n    DomainQuery\r\n    | union UrlQuery\r\n    | union FileHashQuery\r\n    | union IPQuery\r\n    | union EmailAddressQuery\r\n    | union EmailMessageQuery\r\n    | where array_length(todynamic(SourceSystemArray))!=1\r\n    | summarize sum(count_) by SourceSystemArray\r\n    | extend counter=1\r\n};\r\nlet CountOfActiveIndicatorsBySource=view(){\r\n    ThreatIntelligenceIndicator\r\n    | where SourceSystem == \"Cofense Intelligence\"\r\n    // latest data of cofense indicator to avoid duplicates\r\n    | summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n\t| summarize arg_max(TimeGenerated, *) by IndicatorId\r\n    | where ExpirationDateTime > now() and Active == true\r\n    | summarize count() by SourceSystem\r\n    | project SourceSystem, count_\r\n};\r\nSingleSourceIndicators\r\n| join kind=fullouter MultipleSourceIndicators on counter \r\n| where SourceSystemArray contains todynamic(SourceSystemArray)[0] \r\n| order by SourceSystemArray\r\n| extend solitary_count=sum_count_\r\n| summarize shared_count = sum(sum_count_1) by SourceSystemArray, solitary_count\r\n| extend total_count = shared_count + solitary_count\r\n| extend unique_percentage = round(toreal(solitary_count)/toreal(total_count)*100, 1)\r\n| extend IndicatorSource = tostring(todynamic(SourceSystemArray)[0])\r\n| join kind=inner CountOfActiveIndicatorsBySource on $left.IndicatorSource == $right.SourceSystem\r\n| order by unique_percentage desc\r\n| project Source=IndicatorSource, UniquenessPercentage=unique_percentage, ActiveIndicators = count_\r\n\r\n",
              "size": 0,
              "showAnalytics": true,
              "title": "Uniqueness of Cofense Threat Intelligence Sources",
              "timeContextFromParameter": "TimeRange",
              "showExportToExcel": true,
              "queryType": 0,
              "resourceType": "microsoft.operationalinsights/workspaces",
              "gridSettings": {
                "formatters": [
                  {
                    "columnMatch": "Source",
                    "formatter": 18,
                    "formatOptions": {
                      "thresholdsOptions": "icons",
                      "thresholdsGrid": [
                        {
                          "operator": "Default",
                          "thresholdValue": null,
                          "representation": "View",
                          "text": "{0}{1}"
                        }
                      ]
                    }
                  },
                  {
                    "columnMatch": "ActiveIndicators",
                    "formatter": 4,
                    "formatOptions": {
                      "palette": "blue"
                    }
                  }
                ],
                "filter": true,
                "sortBy": [
                  {
                    "itemKey": "$gen_thresholds_Source_0",
                    "sortOrder": 1
                  }
                ]
              },
              "sortBy": [
                {
                  "itemKey": "$gen_thresholds_Source_0",
                  "sortOrder": 1
                }
              ]
            },
            "customWidth": "50",
            "name": "query - 12"
          },
          {
            "type": 3,
            "content": {
              "version": "KqlItem/1.0",
              "query": "ThreatIntelligenceIndicator\r\n| where SourceSystem == \"Cofense Intelligence\"\r\n| where Tags != \"\"\r\n| parse Tags with * \"[\\\"threatID-\" threat_id \"\\\"]\"\r\n| extend threat_id = toreal(threat_id)\r\n| join kind=inner Malware_Data_CL on $left.threat_id == $right.id_d\r\n// latest data of cofense indicator to avoid duplicates \r\n| summarize arg_max(TimeGenerated,*) by ExternalIndicatorId\r\n| extend Ioc = case(ThreatType == \"File\", FileHashValue, \r\n                    ThreatType == \"URL\", Url,\r\n                       DomainName)\r\n| order by TimeGenerated desc\r\n| project [\"Threat ID\"]=threat_id, [\"Confidence Score\"]=ConfidenceScore, [\"Threat Type\"]=ThreatType, [\"IOC\"]=Ioc, Label=label_s, [\"Last Published\"]=unixtime_microseconds_todatetime(lastPublished_d*1000), [\"First Published\"]=unixtime_microseconds_todatetime(firstPublished_d*1000), [\"Threat Detail URL\"]=threatDetailURL_s, [\"Download Report (HTML)\"]=ReportDownload_HTML__s, [\"Download Report (PDF)\"]=ReportDownload_PDF__s, [\"Executive Summary\"]=executiveSummary_s",
              "size": 0,
              "showAnalytics": true,
              "title": "Cofense Intelligence Threat Indicators Data",
              "timeContextFromParameter": "TimeRange",
              "showRefreshButton": true,
              "showExportToExcel": true,
              "queryType": 0,
              "resourceType": "microsoft.operationalinsights/workspaces",
              "gridSettings": {
                "formatters": [
                  {
                    "columnMatch": "Confidence Score",
                    "formatter": 1
                  },
                  {
                    "columnMatch": "Threat Detail URL",
                    "formatter": 7,
                    "formatOptions": {
                      "linkTarget": "Url"
                    }
                  },
                  {
                    "columnMatch": "Download Report (HTML)",
                    "formatter": 7,
                    "formatOptions": {
                      "linkTarget": "Url",
                      "linkLabel": "Download HTML Report"
                    }
                  },
                  {
                    "columnMatch": "Download Report (PDF)",
                    "formatter": 7,
                    "formatOptions": {
                      "linkTarget": "Url",
                      "linkLabel": "Download PDF Report"
                    }
                  },
                  {
                    "columnMatch": "threat Detail URL",
                    "formatter": 7,
                    "formatOptions": {
                      "linkTarget": "Url"
                    }
                  },
                  {
                    "columnMatch": "Report URL",
                    "formatter": 7,
                    "formatOptions": {
                      "linkTarget": "Url"
                    }
                  },
                  {
                    "columnMatch": "Threat Indicator Link",
                    "formatter": 7,
                    "formatOptions": {
                      "linkTarget": "Url"
                    }
                  }
                ],
                "rowLimit": 10000,
                "filter": true
              },
              "sortBy": []
            },
            "name": "query - 6"
          }
        ]
      },
      "name": "Indicators Ingestion"
    }
  ],
  "fromTemplateId": "sentinel-CofenseIntelligenceThreatIndicators",
  "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json"
}