Skip to content

Instantly share code, notes, and snippets.

@rcx
rcx / ControlFlowGraphDumper.java
Last active October 9, 2017 04:36
Java CFG linearization (2nd edition)
// (c) 2017 maple-ir project.
package org.mapleir.ir.algorithms;
import java.util.*;
import org.objectweb.asm.Label;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.LabelNode;
import org.objectweb.asm.tree.MethodNode;
// What is the problem with this implementation of List#addAll? Assume add() is implemented properly.
@Override
public boolean addAll(Collection<? extends Statement> c) {
boolean ret = false;
for (Statement s : c)
ret = ret || add(s);
return ret;
}
@rcx
rcx / PluginCracker.java
Last active October 9, 2017 04:41
Spigot plugin cracker
package org.spigotmc.plugincracker;
import org.objectweb.asm.*;
import org.objectweb.asm.commons.JSRInlinerAdapter;
import org.objectweb.asm.tree.*;
import org.objectweb.asm.util.CheckClassAdapter;
import java.io.*;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
@rcx
rcx / COMPILING.md
Created November 18, 2017 01:36
Compiling Veles on Windows

Note: change cmake -G parameter to whatever visual studio you need... just pass cmake -G "" to make it list all the options

git clone https://github.com/codilime/veles
cd veles

Open CMakeLists.txt add this at the top:

@rcx
rcx / codecave.cpp
Last active May 26, 2018 02:09
CS:GO code cave proof of concept
#include "stdafx.h"
DWORD getPID(LPCSTR szFileName)
{
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
PROCESSENTRY32 pe;
pe.dwFlags = sizeof(PROCESSENTRY32);
if (hSnapshot == INVALID_HANDLE_VALUE)
return 0;
@rcx
rcx / exploit.py
Created September 5, 2018 04:46
rtorrent 0.9.6 - Denial of Service (mirror from exploitdb)
# Mirror of https://www.exploit-db.com/exploits/44894/
# Exploit Title: rtorrent 0.9.6 - Denial of Service
# Date: 2018-01-10
# Exploit Author: ecx86
# Vendor Homepage: http://rtorrent.net
# Software Link: https://github.com/rakshasa/rtorrent/releases
# Version: <= 0.9.6
# Tested on: Debian GNU/Linux 9.4 (stretch)
@rcx
rcx / bytes.py
Created November 16, 2018 02:26
python3 encoding cheatsheet
#!/usr/bin/env python3.6
my_string = 'hello world'
# get bytes from string
my_bytes = my_string.encode() # default is utf8. accepts: utf-8, utf16, ascii, etc
print(my_bytes)
# get hex from bytes
my_hex = my_bytes.hex() # NEW in python3.5, on python<3.4 use binascii (un)hexlify
print(my_hex)
@rcx
rcx / CLASSAdv-FIXED.bt
Created June 5, 2019 07:23
010 editor Java classfile template with fix for classfiles version < 45.3
//------------------------------------------------
//--- 010 Editor v5.0 Binary Template
//
// File: CLASSAdv.bt
// Authors: Pishchik Ilya L. (RUS)
// Version: 1.2
// Purpose: A template for parsing Java Class (JVM) Files.
// Includes visualizing bytecode.
// Category: Programming
// File Mask: *.class
@rcx
rcx / README.md
Last active December 24, 2019 10:06
Generate self-signed certificate with openssl

Based off of this gist

I'm sick of typing the commands to self-sign these certs but I'm also way too lazy to setup proper PKI and ACME server. So instead I ssh into this server and do the needful each time, then rsync the key and crt LOL. All this crap is behind a VPN and the ssl is really just there so firefox will remember my passwords...

Why do we need faketime (apt install faketime)? Because Apple.

And same with the fancy extendedKeyUsage nonsense.

@rcx
rcx / fancurve.py
Last active January 28, 2020 11:10
Dell Poweredge manual fan controller
#!/usr/local/bin/python
import subprocess, os, time, collections, re
goal_temp = 40.0
k_p = 5
k_i = 0.1
k_d = 2
max_fan = 100
min_fan = 10 # keep the fans at x% at least so the server remains cool when idle.