Skip to content

Commit cc99c08

Browse files
committed
general rust-fixme-3
1 parent 58807fc commit cc99c08

File tree

136 files changed

+434
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+434
-0
lines changed
1.73 KB
Binary file not shown.

src/PICOCTF/GENERAL/rust-fixme-3/fixme3/Cargo.lock

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "rust_proj"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
xor_cryptor = "1.2.3"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
use xor_cryptor::XORCryptor;
2+
3+
fn decrypt(encrypted_buffer: Vec<u8>, borrowed_string: &mut String) {
4+
// Key for decryption
5+
let key = String::from("CSUCKS");
6+
7+
// Editing our borrowed value
8+
borrowed_string.push_str("PARTY FOUL! Here is your flag: ");
9+
10+
// Create decryption object
11+
let res = XORCryptor::new(&key);
12+
if res.is_err() {
13+
return;
14+
}
15+
let xrc = res.unwrap();
16+
17+
// Decrypt the flag
18+
let decrypted_buffer = xrc.decrypt_vec(encrypted_buffer);
19+
20+
// Append the decrypted result to the borrowed string
21+
borrowed_string.push_str(&String::from_utf8_lossy(&decrypted_buffer));
22+
23+
println!("{}", borrowed_string);
24+
}
25+
26+
fn main() {
27+
// Encrypted flag values
28+
let hex_values = [
29+
"41", "30", "20", "63", "4a", "45", "54", "76", "12", "90", "7e", "53", "63", "e1", "01", "35",
30+
"7e", "59", "60", "f6", "03", "86", "7f", "56", "41", "29", "30", "6f", "08", "c3", "61", "f9", "35",
31+
];
32+
33+
// Convert the hexadecimal strings to bytes and collect them into a vector
34+
let encrypted_buffer: Vec<u8> = hex_values.iter()
35+
.map(|&hex| u8::from_str_radix(hex, 16).unwrap())
36+
.collect();
37+
38+
let mut party_foul = String::from("Using memory unsafe languages is a: ");
39+
decrypt(encrypted_buffer, &mut party_foul);
40+
}
41+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
use xor_cryptor::XORCryptor;
2+
3+
fn decrypt(encrypted_buffer: Vec<u8>, borrowed_string: &mut String) {
4+
// Key for decryption
5+
let key = String::from("CSUCKS");
6+
7+
// Editing our borrowed value
8+
borrowed_string.push_str("PARTY FOUL! Here is your flag: ");
9+
10+
// Create decryption object
11+
let res = XORCryptor::new(&key);
12+
if res.is_err() {
13+
return;
14+
}
15+
let xrc = res.unwrap();
16+
17+
// Did you know you have to do "unsafe operations in Rust?
18+
// https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html
19+
// Even though we have these memory safe languages, sometimes we need to do things outside of the rules
20+
// This is where unsafe rust comes in, something that is important to know about in order to keep things in perspective
21+
22+
// unsafe {
23+
// Decrypt the flag operations
24+
let decrypted_buffer = xrc.decrypt_vec(encrypted_buffer);
25+
26+
// Creating a pointer
27+
let decrypted_ptr = decrypted_buffer.as_ptr();
28+
let decrypted_len = decrypted_buffer.len();
29+
30+
// Unsafe operation: calling an unsafe function that dereferences a raw pointer
31+
let decrypted_slice = std::slice::from_raw_parts(decrypted_ptr, decrypted_len);
32+
33+
borrowed_string.push_str(&String::from_utf8_lossy(decrypted_slice));
34+
// }
35+
println!("{}", borrowed_string);
36+
}
37+
38+
fn main() {
39+
// Encrypted flag values
40+
let hex_values = ["41", "30", "20", "63", "4a", "45", "54", "76", "12", "90", "7e", "53", "63", "e1", "01", "35", "7e", "59", "60", "f6", "03", "86", "7f", "56", "41", "29", "30", "6f", "08", "c3", "61", "f9", "35"];
41+
42+
// Convert the hexadecimal strings to bytes and collect them into a vector
43+
let encrypted_buffer: Vec<u8> = hex_values.iter()
44+
.map(|&hex| u8::from_str_radix(hex, 16).unwrap())
45+
.collect();
46+
47+
let mut party_foul = String::from("Using memory unsafe languages is a: ");
48+
decrypt(encrypted_buffer, &mut party_foul);
49+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc_fingerprint":16153101823103919521,"outputs":{"13331785392996375709":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/usr\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.85.1 (4eb161250 2025-03-15) (Arch Linux rust 1:1.85.1-1)\nbinary: rustc\ncommit-hash: 4eb161250e340c8f48f66e2b929ef4a5bed7c181\ncommit-date: 2025-03-15\nhost: x86_64-unknown-linux-gnu\nrelease: 1.85.1\nLLVM version: 19.1.7\n","stderr":""}},"successes":{}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Signature: 8a477f597d28d172789f06886806bc55
2+
# This file is a cache directory tag created by cargo.
3+
# For information about cache directory tags see https://bford.info/cachedir/

src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/.cargo-lock

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
b052dc547c23e8d7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"[\"default\", \"std\"]","declared_features":"[\"default\", \"std\"]","target":14239918459391072445,"profile":15657897354478470176,"path":11905571973449469681,"deps":[[3528074118530651198,"crossbeam_epoch",false,17977530045050467690],[15465834242991917682,"crossbeam_utils",false,14741511271494303972]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/crossbeam-deque-e01e7fb4adbd8daa/dep-lib-crossbeam_deque","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6a3525b253047df9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"[\"alloc\", \"std\"]","declared_features":"[\"alloc\", \"default\", \"loom\", \"loom-crate\", \"nightly\", \"std\"]","target":5830366855417007734,"profile":15657897354478470176,"path":16258193909962029838,"deps":[[15465834242991917682,"crossbeam_utils",false,14741511271494303972]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/crossbeam-epoch-f4b6ad9386a97d5f/dep-lib-crossbeam_epoch","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e4c0d5c5655e94cc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"[\"default\", \"std\"]","declared_features":"[\"default\", \"loom\", \"nightly\", \"std\"]","target":588591820597892370,"profile":11274545624197158258,"path":12099714956433143013,"deps":[[15465834242991917682,"build_script_build",false,18342298036996179375]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/crossbeam-utils-df81cabd9f4557cb/dep-lib-crossbeam_utils","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
33a0f60f78f0afd1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"[\"default\", \"std\"]","declared_features":"[\"default\", \"loom\", \"nightly\", \"std\"]","target":5408242616063297496,"profile":2175425913391121376,"path":15804061795559296822,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/crossbeam-utils-e2f32f4f693e23d7/dep-build-script-build-script-build","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
af85800be2ee8cfe
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[15465834242991917682,"build_script_build",false,15109559673305866291]],"local":[{"RerunIfChanged":{"output":"debug/build/crossbeam-utils-e8a62791a1623f8a/output","paths":["no_atomic.rs"]}}],"rustflags":[],"config":0,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
48612376b7cbce43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"[]","declared_features":"[\"default\", \"serde\", \"use_std\"]","target":5928621874859211260,"profile":15657897354478470176,"path":7432792881878603922,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/either-2fed822247c480b9/dep-lib-either","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
26bd422f5f18efe8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"[]","declared_features":"[\"web_spin_lock\"]","target":16352802939243045765,"profile":15657897354478470176,"path":12211936861091723504,"deps":[[9705675356647965917,"rayon_core",false,10200643873226757984],[10298382533111201748,"either",false,4886066634565050696]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/rayon-cb1cc5028bc6aba8/dep-lib-rayon","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d8a6db5b29b877d5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[9705675356647965917,"build_script_build",false,6913118559067626990]],"local":[{"RerunIfChanged":{"output":"debug/build/rayon-core-854be806e20d23f8/output","paths":["build.rs"]}}],"rustflags":[],"config":0,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6017f2af8ef78f8d
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"[]","declared_features":"[\"web_spin_lock\"]","target":9103977627086248499,"profile":15657897354478470176,"path":17900272853038485929,"deps":[[7337430222156118690,"crossbeam_deque",false,15557723929658020528],[9705675356647965917,"build_script_build",false,15381965540081510104],[15465834242991917682,"crossbeam_utils",false,14741511271494303972]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/rayon-core-867bdac6e2a6d1d0/dep-lib-rayon_core","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
eedd62c3b354f05f
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"[]","declared_features":"[\"web_spin_lock\"]","target":5408242616063297496,"profile":2225463790103693989,"path":8528598664176003311,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/rayon-core-e0e2a185a55afb4f/dep-build-script-build-script-build","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ec36bba83a7b72e5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"[]","declared_features":"[]","target":4514799321564782555,"profile":8731458305071235362,"path":4942398508502643691,"deps":[[7438863509268696723,"xor_cryptor",false,10961669275791452276]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/rust_proj-0190189bf0cf9e55/dep-bin-rust_proj","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aeacdd50262e191f
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"[]","declared_features":"[]","target":4514799321564782555,"profile":1722584277633009122,"path":4942398508502643691,"deps":[[7438863509268696723,"xor_cryptor",false,10961669275791452276]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/rust_proj-fe127ecd45c3faa8/dep-test-bin-rust_proj","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
74e8dc0021ac1f98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":13060510487386344644,"features":"[]","declared_features":"[]","target":3545222828950601293,"profile":15657897354478470176,"path":16822472728967828384,"deps":[[10697383615564341592,"rayon",false,16784661133326990630]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/xor_cryptor-acbe235b6f6a3d9a/dep-lib-xor_cryptor","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/home/bugs/Playground/spritnote/src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/build/crossbeam-utils-e2f32f4f693e23d7/build_script_build-e2f32f4f693e23d7: /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-utils-0.8.20/build.rs /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-utils-0.8.20/no_atomic.rs /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-utils-0.8.20/build-common.rs
2+
3+
/home/bugs/Playground/spritnote/src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/build/crossbeam-utils-e2f32f4f693e23d7/build_script_build-e2f32f4f693e23d7.d: /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-utils-0.8.20/build.rs /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-utils-0.8.20/no_atomic.rs /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-utils-0.8.20/build-common.rs
4+
5+
/home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-utils-0.8.20/build.rs:
6+
/home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-utils-0.8.20/no_atomic.rs:
7+
/home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-utils-0.8.20/build-common.rs:
8+
9+
# env-dep:CARGO_PKG_NAME=crossbeam-utils
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cargo:rerun-if-changed=no_atomic.rs
2+
cargo:rustc-check-cfg=cfg(crossbeam_no_atomic,crossbeam_sanitize_thread)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/bugs/Playground/spritnote/src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/build/crossbeam-utils-e8a62791a1623f8a/out

src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/build/crossbeam-utils-e8a62791a1623f8a/stderr

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cargo:rerun-if-changed=build.rs
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/bugs/Playground/spritnote/src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/build/rayon-core-854be806e20d23f8/out

src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/build/rayon-core-854be806e20d23f8/stderr

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/home/bugs/Playground/spritnote/src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/build/rayon-core-e0e2a185a55afb4f/build_script_build-e0e2a185a55afb4f: /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/build.rs
2+
3+
/home/bugs/Playground/spritnote/src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/build/rayon-core-e0e2a185a55afb4f/build_script_build-e0e2a185a55afb4f.d: /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/build.rs
4+
5+
/home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/build.rs:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/home/bugs/Playground/spritnote/src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/deps/libcrossbeam_deque-e01e7fb4adbd8daa.rmeta: /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-deque-0.8.5/src/lib.rs /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-deque-0.8.5/src/deque.rs
2+
3+
/home/bugs/Playground/spritnote/src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/deps/libcrossbeam_deque-e01e7fb4adbd8daa.rlib: /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-deque-0.8.5/src/lib.rs /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-deque-0.8.5/src/deque.rs
4+
5+
/home/bugs/Playground/spritnote/src/PICOCTF/GENERAL/rust-fixme-3/fixme3/target/debug/deps/crossbeam_deque-e01e7fb4adbd8daa.d: /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-deque-0.8.5/src/lib.rs /home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-deque-0.8.5/src/deque.rs
6+
7+
/home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-deque-0.8.5/src/lib.rs:
8+
/home/bugs/.local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-deque-0.8.5/src/deque.rs:

0 commit comments

Comments
 (0)