intelmq-extensions 1.8.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. intelmq_extensions/__init__.py +0 -0
  2. intelmq_extensions/bots/__init__.py +0 -0
  3. intelmq_extensions/bots/collectors/blackkite/__init__.py +0 -0
  4. intelmq_extensions/bots/collectors/blackkite/_client.py +167 -0
  5. intelmq_extensions/bots/collectors/blackkite/collector.py +182 -0
  6. intelmq_extensions/bots/collectors/disp/__init__.py +0 -0
  7. intelmq_extensions/bots/collectors/disp/_client.py +121 -0
  8. intelmq_extensions/bots/collectors/disp/collector.py +104 -0
  9. intelmq_extensions/bots/collectors/xmpp/__init__.py +0 -0
  10. intelmq_extensions/bots/collectors/xmpp/collector.py +210 -0
  11. intelmq_extensions/bots/experts/__init__.py +0 -0
  12. intelmq_extensions/bots/experts/certat_contact_intern/__init__.py +0 -0
  13. intelmq_extensions/bots/experts/certat_contact_intern/expert.py +139 -0
  14. intelmq_extensions/bots/experts/copy_extra/__init__.py +0 -0
  15. intelmq_extensions/bots/experts/copy_extra/expert.py +27 -0
  16. intelmq_extensions/bots/experts/event_group_splitter/__init__.py +0 -0
  17. intelmq_extensions/bots/experts/event_group_splitter/expert.py +117 -0
  18. intelmq_extensions/bots/experts/event_splitter/__init__.py +0 -0
  19. intelmq_extensions/bots/experts/event_splitter/expert.py +41 -0
  20. intelmq_extensions/bots/experts/squelcher/__init__.py +0 -0
  21. intelmq_extensions/bots/experts/squelcher/expert.py +316 -0
  22. intelmq_extensions/bots/experts/vulnerability_lookup/__init__.py +0 -0
  23. intelmq_extensions/bots/experts/vulnerability_lookup/expert.py +136 -0
  24. intelmq_extensions/bots/outputs/__init__.py +0 -0
  25. intelmq_extensions/bots/outputs/mattermost/__init__.py +0 -0
  26. intelmq_extensions/bots/outputs/mattermost/output.py +113 -0
  27. intelmq_extensions/bots/outputs/to_logs/__init__.py +0 -0
  28. intelmq_extensions/bots/outputs/to_logs/output.py +12 -0
  29. intelmq_extensions/bots/outputs/xmpp/__init__.py +0 -0
  30. intelmq_extensions/bots/outputs/xmpp/output.py +180 -0
  31. intelmq_extensions/bots/parsers/__init__.py +0 -0
  32. intelmq_extensions/bots/parsers/blackkite/__init__.py +0 -0
  33. intelmq_extensions/bots/parsers/blackkite/_transformers.py +202 -0
  34. intelmq_extensions/bots/parsers/blackkite/parser.py +65 -0
  35. intelmq_extensions/bots/parsers/disp/__init__.py +0 -0
  36. intelmq_extensions/bots/parsers/disp/parser.py +125 -0
  37. intelmq_extensions/bots/parsers/malwaredomains/__init__.py +0 -0
  38. intelmq_extensions/bots/parsers/malwaredomains/parser.py +63 -0
  39. intelmq_extensions/cli/__init__.py +0 -0
  40. intelmq_extensions/cli/create_reports.py +161 -0
  41. intelmq_extensions/cli/intelmqcli.py +657 -0
  42. intelmq_extensions/cli/lib.py +670 -0
  43. intelmq_extensions/cli/utils.py +12 -0
  44. intelmq_extensions/etc/harmonization.conf +434 -0
  45. intelmq_extensions/etc/squelcher.conf +52 -0
  46. intelmq_extensions/lib/__init__.py +0 -0
  47. intelmq_extensions/lib/api_helpers.py +105 -0
  48. intelmq_extensions/lib/blackkite.py +29 -0
  49. intelmq_extensions/tests/__init__.py +0 -0
  50. intelmq_extensions/tests/base.py +336 -0
  51. intelmq_extensions/tests/bots/__init__.py +0 -0
  52. intelmq_extensions/tests/bots/collectors/__init__.py +0 -0
  53. intelmq_extensions/tests/bots/collectors/blackkite/__init__.py +0 -0
  54. intelmq_extensions/tests/bots/collectors/blackkite/base.py +45 -0
  55. intelmq_extensions/tests/bots/collectors/blackkite/test_client.py +154 -0
  56. intelmq_extensions/tests/bots/collectors/blackkite/test_collector.py +287 -0
  57. intelmq_extensions/tests/bots/collectors/disp/__init__.py +0 -0
  58. intelmq_extensions/tests/bots/collectors/disp/base.py +147 -0
  59. intelmq_extensions/tests/bots/collectors/disp/test_client.py +134 -0
  60. intelmq_extensions/tests/bots/collectors/disp/test_collector.py +137 -0
  61. intelmq_extensions/tests/bots/collectors/xmpp/__init__.py +0 -0
  62. intelmq_extensions/tests/bots/collectors/xmpp/test_collector.py +10 -0
  63. intelmq_extensions/tests/bots/experts/__init__.py +0 -0
  64. intelmq_extensions/tests/bots/experts/certat_contact_intern/__init__.py +0 -0
  65. intelmq_extensions/tests/bots/experts/certat_contact_intern/test_expert.py +176 -0
  66. intelmq_extensions/tests/bots/experts/copy_extra/__init__.py +0 -0
  67. intelmq_extensions/tests/bots/experts/copy_extra/test_expert.py +42 -0
  68. intelmq_extensions/tests/bots/experts/event_group_splitter/__init__.py +0 -0
  69. intelmq_extensions/tests/bots/experts/event_group_splitter/test_expert.py +302 -0
  70. intelmq_extensions/tests/bots/experts/event_splitter/__init__.py +0 -0
  71. intelmq_extensions/tests/bots/experts/event_splitter/test_expert.py +101 -0
  72. intelmq_extensions/tests/bots/experts/squelcher/__init__.py +0 -0
  73. intelmq_extensions/tests/bots/experts/squelcher/test_expert.py +548 -0
  74. intelmq_extensions/tests/bots/experts/vulnerability_lookup/__init__.py +0 -0
  75. intelmq_extensions/tests/bots/experts/vulnerability_lookup/test_expert.py +203 -0
  76. intelmq_extensions/tests/bots/outputs/__init__.py +0 -0
  77. intelmq_extensions/tests/bots/outputs/mattermost/__init__.py +0 -0
  78. intelmq_extensions/tests/bots/outputs/mattermost/test_output.py +138 -0
  79. intelmq_extensions/tests/bots/outputs/xmpp/__init__.py +0 -0
  80. intelmq_extensions/tests/bots/outputs/xmpp/test_output.py +10 -0
  81. intelmq_extensions/tests/bots/parsers/__init__.py +0 -0
  82. intelmq_extensions/tests/bots/parsers/blackkite/__init__.py +0 -0
  83. intelmq_extensions/tests/bots/parsers/blackkite/data.py +69 -0
  84. intelmq_extensions/tests/bots/parsers/blackkite/test_parser.py +197 -0
  85. intelmq_extensions/tests/bots/parsers/disp/__init__.py +0 -0
  86. intelmq_extensions/tests/bots/parsers/disp/test_parser.py +282 -0
  87. intelmq_extensions/tests/bots/parsers/malwaredomains/__init__.py +0 -0
  88. intelmq_extensions/tests/bots/parsers/malwaredomains/test_parser.py +62 -0
  89. intelmq_extensions/tests/cli/__init__.py +0 -0
  90. intelmq_extensions/tests/cli/test_create_reports.py +97 -0
  91. intelmq_extensions/tests/cli/test_intelmqcli.py +158 -0
  92. intelmq_extensions/tests/lib/__init__.py +0 -0
  93. intelmq_extensions/tests/lib/base.py +81 -0
  94. intelmq_extensions/tests/lib/test_api_helpers.py +126 -0
  95. intelmq_extensions-1.8.1.dist-info/METADATA +60 -0
  96. intelmq_extensions-1.8.1.dist-info/RECORD +100 -0
  97. intelmq_extensions-1.8.1.dist-info/WHEEL +5 -0
  98. intelmq_extensions-1.8.1.dist-info/entry_points.txt +33 -0
  99. intelmq_extensions-1.8.1.dist-info/licenses/LICENSE +661 -0
  100. intelmq_extensions-1.8.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,434 @@
1
+ {
2
+ "event": {
3
+ "classification.identifier": {
4
+ "description": "The lowercase identifier defines the actual software or service (e.g. ``heartbleed`` or ``ntp_version``) or standardized malware name (e.g. ``zeus``). Note that you MAY overwrite this field during processing for your individual setup. This field is not standardized across IntelMQ setups/users.",
5
+ "type": "String"
6
+ },
7
+ "classification.taxonomy": {
8
+ "description": "We recognize the need for the CSIRT teams to apply a static (incident) taxonomy to abuse data. With this goal in mind the type IOC will serve as a basis for this activity. Each value of the dynamic type mapping translates to a an element in the static taxonomy. The European CSIRT teams for example have decided to apply the eCSIRT.net incident classification. The value of the taxonomy key is thus a derivative of the dynamic type above. For more information about check `ENISA taxonomies <http://www.enisa.europa.eu/activities/cert/support/incident-management/browsable/incident-handling-process/incident-taxonomy/existing-taxonomies>`_.",
9
+ "length": 100,
10
+ "type": "LowercaseString"
11
+ },
12
+ "classification.type": {
13
+ "description": "The abuse type IOC is one of the most crucial pieces of information for any given abuse event. The main idea of dynamic typing is to keep our ontology flexible, since we need to evolve with the evolving threatscape of abuse data. In contrast with the static taxonomy below, the dynamic typing is used to perform business decisions in the abuse handling pipeline. Furthermore, the value data set should be kept as minimal as possible to avoid *type explosion*, which in turn dilutes the business value of the dynamic typing. In general, we normally have two types of abuse type IOC: ones referring to a compromised resource or ones referring to pieces of the criminal infrastructure, such as a command and control servers for example.",
14
+ "type": "ClassificationType"
15
+ },
16
+ "comment": {
17
+ "description": "Free text commentary about the abuse event inserted by an analyst.",
18
+ "type": "String"
19
+ },
20
+ "destination.abuse_contact": {
21
+ "description": "Abuse contact for destination address. A comma separated list.",
22
+ "type": "LowercaseString"
23
+ },
24
+ "destination.account": {
25
+ "description": "An account name or email address, which has been identified to relate to the destination of an abuse event.",
26
+ "type": "String"
27
+ },
28
+ "destination.allocated": {
29
+ "description": "Allocation date corresponding to BGP prefix.",
30
+ "type": "DateTime"
31
+ },
32
+ "destination.as_name": {
33
+ "description": "The autonomous system name to which the connection headed.",
34
+ "type": "String"
35
+ },
36
+ "destination.asn": {
37
+ "description": "The autonomous system number to which the connection headed.",
38
+ "type": "ASN"
39
+ },
40
+ "destination.domain_suffix": {
41
+ "description": "The suffix of the domain from the public suffix list.",
42
+ "type": "FQDN"
43
+ },
44
+ "destination.fqdn": {
45
+ "description": "A DNS name related to the host from which the connection originated. DNS allows even binary data in DNS, so we have to allow everything. A final point is stripped, string is converted to lower case characters.",
46
+ "regex": "^.*[^\\.]$",
47
+ "type": "FQDN"
48
+ },
49
+ "destination.geolocation.cc": {
50
+ "description": "Country-Code according to ISO3166-1 alpha-2 for the destination IP.",
51
+ "length": 2,
52
+ "regex": "^[a-zA-Z0-9]{2}$",
53
+ "type": "UppercaseString"
54
+ },
55
+ "destination.geolocation.city": {
56
+ "description": "Some geolocation services refer to city-level geolocation.",
57
+ "type": "String"
58
+ },
59
+ "destination.geolocation.country": {
60
+ "description": "The country name derived from the ISO3166 country code (assigned to cc field).",
61
+ "type": "String"
62
+ },
63
+ "destination.geolocation.latitude": {
64
+ "description": "Latitude coordinates derived from a geolocation service, such as MaxMind geoip db.",
65
+ "type": "Float"
66
+ },
67
+ "destination.geolocation.longitude": {
68
+ "description": "Longitude coordinates derived from a geolocation service, such as MaxMind geoip db.",
69
+ "type": "Float"
70
+ },
71
+ "destination.geolocation.region": {
72
+ "description": "Some geolocation services refer to region-level geolocation.",
73
+ "type": "String"
74
+ },
75
+ "destination.geolocation.state": {
76
+ "description": "Some geolocation services refer to state-level geolocation.",
77
+ "type": "String"
78
+ },
79
+ "destination.ip": {
80
+ "description": "The IP which is the target of the observed connections.",
81
+ "type": "IPAddress"
82
+ },
83
+ "destination.local_hostname": {
84
+ "description": "Some sources report a internal hostname within a NAT related to the name configured for a compromized system",
85
+ "type": "String"
86
+ },
87
+ "destination.local_ip": {
88
+ "description": "Some sources report a internal (NATed) IP address related a compromized system. N.B. RFC1918 IPs are OK here.",
89
+ "type": "IPAddress"
90
+ },
91
+ "destination.network": {
92
+ "description": "CIDR for an autonomous system. Also known as BGP prefix. If multiple values are possible, select the most specific.",
93
+ "type": "IPNetwork"
94
+ },
95
+ "destination.port": {
96
+ "description": "The port to which the connection headed.",
97
+ "type": "Integer"
98
+ },
99
+ "destination.registry": {
100
+ "description": "The IP registry a given ip address is allocated by.",
101
+ "length": 7,
102
+ "type": "Registry"
103
+ },
104
+ "destination.reverse_dns": {
105
+ "description": "Reverse DNS name acquired through a reverse DNS query on an IP address. N.B. Record types other than PTR records may also appear in the reverse DNS tree. Furthermore, unfortunately, there is no rule prohibiting people from writing anything in a PTR record. Even JavaScript will work. A final point is stripped, string is converted to lower case characters.",
106
+ "regex": "^.*[^\\.]$",
107
+ "type": "FQDN"
108
+ },
109
+ "destination.tor_node": {
110
+ "description": "If the destination IP was a known tor node.",
111
+ "type": "Boolean"
112
+ },
113
+ "destination.url": {
114
+ "description": "A URL denotes on IOC, which refers to a malicious resource, whose interpretation is defined by the abuse type. A URL with the abuse type phishing refers to a phishing resource.",
115
+ "type": "URL"
116
+ },
117
+ "destination.urlpath": {
118
+ "description": "The path portion of an HTTP or related network request.",
119
+ "type": "String"
120
+ },
121
+ "destination_visible": {
122
+ "description": "If destination fields are visible.",
123
+ "type": "Boolean"
124
+ },
125
+ "event_description.target": {
126
+ "description": "Some sources denominate the target (organization) of a an attack.",
127
+ "type": "String"
128
+ },
129
+ "event_description.text": {
130
+ "description": "A free-form textual description of an abuse event.",
131
+ "type": "String"
132
+ },
133
+ "event_description.url": {
134
+ "description": "A description URL is a link to a further description of the the abuse event in question.",
135
+ "type": "URL"
136
+ },
137
+ "event_hash": {
138
+ "description": "Computed event hash with specific keys and values that identify a unique event. At present, the hash should default to using the SHA1 function. Please note that for an event hash to be able to match more than one event (deduplication) the receiver of an event should calculate it based on a minimal set of keys and values present in the event. Using for example the observation time in the calculation will most likely render the checksum useless for deduplication purposes.",
139
+ "length": 40,
140
+ "regex": "^[A-F0-9./]+$",
141
+ "type": "UppercaseString"
142
+ },
143
+ "extra": {
144
+ "description": "All anecdotal information, which cannot be parsed into the data harmonization elements. E.g. os.name, os.version, etc. **Note**: this is only intended for mapping any fields which can not map naturally into the data harmonization. It is not intended for extending the data harmonization with your own fields.",
145
+ "type": "JSONDict"
146
+ },
147
+ "feed.accuracy": {
148
+ "description": "A float between 0 and 100 that represents how accurate the data in the feed is",
149
+ "type": "Accuracy"
150
+ },
151
+ "feed.code": {
152
+ "description": "Code name for the feed, e.g. DFGS, HSDAG etc.",
153
+ "length": 100,
154
+ "type": "String"
155
+ },
156
+ "feed.documentation": {
157
+ "description": "A URL or hint where to find the documentation of this feed.",
158
+ "type": "String"
159
+ },
160
+ "feed.name": {
161
+ "description": "Name for the feed, usually found in collector bot configuration.",
162
+ "type": "String"
163
+ },
164
+ "feed.provider": {
165
+ "description": "Name for the provider of the feed, usually found in collector bot configuration.",
166
+ "type": "String"
167
+ },
168
+ "feed.url": {
169
+ "description": "The URL of a given abuse feed, where applicable",
170
+ "type": "URL"
171
+ },
172
+ "malware.hash.md5": {
173
+ "description": "A string depicting an MD5 checksum for a file, be it a malware sample for example.",
174
+ "length": 200,
175
+ "regex": "^[ -~]+$",
176
+ "type": "String"
177
+ },
178
+ "malware.hash.sha1": {
179
+ "description": "A string depicting a SHA1 checksum for a file, be it a malware sample for example.",
180
+ "length": 200,
181
+ "regex": "^[ -~]+$",
182
+ "type": "String"
183
+ },
184
+ "malware.hash.sha256": {
185
+ "description": "A string depicting a SHA256 checksum for a file, be it a malware sample for example.",
186
+ "length": 200,
187
+ "regex": "^[ -~]+$",
188
+ "type": "String"
189
+ },
190
+ "malware.name": {
191
+ "description": "The malware name in lower case.",
192
+ "regex": "^[ -~]+$",
193
+ "type": "LowercaseString"
194
+ },
195
+ "malware.version": {
196
+ "description": "A version string for an identified artifact generation, e.g. a crime-ware kit.",
197
+ "regex": "^[ -~]+$",
198
+ "type": "String"
199
+ },
200
+ "misp.attribute_uuid": {
201
+ "description": "MISP - Malware Information Sharing Platform & Threat Sharing UUID of an attribute.",
202
+ "length": 36,
203
+ "regex": "^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$",
204
+ "type": "LowercaseString"
205
+ },
206
+ "misp.event_uuid": {
207
+ "description": "MISP - Malware Information Sharing Platform & Threat Sharing UUID.",
208
+ "length": 36,
209
+ "regex": "^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[0-9a-z]{12}$",
210
+ "type": "LowercaseString"
211
+ },
212
+ "notify": {
213
+ "description": "If mail will be sent out to affected or responsible contact.",
214
+ "type": "Boolean"
215
+ },
216
+ "output": {
217
+ "description": "Event data converted into foreign format, intended to be exported by output plugin.",
218
+ "type": "JSON"
219
+ },
220
+ "protocol.application": {
221
+ "description": "e.g. vnc, ssh, sip, irc, http or smtp.",
222
+ "length": 100,
223
+ "regex": "^[ -~]+$",
224
+ "type": "LowercaseString"
225
+ },
226
+ "protocol.transport": {
227
+ "description": "e.g. tcp, udp, icmp.",
228
+ "iregex": "^(ip|icmp|igmp|ggp|ipencap|st2|tcp|cbt|egp|igp|bbn-rcc|nvp(-ii)?|pup|argus|emcon|xnet|chaos|udp|mux|dcn|hmp|prm|xns-idp|trunk-1|trunk-2|leaf-1|leaf-2|rdp|irtp|iso-tp4|netblt|mfe-nsp|merit-inp|sep|3pc|idpr|xtp|ddp|idpr-cmtp|tp\\+\\+|il|ipv6|sdrp|ipv6-route|ipv6-frag|idrp|rsvp|gre|mhrp|bna|esp|ah|i-nlsp|swipe|narp|mobile|tlsp|skip|ipv6-icmp|ipv6-nonxt|ipv6-opts|cftp|sat-expak|kryptolan|rvd|ippc|sat-mon|visa|ipcv|cpnx|cphb|wsn|pvp|br-sat-mon|sun-nd|wb-mon|wb-expak|iso-ip|vmtp|secure-vmtp|vines|ttp|nsfnet-igp|dgp|tcf|eigrp|ospf|sprite-rpc|larp|mtp|ax.25|ipip|micp|scc-sp|etherip|encap|gmtp|ifmp|pnni|pim|aris|scps|qnx|a/n|ipcomp|snp|compaq-peer|ipx-in-ip|vrrp|pgm|l2tp|ddx|iatp|st|srp|uti|smp|sm|ptp|isis|fire|crtp|crdup|sscopmce|iplt|sps|pipe|sctp|fc|divert)$",
229
+ "length": 11,
230
+ "type": "LowercaseString"
231
+ },
232
+ "raw": {
233
+ "description": "The original line of the event from encoded in base64.",
234
+ "type": "Base64"
235
+ },
236
+ "rtir_incident_id": {
237
+ "description": "Request Tracker Incident Response incident id.",
238
+ "type": "Integer"
239
+ },
240
+ "rtir_investigation_id": {
241
+ "description": "Request Tracker Incident Response investigation id.",
242
+ "type": "Integer"
243
+ },
244
+ "rtir_report_id": {
245
+ "description": "Request Tracker Incident Response incident report id.",
246
+ "type": "Integer"
247
+ },
248
+ "screenshot_url": {
249
+ "description": "Some source may report URLs related to a an image generated of a resource without any metadata. Or an URL pointing to resource, which has been rendered into a webshot, e.g. a PNG image and the relevant metadata related to its retrieval/generation.",
250
+ "type": "URL"
251
+ },
252
+ "sent_at": {
253
+ "description": "Time when the report has been sent to the responsible recipient.",
254
+ "type": "DateTime"
255
+ },
256
+ "shareable_extra_info": {
257
+ "description": "Fields from extra which can be shared.",
258
+ "type": "JSON"
259
+ },
260
+ "source.abuse_contact": {
261
+ "description": "Abuse contact for source address. A comma separated list.",
262
+ "type": "LowercaseString"
263
+ },
264
+ "source.account": {
265
+ "description": "An account name or email address, which has been identified to relate to the source of an abuse event.",
266
+ "type": "String"
267
+ },
268
+ "source.allocated": {
269
+ "description": "Allocation date corresponding to BGP prefix.",
270
+ "type": "DateTime"
271
+ },
272
+ "source.as_name": {
273
+ "description": "The autonomous system name from which the connection originated.",
274
+ "type": "String"
275
+ },
276
+ "source.asn": {
277
+ "description": "The autonomous system number from which originated the connection.",
278
+ "type": "ASN"
279
+ },
280
+ "source.domain_suffix": {
281
+ "description": "The suffix of the domain from the public suffix list.",
282
+ "type": "FQDN"
283
+ },
284
+ "source.fqdn": {
285
+ "description": "A DNS name related to the host from which the connection originated. DNS allows even binary data in DNS, so we have to allow everything. A final point is stripped, string is converted to lower case characters.",
286
+ "regex": "^.*[^\\.]$",
287
+ "type": "FQDN"
288
+ },
289
+ "source.geolocation.cc": {
290
+ "description": "Country-Code according to ISO3166-1 alpha-2 for the source IP.",
291
+ "length": 2,
292
+ "regex": "^[a-zA-Z0-9]{2}$",
293
+ "type": "UppercaseString"
294
+ },
295
+ "source.geolocation.city": {
296
+ "description": "Some geolocation services refer to city-level geolocation.",
297
+ "type": "String"
298
+ },
299
+ "source.geolocation.country": {
300
+ "description": "The country name derived from the ISO3166 country code (assigned to cc field).",
301
+ "type": "String"
302
+ },
303
+ "source.geolocation.cymru_cc": {
304
+ "description": "The country code denoted for the ip by the Team Cymru asn to ip mapping service.",
305
+ "length": 2,
306
+ "regex": "^[a-zA-Z0-9]{2}$",
307
+ "type": "UppercaseString"
308
+ },
309
+ "source.geolocation.geoip_cc": {
310
+ "description": "MaxMind Country Code (ISO3166-1 alpha-2).",
311
+ "length": 2,
312
+ "regex": "^[a-zA-Z0-9]{2}$",
313
+ "type": "UppercaseString"
314
+ },
315
+ "source.geolocation.latitude": {
316
+ "description": "Latitude coordinates derived from a geolocation service, such as MaxMind geoip db.",
317
+ "type": "Float"
318
+ },
319
+ "source.geolocation.longitude": {
320
+ "description": "Longitude coordinates derived from a geolocation service, such as MaxMind geoip db.",
321
+ "type": "Float"
322
+ },
323
+ "source.geolocation.region": {
324
+ "description": "Some geolocation services refer to region-level geolocation.",
325
+ "type": "String"
326
+ },
327
+ "source.geolocation.state": {
328
+ "description": "Some geolocation services refer to state-level geolocation.",
329
+ "type": "String"
330
+ },
331
+ "source.ip": {
332
+ "description": "The ip observed to initiate the connection",
333
+ "type": "IPAddress"
334
+ },
335
+ "source.local_hostname": {
336
+ "description": "Some sources report a internal hostname within a NAT related to the name configured for a compromised system",
337
+ "type": "String"
338
+ },
339
+ "source.local_ip": {
340
+ "description": "Some sources report a internal (NATed) IP address related a compromised system. N.B. RFC1918 IPs are OK here.",
341
+ "type": "IPAddress"
342
+ },
343
+ "source.network": {
344
+ "description": "CIDR for an autonomous system. Also known as BGP prefix. If multiple values are possible, select the most specific.",
345
+ "type": "IPNetwork"
346
+ },
347
+ "source.port": {
348
+ "description": "The port from which the connection originated.",
349
+ "length": 5,
350
+ "type": "Integer"
351
+ },
352
+ "source.registry": {
353
+ "description": "The IP registry a given ip address is allocated by.",
354
+ "length": 7,
355
+ "type": "Registry"
356
+ },
357
+ "source.reverse_dns": {
358
+ "description": "Reverse DNS name acquired through a reverse DNS query on an IP address. N.B. Record types other than PTR records may also appear in the reverse DNS tree. Furthermore, unfortunately, there is no rule prohibiting people from writing anything in a PTR record. Even JavaScript will work. A final point is stripped, string is converted to lower case characters.",
359
+ "regex": "^.*[^\\.]$",
360
+ "type": "FQDN"
361
+ },
362
+ "source.tor_node": {
363
+ "description": "If the source IP was a known tor node.",
364
+ "type": "Boolean"
365
+ },
366
+ "source.url": {
367
+ "description": "A URL denotes an IOC, which refers to a malicious resource, whose interpretation is defined by the abuse type. A URL with the abuse type phishing refers to a phishing resource.",
368
+ "type": "URL"
369
+ },
370
+ "source.urlpath": {
371
+ "description": "The path portion of an HTTP or related network request.",
372
+ "type": "String"
373
+ },
374
+ "status": {
375
+ "description": "Status of the malicious resource (phishing, dropzone, etc), e.g. online, offline.",
376
+ "type": "String"
377
+ },
378
+ "time.observation": {
379
+ "description": "The time the collector of the local instance processed (observed) the event.",
380
+ "type": "DateTime"
381
+ },
382
+ "time.source": {
383
+ "description": "The time of occurrence of the event as reported the feed (source).",
384
+ "type": "DateTime"
385
+ },
386
+ "tlp": {
387
+ "description": "Traffic Light Protocol level of the event.",
388
+ "type": "TLP"
389
+ }
390
+ },
391
+ "report": {
392
+ "extra": {
393
+ "description": "All anecdotal information of the report, which cannot be parsed into the data harmonization elements. E.g. subject of mails, etc. This is data is not automatically propagated to the events.",
394
+ "type": "JSONDict"
395
+ },
396
+ "feed.accuracy": {
397
+ "description": "A float between 0 and 100 that represents how accurate the data in the feed is",
398
+ "type": "Accuracy"
399
+ },
400
+ "feed.code": {
401
+ "description": "Code name for the feed, e.g. DFGS, HSDAG etc.",
402
+ "length": 100,
403
+ "type": "String"
404
+ },
405
+ "feed.documentation": {
406
+ "description": "A URL or hint where to find the documentation of this feed.",
407
+ "type": "String"
408
+ },
409
+ "feed.name": {
410
+ "description": "Name for the feed, usually found in collector bot configuration.",
411
+ "type": "String"
412
+ },
413
+ "feed.provider": {
414
+ "description": "Name for the provider of the feed, usually found in collector bot configuration.",
415
+ "type": "String"
416
+ },
417
+ "feed.url": {
418
+ "description": "The URL of a given abuse feed, where applicable",
419
+ "type": "URL"
420
+ },
421
+ "raw": {
422
+ "description": "The original raw and unparsed data encoded in base64.",
423
+ "type": "Base64"
424
+ },
425
+ "rtir_report_id": {
426
+ "description": "Request Tracker Incident Response incident report id.",
427
+ "type": "Integer"
428
+ },
429
+ "time.observation": {
430
+ "description": "The time the collector of the local instance processed (observed) the event.",
431
+ "type": "DateTime"
432
+ }
433
+ }
434
+ }
@@ -0,0 +1,52 @@
1
+ [
2
+ [
3
+ {
4
+ "source.asn": 1,
5
+ "source.network": "192.0.2.0/24",
6
+ "source.ip": "192.0.2.1",
7
+ "classification.type": "vulnerable-system"
8
+ }, {
9
+ "ttl": 3600
10
+ }
11
+ ], [
12
+ {
13
+ "source.asn": 1,
14
+ "source.network": "192.0.2.0/24",
15
+ "source.ip": "192.0.2.4"
16
+ }, {
17
+ "ttl": 7200
18
+ }
19
+ ], [
20
+ {
21
+ "source.asn": 1,
22
+ "source.ip": "198.51.100.45"
23
+ }, {
24
+ "ttl": 86400
25
+ }
26
+ ], [
27
+ {
28
+ "source.asn": 1,
29
+ "source.network": "198.51.100.0/24"
30
+ }, {
31
+ "ttl": 115200
32
+ }
33
+ ], [
34
+ {
35
+ "source.asn": 12312
36
+ }, {
37
+ "ttl": -1
38
+ }
39
+ ], [
40
+
41
+ {
42
+ "source.iprange": ["10.0.0.1", "10.0.0.100"]
43
+ }, {
44
+ "ttl": 72643
45
+ }
46
+ ], [
47
+ {},
48
+ {
49
+ "ttl": 604800
50
+ }
51
+ ]
52
+ ]
File without changes
@@ -0,0 +1,105 @@
1
+ """Common helpers to speak with APIs
2
+
3
+ SPDX-FileCopyrightText: 2023 CERT.at GmbH <https://cert.at/>
4
+ SPDX-License-Identifier: AGPL-3.0-or-later
5
+ """
6
+
7
+ import base64
8
+ import json
9
+ import logging
10
+ import time
11
+ from contextlib import contextmanager
12
+ from datetime import datetime, timedelta
13
+ from threading import RLock
14
+
15
+ import requests
16
+ from dateutil.tz import UTC
17
+
18
+ default_logger = logging.getLogger(__name__)
19
+ # refresh access token when it's about to expire in 10 minutes
20
+ DEFAULT_REFRESH_WINDOW = 10
21
+
22
+
23
+ class OAuthAccessMixin:
24
+ def init_oauth(
25
+ self,
26
+ oauth_clientid: str,
27
+ oauth_clientsecret: str,
28
+ oauth_url: str,
29
+ session: requests.Session,
30
+ oauth_scope: str = "",
31
+ oauth_grant_type: str = "client_credentials",
32
+ logger: logging.Logger = default_logger,
33
+ refresh_before: int = DEFAULT_REFRESH_WINDOW,
34
+ limiter: "RateLimiter" = None,
35
+ ) -> None:
36
+ self._oauth_clientid = oauth_clientid
37
+ self._oauth_clientsecret = oauth_clientsecret
38
+ self._oauth_url = oauth_url
39
+ self._oauth_scope = oauth_scope
40
+ self._oauth_grant_type = oauth_grant_type
41
+ self._refresh_before = refresh_before
42
+ self._access_token = None
43
+ self.__logger = logger
44
+ self.__session = session
45
+ self.__limiter = limiter or RateLimiter(0, 0)
46
+
47
+ @property
48
+ def access_token(self):
49
+ if self._access_token:
50
+ _, data, __ = self._access_token.split(".")
51
+ # Add additional padding to overcome the library issue when it's stripped
52
+ data = json.loads(base64.urlsafe_b64decode(data + "==="))
53
+ expiration = datetime.fromtimestamp(data["exp"], tz=UTC)
54
+ refreshing_time = datetime.now(tz=UTC) + timedelta(
55
+ minutes=self._refresh_before
56
+ )
57
+ self.__logger.debug(
58
+ "Comparing %s with expiration %s from access token.",
59
+ refreshing_time,
60
+ expiration,
61
+ )
62
+ if refreshing_time > expiration:
63
+ self._access_token = None
64
+
65
+ if not self._access_token:
66
+ self.__logger.debug("Refreshing OAuth access token.")
67
+ with self.__limiter.call():
68
+ self._access_token = self.__session.post(
69
+ self._oauth_url,
70
+ data={
71
+ "scope": self._oauth_scope,
72
+ "grant_type": self._oauth_grant_type,
73
+ "client_id": self._oauth_clientid,
74
+ "client_secret": self._oauth_clientsecret,
75
+ },
76
+ ).json()["access_token"]
77
+ return self._access_token
78
+
79
+
80
+ class RateLimiter:
81
+ def __init__(self, max_call: int, period_seconds: int):
82
+ self.max_call = max_call
83
+ self.period = period_seconds
84
+ self._last_reset = time.monotonic()
85
+ self._counter = 0
86
+ self._lock = RLock()
87
+
88
+ @contextmanager
89
+ def call(self):
90
+ if not self.period:
91
+ yield
92
+ return
93
+
94
+ while True:
95
+ with self._lock:
96
+ now = time.monotonic()
97
+ if now - self._last_reset > self.period:
98
+ self._counter = 0
99
+ self._last_reset = now
100
+
101
+ if self._counter < self.max_call:
102
+ self._counter += 1
103
+ yield
104
+ break
105
+ time.sleep(now - self._last_reset)
@@ -0,0 +1,29 @@
1
+ """Common parts of BlackKite integration
2
+
3
+ SPDX-FileCopyrightText: 2023 CERT.at GmbH <https://cert.at/>
4
+ SPDX-License-Identifier: AGPL-3.0-or-later
5
+ """
6
+
7
+ from enum import Enum
8
+
9
+
10
+ class Category(str, Enum):
11
+ ApplicationSecurity = "APPSEC"
12
+ PatchManagement = "PATCH"
13
+ DNSHealth = "DNS"
14
+ EmailSecurity = "SMTP"
15
+ FraudulentDomains = "FRADOM"
16
+ CredentialManagement = "LEAK"
17
+ IPReputation = "REP"
18
+ NetworkSecurity = "NETSEC"
19
+ CDNSecurity = "CDN"
20
+ DDoSResiliency = "DDOS"
21
+ AttackSurface = "ATTSRF"
22
+ SSLTLSstrength = "SSL"
23
+ FraudulentApps = "FRAAPP"
24
+ InformationDisclosure = "INFDIS"
25
+ HacktivistShares = "HACK"
26
+ SocialNetwork = "SOCIAL"
27
+ BrandMonitoring = "BRM"
28
+ WebRanking = "WBR"
29
+ WebsiteSecurity = "WSS"
File without changes