diff --git a/Cargo.lock b/Cargo.lock
index e1bd808..d7400bc 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -329,6 +329,19 @@ dependencies = [
"syn 2.0.98",
]
+[[package]]
+name = "axum-msgpack"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1dd328722bb555cc4e7306591aae2d80be83b64c71b183b0e9dd9a16412dc55a"
+dependencies = [
+ "axum",
+ "hyper",
+ "mime",
+ "rmp-serde",
+ "serde",
+]
+
[[package]]
name = "axum-server"
version = "0.7.1"
@@ -545,6 +558,8 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d3ad3122b0001c7f140cf4d605ef9a9e2c24d96ab0b4fb4347b76de2425f445"
dependencies = [
+ "serde",
+ "serde_json",
"thiserror 1.0.69",
]
@@ -2891,6 +2906,28 @@ dependencies = [
"windows-sys 0.52.0",
]
+[[package]]
+name = "rmp"
+version = "0.8.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "228ed7c16fa39782c3b3468e974aec2795e9089153cd08ee2e9aefb3613334c4"
+dependencies = [
+ "byteorder",
+ "num-traits",
+ "paste",
+]
+
+[[package]]
+name = "rmp-serde"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db"
+dependencies = [
+ "byteorder",
+ "rmp",
+ "serde",
+]
+
[[package]]
name = "rpassword"
version = "7.3.1"
@@ -3122,18 +3159,27 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.217"
+version = "1.0.218"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
+checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
dependencies = [
"serde_derive",
]
[[package]]
-name = "serde_derive"
-version = "1.0.217"
+name = "serde_bytes"
+version = "0.11.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
+checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.218"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
dependencies = [
"proc-macro2",
"quote",
@@ -3142,9 +3188,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.138"
+version = "1.0.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949"
+checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6"
dependencies = [
"itoa",
"memchr",
@@ -3379,6 +3425,9 @@ name = "sparse-actions"
version = "2.0.0"
dependencies = [
"bindgen",
+ "chrono",
+ "serde",
+ "serde_bytes",
]
[[package]]
@@ -3387,8 +3436,10 @@ version = "0.7.0"
dependencies = [
"async-trait",
"bytes",
+ "cron",
"futures",
"http",
+ "http-body",
"http-body-util",
"hyper",
"hyper-rustls",
@@ -3397,8 +3448,11 @@ dependencies = [
"pcap-sys",
"pin-project",
"rand 0.9.0",
+ "rmp-serde",
"rustls",
"rustls-openssl",
+ "serde",
+ "serde_json",
"simple_logger",
"smoltcp",
"sparse-actions",
@@ -3414,13 +3468,16 @@ version = "2.0.0"
dependencies = [
"anyhow",
"axum",
+ "axum-msgpack",
"axum-server",
+ "chrono",
"futures",
"rcgen",
"rustls",
"rustls-pki-types",
"serde",
"serde_json",
+ "sparse-actions",
"sqlx",
"tokio",
"tokio-stream",
@@ -3454,7 +3511,9 @@ dependencies = [
"rcgen",
"rpassword",
"rustls-pki-types",
+ "send_wrapper",
"serde",
+ "serde_json",
"sha2",
"sparse-actions",
"sparse-handler",
diff --git a/sparse-actions/Cargo.toml b/sparse-actions/Cargo.toml
index b9d2a31..f009571 100644
--- a/sparse-actions/Cargo.toml
+++ b/sparse-actions/Cargo.toml
@@ -4,6 +4,9 @@ edition = "2021"
version.workspace = true
[dependencies]
+chrono = { version = "0.4.39", features = ["serde"] }
+serde = { version = "1.0.218", features = ["derive"] }
+serde_bytes = "0.11.15"
[build-dependencies]
bindgen = "0.69"
diff --git a/sparse-actions/src/actions.rs b/sparse-actions/src/actions.rs
new file mode 100644
index 0000000..ab03d65
--- /dev/null
+++ b/sparse-actions/src/actions.rs
@@ -0,0 +1 @@
+pub trait Action {}
diff --git a/sparse-actions/src/lib.rs b/sparse-actions/src/lib.rs
index 6761f1e..be8f8d9 100644
--- a/sparse-actions/src/lib.rs
+++ b/sparse-actions/src/lib.rs
@@ -3,3 +3,6 @@
pub mod payload_types {
include!(concat!(std::env!("OUT_DIR"), "/bindings.rs"));
}
+
+pub mod actions;
+pub mod messages;
diff --git a/sparse-actions/src/messages.rs b/sparse-actions/src/messages.rs
new file mode 100644
index 0000000..587bfa8
--- /dev/null
+++ b/sparse-actions/src/messages.rs
@@ -0,0 +1,40 @@
+use std::path::PathBuf;
+
+use serde::{Deserialize, Serialize};
+
+#[derive(Clone, Serialize, Deserialize)]
+pub struct RegisterBeacon {
+ pub beacon_id: String,
+ pub template_id: u16,
+ pub cwd: PathBuf,
+ pub operating_system: String,
+ pub userent: String,
+ pub hostname: String,
+}
+
+#[derive(Clone, Serialize, Deserialize)]
+pub enum CronTimezone {
+ Utc,
+ Local,
+}
+
+#[derive(Clone, Serialize, Deserialize)]
+pub enum RuntimeConfig {
+ Oneshot,
+ Random {
+ interval_min: u64,
+ interval_max: u64,
+ },
+ Regular {
+ interval: u64,
+ },
+ Cron {
+ schedule: String,
+ timezone: CronTimezone,
+ },
+}
+
+#[derive(Clone, Serialize, Deserialize)]
+pub struct BeaconConfig {
+ pub runtime_config: RuntimeConfig,
+}
diff --git a/sparse-beacon/Cargo.toml b/sparse-beacon/Cargo.toml
index 70a2e51..ce232fd 100644
--- a/sparse-beacon/Cargo.toml
+++ b/sparse-beacon/Cargo.toml
@@ -8,7 +8,7 @@ publish = false
hyper = { version = "1.6.0", features = ["client", "http1", "http2"] }
smoltcp = { version = "0.12.0", default-features = false, features = ["async", "log", "medium-ethernet", "proto-ipv4", "proto-ipv4-fragmentation", "socket-raw", "socket-tcp", "std"] }
thiserror = "2.0.11"
-tokio = { version = "1.43.0", features = ["fs", "io-std", "io-util", "net", "process", "rt", "sync", "tokio-macros"] }
+tokio = { version = "1.43.0", features = ["fs", "io-std", "io-util", "net", "process", "rt", "sync", "time", "tokio-macros"] }
async-trait = "0.1.86"
tracing = "0.1.41"
rand = "0.9.0"
@@ -27,6 +27,11 @@ http-body-util = "0.1.2"
pcap-sys = { version = "0.1.0", path = "../pcap-sys" }
sparse-actions = { version = "2.0.0", path = "../sparse-actions" }
packets = { version = "0.1.0", path = "../packets" }
+serde_json = "1.0.139"
+serde = "1.0.217"
+http-body = "1.0.1"
+rmp-serde = "1.3.0"
+cron = "0.15.0"
[features]
openssl = ["dep:rustls-openssl"]
diff --git a/sparse-beacon/src/adapter.rs b/sparse-beacon/src/adapter.rs
index b21f24e..6a56a42 100644
--- a/sparse-beacon/src/adapter.rs
+++ b/sparse-beacon/src/adapter.rs
@@ -26,7 +26,13 @@ pub struct BeaconInterface {
pub trait BeaconAdapter {
type Error: error::AdapterError + Send + Sync;
+ const OPERATING_SYSTEM: &'static str;
+
fn interface_name_from_interface(interface: &BeaconInterface) -> Vec