-
Notifications
You must be signed in to change notification settings - Fork 12
feat(paloalto): create cortex XSOAR collector (#301) #348
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
Open
mariot
wants to merge
27
commits into
main
Choose a base branch
from
feature/301-create-palo-alto-xsoar
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
53859f0
[palo-alto-cortex-xsoar] feature(core): create collector (#301)
mariot 154c6aa
[palo-alto-cortex-xsoar] add tests
mariot 2d3bc5e
[palo-alto-cortex-xsoar] use HttpUrl type of api_url
mariot e7e8cb9
[palo-alto-cortex-xsoar] add tests
mariot 346f07e
[palo-alto-cortex-xsoar] withdrawing unnecessary alias in CustomFields
guzmud 82b873f
[palo-alto-cortex-xsoar] adding timeout value to requests in client API
guzmud fef8355
[palo-alto-xsoar] adding automatic retries with increasing backoff
guzmud 7be995e
[palo-alto-xsoar] chore(utils): deleting leftover debug print
guzmud b810702
[palo-alto-xsoar] feat(fetcher): adding alert_process_image_name to m…
guzmud 869cccb
[palo-alto-xsoar] feat(apiclient): session creation made during init
guzmud f72e078
add ub9 image
mariot 87ead61
revert API use
mariot a7ff4a6
Revert "revert API use"
mariot 16f0511
feat(expectation): add regex to find implant
mariot eec4604
Potential fix for pull request finding
mariot 2bf7589
Potential fix for pull request finding
mariot 8e62948
Potential fix for pull request finding
mariot 69fcc14
refactor: add Pydantic type hinting to ioc_extractor and alert_fetcher
mariot 06dfa8e
refactor: remove redundant include_paths from IOC extraction
mariot 070bc8d
feat: improve error handling in IOC extraction to prevent batch failure
mariot 3f6add3
test: add tests for ioc_extractor and allow extra fields in CustomFields
mariot e3d8608
test: fix ioc_extractor tests for JSON escaping and mocking
mariot d8e6120
fix: resolve timezone drift in alert fetching by correctly handling l…
mariot fd06eb5
fix: preserve original timezone in alert fetcher queries
mariot b29fe0e
fix: ensure timezone offset is always present in Palo Alto API queries
mariot b42fef2
fix: small changes
mariot 4236506
fix: typings
mariot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .idea | ||
| .venv | ||
| .run | ||
| *.lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| FROM python:3.13-alpine AS builder | ||
|
|
||
| # poetry version available on Ubuntu 24.04 | ||
| RUN pip3 install poetry==2.1.3 | ||
|
|
||
| RUN apk update && apk upgrade | ||
|
|
||
| ARG installdir=/collector | ||
| ADD . ${installdir} | ||
| RUN cd ${installdir} && poetry build | ||
|
|
||
| FROM python:3.13-alpine AS runner | ||
|
|
||
| # Declare the build argument | ||
| ARG PYOAEV_GIT_BRANCH_OVERRIDE | ||
|
|
||
| ARG installdir=/collector | ||
| COPY --from=builder ${installdir} ${installdir} | ||
| RUN cd ${installdir}/dist && pip3 install --no-cache-dir "$(ls *.whl)[prod]" | ||
|
|
||
| RUN if [[ ${PYOAEV_GIT_BRANCH_OVERRIDE} ]] ; then \ | ||
| echo "Forcing specific version of client-python" && \ | ||
| apk add --no-cache git && \ | ||
| pip install pip3-autoremove && \ | ||
| pip-autoremove pyoaev -y && \ | ||
| pip install git+https://github.com/OpenAEV-Platform/client-python@${PYOAEV_GIT_BRANCH_OVERRIDE} ; \ | ||
| fi | ||
|
Comment on lines
+21
to
+27
|
||
|
|
||
| # necessary for icon location | ||
| WORKDIR ${installdir} | ||
|
|
||
| CMD ["python3", "-m", "src"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| FROM registry.access.redhat.com/ubi9/ubi-minimal AS base | ||
|
|
||
| RUN set -eux; \ | ||
| microdnf -y --setopt=install_weak_deps=0 install python3.12; \ | ||
| microdnf clean all; | ||
|
|
||
|
|
||
| FROM base AS builder | ||
|
|
||
| RUN set -eux; \ | ||
| microdnf -y --setopt=install_weak_deps=0 install python3.12-pip; \ | ||
| pip3.12 install poetry==2.1.3; \ | ||
| microdnf -y remove python3.12-pip; \ | ||
| microdnf clean all; | ||
|
|
||
| WORKDIR /collector | ||
| COPY ./ ./ | ||
| RUN set -eux; \ | ||
| poetry build | ||
|
|
||
|
|
||
| FROM base AS runner | ||
|
|
||
| ARG PYOAEV_GIT_BRANCH_OVERRIDE="" | ||
|
|
||
| WORKDIR /collector | ||
| COPY --from=builder /collector/ ./ | ||
|
|
||
| RUN set -eux; \ | ||
| microdnf -y --setopt=install_weak_deps=0 install python3.12-pip; \ | ||
| (cd dist && pip3.12 install --no-cache-dir "$(ls *.whl)[prod]"); \ | ||
| if [ -n "${PYOAEV_GIT_BRANCH_OVERRIDE}" ] ; then \ | ||
| echo "Forcing specific version of client-python"; \ | ||
| microdnf -y --setopt=install_weak_deps=0 install git-core; \ | ||
| pip3.12 install pip3-autoremove; \ | ||
| pip-autoremove pyoaev -y; \ | ||
| pip3.12 install git+https://github.com/OpenAEV-Platform/client-python@${PYOAEV_GIT_BRANCH_OVERRIDE}; \ | ||
| microdnf -y remove git-core; \ | ||
| fi; \ | ||
| microdnf -y remove python3.12-pip; \ | ||
| microdnf clean all; | ||
|
|
||
| CMD ["python3.12", "-m", "src"] | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question:
Any reason to use mticpy, i saw that you are using
transform.iocextractbut you have to build the ioc_regex.So i don't really get what's the benefit against
reorioc_finderalready used in a connector (cf. https://github.com/OpenCTI-Platform/connectors/blob/master/external-import/crowdstrike/src/crowdstrike_feeds_services/utils/ioc_extractor.py)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ioc_finderis great, but it lacks the ability to retreive command line infos. If we were to useioc_finder, we will need to pass the entire string to it, the query it again withreto get all the infos we need. Withmticpy, we can define the regex we need and pass to it once.