]> granicus.if.org Git - neomutt/commitdiff
basic stuff to get keybase to work with mutt
authorJakkin <dracogoyle@gmail.com>
Sun, 19 Jun 2016 01:18:19 +0000 (20:18 -0500)
committerRichard Russon <rich@flatcap.org>
Sat, 30 Jul 2016 09:44:01 +0000 (10:44 +0100)
.muttrc [new file with mode: 0644]
README.md [new file with mode: 0644]
decrypt.sh [new file with mode: 0755]
keybase.py [new file with mode: 0644]
verify.sh [new file with mode: 0755]

diff --git a/.muttrc b/.muttrc
new file mode 100644 (file)
index 0000000..2bf672a
--- /dev/null
+++ b/.muttrc
@@ -0,0 +1 @@
+macro compose K "<enter-command>unset wait_key<enter><shell-escape>python ~/.mutt/keybaseMutt/keybase.py<enter><enter-command>set wait_key<enter>
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..13ac9b6
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# KeybaseMutt
+
+A work in progress to make keybas work with mutt.
diff --git a/decrypt.sh b/decrypt.sh
new file mode 100755 (executable)
index 0000000..56f8f21
--- /dev/null
@@ -0,0 +1,2 @@
+#! /usr/bin/bash
+sed -n 's/^.*BEGIN KEYBASE/BEGIN KEYBASE/p' | keybase decrypt
diff --git a/keybase.py b/keybase.py
new file mode 100644 (file)
index 0000000..24c9037
--- /dev/null
@@ -0,0 +1,57 @@
+#! /usr/bin/env python
+# Written by Joshua Jordi
+
+import os
+
+def helpfunc():
+    print("Run keybase commands here as if you were using keybase. WARNING: this program is not capable of MIME formatting. Only inline.")
+    print("To encrypt, use keybase syntax. (ie. 'keybase encrypt jakkinstewart' or 'keybase pgp encrypt jakkinstewart') Do not include a '-i' or '-o'. This script uses them in the background. Including either flag will mess with the script. (Unless that's what you want to do.)")
+    print("Don't worry about finding or attaching the file, the macro will take care of that.")
+    print("To sign, give it the style ('sign' or 'pgp sign'. It will automatically include the signature in the file.")
+    print("This program will not be able to decrypt or verify messages. I've created separate scripts for that.")
+    print('Type "quit" to quit.')
+
+def encrypt(parameters):
+    os.system('pwd > .file')
+    directory = open('.file', 'r')
+    pwd = directory.read().strip('\n')
+    directory.close()
+    tmp = open("%s/.mutt/keybaseMutt/.tmp" % pwd, "r")
+    tmp = tmp.read().strip("\n")
+    print("Working....")
+    os.system('%s -i %s -o %s' % (parameters, tmp, tmp))
+    print("Done!")
+
+def sign(parameters):
+    os.system('pwd > .file')
+    directory = open('.file', 'r')
+    pwd = directory.read().strip('\n')
+    directory.close()
+    tmp = open('%s/.mutt/keybaseMutt/.tmp' % pwd, 'r')
+    tmp = tmp.read().strip('\n')
+    print("Working...")
+    os.system('%s -i %s -o /tmp/signature.asc && cat /tmp/signature.asc > %s && rm /tmp/signature.asc' % (parameters, tmp, tmp))
+    print("Done!")
+
+exitVar = ''
+
+print("Type help to learn how to use me.")
+
+while exitVar.lower() != 'quit':
+    inputStuffs = input()
+    if (inputStuffs.lower() == 'help'):
+        helpfunc()
+
+    elif ('encrypt' in inputStuffs):
+        encrypt(inputStuffs)
+
+    elif ('decrypt' in inputStuffs):
+        decrypt(inputStuffs)
+
+    elif ('quit' in inputStuffs):
+        exitVar = 'quit'
+
+    else:
+        print("You didn't use a known keybase command.")
+
+os.system('rm .file')
diff --git a/verify.sh b/verify.sh
new file mode 100755 (executable)
index 0000000..c9813eb
--- /dev/null
+++ b/verify.sh
@@ -0,0 +1,2 @@
+#! /usr/bin/bash
+sed -n 's/^.*BEGIN KEYBASE/BEGIN KEYBASE/p' | keybase verify