GithubHelp home page GithubHelp logo

libwhp's Introduction

libwhp

Windows Hypervisor Platform API for Rust: https://docs.microsoft.com/en-us/virtualization/api/

This crate takes advantage of the safety, lifetime, memory management and error handling features available in Rust while retaining the original design of the native Windows Hypervisor Platform (WHP) API.

Prerequisites

Make sure to have at least:

  • Windows 10 build 17134 (RS5 or above)
  • Windows Server 1809 (RS5 or above)

Enable the Windows Hypervisor Platform and reboot:

Dism /Online /Enable-Feature /FeatureName:HypervisorPlatform
shutdown /r /t 0

Last but not least, install Rust on Windows.

Running the demo example

  1. Clone the project's repository:
git clone https://github.com/insula-rs/libwhp
cd libwhp
  1. This example includes a payload (the "guest" binary) that needs to be compiled using GCC, e.g. with WSL (Windows Subsystem for Linux). All we need is make, gcc and ld. On Ubuntu:
wsl sudo apt-get update
wsl sudo apt-get dist-upgrade -y
wsl sudo apt-get install gcc make binutils -y
  1. Build the payload:
pushd examples\payload
wsl make
popd
  1. Build and run the example:
cargo run --example demo

Here's what it does:

  • Checks for the hypervisor presence
  • Creates a partition
  • Sets various partition properties, like the allowed exit types and CPUID results
  • Allocates and maps memory
  • Creates a vCPU
  • Sets up registers for long mode (64 bit)
  • Reads the payload in memory (payload.img)
  • Sets up the MMIO / IO port intruction emulator and related callbacks
  • Starts the vCPU loop
  • Handles various types of exits: CPUID, MSR read / write, IO port, MMIO, Halt, etc

libwhp's People

Contributors

alexpilotti avatar epakskape avatar jennymankin avatar petrutlucian94 avatar tkreuzer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.