diff --git a/usr/bin/aaa b/usr/bin/aaa new file mode 100755 index 0000000..c5db6d6 --- /dev/null +++ b/usr/bin/aaa @@ -0,0 +1,25 @@ +#!/usr/bin/bash + +if [ "$#" -lt 1 ] || [ "$#" -gt 3 ]; then + echo "Usage: $0 arg1 [arg2] [arg3]" + exit 1 +fi + +# interactive session check +if [ -t 0 ]; then + echo -n "Delete existing output files? [y/N]: " + read ans + case "$ans" in + y|Y) rm -f *.school ;; + *) echo "Aborted"; exit 0 ;; + esac +fi + +# process input file +while IFS= read -r line; do + new_f="${line%.*}.school" + f > "$new_f" +done < "$FILE" + +exit 0 + diff --git a/usr/bin/stereogramer b/usr/bin/stereogramer new file mode 100755 index 0000000..a137321 --- /dev/null +++ b/usr/bin/stereogramer @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +import sys +import numpy as np +from PIL import Image + +def depth_map(w, h): + # simple demo: circular bump + y, x = np.ogrid[:h, :w] + cx, cy = w // 2, h // 2 + r = min(w, h) // 3 + d = ((x - cx)**2 + (y - cy)**2) <= r*r + return d.astype(np.float32) + +def stereogram(depth, pattern_w=64, max_shift=32): + h, w = depth.shape + img = np.random.randint(0, 256, (h, w), dtype=np.uint8) + + for y in range(h): + for x in range(pattern_w, w): + z = depth[y, x] + shift = int(z * max_shift) + src = x - pattern_w + shift + if src >= 0: + img[y, x] = img[y, src] + return img + +def main(argc, argv): + w = int(argv[1]) if argc > 1 else 600 + h = int(argv[2]) if argc > 2 else 400 + out = argv[3] if argc > 3 else "stereogram.png" + + d = depth_map(w, h) + s = stereogram(d) + + Image.fromarray(s).save(out) + print(out) + +if __name__ == "__main__": + main(len(sys.argv), sys.argv) diff --git a/usr/bin/unzip_bruteforce b/usr/bin/unzip_bruteforce index 8e33f57..7fa3cfb 100755 --- a/usr/bin/unzip_bruteforce +++ b/usr/bin/unzip_bruteforce @@ -1,28 +1,20 @@ #!/usr/bin/env bash -set -euo pipefail +set -uo pipefail # drop -e LIST=${1:-list} FILE=${2:-} -usage() { - echo "usage: $0 [wordlist] " - echo "default wordlist: ./list" - exit 1 -} - -[[ -z "$FILE" ]] && usage -[[ ! -f "$LIST" ]] && { echo "missing wordlist: $LIST"; exit 1; } -[[ ! -f "$FILE" ]] && { echo "missing zip: $FILE"; exit 1; } +[[ -z "$FILE" ]] && { echo "usage: $0 [wordlist] "; exit 1; } i=0 while IFS= read -r line; do ((i++)) - (( i % 1000 == 0 )) && echo "$i tried..." - if unzip -P "$line" -t "$FILE" >/dev/null 2>&1; then + unzip -P "$line" -t "$FILE" >/dev/null 2>&1 + if [[ $? -eq 0 ]]; then echo "FOUND: $line" exit 0 fi