codingo / NoSQLMap

Automated NoSQL database enumeration and web application exploitation tool.
GNU General Public License v3.0
2.8k stars 574 forks source link

Problem when i try to install in kali #126

Closed alonsoir closed 1 year ago

alonsoir commented 2 years ago

What's the problem (or question)?

setup script is not working in kali.

──(kali㉿kali)-[~/git] └─$ cat /etc/issue grep VERSION /etc/os-release Kali GNU/Linux Rolling \n \l

VERSION="2022.1" VERSION_ID="2022.1" VERSION_CODENAME="kali-rolling"

Do you have an idea for a solution?

How can we reproduce the issue?

Just run setup script in kali

What are the running context details?

`┌──(kali㉿kali)-[~/git/NoSQLMap] └─$ sudo python setup.py install running install /usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( /usr/lib/python3/dist-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( /usr/lib/python3/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 1.16.0-unknown is an invalid version and will not be supported in a future release warnings.warn( /usr/lib/python3/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 1.12.1-git20200711.33e2d80-dfsg1-0.6 is an invalid version and will not be supported in a future release warnings.warn( running bdist_egg running egg_info writing NoSQLMap.egg-info/PKG-INFO writing dependency_links to NoSQLMap.egg-info/dependency_links.txt writing entry points to NoSQLMap.egg-info/entry_points.txt writing requirements to NoSQLMap.egg-info/requires.txt writing top-level names to NoSQLMap.egg-info/top_level.txt reading manifest file 'NoSQLMap.egg-info/SOURCES.txt' adding license file 'COPYING' writing manifest file 'NoSQLMap.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib warning: install_lib: 'build/lib' does not exist -- no Python modules to install

creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/EGG-INFO installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts running install_scripts running build_scripts creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.9/nsmmongo.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.9/nosqlmap.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.9/nsmcouch.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.9/exception.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.9/nsmscan.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.9/nsmweb.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/nsmmongo.py to 755 changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/nosqlmap.py to 755 changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/nsmcouch.py to 755 changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/exception.py to 755 changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/nsmscan.py to 755 changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/nsmweb.py to 755 copying NoSQLMap.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying NoSQLMap.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying NoSQLMap.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying NoSQLMap.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying NoSQLMap.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying NoSQLMap.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO zip_safe flag not set; analyzing archive contents... creating 'dist/NoSQLMap-0.7-py3.9.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing NoSQLMap-0.7-py3.9.egg Removing /usr/local/lib/python3.9/dist-packages/NoSQLMap-0.7-py3.9.egg Copying NoSQLMap-0.7-py3.9.egg to /usr/local/lib/python3.9/dist-packages NoSQLMap 0.7 is already the active version in easy-install.pth Installing exception.py script to /usr/local/bin Installing nosqlmap.py script to /usr/local/bin Installing nsmcouch.py script to /usr/local/bin Installing nsmmongo.py script to /usr/local/bin Installing nsmscan.py script to /usr/local/bin Installing nsmweb.py script to /usr/local/bin Installing NoSQLMap script to /usr/local/bin

Installed /usr/local/lib/python3.9/dist-packages/NoSQLMap-0.7-py3.9.egg Processing dependencies for NoSQLMap==0.7 Searching for pymongo==2.7.2 Reading https://pypi.org/simple/pymongo/ /usr/lib/python3/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: is an invalid version and will not be supported in a future release warnings.warn( Downloading https://files.pythonhosted.org/packages/8e/34/4b3cd4bfe5f3bfbd89873c8e24e091a6a6510c57fedea76161530be18a61/pymongo-2.7.2.tar.gz#sha256=8fb45e3edec006f4b11580fc579bec7781a8b3201ce0abf31593f086070e51f6 Best match: pymongo 2.7.2 Processing pymongo-2.7.2.tar.gz Writing /tmp/easy_install-_lyighgk/pymongo-2.7.2/setup.cfg Running pymongo-2.7.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_lyighgk/pymongo-2.7.2/egg-dist-tmp-l9knnz25 error: Setup script exited with error in pymongo setup command: use_2to3 is invalid.

bramvbilsen commented 2 years ago

This project does not seem to work with Python 3.x, so use python 2.7.x instead.

alonsoir commented 2 years ago

Thanks for the answer, do you know if it is in the roadmap to update the tool to python3? python2 has been deprecated for two years...

bramvbilsen commented 2 years ago

Actually, I just tried this with python 2, it installed but I am getting a a syntax error upon running. I tried running this via python and docker on a Mac without success. Also tried the same in an Ubuntu VM but was greeted with the exact same errors that I got on Mac. I'm in no way associated with this proejct, so no clue about any updates.

bramvbilsen commented 2 years ago

What platform are you running this on?

sl2mmin commented 2 years ago

Actually, I just tried this with python 2, it installed but I am getting a a syntax error upon running. I tried running this via python and docker on a Mac without success. Also tried the same in an Ubuntu VM but was greeted with the exact same errors that I got on Mac. I'm in no way associated with this proejct, so no clue about any updates.

If you're getting an invalid syntax error from certifi then what fixed it for me was just removing the one NoSQLMap installs and installing an older version that works with Python2.

Error location:

  File "/usr/local/lib/python2.7/dist-packages/certifi-2022.5.18.1-py2.7.egg/certifi/core.py", line 17
    def where() -> str:

Fix:

pip2 uninstall certifi
pip2 install certifi==2018.10.15
alonsoir commented 2 years ago

Hi, it is not working, both ways.

`> sudo python setup.py install running install /usr/local/lib/python3.10/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( /usr/local/lib/python3.10/dist-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( /usr/local/lib/python3.10/dist-packages/pkg_resources/init.py:123: PkgResourcesDeprecationWarning: 1.16.0-unknown is an invalid version and will not be supported in a future release warnings.warn( /usr/local/lib/python3.10/dist-packages/pkg_resources/init.py:123: PkgResourcesDeprecationWarning: 1.12.1-git20200711.33e2d80-dfsg1-0.6 is an invalid version and will not be supported in a future release warnings.warn( running bdist_egg running egg_info writing NoSQLMap.egg-info/PKG-INFO writing dependency_links to NoSQLMap.egg-info/dependency_links.txt writing entry points to NoSQLMap.egg-info/entry_points.txt writing requirements to NoSQLMap.egg-info/requires.txt writing top-level names to NoSQLMap.egg-info/top_level.txt reading manifest file 'NoSQLMap.egg-info/SOURCES.txt' adding license file 'COPYING' writing manifest file 'NoSQLMap.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib warning: install_lib: 'build/lib' does not exist -- no Python modules to install

creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/EGG-INFO installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts running install_scripts running build_scripts creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.10/nsmmongo.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.10/nosqlmap.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.10/nsmcouch.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.10/exception.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.10/nsmscan.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts copying build/scripts-3.10/nsmweb.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/nsmmongo.py to 755 changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/nosqlmap.py to 755 changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/nsmcouch.py to 755 changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/exception.py to 755 changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/nsmscan.py to 755 changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/nsmweb.py to 755 copying NoSQLMap.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying NoSQLMap.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying NoSQLMap.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying NoSQLMap.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying NoSQLMap.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying NoSQLMap.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO zip_safe flag not set; analyzing archive contents... creating 'dist/NoSQLMap-0.7-py3.10.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing NoSQLMap-0.7-py3.10.egg Removing /usr/local/lib/python3.10/dist-packages/NoSQLMap-0.7-py3.10.egg Copying NoSQLMap-0.7-py3.10.egg to /usr/local/lib/python3.10/dist-packages NoSQLMap 0.7 is already the active version in easy-install.pth Installing exception.py script to /usr/local/bin Installing nosqlmap.py script to /usr/local/bin Installing nsmcouch.py script to /usr/local/bin Installing nsmmongo.py script to /usr/local/bin Installing nsmscan.py script to /usr/local/bin Installing nsmweb.py script to /usr/local/bin Installing NoSQLMap script to /usr/local/bin

Installed /usr/local/lib/python3.10/dist-packages/NoSQLMap-0.7-py3.10.egg Processing dependencies for NoSQLMap==0.7 Searching for pymongo==2.7.2 Reading https://pypi.org/simple/pymongo/ /usr/local/lib/python3.10/dist-packages/pkg_resources/init.py:123: PkgResourcesDeprecationWarning: is an invalid version and will not be supported in a future release warnings.warn( Downloading https://files.pythonhosted.org/packages/8e/34/4b3cd4bfe5f3bfbd89873c8e24e091a6a6510c57fedea76161530be18a61/pymongo-2.7.2.tar.gz#sha256=8fb45e3edec006f4b11580fc579bec7781a8b3201ce0abf31593f086070e51f6 Best match: pymongo 2.7.2 Processing pymongo-2.7.2.tar.gz Writing /tmp/easy_install-kupmanps/pymongo-2.7.2/setup.cfg Running pymongo-2.7.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-kupmanps/pymongo-2.7.2/egg-dist-tmp-a7ly6vl7 error: Setup script exited with error in pymongo setup command: use_2to3 is invalid.

python nosqlmap.py File "/home/kali/git/NoSQLMap/nosqlmap.py", line 65 print " _ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? `

The docker compose way does not work either.

`> docker-compose build Building nosqlmap Sending build context to Docker daemon 4.096kB Step 1/10 : FROM python:2.7-alpine ---> 8579e446340f Step 2/10 : RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/main' >> /etc/apk/repositories ---> Using cache ---> 9b597a475c30 Step 3/10 : RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/community' >> /etc/apk/repositories ---> Using cache ---> 10875167047b Step 4/10 : RUN apk update && apk add mongodb git ---> Using cache ---> 8cffa390efeb Step 5/10 : RUN git clone https://github.com/codingo/NoSQLMap.git /root/NoSqlMap ---> Using cache ---> 60ea6cf8c1b7 Step 6/10 : WORKDIR /root/NoSqlMap ---> Using cache ---> 93e6b94550bb Step 7/10 : RUN python setup.py install ---> Using cache ---> f401d7fcd281 Step 8/10 : COPY entrypoint.sh /tmp/entrypoint.sh ---> Using cache ---> 7c60c7a3641e Step 9/10 : RUN chmod +x /tmp/entrypoint.sh ---> Using cache ---> 630bcdf81391 Step 10/10 : ENTRYPOINT ["/tmp/entrypoint.sh"] ---> Using cache ---> e977052fa530 Successfully built e977052fa530 Successfully tagged nosqlmap:latest

docker-compose run nosqlmap Creating docker_nosqlmap_run ... done Traceback (most recent call last): File "nosqlmap.py", line 8, in import nsmcouch File "/root/NoSqlMap/nsmcouch.py", line 8, in import requests File "/usr/local/lib/python2.7/site-packages/requests-2.20.0-py2.7.egg/requests/init.py", line 112, in from . import utils File "/usr/local/lib/python2.7/site-packages/requests-2.20.0-py2.7.egg/requests/utils.py", line 24, in from . import certs File "/usr/local/lib/python2.7/site-packages/requests-2.20.0-py2.7.egg/requests/certs.py", line 15, in from certifi import where File "/usr/local/lib/python2.7/site-packages/certifi-2022.5.18.1-py2.7.egg/certifi/init.py", line 1, in from .core import contents, where File "/usr/local/lib/python2.7/site-packages/certifi-2022.5.18.1-py2.7.egg/certifi/core.py", line 17 def where() -> str: ^ SyntaxError: invalid syntax ERROR: 1 `

Stean commented 2 years ago

It worked for me when using Python 2.7 with virtualenv. I didn't run setup.py but instead installed all dependencies and directly started the main script:

$ virtualenv -p /usr/bin/python2.7 venv
$ source venv/bin/activate
$ pip install couchdb pbkdf2 ipcalc requests pymongo six
$ python nosqlmap.py --help

My Kali version:

VERSION="2020.4"
VERSION_ID="2020.4"
VERSION_CODENAME="kali-rolling"
alonsoir commented 2 years ago

Hi, do you plan to upgrade to python 3.x? 2.x is deprecated...

passerbyo commented 1 year ago

nosqlmap supports 3x instead of 2x

alonsoir commented 1 year ago

which python3.x version?

thanks

github-actions[bot] commented 1 year ago

Stale issue message

kumar2812 commented 1 year ago

Screenshot (3) facing this issue,,,,help me

binaryc0de commented 1 year ago

Same exact issue. It's obvious from the code that it's python 2 and not 3. Looks like docker install is broken too?

image