Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regions data not found when account ID starts with a zero #795

Open
jtyers opened this issue Nov 5, 2020 · 3 comments
Open

Regions data not found when account ID starts with a zero #795

jtyers opened this issue Nov 5, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@jtyers
Copy link
Contributor

jtyers commented Nov 5, 2020

Using the Docker container, when running cloudmapper.py report, with multiple accounts, I get the following error:

Traceback (most recent call last):
  File "./cloudmapper.py", line 72, in <module>
    main()
  File "./cloudmapper.py", line 66, in main
    commands[command].run(arguments)
  File "/opt/cloudmapper/commands/report.py", line 471, in run
    report(accounts, config, args)
  File "/opt/cloudmapper/commands/report.py", line 91, in report
    "collection_date": get_collection_date(account)[:10],
  File "/opt/cloudmapper/shared/common.py", line 332, in get_collection_date
    account_struct, "iam-get-credential-report", get_us_east_1(account_struct)
  File "/opt/cloudmapper/shared/common.py", line 306, in get_us_east_1
    for region_json in get_regions(account):
  File "/opt/cloudmapper/shared/common.py", line 162, in get_regions
    regions = pyjq.all(".Regions[]{}".format(region_filter), region_data)
  File "/usr/local/lib/python3.7/site-packages/pyjq.py", line 49, in all
    return compile(script, vars, library_paths).all(_get_value(value, url, opener))
  File "_pyjq.pyx", line 209, in _pyjq.Script.all (_pyjq.c:2561)
_pyjq.ScriptRuntimeError: Cannot iterate over null (null)

After some debugging I saw the account data involved did have a describe-regions.json and it contained data in the right format. However, the account ID started with a zero. Doing this:

cd account-data
ln -s 012345678 12345678  # replace with real account IDs

...fixed it. Very nasty hack that may mess up other parts of my audit though! This should be fixed - clearly Python is doing a silent type conversion to a number somewhere and stripping the zero.

@0xdabbad00 0xdabbad00 added the bug Something isn't working label Nov 12, 2020
@0xdabbad00
Copy link
Collaborator

Yikes, thanks for reporting @jtyers. I'll look into it.

@SmoothSailingMusic
Copy link

Can report that I am experiencing this same issue.
The suggested fix did not work in my case.
Clients aws ID also begins with a zero.

@erict35000
Copy link

Hi,

I was unable to install cloud mapper on macOS Monterey, Ubuntu 22.04 and Mint.

So I decided to install docker on macOS Monterey and follow these instructions : #896

Everything is fine, but when I type python cloudmapper.py report --accounts XXX,XXX, what I have to input as accounts. I try with audit, my account on AWS and the number of AWSaccount. I use a specific config.json for my AWS platform but it asks a region or tells me audit our xxxx are not in my config file.

Could you please tell me what I need to add to my config.json file ?

Regards
Eric

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants