0

I've pulled the NCC Group Scout suite repo from Github and am attempting to run it but it fails importing a module because it doesn't like a method definition that includes the async keyword.

I've read up as much as I can on this library and for the life of me I can't see what the syntax error is, so I'm hoping some of the eagle eyed members here can see it.

The original file can be found here - https://github.com/nccgroup/ScoutSuite/blob/master/ScoutSuite/main.py

I've tried inserting a simple method definition of my own and the same error report has shifted to that one:

import asyncio

async def xx():
    x = 0

Gives the same error:

    async def xx():
            ^
SyntaxError: invalid syntax

For what it's worth here is the method def in question:

async def _run(provider,
               # AWS
               profile,
               # Azure
               user_account, service_account,
               cli, msi, service_principal, file_auth, tenant_id,       subscription_id,
               client_id, client_secret,
               username, password,
               # GCP
               project_id, folder_id, organization_id, all_projects,
               # General
               report_name, report_dir,
               timestamp,
               services, skipped_services,
               result_format,
               database_name, host_ip, host_port,
               regions,
               fetch_local, update,
               ip_ranges, ip_ranges_name_key,
               ruleset, exceptions,
               force_write,
               debug,
               quiet,
               log_file,
               no_browser,
               programmatic_execution,
               **kwargs):

When I search for similar errors, I see lots of examples where the error is reported with the carat ^ under the async keyword, not the def keyword. These all relate to python version etc. but I'm using python3.7 which seems to be ok with the async reference.

I suspect this is an obvious syntax error that is eluding me. Can anyone spot what it is?

Kaliklipper
  • 355
  • 5
  • 19
  • Weird, on a hunch I just deleted the comments from the argument list and it started working. I say weird because when I inserted the async def xx() in front of it, the failure shifted there.... – Kaliklipper Jun 27 '19 at 16:25
  • Can you start from your example and trim it until you end up with a **minimal** file that still fails with a `SyntaxError`? I tried downloading the [file](https://raw.githubusercontent.com/nccgroup/ScoutSuite/master/ScoutSuite/__main__.py), but it works for me in Python 3.7 - I get an import error because I don't have `ScotSuite`, but no `SyntaxError`. – user4815162342 Jun 27 '19 at 19:36
  • 1
    In fact, your error looks like you're trying to import the example using Python prior to 3.5, possibly even Python 2.7. For example, running your example with Python 2.7 results in exactly the kind of exception you describe, with the caret pointing to the end of the `def`. – user4815162342 Jun 27 '19 at 19:37
  • Thanks user4815162342, That is odd. I'm using PyCharm to investigate this issue and the "Project interpreter" is definitely Python3.7 Should I be setting the version elsewhere I wonder? – Kaliklipper Jul 01 '19 at 14:28
  • Good question. You can delete everything else and `print(sys.version_info)` (after importing `sys`) to get an authoritative confirmation about which version you are running. – user4815162342 Jul 01 '19 at 15:42
  • Thanks user4815162342 I'll keep that for future reference. In the end I deleted the project and reimported it and the issue seems to go away. – Kaliklipper Jul 08 '19 at 14:54

1 Answers1

0

This happens because you are importing asyncio which is already present in stdlib, as explained here

freedev
  • 25,946
  • 8
  • 108
  • 125