aboul3la / Sublist3r

Fast subdomains enumeration tool for penetration testers
GNU General Public License v2.0
9.51k stars 2.07k forks source link

ImportError: No module named dns.resolver #265

Open bfosterscripps opened 3 years ago

bfosterscripps commented 3 years ago

On macOS Catalina (v10.15.5).
I cloned the repository, ran sudo pip install -r requirements.txt, and when I try to use the script, I get this error:

$ python sublist3r.py −d example.com
Traceback (most recent call last):
  File "sublist3r.py", line 21, in <module>
    from subbrute import subbrute
  File "/Users/bfoster/tools/Sublist3r/subbrute/subbrute.py", line 18, in <module>
    import dns.resolver
ImportError: No module named dns.resolver

I have already followed suggestions elsewhere online (including a similar problem with issue #223):

The solution in these links is:

pip3 install dnspython==1.15.0 # or
pip install dnspython==1.15.0 # or
pip install dnspython 

When I run these I get:

$ pip install dnspython==1.15.0
Requirement already satisfied: dnspython==1.15.0 in /usr/local/lib/python3.8/site-packages (1.15.0)

When I re-try the pip install -r requirements.txt I get:

$ sudo pip install -r requirements.txt 
WARNING: The directory '/Users/$USER/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: argparse in /usr/local/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (1.4.0)
Requirement already satisfied: dnspython in /usr/local/lib/python3.8/site-packages (from -r requirements.txt (line 2)) (1.15.0)
Requirement already satisfied: requests in /usr/local/lib/python3.8/site-packages (from -r requirements.txt (line 3)) (2.24.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.8/site-packages (from requests->-r requirements.txt (line 3)) (1.25.10)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/site-packages (from requests->-r requirements.txt (line 3)) (2020.6.20)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.8/site-packages (from requests->-r requirements.txt (line 3)) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.8/site-packages (from requests->-r requirements.txt (line 3)) (3.0.4)

Yet I still get:

$ python sublist3r.py −d example.com
Traceback (most recent call last):
  File "sublist3r.py", line 21, in <module>
    from subbrute import subbrute
  File "/Users/bfoster/tools/Sublist3r/subbrute/subbrute.py", line 18, in <module>
    import dns.resolver
ImportError: No module named dns.resolver

EDIT: I found a "workaround" - apparently when you use python3 it works:

$ python3 sublist3r.py -d example.com

                 ____        _     _ _     _   _____
                / ___| _   _| |__ | (_)___| |_|___ / _ __
                \___ \| | | | '_ \| | / __| __| |_ \| '__|
                 ___) | |_| | |_) | | \__ \ |_ ___) | |
                |____/ \__,_|_.__/|_|_|___/\__|____/|_|

                # Coded By Ahmed Aboul-Ela - @aboul3la

[-] Enumerating subdomains now for example.com
[-] Searching now in Baidu..
[-] Searching now in Yahoo..
[-] Searching now in Google..
[-] Searching now in Bing..
[-] Searching now in Ask..
[-] Searching now in Netcraft..
[-] Searching now in DNSdumpster..
[-] Searching now in Virustotal..
[-] Searching now in ThreatCrowd..
[-] Searching now in SSL Certificates..
[-] Searching now in PassiveDNS..
[-] Total Unique Subdomains Found: 16267
www.example.com
*.example.com
...
jr1221 commented 3 years ago

This is most likely not a workaround, rather you calling python2 to run the script. What is the output of python --version?

bfosterscripps commented 3 years ago

I meant workaround in the sense that I was able to use python3, even if python2 wasn't working.

As requested:

$ python --version
Python 2.7.16
testusername911 commented 3 years ago

Having this issue as well. I also noticed when you used python3, bruteforcing does not proceed.

PrajwalKhante commented 3 years ago

use python3

glaucusec commented 3 years ago

Thanks for the solution.

M0dred commented 3 years ago

Try to git clone https://github.com/rthalley/dnspython on the /Sublist3r and cd /dnspython sudo python3 setup.py install

It's work maybe

Hassan01256 commented 3 years ago

Try to git clone https://github.com/rthalley/dnspython on the /Sublist3r and cd /dnspython sudo python3 setup.py install

It's work maybe

it worked.Thanks!

drewlong commented 2 years ago

For anyone looking for a quick fix, just edit the shebang at the top of sublist3r.py :

#!/usr/bin/env python3 #instead of python

fherdlcruz commented 2 years ago

My solutions:

I was installed the next library py3dns. I just removed the library py3dns and install pip install dnspython and ready!

Ily455 commented 1 year ago

Thanks!