{
  "__inputs": [
    {
      "name": "DS_THREATMAP",
      "label": "Threatmap Postgres",
      "type": "datasource",
      "pluginId": "grafana-postgresql-datasource",
      "pluginName": "PostgreSQL",
      "description": "PostgreSQL database loaded by the threatmap-feeds n8n workflows"
    }
  ],
  "__requires": [
    {
      "type": "datasource",
      "id": "grafana-postgresql-datasource",
      "name": "PostgreSQL"
    },
    {
      "type": "panel",
      "id": "barchart",
      "name": "barchart"
    },
    {
      "type": "panel",
      "id": "geomap",
      "name": "geomap"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "stat"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "table"
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "timeseries"
    }
  ],
  "uid": "tm-overview",
  "title": "Threat map: overview",
  "description": "Fortinet outbreak arcs plus known-bad IPs from DShield, Feodo, blocklist.de, AbuseIPDB and OTX, enriched with geo, Shodan InternetDB, GreyNoise, AbuseIPDB and OTX.",
  "tags": [
    "threatmap"
  ],
  "timezone": "browser",
  "schemaVersion": 41,
  "editable": true,
  "graphTooltip": 1,
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "refresh": "1m",
  "templating": {
    "list": []
  },
  "annotations": {
    "list": []
  },
  "panels": [
    {
      "id": 1,
      "type": "stat",
      "title": "Attack events",
      "description": "Fortinet outbreak events in the selected time range.",
      "gridPos": {
        "x": 0,
        "y": 0,
        "w": 6,
        "h": 4
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select count(*) from attack_events where $__timeFilter(event_at)"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "fixed",
            "fixedColor": "#3987e5"
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      }
    },
    {
      "id": 2,
      "type": "stat",
      "title": "Critical attack events",
      "description": "Fortinet events rated Critical in the selected time range.",
      "gridPos": {
        "x": 6,
        "y": 0,
        "w": 6,
        "h": 4
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select count(*) from attack_events where $__timeFilter(event_at) and severity = 'Critical'"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "fixed",
            "fixedColor": "#d03b3b"
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      }
    },
    {
      "id": 3,
      "type": "stat",
      "title": "Known-bad IPs (7 days)",
      "description": "Unique IPs listed by any feed in the last 7 days.",
      "gridPos": {
        "x": 12,
        "y": 0,
        "w": 6,
        "h": 4
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select count(distinct ip) from ip_sightings where seen_on >= current_date - 7"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "fixed",
            "fixedColor": "#3987e5"
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      }
    },
    {
      "id": 4,
      "type": "stat",
      "title": "Bad IPs exposing known CVEs",
      "description": "Listed IPs where Shodan InternetDB reports at least one CVE on an open service.",
      "gridPos": {
        "x": 18,
        "y": 0,
        "w": 6,
        "h": 4
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select count(*) from enrichment where provider = 'internetdb' and jsonb_array_length(coalesce(data->'vulns', '[]')) > 0"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "fixed",
            "fixedColor": "#3987e5"
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      }
    },
    {
      "id": 5,
      "type": "geomap",
      "title": "Fortinet attacks: sources and targets",
      "description": "City-level geo from Fortinet's feed. Marker size is the number of events.",
      "gridPos": {
        "x": 0,
        "y": 4,
        "w": 14,
        "h": 13
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select src_lat as lat, src_lon as lon, coalesce(src_city, src_country) as place, src_country as country,\n       sum(hits) as events\nfrom attack_events where $__timeFilter(event_at) and src_lat is not null\ngroup by 1, 2, 3, 4"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select dst_lat as lat, dst_lon as lon, coalesce(dst_city, dst_country) as place, dst_country as country,\n       sum(hits) as events\nfrom attack_events where $__timeFilter(event_at) and dst_lat is not null\ngroup by 1, 2, 3, 4"
        }
      ],
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "options": {
        "view": {
          "id": "zero",
          "lat": 20,
          "lon": 0,
          "zoom": 1.2
        },
        "controls": {
          "showZoom": true,
          "mouseWheelZoom": true,
          "showAttribution": true
        },
        "basemap": {
          "type": "default",
          "name": "Basemap"
        },
        "layers": [
          {
            "type": "markers",
            "name": "Attack sources",
            "filterData": {
              "id": "byRefId",
              "options": "A"
            },
            "location": {
              "mode": "coords",
              "latitude": "lat",
              "longitude": "lon"
            },
            "tooltip": true,
            "config": {
              "showLegend": true,
              "style": {
                "color": {
                  "fixed": "#d95926"
                },
                "opacity": 0.6,
                "size": {
                  "field": "events",
                  "min": 3,
                  "max": 18,
                  "fixed": 5
                },
                "symbol": {
                  "mode": "fixed",
                  "fixed": "img/icons/marker/circle.svg"
                }
              }
            }
          },
          {
            "type": "markers",
            "name": "Attack targets",
            "filterData": {
              "id": "byRefId",
              "options": "B"
            },
            "location": {
              "mode": "coords",
              "latitude": "lat",
              "longitude": "lon"
            },
            "tooltip": true,
            "config": {
              "showLegend": true,
              "style": {
                "color": {
                  "fixed": "#3987e5"
                },
                "opacity": 0.6,
                "size": {
                  "field": "events",
                  "min": 3,
                  "max": 18,
                  "fixed": 5
                },
                "symbol": {
                  "mode": "fixed",
                  "fixed": "img/icons/marker/circle.svg"
                }
              }
            }
          }
        ],
        "tooltip": {
          "mode": "details"
        }
      }
    },
    {
      "id": 6,
      "type": "timeseries",
      "title": "Attack events by severity",
      "description": "",
      "gridPos": {
        "x": 14,
        "y": 4,
        "w": 10,
        "h": 13
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "time_series",
          "rawSql": "select $__timeGroupAlias(event_at, $__interval), coalesce(severity, 'Unknown') as metric, sum(hits) as value\nfrom attack_events where $__timeFilter(event_at)\ngroup by 1, 2 order by 1"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "bars",
            "lineWidth": 2,
            "fillOpacity": 80,
            "barAlignment": 0,
            "stacking": {
              "mode": "normal"
            },
            "showPoints": "never",
            "axisSoftMin": 0
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Critical"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "#d03b3b"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "High"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "#ec835a"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Medium"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "#fab219"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Low"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "#898781"
                }
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 7,
      "type": "barchart",
      "title": "Top attack source countries",
      "description": "",
      "gridPos": {
        "x": 0,
        "y": 17,
        "w": 8,
        "h": 10
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select src_country as country, sum(hits) as events from attack_events\nwhere $__timeFilter(event_at) and src_country is not null\ngroup by 1 order by 2 desc limit 15"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "fixed",
            "fixedColor": "#3987e5"
          },
          "custom": {
            "fillOpacity": 90,
            "lineWidth": 0
          }
        },
        "overrides": []
      },
      "options": {
        "orientation": "horizontal",
        "showValue": "auto",
        "barWidth": 0.7,
        "groupWidth": 0.7,
        "legend": {
          "showLegend": false,
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        },
        "xTickLabelMaxLength": 28
      }
    },
    {
      "id": 8,
      "type": "barchart",
      "title": "Top targeted countries",
      "description": "",
      "gridPos": {
        "x": 8,
        "y": 17,
        "w": 8,
        "h": 10
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select dst_country as country, sum(hits) as events from attack_events\nwhere $__timeFilter(event_at) and dst_country is not null\ngroup by 1 order by 2 desc limit 15"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "fixed",
            "fixedColor": "#3987e5"
          },
          "custom": {
            "fillOpacity": 90,
            "lineWidth": 0
          }
        },
        "overrides": []
      },
      "options": {
        "orientation": "horizontal",
        "showValue": "auto",
        "barWidth": 0.7,
        "groupWidth": 0.7,
        "legend": {
          "showLegend": false,
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        },
        "xTickLabelMaxLength": 28
      }
    },
    {
      "id": 9,
      "type": "table",
      "title": "Top signatures",
      "description": "",
      "gridPos": {
        "x": 16,
        "y": 17,
        "w": 8,
        "h": 10
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select signature, category, severity, sum(hits) as events from attack_events\nwhere $__timeFilter(event_at)\ngroup by 1, 2, 3 order by 4 desc limit 25"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "filterable": true
          }
        },
        "overrides": []
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "sortBy": [
          {
            "displayName": "events",
            "desc": true
          }
        ]
      }
    },
    {
      "id": 10,
      "type": "row",
      "title": "Known-bad IPs (feeds + enrichment)",
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 27,
        "w": 24,
        "h": 1
      },
      "panels": []
    },
    {
      "id": 11,
      "type": "geomap",
      "title": "Where listed IPs are hosted",
      "description": "Only IPs that have been geolocated so far (ip-api, 100 every 5 minutes). Marker size is the IP count.",
      "gridPos": {
        "x": 0,
        "y": 28,
        "w": 14,
        "h": 12
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select lat, lon, coalesce(city, country) as place, country, count(*) as ips\nfrom ip_profile where lat is not null and last_seen >= current_date - 7\ngroup by 1, 2, 3, 4"
        }
      ],
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "options": {
        "view": {
          "id": "zero",
          "lat": 20,
          "lon": 0,
          "zoom": 1.2
        },
        "controls": {
          "showZoom": true,
          "mouseWheelZoom": true,
          "showAttribution": true
        },
        "basemap": {
          "type": "default",
          "name": "Basemap"
        },
        "layers": [
          {
            "type": "markers",
            "name": "Listed IPs",
            "filterData": {
              "id": "byRefId",
              "options": "A"
            },
            "location": {
              "mode": "coords",
              "latitude": "lat",
              "longitude": "lon"
            },
            "tooltip": true,
            "config": {
              "showLegend": true,
              "style": {
                "color": {
                  "fixed": "#c98500"
                },
                "opacity": 0.6,
                "size": {
                  "field": "ips",
                  "min": 3,
                  "max": 18,
                  "fixed": 5
                },
                "symbol": {
                  "mode": "fixed",
                  "fixed": "img/icons/marker/circle.svg"
                }
              }
            }
          }
        ],
        "tooltip": {
          "mode": "details"
        }
      }
    },
    {
      "id": 12,
      "type": "timeseries",
      "title": "New IP sightings per hour by feed",
      "description": "First time each IP was listed by a feed on a given day.",
      "gridPos": {
        "x": 14,
        "y": 28,
        "w": 10,
        "h": 12
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "time_series",
          "rawSql": "select $__timeGroupAlias(first_ingested_at, '1h'), source as metric, count(*) as value\nfrom ip_sightings where $__timeFilter(first_ingested_at)\ngroup by 1, 2 order by 1"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "bars",
            "lineWidth": 2,
            "fillOpacity": 80,
            "barAlignment": 0,
            "stacking": {
              "mode": "normal"
            },
            "showPoints": "never",
            "axisSoftMin": 0
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "dshield"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "#3987e5"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "feodo"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "#d95926"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "blocklistde"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "#199e70"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "abuseipdb"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "#c98500"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "otx"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "#d55181"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "fortinet"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "#008300"
                }
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 13,
      "type": "barchart",
      "title": "Top hosting networks (ASN)",
      "description": "Among listed IPs that have been geolocated.",
      "gridPos": {
        "x": 0,
        "y": 40,
        "w": 8,
        "h": 10
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select asn, count(*) as ips from ip_profile where asn is not null and asn <> ''\ngroup by 1 order by 2 desc limit 15"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "fixed",
            "fixedColor": "#3987e5"
          },
          "custom": {
            "fillOpacity": 90,
            "lineWidth": 0
          }
        },
        "overrides": []
      },
      "options": {
        "orientation": "horizontal",
        "showValue": "auto",
        "barWidth": 0.7,
        "groupWidth": 0.7,
        "legend": {
          "showLegend": false,
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        },
        "xTickLabelMaxLength": 28
      }
    },
    {
      "id": 14,
      "type": "barchart",
      "title": "Most common open ports",
      "description": "Open ports on listed IPs, from Shodan InternetDB.",
      "gridPos": {
        "x": 8,
        "y": 40,
        "w": 8,
        "h": 10
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select port::text as port, count(*) as ips\nfrom enrichment, jsonb_array_elements_text(coalesce(data->'ports', '[]')) as port\nwhere provider = 'internetdb'\ngroup by 1 order by 2 desc limit 15"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "fixed",
            "fixedColor": "#3987e5"
          },
          "custom": {
            "fillOpacity": 90,
            "lineWidth": 0
          }
        },
        "overrides": []
      },
      "options": {
        "orientation": "horizontal",
        "showValue": "auto",
        "barWidth": 0.7,
        "groupWidth": 0.7,
        "legend": {
          "showLegend": false,
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        },
        "xTickLabelMaxLength": 28
      }
    },
    {
      "id": 15,
      "type": "barchart",
      "title": "Most common CVEs on attacking IPs",
      "description": "CVEs Shodan matched to services on listed IPs.",
      "gridPos": {
        "x": 16,
        "y": 40,
        "w": 8,
        "h": 10
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select cve, count(*) as ips\nfrom enrichment, jsonb_array_elements_text(coalesce(data->'vulns', '[]')) as cve\nwhere provider = 'internetdb'\ngroup by 1 order by 2 desc limit 15"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "fixed",
            "fixedColor": "#3987e5"
          },
          "custom": {
            "fillOpacity": 90,
            "lineWidth": 0
          }
        },
        "overrides": []
      },
      "options": {
        "orientation": "horizontal",
        "showValue": "auto",
        "barWidth": 0.7,
        "groupWidth": 0.7,
        "legend": {
          "showLegend": false,
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        },
        "xTickLabelMaxLength": 28
      }
    },
    {
      "id": 16,
      "type": "table",
      "title": "Highest-risk IPs",
      "description": "Sorted by AbuseIPDB score, then OTX pulse count, then how many feeds list the IP. Blank cells are not enriched yet.",
      "gridPos": {
        "x": 0,
        "y": 50,
        "w": 24,
        "h": 12
      },
      "datasource": {
        "type": "grafana-postgresql-datasource",
        "uid": "${DS_THREATMAP}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "grafana-postgresql-datasource",
            "uid": "${DS_THREATMAP}"
          },
          "rawQuery": true,
          "editorMode": "code",
          "format": "table",
          "rawSql": "select host(ip) as ip, array_to_string(sources, ', ') as feeds, country, city, asn,\n       abuse_score, abuse_reports, otx_pulses, greynoise_class,\n       ports::text as ports, jsonb_array_length(coalesce(vulns, '[]')) as cves\nfrom ip_profile\nwhere last_seen >= current_date - 7\norder by abuse_score desc nulls last, otx_pulses desc nulls last, cardinality(sources) desc, cves desc\nlimit 200"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "filterable": true
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "abuse_score"
            },
            "properties": [
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "#0ca30c",
                      "value": null
                    },
                    {
                      "color": "#fab219",
                      "value": 50
                    },
                    {
                      "color": "#d03b3b",
                      "value": 90
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm"
      }
    }
  ]
}
