From 826f656485260bd28a8e0b6e31ff34872f6869c4 Mon Sep 17 00:00:00 2001 From: Hanbeom kim Date: Fri, 27 Sep 2024 15:28:48 +0900 Subject: [PATCH] Add packet attribute triage function - Add triage functionality for scoring with attributes of each protocol. - Add the `target_attribute` to the `Match` trait. - Implement `score_by_packet_attr` under `Match` trait. - Modify the `ValueKind` enum to support different types of input. - Remove the `tor` module file. The structures (`HttpEventFields`, `TorConnection`) and implementations within that module have been moved to `crate::event::http`. - Fix HTTP detection events to consistently use `referrer` instead of `referrer` and `referer` interchangeably. - Change the type of fields in the detection event structure for some protocols. - `post_body`: `Vec` to `String`. - `chaddr`: `Vec` to `String`. - `class_id`: `Vec` to `String`. - `client_id`: `Vec` to `String`. Close: #354 --- CHANGELOG.md | 40 ++- Cargo.toml | 1 + src/event.rs | 23 +- src/event/bootp.rs | 43 ++- src/event/common.rs | 454 +++++++++++++++++++++++++- src/event/conn.rs | 78 ++++- src/event/dcerpc.rs | 12 +- src/event/dhcp.rs | 65 +++- src/event/dns.rs | 52 ++- src/event/ftp.rs | 57 +++- src/event/http.rs | 366 ++++++++++++++++++--- src/event/kerberos.rs | 35 +- src/event/ldap.rs | 51 ++- src/event/log.rs | 12 +- src/event/mqtt.rs | 38 ++- src/event/network.rs | 29 +- src/event/nfs.rs | 28 +- src/event/ntlm.rs | 31 +- src/event/rdp.rs | 41 ++- src/event/smb.rs | 37 ++- src/event/smtp.rs | 33 +- src/event/ssh.rs | 41 ++- src/event/sysmon.rs | 31 +- src/event/tls.rs | 69 +++- src/migration.rs | 4 +- src/migration/migration_structures.rs | 16 +- src/tables/triage_policy.rs | 6 +- 27 files changed, 1498 insertions(+), 195 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8383618..d5ba438 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,35 @@ file is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- Added triage functionality for scoring with attributes of each raw event. + - Added a new enum type `AttrValue`. This type is used to convert the + attribute value of each raw event to its corresponding type to perform + comparison operations. + - Added the `target_attribute` to the `Match` trait to generate an `AttrValue` + from the field in all detection event. + - Implemented `score_by_packet_attr` under `Match` trait. + +### Changed + +- Removed the `tor` module file. The structures (`HttpEventFields`, + `TorConnection`) and implementations within that module have been moved to + `crate::event::http`. +- Fixed HTTP detection events to consistently use `referrer` instead of + `referrer` and `referrer` interchangeably. +- Modified the `ValueKind` enum to support different types of input for packet + attribute triage. +- Changed the type of fields in the detection event structure for some raw + event. This change allows users to see meaningful values directly without + having to do any special conversion for that field. + - `post_body`(HTTP): `Vec` to `String`. + - `chaddr`(BOOTP): `Vec` to `String`. + - `class_id`(DHCP): `Vec` to `String`. + - `client_id`(DHCP): `Vec` to `String`. + ## [0.33.0] - 2024-12-12 ### Changed @@ -327,7 +356,7 @@ Versioning](https://semver.org/spec/v2.0.0.html). - Changed the return type of `Store::network_map` to `IndexedTable` to enhance security by preventing direct exposure of internal structure. - Replaced `IndexedMap::get_by_id` function with `Indexed::get_by_id`, providing - a more structured and type-safe result. + a more structured and type-safe result. - Previously, the function returned a binary representation of the key-value pair: `Result<(Option>, Option>)>`. - Now, it returns `Result>`, where T is the entry type. @@ -343,8 +372,8 @@ Versioning](https://semver.org/spec/v2.0.0.html). more straightforward and human-readable format compared to the raw binary format exposed by `IndexSet`. - Replaced the `IndexedTable::get`, `IndexedTable::get` and - `IndexedTable::get` method with the more general function - `IndexedTable::get_by_id`. This change enhances flexibility by allowing + `IndexedTable::get` method with the more general function + `IndexedTable::get_by_id`. This change enhances flexibility by allowing retrieval based on any type R rather than being limited to a specific category. Existing code using get for categories should be updated to use get_by_id with the appropriate type. @@ -386,7 +415,7 @@ Versioning](https://semver.org/spec/v2.0.0.html). - Added new functions to facilitate insert, remove, and update operations, ensuring a more controlled and secure template management. - Introduced `Structured`, `Unstructured`, `StructuredClusteringAlgorithm` and - `UnstructuredClusteringAlgorithm` to describe data stored in `Table