summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/cli/bitmask_cli.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask/cli/bitmask_cli.py')
-rwxr-xr-xsrc/leap/bitmask/cli/bitmask_cli.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/leap/bitmask/cli/bitmask_cli.py b/src/leap/bitmask/cli/bitmask_cli.py
index 9110f88a..0c1fe832 100755
--- a/src/leap/bitmask/cli/bitmask_cli.py
+++ b/src/leap/bitmask/cli/bitmask_cli.py
@@ -140,6 +140,8 @@ GENERAL COMMANDS:
help='List all known keys')
parser.add_argument('--export', action='store_true',
help='Export the given key')
+ parser.add_argument('address', nargs='?',
+ help='email address of the key')
args = parser.parse_args(sys.argv[2:])
self.subargs = args
@@ -192,6 +194,27 @@ def do_print_result(stuff):
print Fore.RED + 'ERROR:' + '%s' % obj['error'] + Fore.RESET
+def do_print_key(stuff):
+ obj = json.loads(stuff[0])
+ if obj['error']:
+ do_print_result(stuff)
+ return
+
+ key = obj['result']
+ print Fore.GREEN
+ print "Uids: " + ', '.join(key['uids'])
+ print "Fingerprint: " + key['fingerprint']
+ print "Length: " + str(key['length'])
+ print "Expiration: " + key['expiry_date']
+ print "Validation: " + key['validation']
+ print("Used: " + "sig:" + str(key['sign_used']) +
+ ", encr:" + str(key['encr_used']))
+ print "Refresed: " + key['refreshed_at']
+ print Fore.RESET
+ print ""
+ print key['key_data']
+
+
def send_command(cli):
args = cli.args
@@ -314,12 +337,16 @@ def send_command(cli):
elif subargs.export:
data += ['export']
+ cb = do_print_key
else:
error('Use bitmask_cli keys --help to see available subcommands',
stop=True)
return
+ if subargs.address:
+ data.append(subargs.address)
+
s = get_zmq_connection()
d = s.sendMsg(*data, timeout=60)