Browse Source

added more ascii art, improved ascii_sign.py

master
Micah Lee 9 years ago
parent
commit
ae6bdca0f3
  1. 4
      README.md
  2. 0
      ascii_art/micah.txt
  3. 6
      ascii_art/trollwot.txt
  4. 32
      ascii_sign.py

4
README.md

@ -29,7 +29,9 @@ For example, check out my key: http://pgp.mit.edu:11371/pks/lookup?op=vindex&sea @@ -29,7 +29,9 @@ For example, check out my key: http://pgp.mit.edu:11371/pks/lookup?op=vindex&sea
ASCII sign a key like this:
./ascii_sign.py ascii_art.txt KEYID
./ascii_sign.py [ASCII_ART_FILENAME] [KEYID]
If you're ASCII signing a key with multiple user IDs, you'll have to press "y" to verify you want to sign all user IDs for each line.
Brute force PGP key ID (inefficiently)
--------------------------------------

0
ascii_art.txt → ascii_art/micah.txt

6
ascii_art/trollwot.txt

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃╺┳╸┏━┓┏━┓╻ ╻ ╻┏┓╻┏━╸ ╺┳╸╻ ╻┏━╸ ╻ ╻┏━╸┏┓ ┏━┓┏━╸ ╺┳╸┏━┓╻ ╻┏━┓╺┳╸┃
┃ ┃ ┣┳┛┃ ┃┃ ┃ ┃┃┗┫┃╺┓ ┃ ┣━┫┣╸ ┃╻┃┣╸ ┣┻┓ ┃ ┃┣╸ ┃ ┣┳┛┃ ┃┗━┓ ┃ ┃
┃ ╹ ╹┗╸┗━┛┗━╸┗━╸╹╹ ╹┗━┛ ╹ ╹ ╹┗━╸ ┗┻┛┗━╸┗━┛ ┗━┛╹ ╹ ╹┗╸┗━┛┗━┛ ╹ ┃
┃ ~ Observe. Hack. Make. 2013 ~ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

32
ascii_sign.py

@ -11,6 +11,7 @@ class TrollWoT_ASCIISign: @@ -11,6 +11,7 @@ class TrollWoT_ASCIISign:
self.target_keyid = keyid
self.homedir = homedir
self.keyserver_url = "http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x{0}".format(keyid)
self.fingerprints = [self.target_keyid]
self.gpg = gnupg.GPG(gnupghome=homedir, gpgbinary=cwd+'/lib/gnupg/g10/gpg', verbose=False)
@ -19,14 +20,33 @@ class TrollWoT_ASCIISign: @@ -19,14 +20,33 @@ class TrollWoT_ASCIISign:
self.recv_key(self.target_keyid)
# generate new keys
self.gen_keys_and_sign(filename)
# show fingerprints with gpg
subprocess.Popen(['gpg', '--homedir', self.gpg.gnupghome, '--list-sigs', self.target_keyid]).wait()
# prompt for uploading to key server
upload_keys = ''
while upload_keys != 'YES' and upload_keys != 'no':
upload_keys = raw_input('Does this look good? Type "YES" to upload, "no" to quit: ')
if upload_keys == 'YES':
print 'Uploading fingerprints'
for fingerprint in self.fingerprints:
self.send_key(fingerprint)
print '\n\nView the ASCII signed key here: {0}'.format(self.keyserver_url)
def gen_keys_and_sign(self, filename):
fingerprints_to_sign = []
for userid in open(filename, 'r').read().strip().split('\n'):
fingerprint = self.gen_key(userid)
self.send_key(fingerprint)
fingerprints_to_sign.append(fingerprint)
self.fingerprints.append(fingerprint)
for fingerprint in fingerprints_to_sign:
self.sign_key(fingerprint)
self.send_key(self.target_keyid)
# view key
print '\n\nView the ASCII signed key here: {0}'.format(self.keyserver_url)
def gen_key(self, userid):
print 'Generating key with userid: {0}'.format(userid)
@ -42,7 +62,7 @@ class TrollWoT_ASCIISign: @@ -42,7 +62,7 @@ class TrollWoT_ASCIISign:
def sign_key(self, signing_fingerprint):
keyid = signing_fingerprint[-8:]
print 'Signing key {0} with key {1}'.format(self.target_keyid, keyid)
subprocess.Popen(['gpg', '--homedir', self.gpg.gnupghome, '--batch', '--yes', '--status-fd', '1', '--default-key', keyid, '--sign-key', self.target_keyid]).wait()
subprocess.Popen(['gpg', '--homedir', self.gpg.gnupghome, '--yes', '--default-key', keyid, '--sign-key', self.target_keyid]).wait()
def recv_key(self, fingerprint):
keyid = fingerprint[-8:]

Loading…
Cancel
Save