1. Jakub Wilk
  2. password-manager

Commits

Jakub Wilk  committed fb90d91

Initial import.

  • Participants
  • Branches default

Comments (0)

Files changed (2)

File randomize

View file
+#!/bin/sh
+length=${2:-10}
+size=`expr ${1:-1} \* $length`
+/usr/bin/gpg --armor --gen-random 1 "$size" \
+| tr -dc '0-9a-zA-Z' \
+| head -c "$size" \
+| sed -r -e "s/(.{$length})/\1\n/g"
+
+# vim:ft=sh ts=2 sw=2 et

File show-passwords

View file
+#!/usr/bin/python3
+
+import argparse
+import os
+import subprocess as ipc
+import sys
+
+import yaml
+
+def main():
+    os.chdir(sys.path[0])
+    parser = argparse.ArgumentParser()
+    parser.add_argument('keyword', metavar='KEYWORD')
+    options = parser.parse_args()
+    gpg = ipc.Popen(['gpg', '-q', '-d', 'passwords.yaml.gpg'], stdout=ipc.PIPE)
+    for item in yaml.load(gpg.stdout):
+        site = str(item['site'])
+        if not options.keyword in site:
+            continue
+        password = str(item['password'])
+        if '#' in password:
+            continue
+        user = str(item.get('user', '<none>'))
+        print('{site} ({user}) {password}'.format(
+            site=site, user=user, password=password)
+        )
+    gpg.wait()
+
+if __name__ == '__main__':
+    main()
+
+# vim:ts=4 sw=4 et