Skip to content

Instantly share code, notes, and snippets.

@gmh5225
gmh5225 / bootstrap.sh
Created February 4, 2024 04:21 — forked from KireinaHoro/bootstrap.sh
Bootstrap aarch64-linux-android clang/llvm toolchain with sanitizers support
#!/bin/bash
# script that creates clang/llvm cross toolchain for aarch64 android target
# compile a hello world program that runs on AOSP Android:
# test with: adb push hello /data/cache && adb shell /data/cache/hello
# GCC:
# C: aarch64-linux-android-gcc hello.c -o hello -pie
# C++: aarch64-linux-android-g++ hello.cc -o hello -pie -fPIC -static-libgcc \
# -nostdlib -L/usr/local/aarch64-linux-android/lib -lc++ -lc -nostdinc++ \
# -I/usr/local/aarch64-linux-android/include/c++/v1 -std=c++11
# Clang/LLVM:
@gmh5225
gmh5225 / FPGBC_update.py
Created January 24, 2024 10:48 — forked from shinyquagsire23/FPGBC_update.py
FPGBC updater script for macOS (and maybe Linux) using Python
# pip3 install pyusb
# Requires root on macOS to kick the kernel driver off the device.
import usb.core
import usb.util
import struct
import time
import base64
import sys
@gmh5225
gmh5225 / Android Kernel Compilation Guide.md
Created January 20, 2024 22:04 — forked from P1N2O/README.md
Guide to Compile an Android Kernel with Clang

Android Kernel Compilation Guide

This gist is intended to assist beginners, like myself, in getting started with Android Kernel Compilation. Please note that while I'm sharing my setup and process, this guide may not be entirely accurate, and I welcome suggestions from experienced developers to improve it.

Installing Build Tools

I am on Arch, so I will be using pacman to install the base-devel package group.

sudo pacman -S base-devel

On a Debian based distro, you can use apt and install the build-essential package.

@gmh5225
gmh5225 / get_proc_address.c
Created November 28, 2023 08:53 — forked from OtterHacker/get_proc_address.c
Custom GetProcAddress and GetModuleHandle parsing forwarded export
unsigned long hash_string(void* buffer, unsigned long size, char* extension){
unsigned char current = 0;
unsigned long hash = 0;
unsigned char* currentChar = NULL;
hash = 1337;
currentChar = (void*)buffer;
hash++;
while(1){
current = *currentChar;
@gmh5225
gmh5225 / byorwx.cpp
Created November 24, 2023 14:33 — forked from dadevel/byorwx.cpp
Bring your own RWX section
#include <cstdint>
// x86_64-w64-mingw32-g++ -lstdc++ -static -O3 -s -DPAYLOAD_SIZE=276 ./byorwx.cpp ./section.S -o ./byorwx.exe
// msfvenom -p windows/x64/exec -f c CMD=calc.exe --encrypt xor --encrypt-key abcdef
unsigned char buf[] =
"\x9d\x2a\xe0\x80\x95\x8e\xa1\x62\x63\x64\x24\x37\x20\x32"
"\x31\x35\x33\x2e\x50\xb0\x06\x2c\xee\x34\x01\x2a\xe8\x36"
"\x7d\x2e\xea\x30\x43\x2c\xee\x14\x31\x2a\x6c\xd3\x2f\x2c"
"\x2c\x53\xaa\x2c\x54\xa6\xcd\x5e\x02\x18\x67\x4a\x41\x23"
@gmh5225
gmh5225 / FindDirectX9.cmake
Created November 7, 2023 04:20 — forked from billyquith/FindDirectX9.cmake
Cmake Find DirectX config
# Find DirectX9
message("Looking for DirectX9...")
file(GLOB DX9_SEARCH_PATHS
"$ENV{DXSDK_DIR}/Include"
"$ENV{PROGRAMFILES}/Microsoft DirectX SDK*/Include"
"$ENV{PROGRAMFILES}/Microsoft SDKs/Windows/*/Include"
"C:/Program Files (x86)/Windows Kits/*/include/um"
"C:/Program Files/Windows Kits/*/include/um"
@gmh5225
gmh5225 / LLVMParser.g4
Created October 5, 2023 00:53 — forked from rindPHI/LLVMParser.g4
ANTLR4 parser for LLVM IR (human readable ASM representation), parser part (lexer is separate)
// This ANTLR4 parser grammar is based on the parser part of an LLVM BNF grammar from
// https://gist.github.com/mewmew/a2487392d5519ef49658fd8f84d9eed5,
// which in turn has been based on the source code of the official LLVM project,
// as of 2018-02-19 (rev db070bbdacd303ae7da129f59beaf35024d94c53).
// * lib/AsmParser/LLParser.cpp
// === [ Module ] ==============================================================
// https://llvm.org/docs/LangRef.html#module-structure
@gmh5225
gmh5225 / CVE-2023-41892-POC.md
Created September 24, 2023 15:32 — forked from to016/CVE-2023-41892-POC.md
CVE-2023-41892 (Craft CMS Remote Code Execution) - POC

This Gist provides a Proof-of-Concept (POC) for CVE-2023-41892, a Craft CMS vulnerability that allows Remote Code Execution (RCE).

Overview

CVE-2023-41892 is a security vulnerability discovered in Craft CMS, a popular content management system. Craft CMS versions affected by this vulnerability allow attackers to execute arbitrary code remotely, potentially compromising the security and integrity of the application.

POC

import requests
@gmh5225
gmh5225 / writeup.md
Created September 19, 2023 10:32 — forked from avlidienbrunn/writeup.md
challenge writeup content-type shenanigans

Description

This was a challenge to demonstrate how the content-type header can be used to fool the browser into treating the HTTP response body in unexpected ways.

Source

As the harder solution works for both, heres source:

php
@gmh5225
gmh5225 / superfetch_physical_memory_ranges_v2.hpp
Created September 15, 2023 06:25 — forked from Midi12/superfetch_physical_memory_ranges_v2.hpp
NtQuerySystemInformation SystemSuperfetchInformation Version 2 (since windows 10.0.18362.1 at least)
// see more @ https://www.unknowncheats.me/forum/general-programming-and-reversing/397104-ntquerysysteminformation-systemsuperfetchinformation.html
#pragma once
#include <cstdint>
#include <vector>
#include "lazy_loader_light.hpp"
#include "ntstatus.hpp"