forked from liaohuqiu/android-cube-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-sign.py
30 lines (26 loc) · 849 Bytes
/
get-sign.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import sys
import subprocess
from subprocess import call
if len(sys.argv) < 2:
print >> sys.stderr, "Usage: %s <keystore_file> [alias] [password]" % sys.argv[0]
sys.exit(1)
alias = None
password = None
if len(sys.argv) == 4:
alias = sys.argv[2]
password = sys.argv[3]
keystore_file = sys.argv[1]
keystore_file = os.path.expanduser(keystore_file)
keystore_file = os.path.realpath(keystore_file)
if (password and alias):
cmd = 'keytool -list -alias %s -keystore %s -storepass %s -v' % (alias, keystore_file, password)
else:
cmd = 'keytool -list -alias androiddebugkey -keystore %s -storepass android -v' % (keystore_file)
print cmd
print '---------\n'
cmd = cmd.split()
output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
print output
print '---------\n'
print output.replace(':', '').lower()