Skip to main content

Google Workspace

Runs nc-export.py against two CSV exports from the Admin console, one required and one optional. Nothing about your Workspace directory is sent anywhere until you choose to upload the file this produces. The agentless assessment page has the same steps on one page, next to the download.

Read the privacy statement first if you have not already.

Get the script​

Download nc-export.py and verify its checksum against the downloads page before you run it.

Export and run​

You need: Python 3.9 or newer (no packages to install; macOS's built-in python3 is enough) and Google Admin console access to the audit logs and the Users list. On Windows, where python3 is often the Microsoft Store stub, use py nc-export.py ... instead.

  1. Export the OAuth log events. In the Admin console, open Reporting > Audit and investigation > OAuth log events, set the date range, then Download > CSV. Note the date range you chose and your console's UTC offset; you pass them in step 3. Google keeps OAuth Token log events for 6 months and admins can't change that, so an app authorized before then and never re-authorized since will not appear. The logs can also lag by up to a few hours, so grants from the last few hours may be missing. See Google's Data retention and lag times.

  2. Export the users (optional). Open Directory > Users > Download users > All user info columns > CSV. This gives the report an accurate userCountTotal. Skip it and that field is left null rather than guessed.

  3. Run the script from the folder you downloaded it into. Pass the CSV files exactly as downloaded; do not open and re-save them. The file names below are examples.

    python3 nc-export.py google \
    --audit-csv OauthLogEvents.csv \
    --users-csv users.csv \
    --export-window-start 2026-11-11T00:00:00-05:00 \
    --export-window-end 2026-11-18T23:59:59-05:00 \
    --out-dir ./out

    --audit-csv and --out-dir are required. --users-csv is optional. --export-window-start and --export-window-end go together: give the date range from step 1 with your UTC offset. Leave both out and the header's exportWindow is null; the script never guesses it from the event dates.

    Only Authorize events become grants. Other events in the download, such as Revoke, are left out, with a count printed to the terminal.

Two more flags are available: --salt-file (use a fixed salt for reproducible pseudonym output) and --no-pseudonymize (write raw email addresses instead of pseudonyms, only if your organization has decided that is acceptable to share).

What you'll see​

Skipped rows: 0
Nothing has been sent anywhere. Review discover-export.ndjson, then upload it in the Discover app.

Skipped rows is always printed, even when it is 0. A CSV row with a missing or blank required value (actor email, client ID, app name) is skipped with a warning rather than silently mangled or dropped.

If something goes wrong​

The script fails loudly rather than guessing. A few messages you might see, and what they mean:

  • audit CSV '<path>' is missing required column(s): ... means the export doesn't have the columns the script expects. Download OAuth log events again and pass the file as downloaded, rather than a filtered or re-saved copy.
  • warning: 0 grants were found in the source data -- this may indicate a permission or consent problem, not an empty tenant is printed to the terminal and is not fatal. Check that your admin account can see the OAuth log events, and that the date range you chose covers the period you want, before assuming the tenant has no grants.
  • warning: 0 users were found in the source data -- this may indicate a permission or consent problem, not an empty tenant is the same idea, printed only if you supplied --users-csv.

After it finishes​

  1. Open ./out/discover-export.ndjson and read it. See the export format page for the exact field-by-field shape.
  2. Leave ./out/mapping.csv and ./out/salt.txt on your machine. See the privacy statement for what they're for.
  3. In the setup wizard's Scan step, under Export file (discover-export.ndjson), click Choose file, select discover-export.ndjson, then click Upload.
Screenshot pending

The upload flow is live in Discover; a screenshot of this step is still being prepared and will be added here.

Next​