Collection of shell utilities, written in Python.
(once they become large or more useful, they will probably get moved to their own repositories)
Output random password from [[:alnum:]] ^ [0Ol1I], default 128 bits
- generates a random password with specifiable entropy
- chars: a-z, A-Z, 0-9, except: 0, O, l, 1, I (== 57 possible)
- default 22 char password (~128 bits entropy using our charset)
- uses python random.SystemRandom (on linux, os.urandom())
- uses random.choice() to map into range of suitable characters
Args:
- arg1: number of bits of entropy the secret should have, default 128
Calculation:
passlen = 22
setsize = len([[:alnum:]]) - 5 # ([^0Ol1I])
= 26 + 26 + 10 - 5 = 57
entropy = log2(setsize^passlen)
= log2(setsize) * passlen
= passlen * (ln(setsize) / ln(2))
= 22 * (ln(57) / ln(2))
= 128.3235803212
https://en.wikipedia.org/wiki/Password_strength
Dump chrome browser login data/passwords, stored as type=basic v10 records.
Args: by default, tries to open the Brave profile named Default,
otherwise give path to the profile's Login Data file if using
different browser variant (like Chrome or Chromium).
Dump all google keep data to a json file, doing an incremental update from the previous state, provided on stdin, writing updated state to stdout (to keep for input next time), or empty if no changes. Intended to be run from cron for backing up google keep notes.
Pretty prints yaml files as python objects.
Looks for ipv4 addresses in the input and replaces with their looked up name from gethostbyaddr() in the output.
Sorts the input by line length, with a configurable filter length.
Provides the urlencode and urldecode commands, which take all lines of standard input, and all words given in their argument vector, and either encode or decode them for the http url schemes, according to the rules specified in RFC3986 (via urllib.parse).
Prints sys.path on separate lines, using interpreter as given in
invocation (python, python2 or python3 for pypath,
py2path, and py3path, respectively).
example:
$ py3path /home/scott/bin /opt/python-3.12.6/lib/python312.zip /opt/python-3.12.6/lib/python3.12 /opt/python-3.12.6/lib/python3.12/lib-dynload /home/scott/.local/lib/python3.12/site-packages /opt/python-3.12.6/lib/python3.12/site-packages