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
107
108
109
110
111
//! # hypnus 🦀
//!
//! A Rust library for **execution obfuscation**, protecting memory regions during inactivity or sleep cycles.
//! It leverages thread pool timers, waits, and APC, with dynamic call stack spoofing and optional heap obfuscation.
//!
//! Built on top of [uwd](https://github.com/joaoviictorti/uwd).
//!
//! ## Features
//! - Sleep obfuscation with **TpSetTimer**, **TpSetWait**, or **APC**.
//! - Call stack spoofing during both API execution and sleep.
//! - Optional heap obfuscation (via [`HypnusHeap`]) and RWX control.
//! - Automatic CFG (Control Flow Guard) spoofed target registration.
//! - `#[no_std]` support (with `alloc`).
//!
//! ## Examples
//!
//! ### Sleep Obfuscation via ThreadPool Timer
//! ```rust,no_run
//! use hypnus::timer;
//! use core::ffi::c_void;
//!
//! let ptr = 0x13370000 as *mut c_void;
//! let size = 512;
//! let delay = 5;
//!
//! timer!(ptr, size, delay);
//! ```
//!
//! ### Sleep Obfuscation via ThreadPool Wait
//! ```rust,no_run
//! use hypnus::wait;
//! use core::ffi::c_void;
//!
//! let ptr = 0x13370000 as *mut c_void;
//! let size = 512;
//! let delay = 5;
//!
//! wait!(ptr, size, delay);
//! ```
//!
//! ### Sleep Obfuscation via APC (Foliage)
//! ```rust,no_run
//! use hypnus::foliage;
//! use core::ffi::c_void;
//!
//! let ptr = 0x13370000 as *mut c_void;
//! let size = 512;
//! let delay = 5;
//!
//! foliage!(ptr, size, delay);
//! ```
//!
//! ### Heap Obfuscation with RWX
//! ```rust,no_run
//! #![no_std]
//! #![no_main]
//!
//! extern crate alloc;
//!
//! use hypnus::{foliage, ObfMode, HypnusHeap};
//! use core::ffi::c_void;
//!
//! #[unsafe(no_mangle)]
//! fn main() -> u8 {
//! let data = b"\x90\x90\x90\xCC";
//! let ptr = data.as_ptr() as *mut c_void;
//! let size = data.len() as u64;
//! let delay = 5;
//!
//! foliage!(ptr, size, delay, ObfMode::Heap | ObfMode::Rwx);
//! 0
//! }
//!
//! #[global_allocator]
//! static ALLOCATOR: HypnusHeap = HypnusHeap;
//!
//! #[cfg(not(test))]
//! #[panic_handler]
//! fn panic(_info: &core::panic::PanicInfo) -> ! {
//! loop {}
//! }
//! ```
//!
//! # More Information
//!
//! For additional examples and usage, visit the [repository].
//!
//! [repository]: https://github.com/joaoviictorti/hypnus
extern crate alloc;
pub use *;
pub use *;