Giter Club home page Giter Club logo

cosmo's People

Contributors

claudiugeorgiu avatar h2so4t avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cosmo's Issues

Failed to initialize JaCoCo

Hi guys,

I tried to run COSMO in black box mode using a very simple BMI Calculator app (https://f-droid.org/packages/com.zola.bmi/). First, I decompiled the APK using apktool, inserted the debuggable attribute in the AndroidManifest.xml and re-packaged it (https://gist.github.com/nstarke/615ca3603fdded8aee47fab6f4917826). After that, I executed python cli.py com.zola.bmi.apk:

$ python cli.py com.zola.bmi.apk
29/09/2023 22:06:32> [INFO][apk_instrumenter][run_instrumentation()] Instrumenting apk file "com.zola.bmi.apk"
29/09/2023 22:06:32> [INFO][apk_instrumenter][instrument_apk()] Converting to Java bytecode with dex2jar command "C:\Users\Michael\Downloads\dex2jar-2.0\dex2jar-2.0\d2j-dex2jar.bat -f -e nul C:\Users\Michael\App
Data\Local\Temp\tmp9l34xgz2\com.zola.bmi.apk -o C:\Users\Michael\AppData\Local\Temp\tmp9l34xgz2\com.zola.bmi.jar"
29/09/2023 22:06:35> [INFO][apk_instrumenter][instrument_apk()] Instrumenting with Java command "C:\Users\Michael\.jdks\openjdk-15.0.2\bin\java.EXE -jar C:\Users\Michael\git\COSMO\lib\jacococli.jar instrument C:
\Users\Michael\AppData\Local\Temp\tmp9l34xgz2\com.zola.bmi.jar --dest C:\Users\Michael\AppData\Local\Temp\tmp9l34xgz2\jacoco"
29/09/2023 22:06:37> [INFO][apk_instrumenter][instrument_apk()] Converting Java to Dalvik with command "E:\Android\Android\Sdk\build-tools\31.0.0-rc3\dx.BAT -JXmx4g --dex --multi-dex --output=C:\Users\Michael\Ap
pData\Local\Temp\tmp9l34xgz2\dex C:\Users\Michael\AppData\Local\Temp\tmp9l34xgz2\jacoco C:\Users\Michael\git\COSMO\lib\jacocoagent.jar"
29/09/2023 22:06:43> [INFO][apk_instrumenter][instrument_apk()] Running sign command with default debug key "E:\Android\Android\Sdk\build-tools\31.0.0-rc3\apksigner.BAT sign --ks-pass pass:android --ks C:\Users\
Michael\git\COSMO\lib\debug.keystore C:\Users\Michael\AppData\Local\Temp\tmp9l34xgz2\com.zola.bmi.apk"
29/09/2023 22:06:44> [INFO][apk_instrumenter][instrument_apk()] Running align command "E:\Android\Android\Sdk\build-tools\31.0.0-rc3\zipalign.EXE -v -p -f 4 C:\Users\Michael\AppData\Local\Temp\tmp9l34xgz2\com.zo
la.bmi.apk.copy C:\Users\Michael\AppData\Local\Temp\tmp9l34xgz2\com.zola.bmi.apk"
29/09/2023 22:06:44> [INFO][apk_instrumenter][instrument_apk()] Files for apk "com.zola.bmi" saved in "C:\Users\Michael\git\COSMO\output_apks" directory

The instrumenation process looks fine. After that, I had to re-sign the instrumented APK since the installation failed and complained about a stripped signature:

$ adb install -g output_apks/com.zola.bmi.apk
Performing Streamed Install
adb: failed to install output_apks/com.zola.bmi.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl90500489.tmp/base.apk: META-INF/ANDROIDD.SF indicates /data/app/vmdl90500489.tmp/base.apk is signed using APK Signature Scheme v2, but no such signature was found. Signature stripped?]

I suppose you are using some outdated signing scheme, but I could fix that by using my own keystore and after re-signing the installation succeeded. However, when I try to launch the app on the emulator the app crashes immediately with the following stack trace:

2023-09-29 22:08:38.854 3008-3008/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.zola.bmi, PID: 3008
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.zola.bmi/com.zola.bmi.BMIMain}: java.lang.RuntimeException: Failed to initialize JaCoCo.
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2567)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
     Caused by: java.lang.RuntimeException: Failed to initialize JaCoCo.
        at org.jacoco.agent.rt.internal_0000000.Offline.getRuntimeData(Offline.java:41)
        at org.jacoco.agent.rt.internal_0000000.Offline.getProbes(Offline.java:60)
        at com.zola.bmi.BMIMain.$jacocoInit(Unknown Source)
        at com.zola.bmi.BMIMain.<init>(Unknown Source)
        at java.lang.Class.newInstance(Native Method)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) 
        at android.app.ActivityThread.-wrap12(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6119) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
     Caused by: java.io.FileNotFoundException: / (Is a directory)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
        at org.jacoco.agent.rt.internal_0000000.output.FileOutput.openFile(FileOutput.java:68)
        at org.jacoco.agent.rt.internal_0000000.output.FileOutput.startup(FileOutput.java:50)
        at org.jacoco.agent.rt.internal_0000000.Agent.startup(Agent.java:129)
        at org.jacoco.agent.rt.internal_0000000.Agent.getInstance(Agent.java:54)
        at org.jacoco.agent.rt.internal_0000000.Offline.getRuntimeData(Offline.java:39)
        at org.jacoco.agent.rt.internal_0000000.Offline.getProbes(Offline.java:60) 
        at com.zola.bmi.BMIMain.$jacocoInit(Unknown Source) 
        at com.zola.bmi.BMIMain.<init>(Unknown Source) 
        at java.lang.Class.newInstance(Native Method) 
        at android.app.Instrumentation.newActivity(Instrumentation.java:1078) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) 
        at android.app.ActivityThread.-wrap12(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6119) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

I am using a Nexus_5_API_25 emulator and the un-instrumented APK works as expected. Is this failure known to you? I will try to update to a more recent dex2jar version but since the instrumentation logs looked promising, I thought this was not necessary.
Or do I need to grant some additional permissions in the AndroidManifest.xml?

Thanks in advance.

Error during Java to Dalvik conversion command

command: python .\cli.py path_to_my.apk
(I tried several apps, official and my own. Both got the error below.)
18/10/2022 22:52:40> [ERROR][apk_instrumenter][instrument_apk()] Error during Java to Dalvik conversion command: Uncaught translation error: com.android.dx.cf.code.SimException: expected type long[] but found double[]
1 error; aborting

Watch apk instrumented from you

Good morning I apologize for the distrubution.
I wanted to know in what way it was possible to see and magariscarload the source code with its apk of these applications, which have been tested by you.
Awaiting your reply I wish you a good day.
Screenshot 2023-10-03 alle 10 09 22

Could not evaluate onlyIf predicate for task ':app:jacocoInstrumenterReport'

Ciao, ho provato il tool e mi sono imbattuto in un problema nella fase finale, ovvero la fase in cui si va a generare il report HTML.
Quando vado a lanciare il comando ./gradlew jacocoInstrumenterReport, ottengo il seguente errore:
`> Task :app:jacocoInstrumenterReport FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not evaluate onlyIf predicate for task ':app:jacocoInstrumenterReport'.

Could not read path '/Users/francesco/Desktop/coverage'.`

Se puoi servire, lascio anche le informazioni relative al 1) build.gradle (Project :Personal_Health_Monitor), al 2) build.gradle (Module :app) e al file 3) jacoco-instrumenter-coverage.gradle:
1)
build gradle(project)

build gradle(app)

jacoco-instrumenter-coverage gradle

Invece le informazioni relative a gradle sono le seguenti:
Gradle version

Ti ringrazio anticipatamente per la disponibilità.

Experimental results and Aligning APK after Signing

Hi, the experimental results link the in the readme are no longer working.
I also noticed that in the code (apk_instrumenter.py) the apk is being signed (with apksigner) before aligning (with zipalign). I saw in apksigner's documentation that you should first align and then sign.
imagem_2024-03-26_162205

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.