Skip to content

Instantly share code, notes, and snippets.

@robleh
robleh / ClosureImporter.cpp
Last active November 18, 2022 15:33
Import functions from default Windows DLLs without redeclaration
#include <Windows.h>
#include <assert.h>
#define IMPORT(function) function, #function
auto create_importer(const wchar_t* module_name) {
HMODULE module = ::GetModuleHandleW(module_name);
assert(nullptr != module);
return[=]<typename T>(T declaration, const char* symbol) -> T {
@robleh
robleh / stealnspoof.cpp
Last active July 24, 2021 21:02
Failed PoC attempt to spoof a parent PID and impersonate a process token.
#include <iostream>
#include <Windows.h>
int wmain(int argc, PWSTR argv[]) {
auto winlogon = ::OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_CREATE_PROCESS, FALSE, 636); // replace pid
if (INVALID_HANDLE_VALUE == winlogon) {
std::wcout << L"Failed to acquire winlogon handle: " << GetLastError();
return 1;
}
else {
@robleh
robleh / unsub.js
Last active December 9, 2021 21:20
Unsubscribe from all YouTube subcriptions
subButtons = document.getElementsByClassName("style-scope ytd-subscribe-button-renderer")
for (i = 0; i < subButtons.length; i++) {
if (subButtons[i].tagName == "TP-YT-PAPER-BUTTON") {
if (subButtons[i].getAttribute("aria-label").startsWith("Unsubscribe")) {
subButtons[i].click();
document.getElementsByClassName("style-scope yt-button-renderer style-blue-text size-default")[0].click();
}
}
}
@robleh
robleh / youtube-recommendations.filter
Last active December 7, 2025 18:17
uBlock Origin filter to remove YouTube homepage, endscreen and sidebar recommendations
! Homepage
www.youtube.com##.grid-disabled.grid.ytd-browse.style-scope > .ytd-two-column-browse-results-renderer.style-scope
! Sidebar recommendations
www.youtube.com##ytd-watch-next-secondary-results-renderer.ytd-watch-flexy.style-scope
! End screen tiles
www.youtube.com##.ytp-endscreen-content
@robleh
robleh / tcpshell.go
Last active June 6, 2022 08:15
Simple Golang TCP Reverse Shell Implant and Server
package main
import (
"flag"
"io"
"log"
"net"
"os"
"os/exec"
)
@robleh
robleh / HS Challenge
Last active August 29, 2015 14:17
Hacker School Challenge
'''This is a Python based socket server which runs on localhost port 4000.
Use /set?somekey=somekeyvalue to store a key pair. Use /get?key=somekey to
retrieve a key's value.'''
import socket
import sys
HOST = ""
PORT = 4000
key_pairs = {}
@robleh
robleh / CracklePop.c
Created March 10, 2015 03:14
Crackle Pop in C
#include <stdio.h>
#include <stdlib.h>
/*I'm learning C and I thought this would be a fun chance to practice.
I aimed to make a Crackle Pop program which could take any pair of integers as input.
My strategy was to process number pairs containing a factor and a multiple
differently than those which didn't. Thanks for taking the time to check it out!*/
int numbers_not_related(int crackle, int pop);
int numbers_related(int larger_abs, int smaller_abs, char const *crackle_or_pop);