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

Add IntSights support #276

Merged
merged 15 commits into from
Jan 20, 2022
Merged

Add IntSights support #276

merged 15 commits into from
Jan 20, 2022

Conversation

FlorianBracq
Copy link
Collaborator

Simple PR related to #275

@ghost
Copy link

ghost commented Jan 11, 2022

CLA assistant check
All CLA requirements met.

@petebryan petebryan linked an issue Jan 11, 2022 that may be closed by this pull request
Copy link
Contributor

@petebryan petebryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks this looks great!
The code looks good, can I just ask that you add a unit test for this with a mocked response.
Its quite simple to do and you can see examples for the other providers in test_tiproviders.py.

Please let us know if you have any issues with this or want some help.

@FlorianBracq
Copy link
Collaborator Author

Hi @petebryan, I've added some mock data based on what I saw in test_tiproviders.py.

Let me know if I missed anything!

@ianhelle
Copy link
Contributor

Can you add a section to https://github.com/microsoft/msticpy/blob/main/msticpy/resources/mpconfig_defaults.yaml
so that IntSights shows up in the Config UI?
It should look like the XForce one below. (

TIProviders:
  ....
  XForce:
    Args:
      ApiID: *cred_key
      AuthKey: *cred_key
    Primary: bool(default=False)
    Provider: "XForce"

@FlorianBracq
Copy link
Collaborator Author

@ianhelle: Section added!

@petebryan
Copy link
Contributor

petebryan commented Jan 15, 2022

So looking at the failing test here there are a couple for minor changes required.

The first is you need to add the IntSight provider to msticpy\tests\testdata\msticpyconfig.yaml so that the TILookup class in the tests correctly loads it.

Second of all in the mocked data you provide for the test you pass in some dates but in the wrong format.
The format you provide in the mocked data is %Y-%m-%d H:%M:%S.%fZ but the IntSights provider requires %Y-%m-%dT%H:%M:%S.%fZ

If you make these changes the test_tiproviders test file should complete properly.

@petebryan
Copy link
Contributor

Sorry @FlorianBracq there was another test error that I forgot to include in my last message.

On line 367 of https://github.com/FlorianBracq/msticpy/blob/IntSights/tests/sectools/test_tiproviders.py where you are mocking the response you have the query variable defined as:
query = kwargs["params"]["query"]

However with this provider there is no query element of the params so you should just take the params as is with:
query = kwargs["params"]

@petebryan petebryan merged commit 528a74c into microsoft:main Jan 20, 2022
juju4 pushed a commit to juju4/msticpy that referenced this pull request Jun 5, 2022
@FlorianBracq FlorianBracq deleted the IntSights branch January 2, 2023 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for TIProvider IntSights
3 participants