Skip to main content

zond_engine/core/models/
fingerprint.rs

1// Copyright (c) 2026 Erik Lening (hollowpointer) and Contributors
2//
3// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4// If a copy of the MPL was not distributed with this file, You can obtain one at
5// https://mozilla.org/MPL/2.0/.
6
7use serde::{Deserialize, Serialize};
8use std::collections::HashMap;
9
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct ServiceSignature {
12    pub name: String,
13    pub default_ports: Vec<u16>,
14    pub description: Option<String>,
15    pub attribution: Option<String>,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct Probe {
20    pub name: Option<String>,
21    pub payload: String,
22    pub protocol: String,
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
26pub struct MatchRule {
27    pub name: Option<String>,
28    pub pattern: String,
29    pub version_group: Option<u8>,
30    pub vendor: Option<String>,
31    pub product: Option<String>,
32    pub context: Option<String>,
33    pub example: Option<String>,
34    pub metadata: Option<HashMap<String, String>>,
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
38pub struct ServiceDefinition {
39    pub service: ServiceSignature,
40    #[serde(default)]
41    pub probe: Vec<Probe>,
42    #[serde(default)]
43    pub r#match: Vec<MatchRule>,
44}