Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not proceed further at java -jar #12

Open
19oos opened this issue Apr 29, 2021 · 4 comments
Open

Could not proceed further at java -jar #12

19oos opened this issue Apr 29, 2021 · 4 comments

Comments

@19oos
Copy link

19oos commented Apr 29, 2021

Hi,
When I use -w arguments, it failed.
Here is the error msg.


Android CertKiller (v0.1)


CertKiller Wizard Mode

List of devices attached
c358b58a device product:xxxx model:xxx device:xxxx transport_id:2

Enter Application Package Name: com.xxx.xxx
--------------sijo
package:/data/app/~~W0LgvxxxxxxQ==/ com.xxx.xxx-5BBORxxxxxC__zh44A==/base.apk= com.xxx.xxx

8:94
my packages /data/app/~~W0Lgvxxxxxxzf8wtbQ==/ com.xxx.xxx-5BBORxxxxxC__zh44A==/base.apk
'
I. Initiating APK extraction from device
complete

I. Decompiling
complete

I: Applying SSL bypass
complete

I. Building New APK
complete

/n Could not proceed further at java -jar d:\gitspace\Android-CertKiller/dependency/apktool.jar b -f base. Raise a ticket=> https://github.com/51j0/Android-CertKiller/issues/new

(appsec2) d:\gitspace\Android-CertKiller>java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

@bubby963
Copy link

bubby963 commented Jul 7, 2021

Had the same issue. This is how I fixed it. First update apktool.jar in /dependency/apktool.jar to the latest version from https://bitbucket.org/iBotPeaches/apktool/downloads/ (currently 2.5.0). After that change the following in main.py:

def compileApplication():
    first   = 'I. Building New APK'
    second  = '   complete'
    command = "java -jar "+myworkspace()+"/dependency/apktool.jar b -f base"
    myCommand(first,command,second)

to:

def compileApplication():
    first   = 'I. Building New APK'
    second  = '   complete'
    command = "java -jar "+myworkspace()+"/dependency/apktool.jar b -f base --use-aapt2"
    myCommand(first,command,second)

@odolezal
Copy link

@bubby963 Thanks for hint! Your fix worked with current version of apktool 2.6.1 (2022-02-26).

@darkhacknet
Copy link

Doesnt work for me =(

@Hussienx
Copy link

Hussienx commented Jul 9, 2024

`
#!/usr/bin/python
import sys, os, subprocess, re, time ,getopt
from codetamper import mainfestdebuggable
from codetamper import usercertificate
from codetamper import ifTestOnlyAPK

millis = str(int(round(time.time() * 1000)))
SUCCESS = 0
AUTOMATION = 1
MANUAL = 2
verbose = False
debuggable_mode = False

def myworkspace():
return os.path.dirname(os.path.abspath(file))

def myCommand_silent(command):
global verbose
if not verbose:
FNULL = open(os.devnull, 'w')
process = subprocess.call(command, shell=True, stdout=FNULL, stderr=subprocess.STDOUT)
else:
print(command)
process = subprocess.call(command, shell=True)

def myCommand(text, command, second):
print(text)
global verbose
if not verbose:
FNULL = open(os.devnull, 'w')
process = subprocess.Popen(command, shell=True, stdout=FNULL, stderr=subprocess.STDOUT)
else:
print('------------------------------')
process = subprocess.Popen(command, shell=True)
print('*******************************')
print(second)
print('------------------------------')
process.communicate()
if process.returncode != SUCCESS:
terminate("\n Could not proceed further at " + command + ". Raise a ticket=> https://github.com/51j0/Android-CertKiller/issues/new")

def terminate(var):
print(var)
sys.exit(2)

def intro(var):
print('\n***************************************')
print('Android CertKiller (v0.1)')
print('***************************************\n')
print(var)
print('---------------------------------')

def getRealPackageName(package_name):
# SEARCHING FOR PACKAGE
global SUCCESS

command = "adb shell pm list packages -f " + package_name
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None, shell=True)
output = process.communicate()

if process.returncode != SUCCESS:
    print('Something went wrong (ER_Ox1001)')
    sys.exit(2)

orginal_package_name = output[0]
counts = orginal_package_name.count('\n')

if counts > 1:
    print(orginal_package_name)
    print("\n---------------------------------------")
    print("Found " + str(counts) + " packages")
    return ""
elif counts == 0:
    print("\n---------------------------------------")
    text = raw_input("No application found with the given package name. Do you want to Continue(y/N) ")
    if text == '' or text == 'N' or text == 'n':
        terminate("Ending script")
    else:
        return ""

print('--------------sijo')
print(orginal_package_name)
start_index = 8
final_index = orginal_package_name.rfind('base.apk=') + 8
print(str(start_index) + ":" + str(final_index))
package_path = orginal_package_name[start_index:final_index]
package_path = package_path.replace("\n", "")
package_path = package_path.replace("\r", "")
return package_path;

def runwizard():
intro('CertKiller Wizard Mode')
command = "adb devices -l"
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None, shell=True)
output = process.communicate()
print(output[0])

if process.returncode != SUCCESS:
    terminate("Could not proceed further please reinstall ADB")

package_name = raw_input("Enter Application Package Name: ")
package_name = getRealPackageName(package_name)
while package_name == '':
    package_name = raw_input("Enter Application Package Name: ")
    package_name = getRealPackageName(package_name)

print("my packages " + package_name)
if package_name != '':
    os.system("echo '\nPackage: " + package_name + "\n'")
    extracting(package_name, 'A')
    decompileApplication()
    if debuggable_mode:
        mainfestdebuggable()
    usercertificate()
    compileApplication()
    signApplication("base/dist/base.apk", AUTOMATION)
    installApplication(package_name)
    sys.exit(2)
else:
    terminate("Package Not Found")

def extracting(package_name, workspace):
first = 'I. Initiating APK extraction from device'
second = ' complete'
command = "adb pull " + package_name
myCommand(first, command, second)

def decompileApplication():
first = 'I. Decompiling'
second = ' complete'
command = "java -jar " + myworkspace() + "/dependency/apktool.jar d -f base.apk"
myCommand(first, command, second)

def compileApplication():
first = 'I. Building New APK'
second = ' complete'
command = "java -jar " + myworkspace() + "/dependency/apktool.jar b -f base --use-aapt2"
myCommand(first, command, second)

def signApplication(path, mode):
global millis
first = 'I. Signing APK'
second = ' complete'
command = "jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore " + myworkspace() + "/dependency/ssl-key.keystore -storepass android -keypass android " + path + " 51j0"
myCommand(first, command, second)

f = open("base/AndroidManifest.xml", "r")
contents = f.read()
package = re.findall('package="(.*?)"', contents)
f.close()

if mode == AUTOMATION:
    print(command)
    command = 'mkdir "' + myworkspace() + '/unpinnedapk/' + package[0] + millis + '/"'
    myCommand_silent(command)
    command = 'mkdir "' + myworkspace() + '/workspace/' + package[0] + millis + '/"'
    myCommand_silent(command)
    command = 'copy /Y base/dist/base.apk "' + myworkspace() + '/unpinnedapk/' + package[0] + millis + '/base.apk"'
    myCommand_silent(command)
    command = 'copy /Y base "' + myworkspace() + '/workspace/' + package[0] + millis + '/"'
    myCommand_silent(command)
    command = 'copy /Y base.apk "' + myworkspace() + '/workspace/' + package[0] + millis + '/base.apk"'
    myCommand_silent(command)
    text = raw_input("Would you like to install the APK on your device(y/N): ")
    if text == 'y' or text == "Y":
        installApplication(package[0])
    else:
        terminate("Thank you")

def installApplication(package):
global millis
print('------------------------------------\n Installing Unpinned APK')
command = "adb shell pm list packages | grep " + package
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
output = process.communicate()
if process.returncode != SUCCESS:
terminate("Could not install. Please check")

orginal_package_name = output[0]
counts = orginal_package_name.count('\n')
if counts == 1:
    command = "adb uninstall " + package
    myCommand_silent(command)

command = 'adb install "' + myworkspace() + '/unpinnedapk/' + package + millis + '/base.apk"'

isTestAPK = ifTestOnlyAPK(myworkspace() + '/workspace/' + package + millis + '/base/AndroidManifest.xml')
if isTestAPK:
    command = 'adb install -t "' + myworkspace() + '/unpinnedapk/' + package + millis + '/base.apk"'

myCommand_silent(command)
print('------------------------------')
print('Finished')
sys.exit(2)

def usage():
print('')
print('root$ python main.py -w (Wizard Mode)')
print('root$ python main.py -p /desktop/base.apk (Manual Mode)')
print('')
print(' -w --wizard\t Extract APK From device')
print(' -v --verbose\t Verbose Mode')
print(' -p --Path\t APK path')
print(' -d --debuggable mode\tSetting android:debuggable flag to true')
print('')

def main(argv):
global verbose
global debuggable_mode
path = ''
wizard = True
output_folder = 'A'
try:
opts, args = getopt.getopt(argv, "hvdwp:", ["help", "path=", "verbose", "debuggable-mode", "wizard"])
except getopt.GetoptError as err:
usage()
print(err)
sys.exit(2)
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exit(2)
elif opt in ("-w", "--wizard"):
wizard = True
elif opt in ("-p", "--path"):
path = arg
wizard = False
elif opt in ("-v", "--verbose"):
verbose = True
elif opt in ("-d", "--debuggable-mode"):
debuggable_mode = True

if not opts:
    runwizard()

if wizard:
    runwizard()
else:
    intro('CertKiller Manual Mode')
    command = 'copy /Y "' + path + '" base.apk'
    myCommand_silent(command)
    decompileApplication()
    usercertificate()
    compileApplication()
    signApplication("base/dist/base.apk", MANUAL)
    installApplication()
    sys.exit(2)

if name == "main":
main(sys.argv[1:])

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants