-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathlibmhyprot.h
More file actions
106 lines (94 loc) · 2.86 KB
/
libmhyprot.h
File metadata and controls
106 lines (94 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#pragma once
#include <Windows.h>
//
// needed to prepare binary from memory to disk
//
#include <fstream>
//
// +---------------------------------------------------------------------------+
// | |
// | libmhyprot |
// | A wrapper for the vulnerable driver to execute mhyprot exploits |
// | |
// +---------------------------------------------------------------------------+
// | |
// | what it does: |
// | the binary of mhyprot.sys will be loaded our memory to disk. |
// | please note that there is an possibility that the driver will remain |
// | on your system if you did not unload the library properly, or |
// | somethings fails on the our processes. |
// | |
// +---------------------------------------------------------------------------+
//
namespace libmhyprot
{
//
// initialization of this library
//
extern bool mhyprot_init();
//
// uninitialization of this library
// note: if you did not call this, the driver will remains on your system.
//
extern void mhyprot_unload();
//
// read any memory on the kernel
// privilege level: kernel (ring-0)
//
extern bool read_kernel_memory(
uint64_t address,
void* buffer,
size_t size
);
//
// template definition of reading kernel memory above
//
template<class T> T read_kernel_memory(uint64_t address)
{
T buffer;
read_kernel_memory(address, &buffer, sizeof(T));
return buffer;
}
//
// read any process memory by specific process id
// without process handle which granted permission by system
// privilege level: kernel (ring-0)
//
extern bool read_user_memory_raw(
const uint32_t process_id,
uint64_t address,
void* buffer,
size_t size
);
//
// template definition of reading user memory above
//
template<class T> T read_user_memory(
const uint32_t process_id, uint64_t address
)
{
T buffer;
read_user_memory_raw(process_id, address, &buffer, sizeof(T));
return buffer;
}
//
// write any memory to the process by specific process id
// without process handle which granted permission by system
// privilege level: kernel (ring-0)
//
extern bool write_user_memory_raw(
const uint32_t process_id,
uint64_t address,
void* buffer,
size_t size
);
//
// template definition of writing user memory above
//
template<class T> bool write_user_memory(
const uint32_t process_id, uint64_t address, T value
)
{
return write_user_memory_raw(process_id, address, &value, sizeof(T));
}
}