WithSecureLabs/drozer

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

niuTT opened this issue · 17 comments

please help me ,thank you
企业微信20240423-173246@2x

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.

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

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?

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

we'll need to investigate this honestly

  • the fact that drozer recognizes the pixel device means that you have adb forward working properly, and that the drozer agent on the phone is reachable
  • the debug flag didn't provide anything useful
  • none of us have silicon macs to test this on, so we'll need to find a way to test this on a silicon mac

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?

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

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

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:

  • Where is drozer installed? (which drozer)
  • How EXACTLY did you install it? A few questions there:
    • Are you sure you downloaded the wheel from our releases page? Your screenshots from earlier sure looked like you were building from source.
      image
    • What pip3 command did you run? Did you run it as sudo, install to your local distro, did you use a venv?
  • Earlier today you also posted this error (though it looks like you deleted it since):
    image So, just to rule out further issues: are you sure you downloaded the most recent drozer Agent from our repo?

When I have a moment, I'll modify this exception handler:

except Exception as e:
print(f"Caught Exception {e}")

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.

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

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

yeah idk what to tell you

as far as i can tell, everything should be working

  • you adb forward
  • drozer on your macbook connects to the drozer agent on the pixel device, which implies TCP traffic is running fine and that the drozer service itself is for sure listening
  • you have the same python setup as milosz

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:

  • install vmware player (free license)
  • install kali arm64 VM
  • hook up your phone and drozer to the kali VM
  • do drozer shit

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

使用版本:
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