From b571a3168d272f2b571ebd006003878632e55325 Mon Sep 17 00:00:00 2001 From: n1nj4sec Date: Mon, 25 Apr 2016 23:26:01 +0200 Subject: [PATCH] issue #86: adding nice message when jarsigner is missing. --- pupy/pupygen.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pupy/pupygen.py b/pupy/pupygen.py index f74c2e33..9a41b26a 100755 --- a/pupy/pupygen.py +++ b/pupy/pupygen.py @@ -123,7 +123,7 @@ def get_edit_apk(path, new_path, conf): with open(os.path.join(tempdir,"pp.conf"),'w') as w: w.write(new_conf) - print "[+] packaging the apk ... (can take a 10-20 seconds)" + print "[+] packaging the apk ... (can take 10-20 seconds)" #updating the tar with the new config updateTar(os.path.join(tempdir,"assets/private.mp3"), "service/pp.conf", os.path.join(tempdir,"pp.conf")) #repacking the tar in the apk @@ -131,7 +131,13 @@ def get_edit_apk(path, new_path, conf): updateZip(new_path, "assets/private.mp3", t.read()) #signing the tar - res=subprocess.check_output("jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore crypto/pupy-apk-release-key.keystore -storepass pupyp4ssword '%s' pupy_key"%new_path, shell=True) + try: + res=subprocess.check_output("jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore crypto/pupy-apk-release-key.keystore -storepass pupyp4ssword '%s' pupy_key"%new_path, shell=True) + except OSError as e: + if e.errno ==os.errno.ENOENT: + print "Please install jarsigner first." + sys.exit(1) + raise e # -tsa http://timestamp.digicert.com print(res) finally: