vmprotect

Crates.iovmprotect
lib.rsvmprotect
version0.2.0
sourcesrc
created_at2019-08-10 22:31:45.692662
updated_at2020-12-27 19:19:01.970997
descriptionUnofficial VMProtect SDK for Rust
homepage
repositoryhttps://github.com/CertainLach/vmprotect/
max_upload_size
id155722
size364,086
Yaroslav Bolyukin (CertainLach)

documentation

README

vmprotect crates.io

WIP VMProtect SDK for rust

Basic VMProtect features

protected attribute

You need to add this script to vmprotect project for this attribute

Syntax:

#[protected(TYPE[, lock])]
fn some_fn() { ... }
  • TYPE: Protection type
  • [, lock]: Require license to get this function to work.

Example:

#[protected(virtualize)]
fn stringify<T: Display>(value: T) -> String {
    format!("{}", value)
}

protected! macro for code

Syntax:

use vmprotect::protected;

protected!(TYPE[, lock] "NAME"; { /*CODE*/ })
  • NAME: Which name will be displayed in VMProtect GUI
  • TYPE: Protection type (mutate/virtualize/ultra per VMProtect docs)
  • [, lock]: For virtualize/ultra only, require license activation to get this function to work
  • CODE: Your code goes here

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 texts

Syntax:

use vmprotect::protected;

protected!(TYPE "TEXT")
  • TYPE: Text type, possible values: cstr (for normal c strings)/cwstr (for uint16_t c strings (Used i.e in windows))
  • TEXT: Your text, should be supported by your selected text type

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);
}

Licensing

TODO Section, see docs for now

HWID

Example:

println!("Your hwid is \"{}\"", vmprotect::licensing::get_hwid().to_str().unwrap());

Known problems

MacOS: Not enough space for the new segment in the file header

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)

Commit count: 33

cargo fmt