Add base62 encoding

This commit is contained in:
Michael Mikovsky
2025-11-10 22:18:21 -07:00
parent 0881e46a17
commit 2b5074153b
21 changed files with 981 additions and 134 deletions
+71 -12
View File
@@ -13,6 +13,15 @@ dependencies = [
"cpufeatures",
]
[[package]]
name = "aho-corasick"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
dependencies = [
"memchr",
]
[[package]]
name = "android_system_properties"
version = "0.1.5"
@@ -279,6 +288,12 @@ version = "0.4.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
[[package]]
name = "memchr"
version = "2.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
[[package]]
name = "num-traits"
version = "0.2.19"
@@ -318,6 +333,35 @@ version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]]
name = "regex"
version = "1.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
[[package]]
name = "rustversion"
version = "1.0.22"
@@ -394,17 +438,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
[[package]]
name = "unshell-lib"
version = "0.1.0"
dependencies = [
"bincode",
"chrono",
"libloading",
"unshell-obfuscate",
]
[[package]]
name = "unshell-obfuscate"
name = "unshell-crypt"
version = "0.1.0"
dependencies = [
"aes",
@@ -413,10 +447,35 @@ dependencies = [
"getrandom",
"hex",
"hex-literal",
"regex",
"sha2",
]
[[package]]
name = "unshell-lib"
version = "0.0.0"
dependencies = [
"aes",
"bincode",
"block-padding 0.4.1",
"cbc",
"chrono",
"getrandom",
"hex",
"hex-literal",
"libloading",
"sha2",
"unshell-obfuscate",
]
[[package]]
name = "unshell-obfuscate"
version = "0.0.0"
dependencies = [
"proc-macro2",
"quote",
"sha2",
"syn",
"unshell-crypt",
]
[[package]]
+12 -1
View File
@@ -1,10 +1,21 @@
[package]
name = "unshell-lib"
version = "0.1.0"
edition = "2024"
[dependencies]
# Base dependencies
libloading = {version = "0.8.9"}
bincode = "2.0.1"
unshell-obfuscate = {path = "../unshell-obfuscate"}
chrono = "0.4.42"
# Crypt dependencies
aes = "0.8.4"
block-padding = "0.4.1"
cbc = "0.1.2"
getrandom = "0.3.4"
hex = "0.4.3"
hex-literal = "1.1.0"
sha2 = "0.10.9"
#
+1
View File
@@ -0,0 +1 @@
+26 -1
View File
@@ -1,12 +1,16 @@
#![no_main]
pub mod client;
pub mod crypt;
pub mod logger;
pub mod module;
pub mod server;
mod announcement;
use std::sync::{Arc, Mutex};
use std::{
fmt,
sync::{Arc, Mutex},
};
pub use announcement::Announcement;
@@ -18,9 +22,30 @@ pub enum ModuleError {
LibLoadingError(libloading::Error),
// LogError(log::SetLoggerError),
LinkError(String),
CryptError(String),
Error(String),
}
impl std::error::Error for ModuleError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
None
}
fn description(&self) -> &str {
"description() is deprecated; use Display"
}
fn cause(&self) -> Option<&dyn std::error::Error> {
Some(self)
}
}
impl fmt::Display for ModuleError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(format!("{:?}", self).as_str())
}
}
/// Trait for defining modules that have a runtime.
pub trait ModuleRuntime: Send {
/// Returns true if the module is running.
+2 -2
View File
@@ -18,10 +18,10 @@ static GREY: &str = "\x1b[90m";
impl Logger for PrettyLogger {
fn log(&self, message: Record) {
let log_level = match message.log_level {
LogLevel::Debug => format!("{DEBUG_COLOR}DEBUG"),
LogLevel::Debug => format!("{DEBUG_COLOR}DBUG"),
LogLevel::Info => format!("{INFO_COLOR}INFO"),
LogLevel::Warn => format!("{WARN_COLOR}WARN"),
LogLevel::Error => format!("{ERROR_COLOR}ERROR"),
LogLevel::Error => format!("{ERROR_COLOR}ERR!"),
};
let date: DateTime<Utc> = message.time.into();