Konloch / bytecode-viewer

A Java 8+ Jar & Android APK Reverse Engineering Suite (Decompiler, Editor, Debugger & More)
https://bytecodeviewer.com
GNU General Public License v3.0
14.69k stars 1.15k forks source link

#77 Still happens #227

Closed CallMeAlexO closed 1 month ago

CallMeAlexO commented 5 years ago

I opened an APK file, and everything worked well. Then I closed the app, tried to open recent - and this happened.

Bytecode Viewer Version: 2.9.16, Preview Copy: false, Fat Jar: true, OS: Windows 10, Java: 11.0.2

java.io.FileNotFoundException: C:\Users\XXXXXX.Bytecode-Viewer\bcv_temp\IaedBFpJFZQCpllSKCgOXlYiI.jar (The system cannot find the file specified) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:219) at java.base/java.io.FileInputStream.(FileInputStream.java:157) at the.bytecode.club.bytecodeviewer.util.JarUtils.loadClasses(JarUtils.java:98) at the.bytecode.club.bytecodeviewer.BytecodeViewer$6.run(BytecodeViewer.java:899)

Konloch commented 5 years ago

Thanks for the report! Could you tell me the exact name of the APK file?

CallMeAlexO commented 5 years ago

WeChat_v7.0.3_apkpure.com.apk

Konloch commented 5 years ago

This seems to be fixed in v2.9.18, would you be able to try out that version and let me know if it's fixed? (You'll most likely need to re-download that APK since that location is probably deleted)

ckudera commented 5 years ago

I have the same problem with the Huawei Health app in v2.9.17 and v2.9.18

Bytecode Viewer Version: 2.9.18, Preview Copy: false, Fat Jar: true, OS: Linux, Java: 1.8.0_171

java.io.FileNotFoundException: /home/fedora/.Bytecode-Viewer/bcv_temp/mQqyLsOtNLnqJvjnWzfvdDPGZ.jar (Datei oder Verzeichnis nicht gefunden)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at the.bytecode.club.bytecodeviewer.util.JarUtils.loadClasses(JarUtils.java:167)
    at the.bytecode.club.bytecodeviewer.BytecodeViewer$8.run(BytecodeViewer.java:940)
Konloch commented 5 years ago

I'll play around with the settings a bit more and see if I can trigger that error on my end, thanks for the report!

ckudera commented 5 years ago

Thank you for your fast replay and the effort :)

I can provide the apk if this helps with troubleshooting.

Konloch commented 5 years ago

That would definitely help if you could, cheers!

ckudera commented 5 years ago

It also happens with the current version on APK Mirror, therefore no upload is required: https://www.apkmirror.com/apk/huawei-internet-service/health/health-9-0-4-387-release/huawei-health-9-0-4-387-android-apk-download/

Konloch commented 5 years ago

Is your APK conversion currently set to Enjarify?

ckudera commented 5 years ago

No, dex2jar

bla5r commented 5 years ago

I've come across this issue as well. I basically can't import any APK file. I've tried with four distinct APKs, the same error message always shows up, none of them has been successfully loaded.

Here's the output I got from your program:

I: Using Apktool 2.3.0 on FEebUQBjXzUVSgBXuiWaMBbWgtazMfNt.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/user/.Bytecode-Viewer/bcv_temp/tWtejHiadCgc/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Copying raw classes.dex file...
I: Copying raw classes2.dex file...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
dex2jar /home/user/.Bytecode-Viewer/bcv_temp/FEebUQBjXzUVSgBXuiWaMBbWgtazMfNt.apk -> ./FEebUQBjXzUVSgBXuiWaMBbWgtazMfNt-dex2jar.jar
java.io.FileNotFoundException: /home/user/.Bytecode-Viewer/bcv_temp/vFTLbxOYXLdaZdtmeIKEfXdsZ.jar (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at the.bytecode.club.bytecodeviewer.util.JarUtils.loadClasses(JarUtils.java:156)
    at the.bytecode.club.bytecodeviewer.BytecodeViewer$6.run(BytecodeViewer.java:906)

apktool stage works properly however when it comes to dex2jar, it seems like you're opening a JAR file which doesn't actually exist on filesystem — not the one outputted by dex2jar.

I'm running the latest version (2.9.18) on Arch Linux. I hope it would be useful for bug fixing.

0x410c commented 4 years ago

same problem on windows x64 too

Ana06 commented 4 years ago

I also get this error when opening the apk from the third challenge of FLARE-ON challenge 6 on Windows 7:

Bytecode Viewer Version: 2.9.22, Preview Copy: false, Fat Jar: true, OS: Windows 7, Java: 1.8.0_251

java.io.FileNotFoundException: C:\Users\user\.Bytecode-Viewer\bcv_temp\NVDnkKznBGOfzfRzaoZiLCKoE.jar (The system cannot find the file specified)
     at java.io.FileInputStream.open0(Native Method)
     at java.io.FileInputStream.open(Unknown Source)
     at java.io.FileInputStream.<init>(Unknown Source)
     at the.bytecode.club.bytecodeviewer.util.JarUtils.loadClasses(JarUtils.java:168)
     at the.bytecode.club.bytecodeviewer.BytecodeViewer$8.run(BytecodeViewer.java:961)

Opening Bytecode Viewer from a cmd run as administrator I was able to open the apk:

java -j pat-to-Bytecode-Viewer-2.9.22.jar

The solution to run it as administrator was proposed in this issue (which seems to be a duplicate): https://github.com/Konloch/bytecode-viewer/issues/234#issuecomment-583807184

ddast commented 4 years ago

I have not looked in more detail into this issue but it seems to be related to the working directory (cf. #267).

At least in Kali Linux bytecode-viewer is started by the following script:

#!/bin/sh

set -e

cd /usr/share/bytecode-viewer/
exec java -jar Bytecode-Viewer-2.9.22.jar "$@"

Since this sets the working directory to /usr/share/bytecode-viewer/ bytecode-viewer probably tries to store files in this directory which is only allowed by root. Instead starting bytecode-viewer from the home directory with java -jar /usr/share/bytecode-viewer/Bytecode-Viewer-2.9.22.jar worked for me.

oatmeal01 commented 4 years ago

2.9.22 and 2.9.20

Bytecode Viewer Version: 2.9.22, Preview Copy: false, Fat Jar: true, OS: Windows 10, Java: 1.8.0_111

java.io.FileNotFoundException: C:\Users\myPC\.Bytecode-Viewer\bcv_temp\FzOmDNhvVJzdzcvVycXjkCDRo.jar (The system cannot find the file specified)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at the.bytecode.club.bytecodeviewer.util.JarUtils.loadClasses(JarUtils.java:168)
    at the.bytecode.club.bytecodeviewer.BytecodeViewer$8.run(BytecodeViewer.java:961)
jaytj95 commented 3 years ago

Also happens on Mac

Bytecode Viewer Version: 2.9.22, Preview Copy: false, Fat Jar: true, OS: Mac OS X, Java: 1.8.0_231

java.io.FileNotFoundException: /Users/jason/.Bytecode-Viewer/bcv_temp/JMhdUhCPcZLKArVaPmVWHJJlf.jar (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at the.bytecode.club.bytecodeviewer.util.JarUtils.loadClasses(JarUtils.java:168)
    at the.bytecode.club.bytecodeviewer.BytecodeViewer$8.run(BytecodeViewer.java:961)
Konloch commented 3 years ago

Hopefully https://github.com/Konloch/bytecode-viewer/releases/tag/v2.10.12 solves it

leo-stone commented 3 years ago

Hopefully https://github.com/Konloch/bytecode-viewer/releases/tag/v2.10.12 solves it

No, it does not :(

But I do not know if it is caused by this actually:

java.lang.SecurityException: BCV is awesome! Blocking exec: C:\Program Files\Python39\python.exe at the.bytecode.club.bytecodeviewer.util.SecurityMan.checkExec(SecurityMan.java:155) at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1096) at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071) at the.bytecode.club.bytecodeviewer.util.Enjarify.apk2Jar(Enjarify.java:61) at the.bytecode.club.bytecodeviewer.resources.importing.impl.DEXResourceImporter.open(DEXResourceImporter.java:36) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.importKnownFile(ImportResource.java:90) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.run(ImportResource.java:62) at java.base/java.lang.Thread.run(Thread.java:834)

I have no Idea why the SecurityManager is blocking this command? But then follows: java.io.FileNotFoundException: C:\Users\JonDoe\.Bytecode-Viewer\bcv_temp\ZbtbKXPeyEOkCWZXHyivnJnJR.jar (Das System kann die angegebene Datei nicht finden) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:219) at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157) at the.bytecode.club.bytecodeviewer.resources.ResourceContainerImporter.importZipInputStream(ResourceContainerImporter.java:151) at the.bytecode.club.bytecodeviewer.resources.ResourceContainerImporter.importAsZip(ResourceContainerImporter.java:74) at the.bytecode.club.bytecodeviewer.resources.importing.impl.DEXResourceImporter.open(DEXResourceImporter.java:40) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.importKnownFile(ImportResource.java:90) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.run(ImportResource.java:62) at java.base/java.lang.Thread.run(Thread.java:834) java.nio.file.NoSuchFileException: C:\Users\JonDoe\.Bytecode-Viewer\bcv_temp\ZbtbKXPeyEOkCWZXHyivnJnJR.jar at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) at java.base/sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:235) at java.base/java.nio.file.Files.newByteChannel(Files.java:371) at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:261) at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:230) at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:213) at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:174) at the.bytecode.club.bytecodeviewer.resources.ResourceContainerImporter.importApacheZipFile(ResourceContainerImporter.java:176) at the.bytecode.club.bytecodeviewer.resources.ResourceContainerImporter.importAsZip(ResourceContainerImporter.java:81) at the.bytecode.club.bytecodeviewer.resources.importing.impl.DEXResourceImporter.open(DEXResourceImporter.java:40) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.importKnownFile(ImportResource.java:90) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.run(ImportResource.java:62) at java.base/java.lang.Thread.run(Thread.java:834)

Konloch commented 3 years ago

Hi, the security manager was just recently changed in v2.10.14, try v2.10.13 instead, I will fix the security manager and push a v2.10.15 soon

In the mean time select Settings>APK Decoding>Dex2Jar as a work around for the security manager issue.

It is unrelated to #227 though as I introduced this with the security manager changes

Konloch commented 1 month ago

Hi, if you are still experiencing this issue with the latest version of BCV at any time feel free to open a new issue. This is being closed as I believe it should be fixed now.