Konloch / Konloch/bytecode-viewer

Can't open an apk if the current directory is not in the same filesystem as the home directory

Open
#267 4 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
Java
Stars
15.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

According to strace, dex2jar outputs into a file in the current directory, which is then moved into ~/.Bytecode-Viewer, but the move fails if the current directory is not on the same filesystem. This failure is silently ignored and results in a FileNotFoundException.

Log:
```
https://the.bytecode.club - Created by @Konloch - Bytecode Viewer 2.9.22, Fat-Jar: true
Start up took 3 seconds
I: Using Apktool 2.3.0 on calvliYOzSFHBpmjErwIgSPSSLBpYZQw.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/tbodt/.Bytecode-Viewer/bcv_temp/ocdLychdqhWT/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
dex2jar /home/tbodt/.Bytecode-Viewer/bcv_temp/calvliYOzSFHBpmjErwIgSPSSLBpYZQw.apk -> ./calvliYOzSFHBpmjErwIgSPSSLBpYZQw-dex2jar.jar
java.io.FileNotFoundException: /home/tbodt/.Bytecode-Viewer/bcv_temp/zBTpKnEbpgWhomIeHFodTVblq.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.(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)
```

Contributor guide

Open the contributing guide

Research direction

Start with JarUtils.java at line 168 and the call from BytecodeViewer.java at line 961, then reproduce the APK-opening flow with the working directory and home directory on different filesystems. Confirm that the generated dex2jar output is available under ~/.Bytecode-Viewer and that opening the APK no longer ends in FileNotFoundException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
reverse-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.