-
-
Notifications
You must be signed in to change notification settings - Fork 529
Added LoadFileSamePlaybook pivot
#2568
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
92e991e
Added more specific pivot and its migrations
fgibertoni bebe1b7
Fixed typo in class name
fgibertoni 9d51716
Update api_app/pivots_manager/migrations/0036_alter_extractedonenotef…
fgibertoni 0452190
Merge branch 'loadfile-pivot-same-playbook' of github.com:intelowlpro…
fgibertoni 41ce9db
Fixed suggestions
fgibertoni 8addae9
Renamed migration
fgibertoni 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
48 changes: 48 additions & 0 deletions
48
api_app/pivots_manager/migrations/0036_alter_extractedonenotefiles_loadfilesameplaybook.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,48 @@ | ||
| from django.db import migrations | ||
|
|
||
|
|
||
| def migrate(apps, schema_editor): | ||
| PythonModule = apps.get_model("api_app", "PythonModule") | ||
| Parameter = apps.get_model("api_app", "Parameter") | ||
| PluginConfig = apps.get_model("api_app", "PluginConfig") | ||
| PivotConfig = apps.get_model("pivots_manager", "PivotConfig") | ||
| pivot_to_update = PivotConfig.objects.get(name="ExtractedOneNoteFiles") | ||
| pm = PythonModule.objects.create( | ||
| health_check_schedule=None, | ||
| update_schedule=None, | ||
| module="load_file_same_playbook.LoadFileSamePlaybook", | ||
| base_path="api_app.pivots_manager.pivots", | ||
| ) | ||
| param1 = Parameter.objects.create( | ||
| name="field_to_compare", | ||
| type="str", | ||
| description="Dotted path to the field", | ||
| is_secret=False, | ||
| required=True, | ||
| python_module=pm, | ||
| ) | ||
| PluginConfig.objects.filter(pivot_config=pivot_to_update).delete() | ||
| pivot_to_update.python_module = pm | ||
| PluginConfig.objects.create( | ||
| parameter=param1, | ||
| value="stored_base64", | ||
| for_organization=False, | ||
| updated_at="2024-11-07T10:35:46.217160Z", | ||
| analyzer_config=None, | ||
| connector_config=None, | ||
| visualizer_config=None, | ||
| ingestor_config=None, | ||
| pivot_config=pivot_to_update, | ||
| ) | ||
| pivot_to_update.full_clean() | ||
| pivot_to_update.save() | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| atomic = False | ||
| dependencies = [ | ||
| ("api_app", "0063_singleton_and_elastic_report"), | ||
| ("pivots_manager", "0035_pivot_config_phishingextractortoanalysis"), | ||
| ] | ||
|
|
||
| operations = [migrations.RunPython(migrate, migrations.RunPython.noop)] | ||
48 changes: 48 additions & 0 deletions
48
api_app/pivots_manager/migrations/0037_alter_resubmitdownloadedfile_loadfilesameplaybook.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,48 @@ | ||
| from django.db import migrations | ||
|
|
||
|
|
||
| def migrate(apps, schema_editor): | ||
| PythonModule = apps.get_model("api_app", "PythonModule") | ||
| Parameter = apps.get_model("api_app", "Parameter") | ||
| PluginConfig = apps.get_model("api_app", "PluginConfig") | ||
| PivotConfig = apps.get_model("pivots_manager", "PivotConfig") | ||
| pivot_to_update = PivotConfig.objects.get(name="ResubmitDownloadedFile") | ||
| pm = PythonModule.objects.get( | ||
| health_check_schedule=None, | ||
| update_schedule=None, | ||
| module="load_file_same_playbook.LoadFileSamePlaybook", | ||
| base_path="api_app.pivots_manager.pivots", | ||
| ) | ||
| param1 = Parameter.objects.get( | ||
| name="field_to_compare", | ||
| type="str", | ||
| description="Dotted path to the field", | ||
| is_secret=False, | ||
| required=True, | ||
| python_module=pm, | ||
| ) | ||
| PluginConfig.objects.filter(pivot_config=pivot_to_update).delete() | ||
| pivot_to_update.python_module = pm | ||
| PluginConfig.objects.create( | ||
| parameter=param1, | ||
| value="stored_base64", | ||
| for_organization=False, | ||
| updated_at="2024-11-07T10:35:46.217160Z", | ||
| analyzer_config=None, | ||
| connector_config=None, | ||
| visualizer_config=None, | ||
| ingestor_config=None, | ||
| pivot_config=pivot_to_update, | ||
| ) | ||
| pivot_to_update.full_clean() | ||
| pivot_to_update.save() | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| atomic = False | ||
| dependencies = [ | ||
| ("api_app", "0063_singleton_and_elastic_report"), | ||
| ("pivots_manager", "0036_alter_extractedonenotefiles_loadfilesameplaybook"), | ||
| ] | ||
|
|
||
| operations = [migrations.RunPython(migrate, migrations.RunPython.noop)] | ||
fgibertoni marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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,15 @@ | ||
| from api_app.pivots_manager.models import PivotConfig | ||
| from api_app.pivots_manager.pivots.load_file import LoadFile | ||
|
|
||
|
|
||
| class LoadFileSamvmePlaybook(LoadFile): | ||
fgibertoni marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| field_to_compare: str | ||
|
|
||
| @classmethod | ||
| def update(cls) -> bool: | ||
| pass | ||
|
|
||
| def get_playbook_to_execute(self): | ||
| self._config: PivotConfig | ||
| # use the same playbook of the parent when resubmit a file | ||
| return self._job.get_root().playbook_to_execute | ||
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.
Uh oh!
There was an error while loading. Please reload this page.