thez3ro / apk2java-linux Goto Github PK
View Code? Open in Web Editor NEWDecompile apk and get java or smali source
Decompile apk and get java or smali source
I started on Ubuntu, and I get follwing error:
marcin@marcin-comp:~/Projects$ python3 apk2java.py d MakeMeBetter.apk
Running: cp MakeMeBetter.apk /home/marcin/Projects/makemebetter-new.apk
*********************************************
** Extract, fix resource files **
*********************************************
Running: /home/marcin/Projects/apk2java/tool/apktool_200rc3.jar d MakeMeBetter.apk -o /home/marcin/Projects/makemebetter -f
Traceback (most recent call last):
File "apk2java.py", line 213, in <module>
main()
File "apk2java.py", line 185, in main
apktool(options.smali)
File "apk2java.py", line 85, in apktool
call(cmd)
File "apk2java.py", line 14, in call
return subprocess.call(cmd, **kwargs)
File "/usr/lib/python3.5/subprocess.py", line 557, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
The same with normal python:
marcin@marcin-comp:~/Projects$ ./apk2java.py d MakeMeBetter.apk
Running: cp MakeMeBetter.apk /home/marcin/Projects/makemebetter-new.apk
*********************************************
** Extract, fix resource files **
*********************************************
Running: /home/marcin/Projects/apk2java/tool/apktool_200rc3.jar d MakeMeBetter.apk -o /home/marcin/Projects/makemebetter -f
Traceback (most recent call last):
File "./apk2java.py", line 213, in <module>
main()
File "./apk2java.py", line 185, in main
apktool(options.smali)
File "./apk2java.py", line 85, in apktool
call(cmd)
File "./apk2java.py", line 14, in call
return subprocess.call(cmd, **kwargs)
File "/usr/lib/python3.5/subprocess.py", line 557, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
This is what I get when I try to use your utility (I am on Linux Mint 17)
python3 apk2java.py d cz.pilsfree.iptv-1.apk
cp: nelze vytvořit obyčejný soubor „/tmp/apk2java/cz.pilsfree.iptv-1-new.apk“: Adresář nebo soubor neexistuje
*********************************************
** Extract, fix resource files **
*********************************************
/bin/sh: 1: /opt/apk2java/tool/apktool_200rc3.jar: Permission denied
mv: nelze získat informace o „/tmp/apk2java/cz.pilsfree.iptv-1/classes.dex“: Adresář nebo soubor neexistuje
Done
*********************************************
** Convert 'apk' to 'jar' **
*********************************************
dex2jar cz.pilsfree.iptv-1.apk -> /tmp/apk2java/cz.pilsfree.iptv-1.jar
verify /tmp/apk2java/cz.pilsfree.iptv-1.jar
Done
*********************************************
** Decompiling class files **
*********************************************
invalid file (bad magic number): Exec format error
Done
Can't retrieve 'https://github.com/TheZ3ro/apk2java-linux/releases/download/tool/tool.zip'
but file is up
https://github.com/AndroidTamer/apk2java
did a similar porting very long time ago. but this is a shell script version.
/bin/sh: 1: /opt/apk2java/tool/apktool_200rc3.jar: Permission denied
When download the External tool zip, tool folder don't have "+x" permission.
Hi,
Thanks for the great tool.
I would like to know if it is possible to rebuild the code to a new APK after changing it.
Thanks
You can set version number of dex2jar apktool.. in .ini file
i am using this on kali linux, i got this error
Traceback (most recent call last):
File "apk2java.py", line 6, in <module>
import urllib.request
ImportError: No module named request
i don't know how to repair it.
when i tried running the python script
Traceback (most recent call last):
File "./apk2java.py", line 23, in
outdir = os.path.dirname(os.path.realpath(sys.argv[1]))
IndexError: list index out of range
root@LeNO:~/Documents/Jayanta/apk2ja
Try ./apk2java --help to have your current folder nuked........ luckily it was the apk2java folder (it was able to complete delete itself from the hdd).
Console output follows
dario@ivymint /opt/apk2java $ ./apk2java --help
[ E ] Select a valid .apk file!
apk2java Linux - Author: Davide 'TheZero' Silvetti
Usage: ./apk2java [smali] .apk
Write 'smali' for disassemble .dex source code
** Convert 'apk' to 'jar' **
dex2jar /opt/apk2java/ -> -dex2jar.jar
java.io.IOException: File '/opt/apk2java' exists but is a directory
at org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:50)
at org.apache.commons.io.FileUtils.readFileToByteArray(FileUtils.java:40)
at com.googlecode.dex2jar.reader.DexFileReader.(DexFileReader.java:240)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:104)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:174)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:34)
** Remove if any 'src' folder exists **
** Create 'src' and 'class' folders **
** Expand, delete the 'jar' file **
ls: impossibile accedere a /opt/apk2java/*.jar: File o directory non esistente
** Decompiling class files **
** Delete .class files and 'class' folder **
** Extract, fix resource files **
Input file (/opt/apk2java/) was not found or was not readable.
** Create the Eclipse Project **
rm: impossibile rimuovere "/opt/apk2java/": Permesso negato
unzip: cannot find or open /opt/apk2java/tool/eclipseproject.zip, /opt/apk2java/tool/eclipseproject.zip.zip or /opt/apk2java/tool/eclipseproject.zip.ZIP.
cp: impossibile eseguire stat di "./src": File o directory non esistente
./apk2java: riga 176: cd: ./other: File o directory non esistente
cp: "./" e "/opt/apk2java/." sono lo stesso file
cat: /opt/apk2java//AndroidManifest.xml: File o directory non esistente
sed: impossibile leggere /opt/apk2java//.project: File o directory non esistente
** Clean temp folder **
rm: impossibile rimuovere "./src": File o directory non esistente
rm: impossibile rimuovere "./other": File o directory non esistente
** Process complete **
supaplex@hydrogen:~/usr/src/apk2java-linux$ ./apk2java.py d hello_world.apk
Downloading external tool... -> /home/supaplex/usr/src/apk2java-linux/apk2java/tool/
Progress: 100.01% - 8.7 MB/8.7 MB
Running: cp hello_world.apk /home/supaplex/usr/src/apk2java-linux/hello_world-new.apk
** Extract, fix resource files **
Running: /home/supaplex/usr/src/apk2java-linux/apk2java/tool/apktool_200rc3.jar d hello_world.apk -o /home/supaplex/usr/src/apk2java-linux/hello_world -f
Traceback (most recent call last):
File "./apk2java.py", line 213, in
main()
File "./apk2java.py", line 185, in main
apktool(options.smali)
File "./apk2java.py", line 85, in apktool
call(cmd)
File "./apk2java.py", line 14, in call
return subprocess.call(cmd, **kwargs)
File "/usr/lib/python3.5/subprocess.py", line 557, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.5/subprocess.py", line 947, in init
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
Travis is a CI runner that works with github: https://travis-ci.org/
If you sign in using github there, and add this repository to Travis, I can make a PR that upgrades the tools and does some more stuff. We can add a small test that decompiles a simple Android app (the .apk has to be in the repo) to ensure it's all working.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.