From f64747dc93037df0b9b4865aadd3a4c767f8c762 Mon Sep 17 00:00:00 2001 From: raphy Date: Fri, 20 Oct 2023 00:25:59 +0200 Subject: [PATCH] added cackle??? Cackle is a acl for rust crates, to prevent dependency injection attacks. Maybe?? --- cackle.toml | 126 +++++++++++++++++++++++++++++++++++++ src/lib.rs | 6 +- src/pretty_printers/asm.rs | 91 +-------------------------- 3 files changed, 129 insertions(+), 94 deletions(-) create mode 100644 cackle.toml diff --git a/cackle.toml b/cackle.toml new file mode 100644 index 0000000..0b1ec32 --- /dev/null +++ b/cackle.toml @@ -0,0 +1,126 @@ +[common] +version = 2 +import_std = [ + "fs", + "net", + "process", +] + +[sandbox] +kind = "Disabled" + +[pkg.time-macros] +allow_proc_macro = true +allow_unsafe = true + +[pkg.clap_derive] +allow_proc_macro = true + +[pkg.bitflags] +allow_unsafe = true + +[pkg.anstyle-query] +allow_unsafe = true + +[pkg.utf8parse] +allow_unsafe = true + +[pkg.unicode-ident] +allow_unsafe = true + +[pkg.lazy_static] +allow_unsafe = true + +[pkg.anstyle] +allow_unsafe = true + +[pkg.itoa] +allow_unsafe = true + +[pkg.quote] +build.allow_apis = [ + "process", +] + +[pkg.io-lifetimes] +build.allow_apis = [ + "process", +] +allow_unsafe = true + +[pkg.rustix] +build.allow_apis = [ + "fs", + "process", +] +allow_unsafe = true + +[pkg.proc-macro2] +build.allow_apis = [ + "process", +] +allow_unsafe = true + +[pkg.libc] +build.allow_apis = [ + "process", +] +allow_unsafe = true + +[pkg.clap_lex] +allow_unsafe = true + +[pkg.linux-raw-sys] +allow_unsafe = true + +[pkg.log] +allow_unsafe = true + +[pkg.once_cell] +allow_unsafe = true + +[pkg.anstyle-parse] +allow_unsafe = true + +[pkg.atty] +allow_unsafe = true + +[pkg.colored] +allow_unsafe = true + +[pkg.time] +allow_unsafe = true + +[pkg.syn] +allow_unsafe = true + +[pkg.is-terminal] +allow_unsafe = true + +[pkg.simple_logger] +allow_unsafe = true + +[pkg.anstream] +allow_unsafe = true + +[pkg.dekejit] +test.allow_unsafe = true +allow_unsafe = true +allow_apis = [ + "fs", +] + +[pkg.clap_builder] +allow_apis = [ + "fs", +] + +[pkg.num_threads] +allow_apis = [ + "fs", +] + +[api.process] +include = [ + "rustix::process", +] diff --git a/src/lib.rs b/src/lib.rs index 5f2fa22..db9a45e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,10 @@ use std::mem::transmute; +pub mod assembler; +pub mod cli; pub mod cpu; pub mod jit; pub mod loader; -pub mod cli; -pub mod assembler; pub mod pretty_printers; // @@ -23,7 +23,6 @@ pub fn interpret_as_unsigned(x: i16) -> u16 { } pub fn transmute_to_vecu16_as_is(x: Vec) -> Vec { - let mut rb = x.iter(); // raw_bytes must be converted to u16. // @@ -56,7 +55,6 @@ pub fn transmute_to_vecu16_as_is(x: Vec) -> Vec { } pub fn transmute_to_vecu8_as_is(x: Vec) -> Vec { - let mut bytes = vec![]; for b in x.iter() { diff --git a/src/pretty_printers/asm.rs b/src/pretty_printers/asm.rs index 6fbe579..503cd81 100644 --- a/src/pretty_printers/asm.rs +++ b/src/pretty_printers/asm.rs @@ -76,7 +76,7 @@ fn draw_section(sec: Section) -> String { } }, - SectionContent::CString(s) => res.push_str(&s), + SectionContent::CString(s) => res.push_str(&format_line(&s, 8, TERMSIZE)), SectionContent::CVec() => todo!(), } @@ -131,92 +131,3 @@ fn draw_separator(len: u8) -> String { } - - - -// fn wrap_in_bars(&str, indentation: u8) -> String { -// -// -// -// } - -// ┄ -// ┅ -// ┆ -// ┇ -// ┈ -// ┉ -// ┊ -// ┋ -// ┌ -// ┍ -// ┎ -// ┏ -// ┐ -// ┑ -// ┒ -// ┓ -// └ -// ┕ -// ┖ -// ┗ -// ┘ -// ┙ -// ┚ -// ┛ -// ├ -// ┝ -// ┞ -// ┟ -// ┠ -// ┡ -// ┢ -// ┣ -// ┤ -// ┥ -// ┦ -// ┧ -// ┨ -// ┩ -// ┪ -// ┫ -// ┬ -// ┭ -// ┮ -// ┯ -// ┰ -// ┱ -// ┲ -// ┳ -// ┴ -// ┵ -// ┶ -// ┷ -// ┸ -// ┹ -// ┺ -// ┻ -// ┼ -// ┽ -// ┾ -// ┿ -// ╀ -// ╁ -// ╂ -// ╃ -// ╄ -// ╅ -// ╆ -// ╇ -// ╈ -// ╉ -// ╊ -// ╋ -// ╌ -// ╍ -// ╎ -// ╏ -// ═ -// ║ -// ╒ -// ╓