WithSecureLabs / drozer

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

Caught Exception [Errno 35] Resource temporarily unavailable and Caught Exception [Errno 22] Invalid argument #432

Closed niuTT closed 5 months ago

niuTT commented 5 months ago

please help me ,thank you

企业微信20240423-173246@2x
cyberMilosz commented 5 months ago

Hey! We're going to need much more information to replicate your issue. At the very least some details of your environment and how you've installed drozer would be helpful.

In the meantime, hopefully the Docker container provides you with a workaround.

niuTT commented 5 months ago

The Mac M1 device I am using, Python version 3.9.6, and the whl file I downloaded from GitHub for the installation of the drozer

Yogehi commented 5 months ago

can you run drozer console connect --debug and give the output of that please?

also, since you're using python 3.9.6, i'm assuming you don't have brew installed and you didn't do brew install python3, right?

niuTT commented 5 months ago
image
niuTT commented 5 months ago
image
niuTT commented 5 months ago

I have brew but I don’t like to install two pythons, so I use the python that comes with mac

Yogehi commented 5 months ago

we'll need to investigate this honestly

assuming you have the latest version of the drozer agent installed, everything in theory should be working. so we'll look into this

in the mean time, is it possible for you to use the docker container version of drozer instead?

niuTT commented 5 months ago

I used docker to install drozer but it still can't be used

image
Yogehi commented 5 months ago

give us a full list of commands you did, from start to finish

like what commands did you try to run before running docker run

cyberMilosz commented 5 months ago

Hey!

I'm trying to replicate your issues (native install, not docker) and, frankly, I'm just not getting there.

A few questions for you:

When I have a moment, I'll modify this exception handler: https://github.com/WithSecureLabs/drozer/blob/9737ce2b1bbd3836afc68a8cd4449a2c6b5b7073/src/drozer/console/console.py#L75-L76 so hopefully we can get more useful information in the future. But, in the meantime, double-checking that you've installed everything correctly might just help.

fwiw, here's a full log of me installing everything from scratch on an M1 Mac Mini:

milosz@ExtremeTrucks ~ % which drozer
drozer not found
milosz@ExtremeTrucks ~ % which python3
/usr/bin/python3
milosz@ExtremeTrucks ~ % which pip3
/usr/bin/pip3
milosz@ExtremeTrucks ~ % python3 --version
Python 3.9.6

# Downloading drozer
milosz@ExtremeTrucks ~ % wget https://github.com/WithSecureLabs/drozer/releases/download/3.0.2/drozer-3.0.2-py3-none-any.whl  
[...]
drozer-3.0.2-py3-none-any.whl                                100%[==============================================================================================================================================>]  83.74M  34.7MB/s    in 2.4s    

2024-04-24 10:56:20 (34.7 MB/s) - ‘drozer-3.0.2-py3-none-any.whl’ saved [87805849/87805849]

milosz@ExtremeTrucks ~ % sudo -H pip3 install ./drozer-3.0.2-py3-none-any.whl
Processing ./drozer-3.0.2-py3-none-any.whl
Requirement already satisfied: pyopenssl>=22.0.0 in ./Library/Python/3.9/lib/python/site-packages (from drozer==3.0.2) (24.1.0)
Requirement already satisfied: twisted>=18.9.0 in ./Library/Python/3.9/lib/python/site-packages (from drozer==3.0.2) (24.3.0)
Requirement already satisfied: pyyaml in ./Library/Python/3.9/lib/python/site-packages (from drozer==3.0.2) (6.0.1)
Requirement already satisfied: distro in ./Library/Python/3.9/lib/python/site-packages (from drozer==3.0.2) (1.9.0)
Requirement already satisfied: service-identity in ./Library/Python/3.9/lib/python/site-packages (from drozer==3.0.2) (24.1.0)
Requirement already satisfied: protobuf>=4.25.2 in ./Library/Python/3.9/lib/python/site-packages (from drozer==3.0.2) (5.26.1)
Requirement already satisfied: cryptography<43,>=41.0.5 in ./Library/Python/3.9/lib/python/site-packages (from pyopenssl>=22.0.0->drozer==3.0.2) (42.0.5)
Requirement already satisfied: automat>=0.8.0 in ./Library/Python/3.9/lib/python/site-packages (from twisted>=18.9.0->drozer==3.0.2) (22.10.0)
Requirement already satisfied: attrs>=21.3.0 in ./Library/Python/3.9/lib/python/site-packages (from twisted>=18.9.0->drozer==3.0.2) (23.2.0)
Requirement already satisfied: incremental>=22.10.0 in ./Library/Python/3.9/lib/python/site-packages (from twisted>=18.9.0->drozer==3.0.2) (22.10.0)
Requirement already satisfied: zope-interface>=5 in ./Library/Python/3.9/lib/python/site-packages (from twisted>=18.9.0->drozer==3.0.2) (6.3)
Requirement already satisfied: typing-extensions>=4.2.0 in ./Library/Python/3.9/lib/python/site-packages (from twisted>=18.9.0->drozer==3.0.2) (4.11.0)
Requirement already satisfied: constantly>=15.1 in ./Library/Python/3.9/lib/python/site-packages (from twisted>=18.9.0->drozer==3.0.2) (23.10.4)
Requirement already satisfied: hyperlink>=17.1.1 in ./Library/Python/3.9/lib/python/site-packages (from twisted>=18.9.0->drozer==3.0.2) (21.0.0)
Requirement already satisfied: pyasn1 in ./Library/Python/3.9/lib/python/site-packages (from service-identity->drozer==3.0.2) (0.6.0)
Requirement already satisfied: pyasn1-modules in ./Library/Python/3.9/lib/python/site-packages (from service-identity->drozer==3.0.2) (0.4.0)
Requirement already satisfied: six in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (from automat>=0.8.0->twisted>=18.9.0->drozer==3.0.2) (1.15.0)
Requirement already satisfied: cffi>=1.12 in ./Library/Python/3.9/lib/python/site-packages (from cryptography<43,>=41.0.5->pyopenssl>=22.0.0->drozer==3.0.2) (1.16.0)
Requirement already satisfied: idna>=2.5 in ./Library/Python/3.9/lib/python/site-packages (from hyperlink>=17.1.1->twisted>=18.9.0->drozer==3.0.2) (3.7)
Requirement already satisfied: setuptools in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (from zope-interface>=5->twisted>=18.9.0->drozer==3.0.2) (58.0.4)
Requirement already satisfied: pycparser in ./Library/Python/3.9/lib/python/site-packages (from cffi>=1.12->cryptography<43,>=41.0.5->pyopenssl>=22.0.0->drozer==3.0.2) (2.22)
Installing collected packages: drozer
Successfully installed drozer-3.0.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip is available: 23.0.1 -> 24.0
[notice] To update, run: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -m pip install --upgrade pip

# Do I have drozer now?
milosz@ExtremeTrucks ~ % which drozer
/usr/local/bin/drozer

# Downloading and installing the agent
milosz@ExtremeTrucks ~ % wget https://github.com/WithSecureLabs/drozer-agent/releases/download/3.0.0/drozer-agent.apk
[...]
drozer-agent.apk                                             100%[==============================================================================================================================================>]   7.68M  15.0MB/s    in 0.5s    

2024-04-24 11:05:11 (15.0 MB/s) - ‘drozer-agent.apk’ saved [8054496/8054496]

milosz@ExtremeTrucks ~ % adb install drozer-agent.apk
Performing Streamed Install
Success

# Start the app on my phone, make sure the server is running...

# Connect via IP
milosz@ExtremeTrucks ~ % drozer console connect --server 192.168.1.106                                               
Selecting 2efc46d6bed126aa (Google Pixel 8 Pro 14)

            ..                    ..:.
           ..o..                  .r..
            ..a..  . ....... .  ..nd
              ro..idsnemesisand..pr
              .otectorandroidsneme.
           .,sisandprotectorandroids+.
         ..nemesisandprotectorandroidsn:.
        .emesisandprotectorandroidsnemes..
      ..isandp,..,rotecyayandro,..,idsnem.
      .isisandp..rotectorandroid..snemisis.
      ,andprotectorandroidsnemisisandprotec.
     .torandroidsnemesisandprotectorandroid.
     .snemisisandprotectorandroidsnemesisan:
     .dprotectorandroidsnemesisandprotector.

drozer Console (v3.0.2)
dz> 
dz> Caught SIGINT, terminating your session.

# Connect via adb tunnel
milosz@ExtremeTrucks ~ % adb forward tcp:31415 tcp:31415                                                             
31415
milosz@ExtremeTrucks ~ % drozer console connect                                                                      
Selecting 2efc46d6bed126aa (Google Pixel 8 Pro 14)

            ..                    ..:.
           ..o..                  .r..
            ..a..  . ....... .  ..nd
              ro..idsnemesisand..pr
              .otectorandroidsneme.
           .,sisandprotectorandroids+.
         ..nemesisandprotectorandroidsn:.
        .emesisandprotectorandroidsnemes..
      ..isandp,..,rotecyayandro,..,idsnem.
      .isisandp..rotectorandroid..snemisis.
      ,andprotectorandroidsnemisisandprotec.
     .torandroidsnemesisandprotectorandroid.
     .snemisisandprotectorandroidsnemesisan:
     .dprotectorandroidsnemesisandprotector.

drozer Console (v3.0.2)
dz> 
dz> Caught SIGINT, terminating your session.
milosz@ExtremeTrucks ~ %

I've also tried installing in the local pip distro (no sudo) and using virtualenv with identical results.

niuTT commented 5 months ago
image
niuTT commented 5 months ago

es, I tried to compile and install drozer from the source code, and also tried to download the whl file in github, and the error result was the same. I made sure I installed the latest version of drozer agent 3.0 on mobile

niuTT commented 5 months ago
image
niuTT commented 5 months ago

This error was caused by me forgetting to open the drozer agent on the mobile phone, so I deleted this record. image

Yogehi commented 5 months ago

yeah idk what to tell you

as far as i can tell, everything should be working

like milosz said, for now we just need to modify how to handle those errors better so we can help further

only thing i could suggest that you do for now is:

Yogehi commented 5 months ago

closing issue because legit unsure what is going on for now

milosz already confirmed that drozer for sure works on apple computers with silicon and the non-brew version of python

imbauni commented 4 months ago

使用版本: Android 11 drozer Console (v3.0.2) drozer Agent v2.5.2

drozer location: /Users/xxxxxxx/Library/Python/3.8/bin/drozer

我的drozer in mac也遇到一樣的錯誤訊息 Caught Exception [Errno 35] Resource temporarily unavailable or Caught Exception [Errno 22] Invalid argument

但是我改用python3.9,就可以成功執行了 用以下面指令執行 python3.9 drozer console connect