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

[BUG] KeyError when no profile is specified #76

Closed
xC0uNt3r7hr34t opened this issue Sep 27, 2022 · 0 comments · Fixed by #79
Closed

[BUG] KeyError when no profile is specified #76

xC0uNt3r7hr34t opened this issue Sep 27, 2022 · 0 comments · Fixed by #79
Labels

Comments

@xC0uNt3r7hr34t
Copy link
Contributor

xC0uNt3r7hr34t commented Sep 27, 2022

A KeyError occurs when no --profile is not specified. Expected behavior is that the "default" profile will be used when no other profile is specified.

Command Line

py .\surveyor.py --query 'SrcProcName containsCIS \"explorer.exe\"' s1 --creds <cred-file>

Cred File

[default]
url=https://usea1-dfir.sentinelone.net
token=<api token>
account_id=<account-id>

Output/Error

Traceback (most recent call last):
  File "C:\run-surveyor\surveyor.py", line 386, in <module>
    cli()
  File "C:\Users\<redacted user>\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\<redacted user>\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "C:\Users\<redacted user>\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\<redacted user>\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\<redacted user>\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\<redacted user>\AppData\Local\Programs\Python\Python310\lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\run-surveyor\surveyor.py", line 154, in s1
    survey(ctx, 's1')
  File "C:\run-surveyor\surveyor.py", line 232, in survey
    product = get_product_instance(product, **kwargs)
  File "C:\run-surveyor\load.py", line 64, in get_product_instance
    return subclass(**kwargs)
  File "C:\run-surveyor\products\sentinel_one.py", line 74, in __init__
    if 'account_id' in config[profile] and config[profile]['account_id'] not in account_ids:
  File "C:\Users\<redacted user>\AppData\Local\Programs\Python\Python310\lib\configparser.py", line 964, in __getitem__
    raise KeyError(key)
KeyError: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant