codingo / Reconnoitre

A security tool for multithreaded information gathering and service enumeration whilst building directory structures to store results, along with writing out recommendations for further testing.
GNU General Public License v3.0
2.11k stars 456 forks source link

Missing library in Kali #87

Closed digital-shokunin closed 5 years ago

digital-shokunin commented 5 years ago

I'm running reconnoitre in Kali, it was working fine before but now, after a git pull I'm getting some other error.

Traceback (most recent call last):
  File "/usr/local/bin/reconnoitre", line 11, in <module>
    load_entry_point('Reconnoitre==1.0', 'console_scripts', 'reconnoitre')()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 484, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2714, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2332, in load
    return self.resolve()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2338, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.6/dist-packages/Reconnoitre-1.0-py3.6.egg/Reconnoitre/reconnoitre.py", line 6, in <module>
    from lib.core.input import CliArgumentParser
ModuleNotFoundError: No module named 'lib.core'

pip says "lib" is already installed.

pip install lib Requirement already satisfied: lib in /usr/local/lib/python3.6/dist-packages (3.0.0)

Running python3 --version Python 3.6.8rc1

P3J0T commented 5 years ago

Exact same issue, error and environment. Installation works with Python2 however.

codingo commented 5 years ago

Sorry, I missed this originally. Have you both run the setup instructions on the repository? This wasn't necessary before, but is now that I've packaged everything.

P3J0T commented 5 years ago

I've run instructions as described for both Py2 & Py3, it has successfully installed each time but it got to the error above when executing it from the installation context of Py3.

overfl0wd commented 5 years ago

i'm getting the same error using python3 on the kali 2019.1 virtualbox ova.

any update here?

codingo commented 5 years ago

@overfl0wd I'm yet to lab this, admittedly. Looking into it now.

Could you let me know if you ran setup.py as well as the command line flags you've used?

overfl0wd commented 5 years ago

i ran python3 ./setup.py install with python 3.6.8 installed.

installation succeeded, but invoking reconnoitre in a terminal threw ModuleNotFoundError: No module named 'lib'.

after a pip3 install lib i received the ModuleNotFoundError: No module named 'lib.core'.

i just replicated the issue for a second time on a fresh install of the same ova.

noraj commented 5 years ago

@codingo Same problem on ArchLinux:

PKGBUILD:

# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=reconnoitre
pkgver=398.758247a
pkgrel=1
pkgdesc='A security tool for multithreaded information gathering and service enumeration.'
groups=('blackarch' 'blackarch-recon')
arch=('any')
url='https://github.com/codingo/Reconnoitre'
license=('GPL3')
depends=('python' 'python-argparse')
makedepends=('git' 'python-setuptools')
source=("$pkgname::git+https://github.com/codingo/Reconnoitre.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
}

Then on a clean chroot environment:

$ blackarch-devtools -t -e reconnoitre -p reconnoitre-398.758247a-1-any.pkg.tar.xz
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) reconnoitre-398.758247a-1

Total Installed Size:  0,17 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                                                                                 [########################################################################################] 100%
(1/1) checking package integrity                                                                                                               [########################################################################################] 100%
(1/1) loading package files                                                                                                                    [########################################################################################] 100%
(1/1) checking for file conflicts                                                                                                              [########################################################################################] 100%
(1/1) checking available disk space                                                                                                            [########################################################################################] 100%
:: Processing package changes...
(1/1) installing reconnoitre                                                                                                                   [########################################################################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
Package reconnoitre-398.758247a-1-any.pkg.tar.xz installed correctly! Testing it now...
Traceback (most recent call last):
  File "/usr/bin/reconnoitre", line 11, in <module>
    load_entry_point('Reconnoitre==1.0', 'console_scripts', 'reconnoitre')()
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2434, in load
    return self.resolve()
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2440, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3.7/site-packages/Reconnoitre/reconnoitre.py", line 6, in <module>
    from lib.core.input import CliArgumentParser
ModuleNotFoundError: No module named 'lib'
An error as ocurred while trying to execute the binary reconnoitre, are you sure that it's the binary name?

versions installed:

python-appdirs-1.4.3-2  python-packaging-19.0-1  python-pyparsing-2.4.0-1  python-six-1.12.0-1  python-setuptools-1:41.0.1-1 perl-error-0.17027-1  perl-mailtools-2.21-1  perl-timedate-2.30-5  git-2.21.0-1 libnsl-1.2.0-1  python-3.7.3-1  python-argparse-1.4.0-5
noraj commented 5 years ago

I also tried in a clean python 3.6.8 virtuual environment:

$ git clone https://github.com/codingo/Reconnoitre.git
$ cd Reconnoitre
$ python setup.py install
$ reconnoitre
Traceback (most recent call last):
  File "/home/noraj/.pyenv/versions/3.6.8/bin/reconnoitre", line 11, in <module>
    load_entry_point('Reconnoitre==1.0', 'console_scripts', 'reconnoitre')()
  File "/home/noraj/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/noraj/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/home/noraj/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/home/noraj/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/noraj/.pyenv/versions/3.6.8/lib/python3.6/site-packages/Reconnoitre-1.0-py3.6.egg/Reconnoitre/reconnoitre.py", line 6, in <module>
    from lib.core.input import CliArgumentParser
ModuleNotFoundError: No module named 'lib'
noraj commented 5 years ago

@codingo This seems completely unrelated to the OS or the3.x python version but to the packaging itself, as it happens on both Kali Linux and ArchLinux, on python 3.6.8-rc1, 3.6.8 and 3.7.3.

Edu4rdSHL commented 5 years ago

Hello guys, the package is failing with ModuleNotFoundError: No module named 'lib.core' because you're trying to run the script that's outside of the Reconnoitre folder and it's trying to import the lib folder, using the setup.py file fix it issue but you already got another one like ModuleNotFoundError: No module named 'file_helper' because some modules - find_dns.py for example try to use the file_helper module but they're called outside of that folder (in a previous dir). It's solved importing they like:

from lib.file_helper import check_directory

https://github.com/codingo/Reconnoitre/pull/95 will fix it, for now an easy workaround is just use:

$ git clone https://github.com/codingo/Reconnoitre.git
$ cd Reconnoitre
$ find . -type f -print0 | xargs -0 sed -i 's/from file_helper/from lib.file_helper/g'
$ sudo python setup.py install

Then you can run reconnoitre from your terminal.

dkumardefence commented 5 years ago

Hello codingo, I'm facing the lib.file_helper import issue. Can you please look into this. image

Thanks

Edu4rdSHL commented 5 years ago

@dkumardefence what steps are you following?

[edu4rdshl@blackarch tmp]$ git clone https://github.com/codingo/Reconnoitre
Cloning into 'Reconnoitre'...
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 1489 (delta 5), reused 10 (delta 1), pack-reused 1467
Receiving objects: 100% (1489/1489), 357.89 KiB | 389.00 KiB/s, done.
Resolving deltas: 100% (967/967), done.
[edu4rdshl@blackarch tmp]$ cd Reconnoitre
[edu4rdshl@blackarch Reconnoitre]$ ls
assets  LICENSE  MANIFEST.in  README.md  Reconnoitre  setup.py  tests
[edu4rdshl@blackarch Reconnoitre]$ cd Reconnoitre/
[edu4rdshl@blackarch Reconnoitre]$ ls
__init__.py  lib  reconnoitre.py  wordlists
[edu4rdshl@blackarch Reconnoitre]$ python reconnoitre.py 
usage: reconnoitre.py [-h] -t TARGET_HOSTS -o OUTPUT_DIRECTORY [-w WORDLIST]
                      [-p PORT] [--pingsweep] [--dns] [--services]
                      [--hostnames] [--snmp] [--quick] [--virtualhosts]
                      [--ignore-http-codes IGNORE_HTTP_CODES]
                      [--ignore-content-length IGNORE_CONTENT_LENGTH]
                      [--quiet] [--no-udp]
reconnoitre.py: error: the following arguments are required: -t, -o
[edu4rdshl@blackarch Reconnoitre]$ python --version
Python 3.7.3
dkumardefence commented 5 years ago

@Edu4rdSHL - I used the python setup.py install and then launching reconnoitre from terminal. This is my new VM box and in the existing box it just works fine.

Thanks

dkumardefence commented 5 years ago

@Edu4rdSHL BTW python reconnoitre.py works fine too. I was accustomed to use the reconnoitre from terminal(anywhere)