Skip to content

Instantly share code, notes, and snippets.

View ryancdotorg's full-sized avatar

Ryan Castellucci ryancdotorg

View GitHub Profile
@ryancdotorg
ryancdotorg / builder.sh
Last active April 23, 2025 00:59
Script to statically cross compile various useful binaries (dropbear, socat, rsync, rpcapd, tcpdump, openssl, zstd) using musl-libc via musl.cc toolchains,
#!/bin/bash
# From https://gist.github.com/ryancdotorg/84275935f0b82578d8c222e2e915fc78
# built binaries at https://ryanc-musl-bins.s3.amazonaws.com/SHA256SUMS.html
set -eo pipefail
set -x
export BUILD_SCRIPT_DATE="$(date -r "$0" -Iseconds)"
PV_VERSION=1.8.5
@ryancdotorg
ryancdotorg / rsabd.py
Last active February 2, 2025 10:05
backdoored rsa key generation
#!/usr/bin/env python
import sys
import gmpy
import curve25519
from struct import pack
from hashlib import sha256
from binascii import hexlify, unhexlify
@ryancdotorg
ryancdotorg / wzip.py
Last active January 25, 2025 22:46
Partial/streaming zip downloader
#!/usr/bin/env python3
# SPDX-License-Identifier: 0BSD or CC0-1.0 or MIT-0 or Unlicense
# Copyright (c) 2023, Ryan Castellucci, No Rights Reserved
import io, sys
import datetime
import argparse
import requests
import operator
import struct
#!/usr/bin/env python3
from sys import argv, exit, stdin, stdout, stderr
from functools import partial
eprint = partial(print, file=stderr)
import io
import re
import sys
import struct
#pragma once
/* automatically generated */
#define U64H2BE(V) __extension__({ \
uint64_t _v = (V); \
uint8_t _t[8]; \
_t[0] = (_v & UINT64_C(0xFF00000000000000)) >> 56; \
_t[1] = (_v & UINT64_C(0x00FF000000000000)) >> 48; \
_t[2] = (_v & UINT64_C(0x0000FF0000000000)) >> 40; \
" automatically make script files executable when writing for the first time
function! NewScriptExec() abort
" check if this is a new file which starts with a shebang
if exists('s:new_file') && getline(1)[0:1] == '#!'
" based on https://stackoverflow.com/a/57539332
let l:file = expand('%')
let l:old_perm = getfperm(l:file)
" set the exec bit everywhere the read bit is set
let l:new_perm = substitute(l:old_perm, '\v(r.)-', '\1x', 'g')
if (l:old_perm != l:new_perm)
#!/bin/sh /dev/null
# vim: ft=bash:
__pat_safe() { expr "${1-}" : '[^[*!?:]*$' > /dev/null; }
if [ -z "${BASH_VERSION:-}" ]; then
# posix shells can't do variable indirection or pattern substitution
# directly, so we need to use eval and assorted commands
# https://stackoverflow.com/a/36235741/370695
PID3399646 2024-07-07 21:14:30,323 Info:Polynomial Selection (size optimized): Total time: 185661
PID3399646 2024-07-07 21:33:34,744 Info:Polynomial Selection (root optimized): Total time: 13144.5
PID3399646 2024-07-07 21:33:34,744 Info:Polynomial Selection (root optimized): Rootsieve time: 13211
PID3399646 2024-07-07 21:33:37,547 Info:Generate Factor Base: Total cpu/real time for makefb: 32.61/2.7235
PID3399646 2024-07-07 21:36:01,047 Info:Generate Free Relations: Total cpu/real time for freerel: 2243.09/143.364
PID3399646 2024-07-08 15:38:26,312 Info:Generate Free Relations: Total cpu/real time for freerel: 2243.09/143.364
PID3399646 2024-07-08 15:38:26,312 Info:Polynomial Selection (root optimized): Total time: 13144.5
PID3399646 2024-07-08 15:38:26,312 Info:Polynomial Selection (root optimized): Rootsieve time: 13211
PID3399646 2024-07-08 15:38:26,313 Info:Polynomial Selection (size optimized): Total time: 185661
PID3399646 2024-07-08 15:38:26,313 Info:Generate Factor Base: Total cpu/real time for makefb:
@ryancdotorg
ryancdotorg / uap_pass.sh
Created December 19, 2013 06:37
My guest wifi password rotation script, including qr code generator.
#!/bin/bash
TEMP_DIR="/run/shm"
FONT_DIR="/usr/local/share/fonts"
# generate a 12 character password comprised of lower case letters
NEW_PASS=`\
dd if=/dev/urandom bs=1 count=32 2>/dev/null | \
tr '\200-\377' '\0-\177' | \
tr '\0-\77' '\100-\177' | \
H4sICK4p5GECA2Zsb3BweS5pbWcA7PdTrzDM0gWKTtu2bdu2bdu2bVvPtG3btm3b2O/6zm84yb7Y
nXSnqscopNIXPT7bARLi5rvv/74sABDAuwAAOgIA2gEBGgEUFDv/c5AA3h4iRuZvIkYDTgEjFn4H
2oH+w9oBgWaQnYGu3jQ1AocAgAQOF9sBwNvAGSca5VsxZhC6AAH/o80gMPZHDkUORA5eAgAAIAD8
f+v/fUu1Eg4fDrwXADDyrRmumgfABWQG4eqtGWAGLWy4Mmy4GW4G4Xcg4APM6Tpy6v9YlLNRFBGU
v0Ou74wTjIv/XfUBAEVORREAHEYRAhzCt25GAUYQRk5FAP4OuJ5FTkbOtgMA/w7At25EUQJc/g9m
jKD8z4tgBHiBb92JYowcYmAQcN2xACgAb0f+78l0jgPXA9wKdQAA9wIAP9kx/nUA+D6VXP3+/20C
6qYEFvYOpgSe9q7kTqYEpnZW9p6WduYELhamBAqGdsaG1qbOwvZ2BMwEwipihASa9q4E7qb/EW3s
7a3/xzOzdyIwJDCzMTTnh4VSsbB0/s+2d3DwJLAwdCawtzMlJJCwtzH5z6L5L+5/FcxNXVz+F2hI
4GDxH05gbGhjQ0dHBwsFC6VqbkHzf4U5Gcid/w8wNSEwtPtvO1v/Z/2v1H+opROBs4urmRmBkaGx
9f/FqVv8ryP3/9/BTyD/XxZPU2dCApX/Uhlb/C+Nnbkp4f+YonYupk4EDobOzu72TiZcBP8NABAI