nccgroup / ScoutSuite

Multi-Cloud Security Auditing Tool
GNU General Public License v2.0
6.78k stars 1.07k forks source link

Failure while running pre-processing engine: 'NoneType' object is not iterable #1536

Open hacker07UK opened 1 year ago

hacker07UK commented 1 year ago

Describe the bug

This Bug is related to main.py L211: Initialization failure: global flags not at the start of the expression at position 6

I could not able to get past this error even after I pull the request with solution : https://github.com/nccgroup/ScoutSuite/issues/1511

This seems to work for me :

It would be great if you could help me get past the original error or this error

liyun-li commented 1 year ago

@hacker07UK - Can you rerun scout with --debug and paste the error?

Drjacky commented 1 year ago
➜  Scanner scout aws --debug
2023-06-05 09:32:06 MacBook-Pro.local scout[7940] INFO Launching Scout
2023-06-05 09:32:06 MacBook-Pro.local scout[7940] INFO Authenticating to cloud provider
2023-06-05 09:32:06 MacBook-Pro.local scout[7940] ERROR __main__.py L211: Initialization failure: global flags not at the start of the expression at position 6
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/ScoutSuite/__main__.py", line 211, in _run
    cloud_provider = get_provider(provider=provider,
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/ScoutSuite/providers/__init__.py", line 36, in get_provider
    provider_object = get_provider_object(provider)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/ScoutSuite/providers/__init__.py", line 10, in get_provider_object
    provider_module = __import__(f'ScoutSuite.providers.{provider}.provider', fromlist=[provider_class])
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/ScoutSuite/providers/aws/provider.py", line 5, in <module>
    from ScoutSuite.providers.aws.services import AWSServicesConfig
  File "/opt/homebrew/lib/python3.11/site-packages/ScoutSuite/providers/aws/services.py", line 1, in <module>
    from ScoutSuite.providers.aws.facade.base import AWSFacade
  File "/opt/homebrew/lib/python3.11/site-packages/ScoutSuite/providers/aws/facade/base.py", line 3, in <module>
    from ScoutSuite.providers.aws.facade.acm import AcmFacade
  File "/opt/homebrew/lib/python3.11/site-packages/ScoutSuite/providers/aws/facade/acm.py", line 3, in <module>
    from ScoutSuite.providers.aws.facade.utils import AWSFacadeUtils
  File "/opt/homebrew/lib/python3.11/site-packages/ScoutSuite/providers/aws/facade/utils.py", line 5, in <module>
    from ScoutSuite.providers.utils import run_concurrently
  File "/opt/homebrew/lib/python3.11/site-packages/ScoutSuite/providers/utils.py", line 139, in <module>
    re.compile("(p8e-)(?i)[a-z0-9]{32}"),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/__init__.py", line 227, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/_parser.py", line 980, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/_parser.py", line 455, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/_parser.py", line 841, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 6

@liyun-li

liyun-li commented 1 year ago

Interesting...We will certainly look into it!

fernando-gallego commented 1 year ago

Note that the regexps have been updated in several files, not only in utils.py. Please try to reproduce the issue by pulling the develop branch on a freshly installed Python 3.11 virtualenv.