Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ed4cc4980
|
||
|
|
cb1c6b936e
|
||
|
|
fb910d7237
|
||
|
|
d951a1ebed
|
||
|
|
6bd77dbe37
|
||
|
|
cbdcb32fc3
|
+8
-7
@@ -9,18 +9,19 @@ repository = "https://github.com/elituf/haxor"
|
||||
keywords = ["memory", "game", "hacking", "process"]
|
||||
|
||||
[dependencies]
|
||||
derive_more = { version = "2", features = ["debug", "display"] }
|
||||
derive_more = { version = "2", features = [
|
||||
"debug",
|
||||
"deref",
|
||||
"display",
|
||||
"from",
|
||||
] }
|
||||
log = "0.4"
|
||||
thiserror = "2"
|
||||
|
||||
[dependencies.windows]
|
||||
version = "0.62"
|
||||
features = [
|
||||
"Win32_Foundation",
|
||||
windows = { version = "0.62", features = [
|
||||
"Win32_System_Threading",
|
||||
"Win32_System_Diagnostics_ToolHelp",
|
||||
"Win32_System_Diagnostics_Debug",
|
||||
]
|
||||
] }
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
+5
-21
@@ -1,8 +1,8 @@
|
||||
use crate::{
|
||||
Error,
|
||||
error::Error,
|
||||
sys::{handle::Handle, memory, snapshot},
|
||||
};
|
||||
use derive_more::{Debug, derive::Display};
|
||||
use derive_more::{Debug, Display, From};
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
/// a process running on the system
|
||||
@@ -137,29 +137,13 @@ pub struct Module {
|
||||
pub base_size: usize,
|
||||
}
|
||||
|
||||
#[derive(Display)]
|
||||
#[derive(Display, From)]
|
||||
/// an identifier for searching for a process
|
||||
pub enum Identifier {
|
||||
/// process id to search for
|
||||
#[from(u32)]
|
||||
Pid(u32),
|
||||
/// process name to search for
|
||||
#[from(&str, String)]
|
||||
Name(String),
|
||||
}
|
||||
|
||||
impl From<u32> for Identifier {
|
||||
fn from(value: u32) -> Self {
|
||||
Self::Pid(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for Identifier {
|
||||
fn from(value: &str) -> Self {
|
||||
Self::Name(value.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for Identifier {
|
||||
fn from(value: String) -> Self {
|
||||
Self::Name(value)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-13
@@ -1,24 +1,16 @@
|
||||
use crate::Error;
|
||||
use std::ops::Deref;
|
||||
use crate::error::Error;
|
||||
use derive_more::Deref;
|
||||
use windows::Win32::{
|
||||
Foundation::{CloseHandle, HANDLE, INVALID_HANDLE_VALUE},
|
||||
Foundation::{CloseHandle, HANDLE},
|
||||
System::Threading::{OpenProcess, PROCESS_ALL_ACCESS, PROCESS_VM_READ, PROCESS_VM_WRITE},
|
||||
};
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
#[derive(Debug, Default, Deref, Clone)]
|
||||
pub struct Handle(pub HANDLE);
|
||||
|
||||
unsafe impl Send for Handle {}
|
||||
unsafe impl Sync for Handle {}
|
||||
|
||||
impl Deref for Handle {
|
||||
type Target = HANDLE;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Handle {
|
||||
fn drop(&mut self) {
|
||||
if let Err(why) = unsafe { CloseHandle(**self) } {
|
||||
@@ -36,7 +28,7 @@ impl Handle {
|
||||
"failed to open process with needed access: {why}",
|
||||
))
|
||||
})?;
|
||||
if handle == INVALID_HANDLE_VALUE {
|
||||
if handle.is_invalid() {
|
||||
return Err(Error::ObtainHandleError(
|
||||
"failed to get a valid handle".to_string(),
|
||||
));
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use crate::{Error, sys::handle::Handle};
|
||||
use crate::{error::Error, sys::handle::Handle};
|
||||
use std::{ffi::c_void, ptr};
|
||||
use windows::Win32::System::Diagnostics::Debug::{ReadProcessMemory, WriteProcessMemory};
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use crate::Error;
|
||||
use crate::error::Error;
|
||||
use windows::Win32::System::Diagnostics::ToolHelp::{
|
||||
CreateToolhelp32Snapshot, MODULEENTRY32W, Module32FirstW, Module32NextW, PROCESSENTRY32W,
|
||||
Process32FirstW, Process32NextW, TH32CS_SNAPMODULE, TH32CS_SNAPMODULE32, TH32CS_SNAPPROCESS,
|
||||
|
||||
Reference in New Issue
Block a user