Skip to content

Instantly share code, notes, and snippets.

@tothi
tothi / pdf2a4
Created August 4, 2019 11:35
convert pdf to a4 (fit-to-page) using imagemagick
# comment out <policy domain="delegate" rights="none" pattern="gs"/> from /etc/ImageMagick-7/policy.xml
convert -density 150 -define pdf:fit-page=A4 $src.pdf $dst.pdf
# adobe reader error -> use chrome to open & print (on win)
@tothi
tothi / frida-bypass-jb-check.js
Created September 15, 2019 09:06
simple jailbreak check bypass (frida hook for a custom app)
// simple jailbreak check bypass (frida hook for a custom app)
//
// launch app with frida hook:
// frida -U -l frida-bypass-jb-check.js -f ... --no-pause
var fileExistsAtPath = ObjC.classes.NSFileManager["- fileExistsAtPath:"];
var hideFile = 0;
var jailbreakFiles = ["/Applications/Cydia.app",
"/bin/bash",
@tothi
tothi / undrop_innodb.sh
Last active November 12, 2022 18:00
recover innodb from corrupted tablespace
### DANGEROUS OPERATIONS: do not run automatically
### (notes)
# https://web.archive.org/web/20170105064212/https://twindb.com/recover-corrupt-mysql-database/
DB=dbname; TBL=tablename
# from prod mysql instance
mysqlfrm --user=root --server=root:xxx@localhost --port=3307 /var/lib/mysql/${DB}/${TBL}.frm | sed -e 's/^CREATE TABLE `[^`]*`\./CREATE TABLE /g' -e '1d' -e '$a;' | grep -v '^#' > schemas/${DB}_${TBL}_author.sql
# action_0 (move files in case of '0' key is pressed):
find ~/images/ -type f -newermt "2019-12-07" ! -newermt "2019-12-15" | sort | feh -f - -F -A "mv %F ~/images_selected/%N"
#!/usr/bin/env python3
import socket
import struct
import re
import argparse
from termcolor import colored
# used for telnet switching
defaultcreds = 'admin:ipcam'
@tothi
tothi / filmhiradokonline-dl.py
Created November 2, 2020 12:35
download video files from filmhiradokline.hu
#!/usr/bin/env python3
#
# download video from https://filmhiradokonline.hu
#
import argparse
import requests
import urllib.request
import sys
from tqdm import tqdm
@tothi
tothi / compress-pdf-with-gs.md
Created January 24, 2021 23:32 — forked from vibegui/compress-pdf-with-gs.md
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
@tothi
tothi / antirootbypass.js
Created August 12, 2021 01:24
Frida antiroot check bypass for hu.khb (using com.vasco.digipass)
// Frida dumb antiroot check bypass on LineageOS for the
// com.vasco.digipass root checker in hu.khb banking app
//
// run with: frida -U -f hu.khb -l antirootbypass.js --no-pause
// root file existence check
Interceptor.attach(Module.findExportByName(null, 'access'), {
onEnter: function (args) {
this._pathname = args[0].readCString();
this._mode = args[1];
@tothi
tothi / usbgadget_razer.sh
Created August 22, 2021 09:52
Razer USB gadget on Android for Local Privilege Escalation on Windows
# MINIMAL USB gadget setup using CONFIGFS for simulating Razer Gaming HID
# devices for triggering the vulnerable Windows Driver installer
# credits for the Windows Driver install vuln: @j0nh4t
#
# https://twitter.com/j0nh4t/status/1429049506021138437
# https://twitter.com/an0n_r0/status/1429263450748895236
#
# the script was developed & tested on Android LineageOS 18.1
@tothi
tothi / decryptKerbTicket.py
Last active February 15, 2025 00:16 — forked from xan7r/decryptKerbTicket.py
Decrypt kerberos tickets and parse out authorization data
#!/usr/bin/env python3
# NOTE: this script was created for educational purposes to assist learning about kerberos tickets.
# Likely to have a few bugs that cause it to fail to decrypt some TGT or Service tickets.
#
# Recommended Instructions:
# Obtain valid kerberos tickets using Rubeus or mimikatz "sekurlsa::tickets /export"
# Optionally convert tickets to ccache format using kekeo "misc::convert ccache <ticketName.kirbi>"
# Obtain appropriate aes256 key using dcsync (krbtgt for TGT or usually target computer account for Service Ticket)
# Run this script to decrypt:
# ./decryptKerbTicket.py -k 5c7ee0b8f0ffeedbeefdeadbeeff1eefc7d313620feedbeefdeadbeefafd601e -t ./[email protected][email protected]