WithSecureLabs / drozer

The Leading Security Assessment Framework for Android.
https://labs.withsecure.com/tools/drozer
Other
3.9k stars 776 forks source link

ZipUtil.class: file not found #305

Closed MiriUll closed 6 years ago

MiriUll commented 7 years ago

Steps to reproduce

  1. Installed Drozer
  2. Started drozer console connect
  3. ran "run app.package.attacksurface com.csipsimple"

Expected behaviour

Tell us what should happen.

Output all Content provider

Actual behaviour

Tell us what happens instead. `Scanning com.csipsimple... /usr/bin/javac -cp /usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/lib/android.jar ZipUtil.java ZipUtil.java:10: error: error while writing ZipUtil: ZipUtil.class (Permission denied) public class ZipUtil { ^ 1 error /usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/lib/dx --dex --output 4a78a7a38b67b985beccf6efac92375b.apk ZipUtil.class

UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.RuntimeException: ZipUtil.class: file not found at com.android.dex.util.FileUtils.readFile(FileUtils.java:51) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:169) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) at com.android.dx.command.dexer.Main.processOne(Main.java:596) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264) at com.android.dx.command.dexer.Main.run(Main.java:230) at com.android.dx.command.dexer.Main.main(Main.java:199) at com.android.dx.command.Main.main(Main.java:103) 1 error; aborting drozer could not find or compile a required extension library.`

Environment

Operating system: Fedora 25

Java Version: 1.8.0_144

Android Version: 2.3.7

Drozer Version:

Install Method: Built from source/.deb/.exe/.. 'sudo python setup.py install' (I tried 'make rpm' but I get this answer: 'cd common; protoc --python_out=../src/pydiesel/api/ protobuf.proto /bin/sh: protoc: Kommando nicht gefunden. Makefile:55: die Regel für Ziel „src/pydiesel/api/protobuf_pb2.py“ scheiterte make: *** [src/pydiesel/api/protobuf_pb2.py] Fehler 127Ä')

Drozer Config

Contents of ~/.drozer_config
```where do I find that file? It doesn't seem to be there..

### Drozer Error Logs

Drozer error logs, ensure Drozer is launched in debug mode $ drozer console connect --debug


When launching in debug mode I get 
`Scanning com.csipsimple...
/usr/bin/javac -cp /usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/lib/android.jar ZipUtil.java
ZipUtil.java:10: error: error while writing ZipUtil: ZipUtil.class (Permission denied)
public class ZipUtil {
       ^
1 error
/usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/lib/dx --dex --output 4a78a7a38b67b985beccf6efac92375b.apk ZipUtil.class

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
        at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
        at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
        at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
        at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
        at com.android.dx.command.dexer.Main.processClass(Main.java:665)
        at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
        at com.android.dx.command.dexer.Main.access$600(Main.java:78)
        at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:170)
        at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
        at com.android.dx.command.dexer.Main.processOne(Main.java:596)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
        at com.android.dx.command.dexer.Main.run(Main.java:230)
        at com.android.dx.command.dexer.Main.main(Main.java:199)
        at com.android.dx.command.Main.main(Main.java:103)
...while parsing ZipUtil.class

1 error; aborting
exception in module: RuntimeError: drozer could not find or compile a required extension library.

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/console/session.py", line 394, in do_run
    module.run(argv[1:])
  File "/usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/modules/base.py", line 183, in run
    result = self.execute(arguments)
  File "/usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/modules/app/provider.py", line 124, in execute
    uris = self.findAllContentUris(arguments.package)
  File "/usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/modules/common/provider.py", line 206, in findAllContentUris
    uris = uris.union(self.__search_package(package))
  File "/usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/modules/common/provider.py", line 316, in __search_package
    for (path, content_uris) in self.findContentUris(package.packageName):
  File "/usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/modules/common/provider.py", line 228, in findContentUris
    dex_file = self.extractFromZip("classes.dex", path, self.cacheDir())
  File "/usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/modules/common/zip_file.py", line 14, in extractFromZip
    ZipUtil = self.loadClass("common/ZipUtil.apk", "ZipUtil")
  File "/usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/drozer/modules/common/loader.py", line 30, in loadClass
    Module.cache_klass(".".join([source, klass]), loader.loadClass(klass))
  File "/usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/pydiesel/reflection/utils/class_loader.py", line 28, in loadClass
    return self.getClassLoader().loadClass(klass);
  File "/usr/lib/python2.7/site-packages/drozer-2.4.3-py2.7.egg/pydiesel/reflection/utils/class_loader.py", line 51, in getClassLoader
    raise RuntimeError("drozer could not find or compile a required extension library.\n")
RuntimeError: drozer could not find or compile a required extension library.
`

Can someone help me with this?
amarekano commented 6 years ago

Hey @MiriUll, drozer doesn't support java 1.8 yet. You would have to downgrade to java 1.7 in order build from source.

Alternatively, try our rpm package which is available at https://github.com/mwrlabs/drozer/releases/download/2.4.3/drozer-2.4.3-1.noarch.rpm