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

[BUG] Can't decompile Yo-Kai Watch Puni Puni #3165

Closed
SuperTavor opened this issue Jul 17, 2023 · 8 comments · Fixed by #3166
Closed

[BUG] Can't decompile Yo-Kai Watch Puni Puni #3165

SuperTavor opened this issue Jul 17, 2023 · 8 comments · Fixed by #3166
Labels

Comments

@SuperTavor
Copy link

SuperTavor commented Jul 17, 2023

Information

  1. Apktool Version (apktool -2.8.0) -
  2. Operating System (Windows) -
  3. APK From? (Other) -
  4. Java Version (java --8) -

Stacktrace/Logcat

C:\Users\yehon\Downloads\2.0>apktool d yokai-watch-puni-puni-4-98-0.apk
I: Using Apktool 2.8.0 on yokai-watch-puni-puni-4-98-0.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\yehon\AppData\Local\apktool\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
Exception in thread "main" brut.androlib.exceptions.AndrolibException: brut.directory.DirectoryException: Error copying file: assets
        at brut.androlib.ApkDecoder.copyRawFiles(ApkDecoder.java:247)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:140)
        at brut.apktool.Main.cmdDecode(Main.java:183)
        at brut.apktool.Main.main(Main.java:87)
Caused by: brut.directory.DirectoryException: Error copying file: assets
        at brut.directory.DirUtil.copyToDir(DirUtil.java:100)
        at brut.directory.AbstractDirectory.copyToDir(AbstractDirectory.java:208)
        at brut.androlib.ApkDecoder.copyRawFiles(ApkDecoder.java:234)
        ... 3 more
Caused by: brut.directory.DirectoryException: Error copying file:
        at brut.directory.DirUtil.copyToDir(DirUtil.java:100)
        at brut.directory.DirUtil.copyToDir(DirUtil.java:71)
        at brut.directory.AbstractDirectory.copyToDir(AbstractDirectory.java:198)
        at brut.directory.DirUtil.copyToDir(DirUtil.java:87)
        ... 5 more
Caused by: java.nio.file.AccessDeniedException: yokai-watch-puni-puni-4-98-0\assets
        at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
        at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
        at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
        at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(Unknown Source)
        at java.nio.file.spi.FileSystemProvider.newOutputStream(Unknown Source)
        at java.nio.file.Files.newOutputStream(Unknown Source)
        at brut.directory.DirUtil.copyToDir(DirUtil.java:95)
        ... 8 more

Steps to Reproduce

  1. apktool

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks that live in /system/framework or /system/priv-app)

APK

(https://yokai-watch-puni-puni.en.uptodown.com/android)

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything?
  2. If you are trying to install a modified apk, did you resign it?
  3. Are you using the latest apktool version?
@iBotPeaches
Copy link
Owner

Interesting. Some form of directory traversal or replicated "asset" folders which trip up Apktool

@SuperTavor
Copy link
Author

it actually works fine on my old computer. Can you check?

@iBotPeaches
Copy link
Owner

I couldn't replicate :/

➜  3165 apktool d yokai-watch-puni-puni-4-98-0.apk 
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
I: Using Apktool 2.7.1-863405-SNAPSHOT on yokai-watch-puni-puni-4-98-0.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/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...
I: Copying META-INF/services directory
➜  3165 

Though you said Windows. It might be this issue - #2574

@iBotPeaches
Copy link
Owner

Negative it can't be that. There is no multiple depth folders of "assets" - just one.

@SuperTavor
Copy link
Author

What is happening then? my old pc was MacOS, and it worked just fine (I am making a translation patch for the game)

@iBotPeaches
Copy link
Owner

I imagine there is something I'm missing that is specific to Windows

@iBotPeaches
Copy link
Owner

Okay I figured it out. We have an unsupported character name on Windows that is resulting in an empty path

8  2023-07-06 12:23   assets/  

This is not the declaration of a folder like I originally thought. This is some file

➜  3165 cat test 
PK%                                                                                                                                                                                                     ➜  3165 xxd test
00000000: 504b 0506 1111 1111                      PK......
➜  3165 

Dumping in something readable

0000000  20  20  0a
         sp  sp  nl
0000003

So this technically goes back to a long old Windows issue - #1460

Before I close this though, I am going to try one quick patch to skip empty filenames during copying of assets to see if this helps this specific example.

@iBotPeaches
Copy link
Owner

Yeah that worked. I'll move this forward as it seems low-risk.

conno@EXODUS MINGW64 ~/Desktop/Apktool
$ java -jar apktool-2.8.1-ba2f12-SNAPSHOT-small.jar d 3165.apk -f
I: Using Apktool 2.8.1-0d87c5-SNAPSHOT on 3165.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\conno\AppData\Local\apktool\framework\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...
I: Copying META-INF/services directory

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

Successfully merging a pull request may close this issue.

2 participants