Skip to content

Instantly share code, notes, and snippets.

View JohnScience's full-sized avatar

Dmitrii - Demenev JohnScience

View GitHub Profile
@JohnScience
JohnScience / reflective_pe_loader.rs
Created April 4, 2024 06:33
An implementation of a reflective PE loader with a bit of hardcode for an example dll. It is meant to be librarified soon
use core::panic;
use core::ptr;
use goblin::pe::data_directories::DataDirectory;
use goblin::pe::section_table::{IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE};
use goblin::pe::PE;
use winapi::ctypes::c_void;
use winapi::shared::minwindef::HINSTANCE;
use winapi::um::memoryapi::VirtualAlloc;
use winapi::um::winnt::{
DLL_THREAD_ATTACH, MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE, PAGE_EXECUTE_READ,
pub struct VSRegKey(registry::RegKey);
impl VSRegKey {
pub fn open() -> Result<Self, registry::key::Error> {
let regkey = registry::Hive::LocalMachine.open(
r"SOFTWARE\WOW6432Node\Microsoft\VisualStudio",
registry::Security::Read,
)?;
Ok(Self(regkey))
}
@JohnScience
JohnScience / gist:12a28cb57c0c6e791ba3741dceeef584
Created August 26, 2023 08:17
My setup for Rust development (Chrome OS)
sudo apt update
# install essential build tools, notably cc linker
sudo apt install build-essential -y
# install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# configure the current shell, suggested by the installation script
source "$HOME/.cargo/env"
# install dependencies
sudo apt install software-properties-common apt-transport-https wget -y
# Import the GPG key provided by Microsoft to verify the package integrity.