From 7dc91ca752b7fa22ee829ff16c090cc57792a649 Mon Sep 17 00:00:00 2001 From: lark Date: Sun, 24 May 2026 23:01:14 -0700 Subject: [PATCH] migration --- README.md | 212 +- _himi | 86 + config.sh | 48 + himi | 932 +++++ himi.bash | 127 + install.sh | 195 + lists/animals.txt | 1109 ++++++ lists/bips.txt | 2048 +++++++++++ lists/colors.txt | 5611 +++++++++++++++++++++++++++++ lists/eff.txt | 7776 ++++++++++++++++++++++++++++++++++++++++ lists/female_names.txt | 4775 ++++++++++++++++++++++++ lists/food.txt | 1307 +++++++ lists/greek_gods.txt | 445 +++ lists/male_names.txt | 1403 ++++++++ lists/pokemon.txt | 1024 ++++++ splash.txt | 27 + 16 files changed, 27124 insertions(+), 1 deletion(-) create mode 100644 _himi create mode 100644 config.sh create mode 100644 himi create mode 100644 himi.bash create mode 100755 install.sh create mode 100644 lists/animals.txt create mode 100644 lists/bips.txt create mode 100644 lists/colors.txt create mode 100644 lists/eff.txt create mode 100644 lists/female_names.txt create mode 100644 lists/food.txt create mode 100644 lists/greek_gods.txt create mode 100644 lists/male_names.txt create mode 100644 lists/pokemon.txt create mode 100644 splash.txt diff --git a/README.md b/README.md index cdfd4dd..5f229b1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,213 @@ # himitsu -himitsu - secrets generation using custom word-lists, character sets, and templating \ No newline at end of file +Memorable secret generator with configurable word lists and templates. + +## Install + +```bash +# Requires GNU coreutils (macOS: brew install coreutils) +git clone && cd himitsu +./install.sh +``` + +## Usage + +### Generating secrets +```bash +himi # generate → clipboard +himi -o # generate → clipboard + stdout +himi -o secure # use 'secure' template → clipboard + stdout +himi -n 5 -o easy # generate 5 'easy' secrets → clipboard + stdout +himi test '{word}-{num:2}' # test a custom template +``` + +### Use in scripts +```bash +# SSH key with generated passphrase (on clipboard too, ready to save) +ssh-keygen -t ed25519 -f mykey -P "$(himi -o)" + +# Encrypt a file +openssl enc -aes-256-cbc -pbkdf2 -in secrets.tar -out secrets.enc -k "$(himi -o secure)" + +# Generate and reuse in the same session +PASS="$(himi -o)" +htpasswd -b -c .htpasswd admin "$PASS" + +# Wi-Fi password for a new AP +nmcli dev wifi hotspot ssid mynet password "$(himi -o wifi)" +``` + +### Managing word lists and config +```bash +himi list # show lists and enabled status +himi add pokemon.txt # add + enable a list +himi disable pokemon # disable a list +himi enable pokemon # re-enable +himi rebuild # regenerate pool after manual changes +himi config # open config in $EDITOR (auto-rebuilds on change) +``` + +## Checking entropy +```bash +himi entropy # show all templates with entropy +himi entropy secure # show specific template +``` + +``` +TEMPLATE EXAMPLE ENTROPY +-------- ------- ------- +default MAPLE42-river17-K7M93 ≈57.9 bits +easy crane-B4R-842 ≈38.8 bits +secure helm-river-A3K9P-fox-M2X8R! ≈94.4 bits +pin 483927 ≈19.9 bits +diceware crane-helm-tiger-river-maple ≈69.0 bits +wifi TIGER-maple4827 ≈42.9 bits +phone ACFG-KM3Y-XTWD ≈55.0 bits +``` + +## Templates + +Edit `~/.config/himi/config.sh` to customize: + +```bash +TEMPLATES=( + "default|{word!}{num:2}-{word!}{num:2}-{alpha:3}{num:2}" + "easy|{word}-{alpha:3}-{num:3}" + "secure|{word}-{word}-{alpha:5}-{word}-{alpha:5}{special:1}" + "pin|{num:6}" + "diceware|{word}-{word}-{word}-{word}-{word}" + "wifi|{word!}-{word!}{num:4}" + "phone|{safe:4}-{safe:4}-{safe:4}" +) +``` + +**Tokens:** +| Token | Output | Entropy | +|-------|--------|---------| +| `{word}` | `maple` | ~13.8 bits* | +| `{WORD}` | `MAPLE` | ~13.8 bits* | +| `{Word}` | `Maple` | ~13.8 bits* | +| `{word!}` | `maple` or `MAPLE` | ~14.8 bits* | +| `{Word!}` | `maple`/`Maple`/`MAPLE` | ~15.4 bits* | +| `{alpha:N}` | N chars, Crockford Base32 | ~5.0 bits/char | +| `{safe:N}` | N chars, ultra-safe (no ambiguous chars) | ~4.6 bits/char | +| `{num:N}` | N digits | ~3.3 bits/char | +| `{special:N}` | N from `!?@#%~=+` | ~3.0 bits/char | + +\* Word entropy depends on pool size. Values shown assume all built-in lists enabled (~14k words, ~13.8 bits/word). + +## Entropy rules of thumb + +| Bits | Strength | Use case | +|------|----------|----------| +| ~40 | Casual | Low-value accounts, rate-limited logins | +| ~50 | Reasonable | Personal accounts | +| ~60 | Strong | Important accounts, recommended minimum | +| ~80 | Very strong | High-value targets, offline cracking resistance | +| ~128 | Paranoid | Nation-state threat models | + +Online attacks (rate-limited) need far less entropy than offline attacks (cracking leaked hashes). When in doubt, aim for 60+ bits. + +## Uninstall + +```bash +himi uninstall +``` + +## Included Wordlists + +Word lists are curled from GitHub and cleaned up. Here's how each built-in list was made, you can use these as examples in case you want to add your own. The built-in wordlists provide 15175 total words, after deduplication. + +### bips.txt (2048 words) +```bash +curl 'https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/english.txt' | \ + tr -d '" ,[]\t' | tr 'A-Z' 'a-z' | + sed '/^$/d' | sort -u > bips.txt +``` + +### eff.txt (7776 words) +```bash +curl 'https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt | cut -f2' | \ + tr -d '" ,[]\t' | tr 'A-Z' 'a-z' \ + | sed '/^$/d' | sort -u > eff.txt +``` + +### female_names.txt (4775 words) +```bash +curl 'https://raw.githubusercontent.com/arineng/arincli/refs/heads/master/lib/female-first-names.txt' \ + | tr -d '\" ,[]\t' | tr 'A-Z' 'a-z' \ + | sed '/^$/d' | sort -u > ftemp +curl 'https://raw.githubusercontent.com/attackdebris/kerberos_enum_userlists/refs/heads/master/Female_First_Names_Top_500.txt' \ + | tr -d '" ,[]\t' | tr 'A-Z' 'a-z' \ + | sed '/^$/d' | sort -u >> ftemp +curl 'https://raw.githubusercontent.com/righteousgambit/quiet-riot/refs/heads/main/wordlists/femalenames-usa-top1000.txt' \ + | tr -d '" ,[]\t' | tr 'A-Z' 'a-z' \ + | sed '/^$/d' | sort -u >> ftemp +cat ftemp | sort -u > female_names.txt +``` + +### male_names.txt (1403 words) +```bash +curl 'https://raw.githubusercontent.com/arineng/arincli/refs/heads/master/lib/male-first-names.txt' \ + | tr -d '" ,[]\t' | tr 'A-Z' 'a-z' \ + | sed '/^$/d' | sort -u > mtemp +curl 'https://raw.githubusercontent.com/attackdebris/kerberos_enum_userlists/refs/heads/master/Male_First_Names_Top_500.txt' \ + | tr -d '" ,[]\t' | tr 'A-Z' 'a-z' \ + | sed '/^$/d' | sort -u >> mtemp +curl 'https://raw.githubusercontent.com/righteousgambit/quiet-riot/refs/heads/main/wordlists/malenames-usa-top1000.txt' \ + | tr -d '" ,[]\t' | tr 'A-Z' 'a-z' \ + | sed '/^$/d' | sort -u >> mtemp +cat mtemp | sort -u > male_names.txt +``` + +### pokemon.txt (1024 words) +```bash +curl 'https://raw.githubusercontent.com/sindresorhus/pokemon/main/data/en.json' \ + | tr -d '" ,[]\t' | tr 'A-Z' 'a-z' \ + | sed '/^$/d' | sort -u > pokemon.txt +``` + +### greek_gods.txt (445 words) +```bash +curl 'https://raw.githubusercontent.com/katkaypettitt/greek-gods/refs/heads/main/greek_gods.csv' \ + | cut -d ',' -f1 | tr -d ' [],\"' |tr 'A-Z' 'a-z' | sort -u > greek_gods.txt +``` + +### colors.txt (5611 words) +```bash +curl -Ls 'https://raw.githubusercontent.com/meodai/color-names/refs/heads/main/src/colornames.csv' | \ + awk -F',' 'NR > 1 {print $1}' | grep -E "^[A-Za-z]{4,12}$" | tr 'A-Z' 'a-z' \ + >> colors.tmp +curl -Ls 'https://raw.githubusercontent.com/k-kawakami/colorfulnet/refs/heads/master/example_data/wikipedia-list-of-colors.txt' | \ + tr 'A-Z ' 'a-z\n' | tr -d '()' | grep -E "^[a-z]{4,12}$" | sort -u >> colors.tmp +cat colors.tmp | sort -u | tee colors.txt | wc -l + +``` + +### food.txt (1307 words) +```bash +curl -Ls 'https://raw.githubusercontent.com/schollz/food-identicon/master/ingredients.txt' | \ + grep -Ev "(\ |:|â|¼|ã|\.)" | tr 'A-Z' 'a-z' | \ + grep -E "^[a-z-]{4,12}$" >> food.tmp +curl -Ls 'https://gist.githubusercontent.com/peterdemin/920ec3eaaa0a9f3cafd3a855557f5e0c/raw/9c7337d7f6274de704f9018ed363d51dd7a0b128/food.txt' | \ + tr ' -' '\n' | tr 'A-Z' 'a-z' | \ + grep -E "^[a-z]{4,12}$" | sort -u >> food.tmp +cat food.tmp | sort -u | tee food.txt | wc -l +``` + +### animals.txt (1109 words) +```bash +curl -Ls 'https://raw.githubusercontent.com/skjorrface/animals.txt/refs/heads/master/animals.txt' | \ + tr ' ' '\n' | tr 'A-Z' 'a-z' | grep -E "^[a-z-]{4,12}$" | \ + sort -u >> animals.tmp +curl -Ls 'https://raw.githubusercontent.com/timgates42/animal-list-factory/refs/heads/master/animals.txt' | \ + tr 'A-Z' 'a-z' | grep -E "^[a-z-]{4,12}$" | \ + sort -u >> animals.tmp +curl -Ls 'https://raw.githubusercontent.com/juliandefreitas/entity_lists/refs/heads/master/animals.csv' | \ + tr 'A-Z' 'a-z' | grep -E "^[a-z-]{4,12}$" | \ + sort -u >> animals.tmp +curl -Ls 'https://raw.githubusercontent.com/MikeInnes/SourceWalk.jl/refs/heads/master/animals.txt' | \ + tr 'A-Z' 'a-z' | grep -E "^[a-z-]{4,12}$" | \ + sort -u >> animals.tmp +cat animals.tmp | sort -u | tee animals.txt | wc -l +``` diff --git a/_himi b/_himi new file mode 100644 index 0000000..6f58d89 --- /dev/null +++ b/_himi @@ -0,0 +1,86 @@ +#compdef himi + +# himi zsh completion +# Drop in ~/.zfunc/ then run: compinit + +_himi() { + local config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/himi" + local lists_dir="${config_dir}/lists" + local pool_dir="${config_dir}/pool" + + # Get template names from config + local -a templates + if [[ -f "${config_dir}/config.sh" ]]; then + templates=(${(f)"$(grep -E '^\s*"[a-z]+\|' "${config_dir}/config.sh" 2>/dev/null | sed 's/.*"\([a-z]*\)|.*/\1/')"}) + fi + [[ ${#templates} -eq 0 ]] && templates=(default easy secure pin diceware) + + # Get list names + local -a all_lists enabled_lists disabled_lists + disabled_lists=(all) + enabled_lists=(all) + if [[ -d "$lists_dir" ]]; then + for f in "$lists_dir"/*.txt(N); do + local name=${${f:t}%.txt} + all_lists+=($name) + if [[ -L "$pool_dir/$name.txt" ]]; then + enabled_lists+=($name) + else + disabled_lists+=($name) + fi + done + fi + + local -a commands + commands=( + 'add:Add and enable a word list' + 'enable:Enable word list(s), or all' + 'disable:Disable word list(s), or all' + 'remove:Delete a word list permanently' + 'rebuild:Rebuild pool from enabled lists' + 'list:Show all lists and status' + 'entropy:Show entropy for templates' + 'test:Test a custom pattern' + 'config:Edit config in $EDITOR' + 'uninstall:Remove himi and all data' + ) + + _arguments -C \ + '1:command:->cmd' \ + '*:argument:->args' \ + '-o[Output to stdout]' \ + '-n[Number of secrets]:count:(1 3 5 10)' \ + '-h[Show help]' \ + '--help[Show help]' + + case "$state" in + cmd) + _describe -t commands 'commands' commands + _describe -t templates 'templates' templates + ;; + args) + case "${words[2]}" in + add) + _files -g '*.txt' + ;; + enable) + _describe -t lists 'available lists' disabled_lists + ;; + disable) + _describe -t lists 'enabled lists' enabled_lists + ;; + remove) + _describe -t lists 'available lists' all_lists + ;; + entropy) + _describe -t templates 'templates' templates + ;; + test) + _message 'pattern (e.g. {word}-{num:3})' + ;; + esac + ;; + esac +} + +_himi "$@" diff --git a/config.sh b/config.sh new file mode 100644 index 0000000..893a744 --- /dev/null +++ b/config.sh @@ -0,0 +1,48 @@ +# secret config — source'd by the secret command +# Location: ~/.config/himi/config.sh + +# ------------------------------------------------------------------------------ +# Character sets for random portions +# ------------------------------------------------------------------------------ +# Crockford Base32 (32 chars, 5.0 bits/char) +ALPHA_CHARSET='0123456789ABCDEFGHJKMNPQRSTVWXYZ' +# Ultra-safe - no easily confused characters (24 chars, 4.6 bits/char) +SAFE_CHARSET='ACDEFGHJKMNPQRTWXY234679' +NUM_CHARSET='0123456789' +SPECIAL_CHARSET='!?@#%~=+' + +# ------------------------------------------------------------------------------ +# Word filtering (applied when building pool.txt) +# ------------------------------------------------------------------------------ +WORD_MIN_LENGTH=4 +WORD_MAX_LENGTH=9 + +# ------------------------------------------------------------------------------ +# Templates +# Format: "name|pattern" +# +# Tokens: +# {word} — random word (lowercase) +# {WORD} — random word (UPPERCASE) +# {Word} — random word (Title Case) +# {word!} — random lower or UPPER (+1 bit entropy) +# {Word!} — random lower/Title/UPPER (+1.58 bits entropy) +# {alpha:N} — N chars, Crockford Base32 (5.0 bits/char) +# {safe:N} — N chars, ultra-safe (4.6 bits/char) +# {num:N} — N digits (3.3 bits/char) +# {special:N} — N characters from SPECIAL_CHARSET +# ------------------------------------------------------------------------------ +TEMPLATES=( + "default|{word!}{num:2}-{word!}{num:2}-{alpha:3}{num:2}" + "easy|{word}-{alpha:3}-{num:3}" + "secure|{word}-{word}-{alpha:5}-{word}-{alpha:5}{special:1}" + "pin|{num:6}" + "diceware|{word}-{word}-{word}-{word}-{word}" + "wifi|{word!}-{word!}{num:4}" + "phone|{safe:4}-{safe:4}-{safe:4}" +) + +# ------------------------------------------------------------------------------ +# Default template (used when no template name specified) +# ------------------------------------------------------------------------------ +DEFAULT_TEMPLATE="default" diff --git a/himi b/himi new file mode 100644 index 0000000..362128b --- /dev/null +++ b/himi @@ -0,0 +1,932 @@ +#!/usr/bin/env bash +set -euo pipefail + +# === himi === +# Memorable secret generator with configurable word lists and templates. +# +# Usage: +# himi rebuild Rebuild pool from enabled lists +# himi Generate secret (default template) → clipboard +# himi