Get top ten repeated "elements" as defined in database_queries in "event_type" --- parameters: - in: path name: event_type schema: type: string required: true enum: - honeypot - network - cre
(event_type, element)
| 329 | |
| 330 | @app.route("/api/events/count/groupby/<event_type>/<element>", methods=["GET"]) |
| 331 | def groupby_element(event_type, element): |
| 332 | """ |
| 333 | Get top ten repeated "elements" as defined in database_queries in "event_type" |
| 334 | --- |
| 335 | parameters: |
| 336 | - in: path |
| 337 | name: event_type |
| 338 | schema: |
| 339 | type: string |
| 340 | required: true |
| 341 | enum: |
| 342 | - honeypot |
| 343 | - network |
| 344 | - credential |
| 345 | - file |
| 346 | - data |
| 347 | - pcap |
| 348 | - in: path |
| 349 | name: element |
| 350 | schema: |
| 351 | type: string |
| 352 | required: true |
| 353 | enum: |
| 354 | - ip |
| 355 | - country |
| 356 | - port |
| 357 | - module_name |
| 358 | - username |
| 359 | - password |
| 360 | - machine_name |
| 361 | - in: query |
| 362 | name: date |
| 363 | schema: |
| 364 | type: date |
| 365 | required: false |
| 366 | description: Date to filter records for particular day |
| 367 | - in: query |
| 368 | name: country |
| 369 | schema: |
| 370 | type: string |
| 371 | required: false |
| 372 | description: used for filtering events by country |
| 373 | responses: |
| 374 | '200': |
| 375 | description: Ok |
| 376 | examples: |
| 377 | application/json: [{"count":1703,"country":"DE"}] |
| 378 | '404': |
| 379 | description: Not Found |
| 380 | examples: |
| 381 | application/json: { "msg": "file/path not found!", "status": "error"} |
| 382 | |
| 383 | """ |
| 384 | abort(404) if (event_type not in event_types or element not in group_by_elements) else True |
| 385 | date = get_value_from_request("date") |
| 386 | filter_by = get_value_from_request('filter_by') |
| 387 | element_value = get_value_from_request(filter_by) |
| 388 | conditions = [condition for condition in [ |
nothing calls this directly
no test coverage detected