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 command prisma-cloud-compute-get-file-integrity-events #29608

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
b88a7e4
Add command prisma-cloud-compute-get-file-integrity-events (#29187)
ali-sawyer Sep 11, 2023
9843cfa
Merge branch 'master' into contrib/ali-sawyer_prisma-cloud-compute-ad…
ostolero Sep 11, 2023
7235d50
Merged master into current branch.
Sep 12, 2023
38e8d34
Bump pack from version PrismaCloudCompute to 1.4.10.
Sep 12, 2023
a15b820
[pre-commit ruff] Align the entire repo with ruff (#29603)
mmhw Sep 12, 2023
619b06f
remove code to trigger upload on dev branches (#29621)
omerKarkKatz Sep 12, 2023
e7f6357
[pre-commit pycln] Align the entire repo with pycln (#29611)
mmhw Sep 12, 2023
5f72ed1
Fix falls of the autopep8 hook (#29638)
mmhw Sep 12, 2023
a09b614
add marketplaces to metadata (#29629)
yaakovpraisler Sep 12, 2023
39ead03
Fixing AWS Project Number in ASM Cloud (#29593) (#29642)
content-bot Sep 13, 2023
bae335e
[MS Teams] support reset_graph_auth (#29644)
michal-dagan Sep 13, 2023
bacdd27
Recordedfuture threathunting v2.5.0 (#29641)
content-bot Sep 13, 2023
484ee5a
[ASM] Expander 5777 (#29647)
content-bot Sep 13, 2023
84b5b58
XDR Malware Enrichment - hotfix for usernames (split) (#29585)
idovandijk Sep 13, 2023
fe85dab
Update Docker Image To demisto/pyjwt3 (#29656)
content-bot Sep 13, 2023
6287820
Update Docker Image To demisto/trustar (#29660)
content-bot Sep 13, 2023
181b6f9
Update Docker Image To demisto/keeper-ksm (#29661)
content-bot Sep 13, 2023
e34bd6f
Update Docker Image To demisto/py3-tools (#29654)
content-bot Sep 13, 2023
47462c8
Update Docker Image To demisto/taxii-server (#29659)
content-bot Sep 13, 2023
f9b1b7f
Update Docker Image To demisto/datadog-api-client (#29662)
content-bot Sep 13, 2023
6832044
Add reliability parameter to cves and pipl integration (#28703)
DinaMeylakh Sep 13, 2023
c43f2e3
Proofpoint email security pack: update description (#29651)
ilaner Sep 13, 2023
98be458
Jira v2 deprecated (#29649)
israelpoli Sep 13, 2023
12741c0
Update Docker Image To demisto/python3 (#29652)
content-bot Sep 13, 2023
6d50180
XSUP-27717/FortiSIEM (#29458)
sapirshuker Sep 13, 2023
4ddcf09
reverting the Docker image (#29607)
maimorag Sep 13, 2023
946c57a
[Marketplace Contribution] Roksit DNS Security Integration - Sarp (#2…
content-bot Sep 13, 2023
1c0a2e0
add unstuck fetch stream command (#29646)
YuvHayun Sep 14, 2023
9379142
[pre-commit pycln] Align the entire repo with pycln #4 (#29665)
mmhw Sep 14, 2023
60a0367
Remove unnecessary recommendations from extensions.json (#29605)
samuelFain Sep 14, 2023
45b9b10
Zscaler-FW-Logs (#29094)
nkanon Sep 14, 2023
9156b65
PANOS - EXPANDR-5744 (#29223) (#29686)
content-bot Sep 14, 2023
2adb6b4
Audit alert fields fix (#29685)
tomer-pan Sep 14, 2023
2f0deef
Workday documentation fix (#29681)
eyalpalo Sep 14, 2023
b674422
[Marketplace Contribution] Active Directory Query - Content Pack Upda…
content-bot Sep 14, 2023
2e25792
Big query bug xsup 28132 (#29680)
eyalpalo Sep 14, 2023
6aaf860
New Prisma Cloud v2 commands (#29323)
BEAdi Sep 18, 2023
64df741
Prisma Cloud Update (#29666)
eepstain Sep 18, 2023
beed004
Rapid7 appsec (#29134) (#29687)
content-bot Sep 18, 2023
0cd8232
Panos add param (#29672)
ShahafBenYakir Sep 18, 2023
4449359
Fix proxy usage (#85) (#29630)
content-bot Sep 18, 2023
cb0c357
Missing dependencies when installing packs (#28989)
kobymeir Sep 18, 2023
55d182a
Deprecate Picus Community (#29573)
edik24 Sep 18, 2023
e683af7
[ASM] - Expander - GCP Hierarchy field - 4376 (#29696) (#29704)
content-bot Sep 18, 2023
42a33a8
fix merge
ostolero Sep 18, 2023
e053c20
Merge branch 'master' into contrib/ali-sawyer_prisma-cloud-compute-ad…
ostolero Sep 18, 2023
092f760
Merge branch 'master' into contrib/ali-sawyer_prisma-cloud-compute-ad…
ostolero Sep 18, 2023
1e55159
update rn
ostolero Sep 18, 2023
bd09caf
remove access code
ostolero Sep 18, 2023
3434020
fix conflicts
ostolero Sep 20, 2023
e3a3f1b
Merge branch 'master' into contrib/ali-sawyer_prisma-cloud-compute-ad…
ostolero Sep 20, 2023
12572b5
update docker
ostolero Sep 20, 2023
9865c65
fix validation
ostolero Sep 21, 2023
5e24f86
Merge branch 'master' into contrib/ali-sawyer_prisma-cloud-compute-ad…
ostolero Sep 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,32 @@ def get_logs_defender_download_request(self, hostname, lines):
headers = self._headers
return self._http_request('get', 'logs/defender/download', params=params, headers=headers, resp_type="content")

def get_file_integrity_events(self, limit, sort, hostname=None, event_id=None, from_date=None,
to_date=None, search_term=None):
"""
Get runtime file integrity audit events

Args:
hostname (str): The hostname for which to get runtime file integrity events

Returns:
HTTP response
"""
endpoint = "audits/runtime/file-integrity"

headers = self._headers
params = {
"hostname": hostname,
"id": event_id,
"limit": limit,
"from": from_date,
"to": to_date,
"search": search_term,
"sort": "time",
"reverse": sort == "desc"
}
return self._http_request('get', endpoint, params=params, headers=headers)


def format_context(context):
"""
Expand Down Expand Up @@ -1967,6 +1993,42 @@ def get_logs_defender_download_command(client: PrismaCloudComputeClient, args: d
return fileResult(f"{hostname}-logs.tar.gz", response, entryTypes["entryInfoFile"])


def get_file_integrity_events_command(client: PrismaCloudComputeClient, args: dict):
"""
Get runtime file integrity audit events for the given hostname

Args:
client (PrismaCloudComputeClient): prisma-cloud-compute client.
args (dict): prisma-cloud-compute-get-file-integrity-events command arguments

Returns:
HTTP Response object
"""
hostname = args.get('hostname')
event_id = args.get('event_id')
limit = args.get('limit')
from_date = args.get('from_date')
to_date = args.get('to_date')
search_term = args.get('search_term')
sort = args.get('sort')

response = client.get_file_integrity_events(
limit, sort, hostname=hostname, event_id=event_id,
from_date=from_date, to_date=to_date, search_term=search_term
)
if not response:
readable_output = "No results for the given search."
else:
readable_output = None
return CommandResults(
outputs_prefix='PrismaCloudCompute.FileIntegrity',
outputs_key_field='_id',
outputs=format_context(response),
raw_response=response,
readable_output=readable_output
)


def unstuck_fetch_stream_command():
"""
Adds a field to ensure that is_command_is_fetch will recognize the next fetch incidents run as fetch.
Expand Down Expand Up @@ -2100,6 +2162,8 @@ def main():
return_results(results=get_logs_defender_download_command(client=client, args=demisto.args()))
elif requested_command == "prisma-cloud-compute-unstuck-fetch-stream":
return_results(unstuck_fetch_stream_command())
elif requested_command == "prisma-cloud-compute-get-file-integrity-events":
return_results(results=get_file_integrity_events_command(client=client, args=demisto.args()))
# Log exceptions
except Exception as e:
return_error(f'Failed to execute {requested_command} command. Error: {str(e)}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ description: Use the Prisma Cloud Compute integration to fetch incidents from yo
display: Palo Alto Networks - Prisma Cloud Compute
name: PaloAltoNetworks_PrismaCloudCompute
script:
dockerimage: demisto/python3:3.10.13.73190
dockerimage: demisto/python3:3.10.13.74666
isfetch: true
runonce: false
script: "-"
Expand Down Expand Up @@ -1960,6 +1960,71 @@ script:
- contextPath: PrismaCloudCompute.Backups.Time
description: The time of the backup.
type: Date
- description: Get runtime file integrity audit events.
name: prisma-cloud-compute-get-file-integrity-events
arguments:
- name: hostname
description: Hostname for which to get runtime file integrity audit events. Either event_id or hostname is required.
- name: event_id
description: Event ID of runtime file integrity audit event for which to get details. Either event_id or hostname is required.
- name: limit
description: Limit on number of events to return. Only relevant if filtering by hostname.
defaultValue: "10"
- description: 'Minimum timestamp for event search. Format: YYYY-mm-ddTHH:MM:SSZ.'
name: from_date
- description: 'Maximum timestamp for event search. Format: YYYY-mm-ddTHH:MM:SSZ.'
name: to_date
- description: Search term to search events for.
name: search_term
- auto: PREDEFINED
defaultValue: desc
description: Whether to sort by ascending or descending time.
name: sort
predefined:
- asc
- desc
outputs:
- contextPath: PrismaCloudCompute.FileIntegrity.Path
description: The absolute path of the event.
type: string
- contextPath: PrismaCloudCompute.FileIntegrity.RuleName
description: The name of the applied rule for auditing file integrity rules.
type: string
- contextPath: PrismaCloudCompute.FileIntegrity.AccountID
description: The cloud account ID.
type: string
- contextPath: PrismaCloudCompute.FileIntegrity.User
description: The user that initiated the event.
type: string
- contextPath: PrismaCloudCompute.FileIntegrity.Time
description: The time of the event.
type: date
- contextPath: PrismaCloudCompute.FileIntegrity.Hostname
description: The hostname on which the event was found.
type: string
- contextPath: PrismaCloudCompute.FileIntegrity.EventType
description: 'Represents the type of the file integrity event. Possible values: [metadata,read,write].'
type: string
- contextPath: PrismaCloudCompute.FileIntegrity.Collections
description: Collections to which this event applies.
- contextPath: PrismaCloudCompute.FileIntegrity.Fqdn
description: The current fully qualified domain name used in audit alerts.
type: string
- contextPath: PrismaCloudCompute.FileIntegrity.FileType
description: Represents the file type.
type: number
- contextPath: PrismaCloudCompute.FileIntegrity.ProcessName
description: The name of the process that initiated the event.
type: string
- contextPath: PrismaCloudCompute.FileIntegrity.Cluster
description: The cluster on which the event was found.
type: string
- contextPath: PrismaCloudCompute.FileIntegrity._Id
description: The activity's unique identifier.
type: string
- contextPath: PrismaCloudCompute.FileIntegrity.Description
description: A human readable description of the action performed on the path.
type: string
- description: Use this command to unstuck the fetch stream in case it's getting duplicated incidents.
name: prisma-cloud-compute-unstuck-fetch-stream
tests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ This integration provides the ability to import **Palo Alto Networks - Prisma Cl
5. On the right, select the alert triggers. Alert triggers specify which alerts are sent to Cortex XSOAR.
6. Click **Save** to save the alert profile.
7. Make sure you configure the user role to be at least `auditor`, otherwise you will not be able to fetch the alerts.


---
[View Integration Documentation](https://xsoar.pan.dev/docs/reference/integrations/palo-alto-networks-prisma-cloud-compute)
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,30 @@ def test_get_logs_defender_download_command(requests_mock):
assert r["File"] == f"{args.get('hostname')}-logs.tar.gz"


def test_get_file_integrity_events_command(requests_mock):
"""
Given:
- An app client object
- Relevant arguments
When:
- Calling 'prisma-cloud-compute-get-file-integrity-events' command
Then:
- Ensure the file integrity events output equals the raw_response object which is mocked
"""
from PaloAltoNetworks_PrismaCloudCompute import get_file_integrity_events_command, PrismaCloudComputeClient
with open("test_data/file_integrity_events.json") as f:
d = json.load(f)

requests_mock.get(url=BASE_URL + '/audits/runtime/file-integrity', json=d)
client = PrismaCloudComputeClient(base_url=BASE_URL, verify='False', project='', auth=('test', 'test'))
args = {
"hostname": "test123",
"limit": 3
}

assert get_file_integrity_events_command(client, args).raw_response == d


EXAMPLE_CVES = [
{
"cve": "cve1",
Expand Down
Loading