Skip to content

Instantly share code, notes, and snippets.

@imbushuo
imbushuo / simplevm.c
Last active April 8, 2024 07:06
Demonstrates Hypervisor.Framework usage in Apple Silicon
// simplevm.c: demonstrates Hypervisor.Framework usage in Apple Silicon
// Based on the work by @zhuowei
// @imbushuo - Nov 2020
// To build:
// Prepare the entitlement with BOTH com.apple.security.hypervisor and com.apple.vm.networking WHEN SIP IS OFF
// Prepare the entitlement com.apple.security.hypervisor and NO com.apple.vm.networking WHEN SIP IS ON
// ^ Per @never_released, tested on 11.0.1, idk why
// clang -o simplevm -O2 -framework Hypervisor -mmacosx-version-min=11.0 simplevm.c
// codesign --entitlements simplevm.entitlements --force -s - simplevm
@zserge
zserge / kvm-host.c
Last active July 3, 2024 14:58
Tiny KVM host to at least partially run Linux kernel
#define _GNU_SOURCE
#include <asm/bootparam.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/kvm.h>
#include <linux/kvm_para.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@vkobel
vkobel / hash_kernel_module.c
Last active August 19, 2023 13:35
Example of using the Linux Kernel Crypto API for SHA256 hashing (tested with 5.6)
#include <linux/module.h>
#include <crypto/hash.h>
struct sdesc {
struct shash_desc shash;
char ctx[];
};
static struct sdesc *init_sdesc(struct crypto_shash *alg)
{
William Gibson
Neuromancer
Dedication:
for Deb
who made it possible
with love
@SamL98
SamL98 / skiphook.m
Created June 6, 2019 00:01
Hooks and accompanying code for Skiptracing
// MARK: SkipManager
#define NUM_SKIP_BYTES 10
#define BYTES_PER_LINE 34
#define SKIP_FILE_PATH "/Users/samlerner/Documents/Spotify/skipped.csv"
// SkipManager class to handle writing skips to files
class SkipManager {
public:
@victornpb
victornpb / deleteDiscordMessages.js
Last active July 9, 2024 07:46
Delete all your messages from DM or Channel in Discord
/*
This file is now hosted here:
https://github.com/victornpb/undiscord
*/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rverton
rverton / cowroot.c
Created October 21, 2016 14:06
CVE-2016-5195 (DirtyCow) Local Root PoC
/*
* (un)comment correct payload first (x86 or x64)!
*
* $ gcc cowroot.c -o cowroot -pthread
* $ ./cowroot
* DirtyCow root privilege escalation
* Backing up /usr/bin/passwd.. to /tmp/bak
* Size of binary: 57048
* Racing, this may take a while..
* /usr/bin/passwd overwritten
@bagder
bagder / stream-upload-formpost.c
Last active February 21, 2023 05:24
libcurl multipart formpost without content-length
#include <stdio.h>
#include <string.h>
#include <curl/curl.h>
#define MULTI_PART_CONTENT_TYPE_AUDIO "application/octet-stream"
#define DATA_SIZE 10
char demoBuffer[DATA_SIZE] = {1,2,3,4,5,6,7,8,9,0};
const char *metadata = "I am metadata";
int Curr_index ;