duo-labs / cloudmapper

CloudMapper helps you analyze your Amazon Web Services (AWS) environments.
BSD 3-Clause "New" or "Revised" License
6k stars 809 forks source link

Analyzing data fails - (Cannot iterate over null) #648

Open G73I opened 4 years ago

G73I commented 4 years ago

python3.8 cloudmapper.py report --account “XXXX" Traceback (most recent call last): File "cloudmapper.py", line 72, in main() File "cloudmapper.py", line 66, in main commands[command].run(arguments) File "/tools/update1/cloudmapper/commands/report.py", line 471, in run report(accounts, config, args) File "/tools/update1/cloudmapper/commands/report.py", line 91, in report "collection_date": get_collection_date(account)[:10], File "/tools/update1/cloudmapper/shared/common.py", line 331, in get_collection_date account_struct, "iam-get-credential-report", get_us_east_1(account_struct) File "/tools/update1/cloudmapper/shared/common.py", line 305, in get_us_east_1 for region_json in get_regions(account): File "/tools/update1/cloudmapper/shared/common.py", line 161, in get_regions regions = pyjq.all(".Regions[]{}".format(region_filter), region_data) File "/home/me/site/lib/python3.8/site-packages/pyjq.py", line 49, in all return compile(script, vars, library_paths).all(_get_value(value, url, opener)) File "_pyjq.pyx", line 213, in _pyjq.Script.all _pyjq.ScriptRuntimeError: Cannot iterate over null (null)

0xdabbad00 commented 4 years ago

It looks like this failed to get info about the regions which makes me assume that the collect phase was not run.

It also looks like your environment is custom, as it your text mentions python3.8, when CloudMapper's virtualenv I believe enforces python3.7 (https://github.com/duo-labs/cloudmapper/blob/master/Pipfile#L30). That shouldn't be the source of the problem, but does make me hesitant about what all might be unexpected in your environment.

xXx-foC commented 4 years ago

This exact error happened to me - and later I discovered that the --account I used to collect the data was my userid, not the "name" in config.json. The content that gets downloaded into accounts-data is in a folder or the same name. Basically they have to match...or it can't iterate over any data it can't find.

G73I commented 4 years ago

0xdabbad00 the collect phase was run. xXx-foC outlined exactly what I what I did. The "name" in the config.json did not match up. I will execute it again.

Thanks for the Insight.

w0rmr1d3r commented 3 years ago

Has this been solved @G73I ?