Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1f99b30
talaria(std-lib): add whoami (24.1KiB) to deps. For getting username …
engelhartrueben Apr 30, 2025
c0b3dca
talaria(std-lib): add libc (773KiB) to deps. For gettiing admin perms…
engelhartrueben Apr 30, 2025
2de019b
talaria(std-lib): [REBASE] moving to desktop
engelhartrueben Apr 30, 2025
a35aa85
talaria(std-lib): [REBASE LATER] oof
May 1, 2025
654b9ad
talaria(std-lib): add elevated-command crate for checking if use is a…
engelhartrueben May 2, 2025
46b6ab6
talaria(std-lib): added initial attempt at each required function wit…
engelhartrueben May 2, 2025
ba6faee
talaria(std-lib): change is_admin unix implementation to use sys calls
engelhartrueben May 3, 2025
8147e3a
feat(talaria): scaffold error type for scripting
coal-rock May 3, 2025
5ccd88c
feat(talaria): implement `Into<Result<T, Box<EvalAltResult>>>` for sc…
coal-rock May 3, 2025
18301bf
feat(tartarus): begin implementation of scripts
coal-rock May 2, 2025
9f160f3
feat(tartarus): we now support metadata + script parsing
coal-rock May 2, 2025
5b01ec8
feat(rebase): handle minor conflicts
engelhartrueben May 4, 2025
5ff7472
feat(console): begin implementation of script parsing
coal-rock May 2, 2025
9aa1c77
feat(rebase): rebase onto main - fix conflicts
engelhartrueben May 4, 2025
509ca97
feat(rebase): handle conflicts. remove libc dep
engelhartrueben May 4, 2025
78a7617
feat(rebase): handle conflict, remove libc dep
engelhartrueben May 4, 2025
596c5df
feat(rebase): missed a conflict
engelhartrueben May 4, 2025
e3568b1
Merge branch 'main' into re/talaria-std-sys-lib
engelhartrueben May 5, 2025
2191b8c
feat(talaria-sys-lib): change os_name to return a string instead of a…
engelhartrueben May 7, 2025
70f0f28
feat(talaria-sys-library): add os_family function, that returns a str…
engelhartrueben May 7, 2025
0d571e1
feat(talaira-sys-lib): make username failable, similar to hostname
engelhartrueben May 7, 2025
25b3b17
feat(talaria-sys-lib): change is_admin to use the same is_elevated li…
engelhartrueben May 7, 2025
a070e6d
feat(talaria-sys-lib); add extra comments to fn shutdown and fn reboo…
engelhartrueben May 7, 2025
c8ab958
feat(talaria-sys-lib): complete redo of uptime. thanks coal <3.
engelhartrueben May 7, 2025
f3a8089
feat(talaria-sys-lib): add fn is_bsd to check if agent os is either f…
engelhartrueben May 7, 2025
d4b7a19
feat(talaria-sys-lib): comment cleanup
engelhartrueben May 7, 2025
c6cc660
feat(talaria-sys-lib): add two errors types, SysError and SysUnsuppor…
engelhartrueben May 7, 2025
08045a9
feat(talaria-sys-lib): move all errors to custom error types
engelhartrueben May 7, 2025
87786c5
feat(talaria-sys-lib): change fn is_admin to return a bool rather tha…
engelhartrueben May 7, 2025
71ded55
feat(scripting, docs): document return types for sys::cpu_architecture
coal-rock May 8, 2025
23ff121
fix(docs, talaria): is_bsd documentation now has `true` encased in ba…
coal-rock May 8, 2025
720b6bd
chore(talaria): remove deprecated `OsEnum`
coal-rock May 8, 2025
9da6480
fix(talaria, docs): fix spelling of `OpenBSD` and `FreeBSD` in docs
coal-rock May 8, 2025
b5def9a
fix(talaria, docs): general cleanup + document return types for os_fa…
coal-rock May 8, 2025
27c729b
fix(talaria, docs): final `sys` documentation touchup
coal-rock May 8, 2025
f3130b8
fix(docs): nitpick
coal-rock May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 63 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions talaria/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ strum = "0.27"
strum_macros = "0.27"
bytesize = "2.0.1"
rhai = { version = "1.21", featues = ["sync"] }
whoami = "1.6.0"
elevated-command = "1.1.2"
toml = "0.8.22"
1 change: 1 addition & 0 deletions talaria/src/scripting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ impl ScriptingEngine {
let mut modules = vec![];

{
modules.push(("error", exported_module!(error::error)));
modules.push(("crypto", exported_module!(crypto::crypto)));
modules.push(("env", exported_module!(env::env)));
modules.push(("fs", exported_module!(fs::fs)));
Expand Down
34 changes: 34 additions & 0 deletions talaria/src/stdlib/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
use rhai::plugin::*;
use strum_macros::IntoStaticStr;

#[export_module]
pub mod error {
#[derive(Debug, Clone, IntoStaticStr)]
pub enum Error {
FsError(String),
SysError(String),
SysUnsupportedError(String),
}

impl<T> Into<Result<T, Box<EvalAltResult>>> for Error {
fn into(self) -> Result<T, Box<EvalAltResult>> {
Err(Box::new(EvalAltResult::ErrorRuntime(
Dynamic::from(self),
Position::NONE,
)))
}
}

/// Returns a deterministic string that can be matched upon to identify error type
#[rhai_fn(get = "name", pure)]
pub fn get_error_name(error: &mut Error) -> String {
let error: &'static str = error.clone().into();
error.to_string()
}

/// Returns message including both error context and message
#[rhai_fn(get = "msg", pure)]
pub fn get_error_msg(error: &mut Error) -> String {
format!("{:?}", error)
}
}
1 change: 1 addition & 0 deletions talaria/src/stdlib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use rhai::Dynamic;

pub mod crypto;
pub mod env;
pub mod error;
pub mod fs;
pub mod http;
pub mod net;
Expand Down
Loading