Crates.io | vmprotect |
lib.rs | vmprotect |
version | 0.2.0 |
source | src |
created_at | 2019-08-10 22:31:45.692662 |
updated_at | 2020-12-27 19:19:01.970997 |
description | Unofficial VMProtect SDK for Rust |
homepage | |
repository | https://github.com/CertainLach/vmprotect/ |
max_upload_size | |
id | 155722 |
size | 364,086 |
WIP VMProtect SDK for rust
protected
attributeYou need to add this script to vmprotect project for this attribute
Syntax:
#[protected(TYPE[, lock])]
fn some_fn() { ... }
Example:
#[protected(virtualize)]
fn stringify<T: Display>(value: T) -> String {
format!("{}", value)
}
protected!
macro for codeSyntax:
use vmprotect::protected;
protected!(TYPE[, lock] "NAME"; { /*CODE*/ })
Protected code block is works like any other rust block, i.e:
use vmprotect::protected;
// Before protection
let a = {2+3};
// After protection
let a = protected!(virtualize "Addiction"; { 2 + 3 });
Example:
fn main() {
println!("{} + {} = {}", a, b, protected!(ultra "Adding"; {
a + b
}));
}
protected!
macro for textsSyntax:
use vmprotect::protected;
protected!(TYPE "TEXT")
This macro returns string, which can be transformed to normal one. This string is freed when dropped, implementations is located at vmprotect::strings::{encrypted_a::EncryptedStringA, encrypted_w::EncryptedStringW}
use vmprotect::protected;
// Before protection
let a = "Hello, world!";
// After protection
let a = protected!(cstr "Hello, world!");
// Also for wide-strings:
let a = protected!(cwstr "Привет, мир!");
Example:
use vmprotect::protected;
fn main() {
println!("Hello, {:?}!", protected!(A; "%Username%").into() as String);
}
TODO Section, see docs for now
Example:
println!("Your hwid is \"{}\"", vmprotect::licensing::get_hwid().to_str().unwrap());
Can be fixed by adding -C link-arg=-Wl,-headerpad,0x500
to rustc args
For cargo:
export RUSTFLAGS="-C link-arg=-Wl,-headerpad,0x500"
(Based on http://vmpsoft.com/forum/viewtopic.php?f=2&t=6837&start=15#p10527)