- Notifications
You must be signed in to change notification settings - Fork33
Gis 8825 added sentinel one power query render#205
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
12 commits Select commitHold shift + click to select a range
e55a7df gis-83825 change sentinel one const
nazargesyk99cfbba gis-8825 added sentinel one power query mappings
nazargesyk9231d12 Merge branch 'prod' into gis-8825
nazargesykd87ec76 gis-8825 added sentinel one power query render
nazargesyk3c6c43f gis-8825 added sentinel one power query render
nazargesyk73914f5 gis-8825 fix
nazargesyk1ca0bb3 gis-8825 fixes
nazargesyk4f8ab8f Merge branch 'main' into gis-8825
nazargesyk4dff1e1 Merge branch 'main' into gis-8825
nazargesyk2123434 merge
nazargesyk73dee61 gis-8825 cleaning
nazargesykba9ee98 gis-8825 cleaning
nazargesykFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Merge branch 'prod' into gis-8825
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit9231d12f85e01901e74a208b4b26f3780ddf98f5
There are no files selected for viewing
88 changes: 88 additions & 0 deletionsuncoder-core/app/routers/meta_info.py
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,88 @@ | ||
| from dataclasses import asdict | ||
| from fastapi import APIRouter, Body, HTTPException | ||
| from app.models.meta_info import ( | ||
| MetaInfo, | ||
| MetaInfoResponse, | ||
| MitreInfoContainer, | ||
| MitreTacticContainer, | ||
| MitreTechniqueContainer, | ||
| ParsedLogSources, | ||
| RawMetaInfo, | ||
| ) | ||
| from app.translator.core.exceptions.core import UnsupportedPlatform | ||
| from app.translator.translator import app_translator | ||
| meta_info_router = APIRouter() | ||
| @meta_info_router.post("/get_meta_info/", tags=["meta_info"], description="Get Rule MetaInfo") | ||
| @meta_info_router.post("/get_meta_info/", include_in_schema=False) | ||
| def get_meta_info_data( | ||
| source_platform_id: str = Body(..., embed=True), text: str = Body(..., embed=True) | ||
| ) -> MetaInfoResponse: | ||
| try: | ||
| logsources, raw_query_container = app_translator.parse_meta_info(text=text, source=source_platform_id) | ||
| except UnsupportedPlatform as exc: | ||
| raise HTTPException(status_code=400, detail="Unsuported platform") from exc | ||
| except Exception as exc: | ||
| raise HTTPException(status_code=400, detail="Unexpected error.") from exc | ||
| if not raw_query_container: | ||
| raise HTTPException(status_code=400, detail="Can't parse metadata") | ||
| most_frequent_product = max(logsources.get("product"), key=logsources.get("product").get, default=None) | ||
| most_frequent_service = max(logsources.get("service"), key=logsources.get("service").get, default=None) | ||
| most_frequent_category = max(logsources.get("category"), key=logsources.get("category").get, default=None) | ||
| logsources.get("product", {}).pop(most_frequent_product, None) | ||
| logsources.get("service", {}).pop(most_frequent_service, None) | ||
| logsources.get("category", {}).pop(most_frequent_category, None) | ||
| parsed_logsources = ParsedLogSources( | ||
| most_frequent_product=most_frequent_product, | ||
| most_frequent_service=most_frequent_service, | ||
| most_frequent_category=most_frequent_category, | ||
| least_frequent_products=list(logsources.get("product", {}).keys()), | ||
| least_frequent_services=list(logsources.get("service", {}).keys()), | ||
| least_frequent_categories=list(logsources.get("category", {}).keys()), | ||
| ) | ||
| return MetaInfoResponse( | ||
| query=raw_query_container.query, | ||
| language=raw_query_container.language, | ||
| meta_info=MetaInfo( | ||
| id_=raw_query_container.meta_info.id, | ||
| title=raw_query_container.meta_info.title, | ||
| description=raw_query_container.meta_info.description, | ||
| author=raw_query_container.meta_info.author, | ||
| date=raw_query_container.meta_info.date, | ||
| false_positives=raw_query_container.meta_info.false_positives, | ||
| license_=raw_query_container.meta_info.license, | ||
| mitre_attack=MitreInfoContainer( | ||
| tactics=[ | ||
| MitreTacticContainer(**asdict(tactic_container)) | ||
| for tactic_container in raw_query_container.meta_info.mitre_attack.tactics | ||
| ], | ||
| techniques=[ | ||
| MitreTechniqueContainer(**asdict(tactic_container)) | ||
| for tactic_container in raw_query_container.meta_info.mitre_attack.techniques | ||
| ], | ||
| ), | ||
| output_table_fields=raw_query_container.meta_info.output_table_fields, | ||
| parsed_log_sources=parsed_logsources, | ||
| query_fields=raw_query_container.meta_info.query_fields + raw_query_container.meta_info.function_fields, | ||
| query_period=raw_query_container.meta_info.query_period, | ||
| raw_metainfo_container=RawMetaInfo( | ||
| trigger_operator=raw_query_container.meta_info.raw_metainfo_container.trigger_operator, | ||
| trigger_threshold=raw_query_container.meta_info.raw_metainfo_container.trigger_threshold, | ||
| query_frequency=raw_query_container.meta_info.raw_metainfo_container.query_frequency, | ||
| query_period=raw_query_container.meta_info.raw_metainfo_container.query_period, | ||
| ), | ||
| raw_mitre_attack=raw_query_container.meta_info.raw_mitre_attack, | ||
| references=raw_query_container.meta_info.references, | ||
| severity=raw_query_container.meta_info.severity, | ||
| source_mapping_ids=raw_query_container.meta_info.source_mapping_ids, | ||
| status=raw_query_container.meta_info.status, | ||
| tags=raw_query_container.meta_info.tags, | ||
| timeframe=raw_query_container.meta_info.timeframe, | ||
| ), | ||
| ) |
53 changes: 43 additions & 10 deletionsuncoder-core/app/translator/core/mapping.py
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
2 changes: 1 addition & 1 deletionuncoder-core/app/translator/core/mixins/rule.py
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
10 changes: 7 additions & 3 deletionsuncoder-core/app/translator/core/models/query_container.py
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
25 changes: 18 additions & 7 deletionsuncoder-core/app/translator/core/parser.py
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
8 changes: 6 additions & 2 deletionsuncoder-core/app/translator/core/render.py
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
2 changes: 2 additions & 0 deletionsuncoder-core/app/translator/mappings/platforms/carbonblack/default.yml
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,2 @@ | ||
| platform: CarbonBlack | ||
| source: default |
8 changes: 8 additions & 0 deletionsuncoder-core/app/translator/mappings/platforms/carbonblack/linux_dns_query.yml
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,8 @@ | ||
| platform: CarbonBlack | ||
| source: linux_dns_query | ||
| field_mapping: | ||
| User: | ||
| - childproc_username | ||
| - process_username |
9 changes: 9 additions & 0 deletionsuncoder-core/app/translator/mappings/platforms/carbonblack/linux_network_connection.yml
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,9 @@ | ||
| platform: CarbonBlack | ||
| source: linux_network_connection | ||
| field_mapping: | ||
| DestinationHostname: | ||
| - netconn_domain | ||
| - netconn_proxy_domain | ||
| DestinationPort: netconn_port |
8 changes: 8 additions & 0 deletionsuncoder-core/app/translator/mappings/platforms/carbonblack/macos_dns_query.yml
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,8 @@ | ||
| platform: CarbonBlack | ||
| source: macos_dns_query | ||
| field_mapping: | ||
| User: | ||
| - childproc_username | ||
| - process_username |
9 changes: 9 additions & 0 deletionsuncoder-core/app/translator/mappings/platforms/carbonblack/macos_network_connection.yml
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,9 @@ | ||
| platform: CarbonBlack | ||
| source: macos_network_connection | ||
| field_mapping: | ||
| DestinationHostname: | ||
| - netconn_domain | ||
| - netconn_proxy_domain | ||
| DestinationPort: netconn_port |
7 changes: 7 additions & 0 deletionsuncoder-core/app/translator/mappings/platforms/carbonblack/windows_create_remote_thread.yml
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,7 @@ | ||
| platform: CarbonBlack | ||
| source: windows_create_remote_thread | ||
| field_mapping: | ||
| SourceImage: parent_name | ||
| StartModule: modload_name |
8 changes: 8 additions & 0 deletionsuncoder-core/app/translator/mappings/platforms/carbonblack/windows_dns_query.yml
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,8 @@ | ||
| platform: CarbonBlack | ||
| source: windows_dns_query | ||
| field_mapping: | ||
| User: | ||
| - childproc_username | ||
| - process_username |
8 changes: 8 additions & 0 deletionsuncoder-core/app/translator/mappings/platforms/carbonblack/windows_file_event.yml
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,8 @@ | ||
| platform: CarbonBlack | ||
| source: windows_file_event | ||
| field_mapping: | ||
| User: | ||
| - childproc_username | ||
| - process_username |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.