duo-labs / cloudmapper

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

cloudmapper.py report: _pyjq.ScriptRuntimeError: Cannot iterate over null (null) #663

Open aliasfour opened 4 years ago

aliasfour commented 4 years ago

stats_config.yaml contains the following: query: '[.Reservations[].Instances[]|select(.State.Name == "running")]|length'

When I run the report module, I ge the null error.

I changed the above line to: query: '[.Reservations[]?.Instances[]|select(.State.Name == "running")]|length'

and this works.

ksg97031 commented 4 years ago

same issue..

KohanS commented 4 years ago
(cloudmapper) sh-3.2# python3 cloudmapper.py prepare --account prod

Building data for account prod (****************)
- 0 nodes built in region eu-north-1
- 0 nodes built in region ap-south-1
- 0 nodes built in region eu-west-3
- 0 nodes built in region eu-west-2
- 0 nodes built in region eu-west-1
- 0 nodes built in region ap-northeast-2
- 0 nodes built in region me-south-1
- 0 nodes built in region ap-northeast-1
- 0 nodes built in region sa-east-1
- 0 nodes built in region ca-central-1
- 0 nodes built in region ap-east-1
- 0 nodes built in region ap-southeast-1
- 0 nodes built in region ap-southeast-2
- 0 nodes built in region eu-central-1

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 "/../../TOOLS/RECON/cloudmapper/commands/prepare.py", line 831, in run
    prepare(account, config, outputfilter)
  File "/../../TOOLS/RECON/cloudmapper/commands/prepare.py", line 660, in prepare
    cytoscape_json = build_data_structure(account, config, outputfilter)
  File "/../../TOOLS/RECON/cloudmapper/commands/prepare.py", line 477, in build_data_structure
    add_node_to_subnets(region, node, nodes)
  File "/../../TOOLS/RECON/cloudmapper/commands/prepare.py", line 329, in add_node_to_subnets
    if len(node.subnets) == 0 and node._parent and vpc.local_id == node._parent.local_id:
  File "/../../TOOLS/RECON/cloudmapper/shared/nodes.py", line 498, in subnets
    ".DBSubnetGroup.Subnets[].SubnetIdentifier", self._json_blob
  File "/****/.local/share/virtualenvs/cloudmapper-0c-dE7-r/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)
(cloudmapper) sh-3.2# 
rajafarhat1 commented 4 years ago

same error

juggernauthk108 commented 4 years ago

SAME ERROR.

murph-cat commented 4 years ago

Same error, but I will note that the line in stats_config.yaml for me says query: '[.Reservations[]?.Instances[]?|select(.State.Name == "running")]|length' Deleing the question mark after instances fixed nothing.

ghost commented 3 years ago

Same