Skip to content

Instantly share code, notes, and snippets.

View JorianWoltjer's full-sized avatar
💻
Hacking the mainframe

Jorian JorianWoltjer

💻
Hacking the mainframe
View GitHub Profile
@JorianWoltjer
JorianWoltjer / drag.py
Last active July 16, 2022 13:37
Python script that allows you to drag and drop Windows files into a WSL terminal, and copy them to the working directory
#!/usr/bin/python3
from blessed import Terminal
import subprocess
import shlex
term = Terminal()
def read_path():
# Read input from drag
full = ""
@JorianWoltjer
JorianWoltjer / .bashrc
Last active September 23, 2024 16:26
My dotfiles setup for WSL with way too many shortcuts
# Environment Variables
export SCREENDIR=$HOME/.screen
export DISCORD_WEBHOOK="https://discord.com/api/webhooks/[...]/[...]"
export DISCORD_TOKEN="[...]"
export MANPAGER="sh -c 'col -bx | bat -l man -p'" # highlight manpages with https://github.com/sharkdp/bat
export PROMPT_DIRTRIM=1 # truncate cwd in prompt to '...'
wt_duplicate() { # Keep working directory when splitting panes in Windows Terminal
echo -en '\e]9;9;"'
wslpath -w "$PWD" | tr -d '\n'
echo -en '"\x07'
@JorianWoltjer
JorianWoltjer / AdobeCtrlBackspace.ahk
Last active March 18, 2022 21:21
Enable Ctrl+Backspace shortcut to delete an entire word in Adobe apps
#SingleInstance Force
#IfWinActive, ahk_exe Adobe Premiere Pro.exe
^BS:: send, ^+{left}{delete}
#IfWinActive
#IfWinActive, ahk_exe AfterFX.exe
^BS:: send, ^+{left}{delete}
#IfWinActive
@JorianWoltjer
JorianWoltjer / truncated_java_random.md
Last active May 7, 2023 11:43
Practical `java.util.Random` LCG attack using LLL reduction

Practical java.util.Random LCG attack using LLL reduction

An easy-to-use Python script to sync up with the state of a java.util.Random generator after supplying a few samples. The internal seed has 48 bits, and every sample you give to the program will give some amount of bits of information. Here is a table to get an idea of how many samples you should provide per amount of bits in your input number:

bits bound samples (±)
4 16 25
6 64 12
8 256 8
16 65536 4
@JorianWoltjer
JorianWoltjer / ysoserial-fix.py
Last active February 5, 2024 15:59
Simple script that fixes all InaccessibleObjectException or IllegalAccessError for ysoserial using Java 17
#!/usr/bin/env python3
import subprocess
import re
import sys
YSOSERIAL_PATH = "/tool/ysoserial/ysoserial-all.jar" # https://github.com/frohoff/ysoserial/releases
JAVA_COMMAND = ["java"] # May be eg. ["java", "-Xmx2g"] or a path to a java binary
def extract_missing(error):
match = re.findall(r'java\.lang\.reflect\.InaccessibleObjectException: .*?: module (.*?) does not "opens (.*?)" to unnamed module @', error)
import argparse
from pathlib import Path
parser = argparse.ArgumentParser()
parser.add_argument("input", type=Path, help="Input audio file (.mp3, .wav, .m4a, etc.)")
parser.add_argument("output", type=Path, help="Output text file (.txt)")
parser.add_argument("-m", "--model", choices=["small", "medium", "large"], default="medium", help="Model size")
args = parser.parse_args()
from faster_whisper import WhisperModel