MCPcopy Create free account
hub / github.com/Nariod/RustPacker / assemble

Function assemble

src/puzzle.rs:286–314  ·  view source on GitHub ↗
(order: Order)

Source from the content-addressed store, hash-verified

284}
285
286pub fn assemble(order: Order) -> PathBuf {
287 println!("[+] Assembling Rust code..");
288
289 let template_path = template_path_for_execution(&order.execution);
290 let folder = create_root_folder(Path::new(OUTPUT_DIR))
291 .expect("Failed to create output folder");
292 copy_template(template_path, &folder).expect("Failed to copy template");
293
294 let src_dir = folder.join("src");
295 let main_rs = src_dir.join("main.rs");
296 let cargo_toml = folder.join("Cargo.toml");
297
298 let mut replacements = build_replacements(&order, &src_dir);
299
300 let is_proxy = order.proxy_dll.is_some();
301 let target_file = match order.format {
302 Format::Dll => apply_dll_format(&mut replacements, &main_rs, is_proxy),
303 Format::Exe => main_rs,
304 };
305
306 apply_replacements(&replacements, &target_file, &cargo_toml);
307
308 if is_proxy {
309 apply_proxy(&order, &folder);
310 }
311
312 println!("[+] Done assembling Rust code!");
313 folder
314}

Callers 1

mainFunction · 0.85

Calls 7

create_root_folderFunction · 0.85
copy_templateFunction · 0.85
build_replacementsFunction · 0.85
apply_dll_formatFunction · 0.85
apply_replacementsFunction · 0.85
apply_proxyFunction · 0.85

Tested by

no test coverage detected