initstring / cloud_enum

Multi-cloud OSINT tool. Enumerate public resources in AWS, Azure, and Google Cloud.
MIT License
1.64k stars 241 forks source link

Can not start Brute-forcing on azure checks #18

Closed NinjaMinjax closed 4 years ago

NinjaMinjax commented 4 years ago

Hi,

Whatever I'm trying to search, amazon checks are working but once it starts the azure cheks, I get the following message:

[+] Checking for S3 buckets

Elapsed time: 00:02:15

++++++++++++++++++++++++++ azure checks ++++++++++++++++++++++++++

[+] Checking for Azure Storage Accounts [*] Brute-forcing a list of 445 possible DNS names Traceback (most recent call last): File "./cloud_enum.py", line 218, in main() File "./cloud_enum.py", line 205, in main azure_checks.run_all(names, args) File "/cloud_enum/enum_tools/azure_checks.py", line 286, in run_all valid_accounts = check_storage_accounts(names, args.threads, File "/cloud_enum/enum_tools/azure_checks.py", line 77, in check_storage_accounts valid_names = utils.fast_dns_lookup(candidates, nameserver) File "/cloud_enum/enum_tools/utils.py", line 129, in fast_dns_lookup batch_pending[name] = subprocess.Popen(cmd, File "/usr/lib/python3.8/subprocess.py", line 854, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'host'

Please advise.

initstring commented 4 years ago

Thank you for opening this issue!

It looks like it cannot find the executable "host". I use this for DNS lookups. You'll need to ensure "host" is in your PATH. This should be default on most Linux-based operating systems.

I don't test the tool on Windows, so can't give any advice if that is your platform.

I need a better error for this, so I'll leave this issue open as you're not the first to report.

Thanks!

NinjaMinjax commented 4 years ago

That was a fast response :) I'm using Manjaro and it is pretty much a fresh installation.

Why does it look for host when it is hosts file?

initstring commented 4 years ago

It actually looks for a binary called "host" which can be used to perform a DNS lookup. To enumerate azure stuff, I look for DNS entries. It's kind of like "nslookup". Despite the similar name, it is not related to the file /etc/hosts.

You don't hit the error on AWS, because AWS bucket enumeration is done instead by HTTP requests.

Look at line 77 here: https://github.com/initstring/cloud_enum/blob/master/enum_tools/azure_checks.py

valid_names = utils.fast_dns_lookup(candidates, nameserver)

That calls a function from here: https://github.com/initstring/cloud_enum/blob/master/enum_tools/utils.py

line 126:

cmd = ['host', '{}'.format(name), '{}'.format(nameserver)]

So basically it is trying to run "host".

What happens when you type host on the command line on your Manjaro installation?

NinjaMinjax commented 4 years ago

-bash: host: command not found

Manjaro doesn't come with host binary by default. I installed bind-tools via the following command: pacman -S bind-tools

And now it works flawlessly :)

initstring commented 4 years ago

Thanks! I also added a check to provide a better error for others.