dhondta / dronesploit

Drone pentesting framework console
GNU General Public License v3.0
1.44k stars 245 forks source link

Cannot/unknown how to run (Kali Linux) #34

Closed CamoCatX closed 1 year ago

CamoCatX commented 1 year ago

Hello, I am greatly interested by this project and I wanted to test it out, but I received an error (It's probably me).

So first I installed dronesploit with: pip3 install dronesploit that was without error. But when I tried to run it python3 dronesploit it came to this error:

python3: can't open file '/home/kali/dronesploit': [Errno 2] No such file or directory

I know this is probably a simple mistake on my end but what is the solution to this?

dhondta commented 1 year ago

@CamoCatX Did you simply try running dronesploit and not python3 dronesploit ? The command-line tool gets installed in a standard folder that should be included in your $PATH.

CamoCatX commented 1 year ago

I am afraid not... I tried that before the python3, the error message when I tried running that command is: dronesploit: command not found

dhondta commented 1 year ago

@CamoCatX Then it means that the console script gets copied in a folder that is not covered by the $PATH. It should normally be in /usr/local/bin or ~/.local/bin. You should add the relevant path to $PATH.

CamoCatX commented 1 year ago

I added it, now I am receiving this error:

 Traceback (most recent call last):
  File "/home/kali/dronesploit", line 5, in <module>
    from dronesploit.__main__ import main
  File "/home/kali/.local/lib/python3.11/site-packages/dronesploit/__init__.py", line 3, in <module>
    from sploitkit import FrameworkConsole
  File "/home/kali/.local/lib/python3.11/site-packages/sploitkit/__init__.py", line 11, in <module>
    from .core import *
  File "/home/kali/.local/lib/python3.11/site-packages/sploitkit/core/__init__.py", line 1, in <module>
    from .console import *
  File "/home/kali/.local/lib/python3.11/site-packages/sploitkit/core/console.py", line 23, in <module>
    from .command import *
  File "/home/kali/.local/lib/python3.11/site-packages/sploitkit/core/command.py", line 8, in <module>
    from .components.config import Config
  File "/home/kali/.local/lib/python3.11/site-packages/sploitkit/core/components/__init__.py", line 11, in <module>
    from .validator import *
  File "/home/kali/.local/lib/python3.11/site-packages/sploitkit/core/components/validator.py", line 3, in <module>
    from inspect import getargspec
ImportError: cannot import name 'getargspec' from 'inspect' (/usr/lib/python3.11/inspect.py)
justinbetabox commented 1 year ago

Not sure how much this helps but I am also having the same issue. It seems to be a change in how inspect works in python3.11.

CamoCatX commented 1 year ago

@justinbetabox Yes, I asked chatGPT about and it said that the code was made for python 3.8.

justinbetabox commented 1 year ago

@CamoCatX Following this to see if a fix is found. Would love to have this work on 3.11 for ease of use for my students.

dhondta commented 1 year ago

Hi @justinbetabox @CamoCatX I'm working on it. I take the occasion to update Sploitkit and I will then release the update of DroneSploit (expected this weekend). Thank you for your patience.

CamoCatX commented 1 year ago

Thank you so much for replying back to me. The projects that you do are interesting and thought provoking.

amritabithi commented 1 year ago

Hello, I was just able to get it installed and working, with the exception of the "find_ssids" module not showing up, which happened the first time I ever installed and I just can't remember yet how I got the extra modules loaded, but here are the steps that should work for installing:

1) First uninstall dronesploit to clean out any files that may be there already so we can do a clean install: pip3 uninstall dronesploit

2) Purge the python cache: pip3 cache purge

3) Update your pip version to the latest version: python3 -m pip install --upgrade pip

4) Install 'wheel', 'setuptools', and 'readline': pip3 install wheel pip3 install setuptools

4) Install dronesploit with the --upgrade flag included: pip3 install dronesploit --upgrade

RUNNING:

1) Run dronesploit as root as it must toggle the wireless card, etc. (if you do not use sudo it should ask you to anyway): sudo dronesploit

2) Type the 'toggle' command and select your wireless interface, which will put the wireless card in monitor mode (your wireless interface name will be different, you can find it using the command 'ifconfig' and it will be named something similar to'wlpxxx': dronesploit> toggle wlp2s0

3) Select a module and try scanning ( select find_ssids' if it shows for you, I put another random example here: dronesploit> use command/dji/tello/get_sys_info dronesploit> scan wlp2s0

( The network interface name can be found by running ' ifconfig ' and will look something similar to "wlp2s0". )

I just tested again on this computer and those steps seem to work to start up cleanly, however there is one dronesploit module that is important called 'auxillary_wifi/find_ssids' that I will need to remember how I got it to show, I will update if I find my old question about it I had posted....

Also here is a very useful tutorial to help understand the commands and how to use it overall:

----------------------------------------------------------------------------------------------------------------------------------- https://dronesploit.readthedocs.io/en/latest/quickstart.html -----------------------------------------------------------------------------------------------------------------------------------

amritabithi commented 1 year ago

Note: I removed the 'pip3 install readline' command from my post above because it crashes with the latest version of python after rebooting/reloading the environment, and may not be needed on everybody's system to run dronesploit. I needed to install readline to run under Cython compiler but that will then conflict with Cython when running other scripts. tldr; You should not need the 'readline' module if you follow the steps above.

justinbetabox commented 1 year ago

@amritabithi Still am not able to get it working using the steps you listed. It is still throwing the same import error as above.

dhondta commented 1 year ago

@justinbetabox @CamoCatX @amritabithi My apologies, I'm currently busy with something else and therefore late on this. I'm moving the package definition from setup.cfg to pyproject.toml, which I guess could fix the initial issue. I'll get you updated ASAP. Thank you for your patience.

justinbetabox commented 1 year ago

@dhondta I was able to get it to start by changing the getargspec to getfullargspec. Running scan doesn't seem to show any TELLO networks even when I know there are. Aircrack-ng seems to be able to see it however.

Unactived commented 1 year ago

Hello, as evoked the problem is that inspect.getargspec was deprecated in Python 3.0 and removed in Python 3.11

Removed from the inspect module:

  • The getargspec() function, deprecated since Python 3.0; use inspect.signature() or inspect.getfullargspec() instead.
  • The formatargspec() function, deprecated since Python 3.5; use the inspect.signature() function or the inspect.Signature object directly.
  • The undocumented Signature.from_builtin() and Signature.from_function() methods, deprecated since Python 3.5; use the Signature.from_callable() method instead.

I do not have the equipment to be testing this framework and even less conclude on its working state, and didn't dive into the code or the inspect module to check what should precisely be done, but simply replacing the use of getargspec by getfullargspec may be sufficient and not too complex, with possibly some minor adjustments.

According to the doc (of 3.10 since the doc of getargspec was removed as well),

Deprecated since version 3.0: Use getfullargspec() for an updated API that is usually a drop-in replacement, but also correctly handles function annotations and keyword-only parameters.

Alternatively, use signature() and Signature Object, which provide a more structured introspection API for callables.

A naive replacement of the import by from inspect import getfullargspec as getargspec at least allows dronesploit to start without errors (obviously an actual update would rather at least update function calls).

dhondta commented 1 year ago

@justinbetabox FYI ; the import of inspect.getargspec was removed in the latest version. The issue is thus not present anymore. @CamoCatX In the latest version of Kali, when you pip install dronesploit (or whatever package that has a console script), you get a warning telling that the script is installed in /home/kali/.local/bin which is not on PATH. This means that you need to export PATH=$PATH:/home/kali/.local/bin to get dronesploit recognized as a command.