mmisp-lib 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. mmisp/api_schemas/__init__.py +0 -0
  2. mmisp/api_schemas/attributes/__init__.py +0 -0
  3. mmisp/api_schemas/attributes/add_attribute_body.py +34 -0
  4. mmisp/api_schemas/attributes/add_attribute_response.py +33 -0
  5. mmisp/api_schemas/attributes/add_remove_tag_attribute_response.py +13 -0
  6. mmisp/api_schemas/attributes/delete_attribute_response.py +8 -0
  7. mmisp/api_schemas/attributes/delete_selected_attribute_body.py +9 -0
  8. mmisp/api_schemas/attributes/delete_selected_attribute_response.py +13 -0
  9. mmisp/api_schemas/attributes/edit_attribute_body.py +24 -0
  10. mmisp/api_schemas/attributes/edit_attributes_response.py +42 -0
  11. mmisp/api_schemas/attributes/get_all_attributes_response.py +38 -0
  12. mmisp/api_schemas/attributes/get_attribute_response.py +41 -0
  13. mmisp/api_schemas/attributes/get_attribute_statistics_response.py +137 -0
  14. mmisp/api_schemas/attributes/get_describe_types_response.py +29 -0
  15. mmisp/api_schemas/attributes/restore_attribute_reponse.py +25 -0
  16. mmisp/api_schemas/attributes/search_attributes_body.py +74 -0
  17. mmisp/api_schemas/attributes/search_attributes_response.py +52 -0
  18. mmisp/api_schemas/auth_keys/__init__.py +0 -0
  19. mmisp/api_schemas/auth_keys/add_auth_key_body.py +10 -0
  20. mmisp/api_schemas/auth_keys/add_auth_key_response.py +20 -0
  21. mmisp/api_schemas/auth_keys/edit_auth_key_body.py +8 -0
  22. mmisp/api_schemas/auth_keys/edit_auth_key_response.py +24 -0
  23. mmisp/api_schemas/auth_keys/search_auth_keys_body.py +17 -0
  24. mmisp/api_schemas/auth_keys/search_get_all_auth_keys_users_response.py +28 -0
  25. mmisp/api_schemas/auth_keys/view_auth_key_response.py +24 -0
  26. mmisp/api_schemas/authentication/__init__.py +0 -0
  27. mmisp/api_schemas/authentication/exchange_token_login_body.py +5 -0
  28. mmisp/api_schemas/authentication/password_login_body.py +6 -0
  29. mmisp/api_schemas/authentication/start_login_body.py +5 -0
  30. mmisp/api_schemas/authentication/start_login_response.py +21 -0
  31. mmisp/api_schemas/authentication/token_response.py +5 -0
  32. mmisp/api_schemas/events/FreeTextImportWorkerBody.py +17 -0
  33. mmisp/api_schemas/events/__init__.py +0 -0
  34. mmisp/api_schemas/events/add_attribute_via_free_text_import_event_body.py +12 -0
  35. mmisp/api_schemas/events/add_attribute_via_free_text_import_event_response.py +14 -0
  36. mmisp/api_schemas/events/add_edit_get_event_response.py +234 -0
  37. mmisp/api_schemas/events/add_event_body.py +30 -0
  38. mmisp/api_schemas/events/add_remove_tag_events_response.py +11 -0
  39. mmisp/api_schemas/events/delete_event_response.py +14 -0
  40. mmisp/api_schemas/events/edit_event_body.py +28 -0
  41. mmisp/api_schemas/events/get_all_events_response.py +99 -0
  42. mmisp/api_schemas/events/get_event_response.py +8 -0
  43. mmisp/api_schemas/events/index_events_body.py +30 -0
  44. mmisp/api_schemas/events/index_events_response.py +40 -0
  45. mmisp/api_schemas/events/publish_event_response.py +13 -0
  46. mmisp/api_schemas/events/search_events_body.py +43 -0
  47. mmisp/api_schemas/events/search_events_response.py +10 -0
  48. mmisp/api_schemas/events/unpublish_event_response.py +13 -0
  49. mmisp/api_schemas/feeds/__init__.py +0 -0
  50. mmisp/api_schemas/feeds/cache_feed_response.py +12 -0
  51. mmisp/api_schemas/feeds/create_feed_body.py +30 -0
  52. mmisp/api_schemas/feeds/enable_disable_feed_response.py +10 -0
  53. mmisp/api_schemas/feeds/fetch_feeds_response.py +8 -0
  54. mmisp/api_schemas/feeds/get_feed_response.py +47 -0
  55. mmisp/api_schemas/feeds/toggle_feed_body.py +8 -0
  56. mmisp/api_schemas/feeds/update_feed_body.py +30 -0
  57. mmisp/api_schemas/galaxies/__init__.py +0 -0
  58. mmisp/api_schemas/galaxies/attach_galaxy_cluster_body.py +12 -0
  59. mmisp/api_schemas/galaxies/attach_galaxy_cluster_response.py +10 -0
  60. mmisp/api_schemas/galaxies/delete_force_update_import_galaxy_response.py +12 -0
  61. mmisp/api_schemas/galaxies/export_galaxies_body.py +16 -0
  62. mmisp/api_schemas/galaxies/export_galaxies_response.py +44 -0
  63. mmisp/api_schemas/galaxies/galaxy_schema.py +18 -0
  64. mmisp/api_schemas/galaxies/get_all_search_galaxies_response.py +22 -0
  65. mmisp/api_schemas/galaxies/get_galaxy_response.py +37 -0
  66. mmisp/api_schemas/galaxies/import_galaxies_body.py +15 -0
  67. mmisp/api_schemas/galaxies/search_galaxies_body.py +22 -0
  68. mmisp/api_schemas/noticelists/__init__.py +0 -0
  69. mmisp/api_schemas/noticelists/get_all_noticelist_response.py +10 -0
  70. mmisp/api_schemas/noticelists/get_noticelist_response.py +38 -0
  71. mmisp/api_schemas/objects/__init__.py +0 -0
  72. mmisp/api_schemas/objects/create_object_body.py +19 -0
  73. mmisp/api_schemas/objects/get_object_response.py +50 -0
  74. mmisp/api_schemas/objects/search_objects_body.py +49 -0
  75. mmisp/api_schemas/organisations/__init__.py +0 -0
  76. mmisp/api_schemas/organisations/organisation.py +24 -0
  77. mmisp/api_schemas/roles/__init__.py +0 -0
  78. mmisp/api_schemas/roles/role.py +71 -0
  79. mmisp/api_schemas/sharing_groups/__init__.py +0 -0
  80. mmisp/api_schemas/sharing_groups/add_org_to_sharing_group_body.py +6 -0
  81. mmisp/api_schemas/sharing_groups/add_org_to_sharing_group_legacy_body.py +5 -0
  82. mmisp/api_schemas/sharing_groups/add_server_to_sharing_group_body.py +6 -0
  83. mmisp/api_schemas/sharing_groups/add_server_to_sharing_group_legacy_body.py +5 -0
  84. mmisp/api_schemas/sharing_groups/create_sharing_group_body.py +12 -0
  85. mmisp/api_schemas/sharing_groups/create_sharing_group_legacy_body.py +23 -0
  86. mmisp/api_schemas/sharing_groups/create_sharing_group_legacy_response.py +18 -0
  87. mmisp/api_schemas/sharing_groups/delete_sharing_group_legacy_response.py +5 -0
  88. mmisp/api_schemas/sharing_groups/get_all_sharing_groups_response.py +53 -0
  89. mmisp/api_schemas/sharing_groups/get_sharing_group_info_response.py +44 -0
  90. mmisp/api_schemas/sharing_groups/sharing_group.py +19 -0
  91. mmisp/api_schemas/sharing_groups/sharing_group_org.py +8 -0
  92. mmisp/api_schemas/sharing_groups/sharing_group_server.py +8 -0
  93. mmisp/api_schemas/sharing_groups/update_sharing_group_body.py +10 -0
  94. mmisp/api_schemas/sharing_groups/update_sharing_group_legacy_body.py +28 -0
  95. mmisp/api_schemas/sharing_groups/view_update_sharing_group_legacy_response.py +40 -0
  96. mmisp/api_schemas/sightings/__init__.py +0 -0
  97. mmisp/api_schemas/sightings/create_sighting_body.py +49 -0
  98. mmisp/api_schemas/sightings/get_sighting_response.py +27 -0
  99. mmisp/api_schemas/standard_status_response.py +13 -0
  100. mmisp/api_schemas/tags/__init__.py +0 -0
  101. mmisp/api_schemas/tags/create_tag_body.py +15 -0
  102. mmisp/api_schemas/tags/delete_tag_response.py +10 -0
  103. mmisp/api_schemas/tags/get_tag_response.py +31 -0
  104. mmisp/api_schemas/tags/search_tags_response.py +26 -0
  105. mmisp/api_schemas/tags/update_tag_body.py +15 -0
  106. mmisp/api_schemas/taxonomies/__init__.py +0 -0
  107. mmisp/api_schemas/taxonomies/export_taxonomies_response.py +30 -0
  108. mmisp/api_schemas/taxonomies/get_taxonomy_by_id_response.py +30 -0
  109. mmisp/api_schemas/taxonomies/get_taxonomy_response.py +21 -0
  110. mmisp/api_schemas/taxonomies/get_taxonomy_tags_response.py +32 -0
  111. mmisp/api_schemas/user_settings/__init__.py +0 -0
  112. mmisp/api_schemas/user_settings/get_uid_user_setting_response.py +21 -0
  113. mmisp/api_schemas/user_settings/get_user_settings_response.py +13 -0
  114. mmisp/api_schemas/user_settings/search_user_setting_body.py +7 -0
  115. mmisp/api_schemas/user_settings/search_user_setting_response.py +11 -0
  116. mmisp/api_schemas/user_settings/set_user_setting_body.py +5 -0
  117. mmisp/api_schemas/user_settings/set_user_setting_response.py +13 -0
  118. mmisp/api_schemas/user_settings/view_user_setting_response.py +13 -0
  119. mmisp/api_schemas/users/__init__.py +0 -0
  120. mmisp/api_schemas/users/user.py +42 -0
  121. mmisp/api_schemas/users/users_view_me_response.py +12 -0
  122. mmisp/api_schemas/warninglists/__init__.py +0 -0
  123. mmisp/api_schemas/warninglists/check_value_warninglists_body.py +8 -0
  124. mmisp/api_schemas/warninglists/check_value_warninglists_response.py +14 -0
  125. mmisp/api_schemas/warninglists/create_warninglist_body.py +220 -0
  126. mmisp/api_schemas/warninglists/delete_warninglist_response.py +13 -0
  127. mmisp/api_schemas/warninglists/get_selected_all_warninglists_response.py +14 -0
  128. mmisp/api_schemas/warninglists/get_selected_warninglists_body.py +9 -0
  129. mmisp/api_schemas/warninglists/toggle_enable_warninglists_body.py +10 -0
  130. mmisp/api_schemas/warninglists/toggle_enable_warninglists_response.py +10 -0
  131. mmisp/api_schemas/warninglists/warninglist_response.py +42 -0
  132. mmisp/db/__init__.py +0 -0
  133. mmisp/db/config.py +17 -0
  134. mmisp/db/database.py +42 -0
  135. mmisp/db/models/__init__.py +0 -0
  136. mmisp/db/models/attribute.py +92 -0
  137. mmisp/db/models/auth_key.py +24 -0
  138. mmisp/db/models/event.py +62 -0
  139. mmisp/db/models/feed.py +32 -0
  140. mmisp/db/models/galaxy.py +22 -0
  141. mmisp/db/models/galaxy_cluster.py +52 -0
  142. mmisp/db/models/identity_provider.py +22 -0
  143. mmisp/db/models/noticelist.py +22 -0
  144. mmisp/db/models/object.py +39 -0
  145. mmisp/db/models/organisation.py +26 -0
  146. mmisp/db/models/role.py +42 -0
  147. mmisp/db/models/server.py +33 -0
  148. mmisp/db/models/sharing_group.py +43 -0
  149. mmisp/db/models/sighting.py +21 -0
  150. mmisp/db/models/tag.py +19 -0
  151. mmisp/db/models/taxonomy.py +41 -0
  152. mmisp/db/models/user.py +44 -0
  153. mmisp/db/models/user_setting.py +29 -0
  154. mmisp/db/models/warninglist.py +33 -0
  155. mmisp/db/print_changes.py +59 -0
  156. mmisp/lib/__init__.py +0 -0
  157. mmisp/lib/attributes.py +1386 -0
  158. mmisp_lib-0.1.0.dist-info/METADATA +77 -0
  159. mmisp_lib-0.1.0.dist-info/RECORD +161 -0
  160. mmisp_lib-0.1.0.dist-info/WHEEL +5 -0
  161. mmisp_lib-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,43 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class SearchEventsBody(BaseModel):
5
+ returnFormat: str
6
+ page: int | None = None
7
+ limit: int | None = None
8
+ value: str | None = None
9
+ type: str | None = None
10
+ category: str | None = None
11
+ org: str | None = None
12
+ tags: list[str] | None = None
13
+ event_tags: list[str] | None = None
14
+ searchall: str | None = None
15
+ from_: str | None = None
16
+ to: str | None = None
17
+ last: int | None = None
18
+ eventid: str | None = None
19
+ withAttachments: bool | None = None
20
+ sharinggroup: list[str] | None = None
21
+ metadata: bool | None = None
22
+ uuid: str | None = None
23
+ publish_timestamp: str | None = None
24
+ timestamp: str | None = None
25
+ published: bool | None = None
26
+ enforceWarninglist: bool | None = None
27
+ sgReferenceOnly: bool | None = None
28
+ requested_attributes: list[str] | None = None
29
+ includeContext: bool | None = None
30
+ headerless: bool | None = None
31
+ includeWarninglistHits: bool | None = None
32
+ attackGalaxy: str | None = None
33
+ to_ids: bool | None = None
34
+ deleted: bool | None = None
35
+ excludeLocalTags: bool | None = None
36
+ date: str | None = None
37
+ includeSightingdb: bool | None = None
38
+ tag: str | None = None
39
+ object_relation: str | None = None
40
+ threat_level_id: str | None = None
41
+
42
+ class Config:
43
+ orm_mode = True
@@ -0,0 +1,10 @@
1
+ from pydantic import BaseModel
2
+
3
+ from .add_edit_get_event_response import AddEditGetEventResponse
4
+
5
+
6
+ class SearchEventsResponse(BaseModel):
7
+ response: list[AddEditGetEventResponse]
8
+
9
+ class Config:
10
+ orm_mode = True
@@ -0,0 +1,13 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class UnpublishEventResponse(BaseModel):
5
+ saved: bool | None = None
6
+ success: bool | None = None
7
+ name: str
8
+ message: str
9
+ url: str
10
+ id: str | None = None
11
+
12
+ class Config:
13
+ orm_mode = True
File without changes
@@ -0,0 +1,12 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class FeedCacheResponse(BaseModel):
5
+ name: str
6
+ message: str
7
+ url: str
8
+ saved: bool
9
+ success: bool
10
+
11
+ class Config:
12
+ orm_mode = True
@@ -0,0 +1,30 @@
1
+ from pydantic import BaseModel, Field
2
+
3
+
4
+ class FeedCreateBody(BaseModel):
5
+ name: str = Field(min_length=1)
6
+ provider: str = Field(min_length=1)
7
+ url: str = Field(min_length=1)
8
+ rules: str | None = None
9
+ enabled: bool | None = None
10
+ distribution: str | None = None
11
+ sharing_group_id: str | None = None
12
+ tag_id: str | None = None
13
+ default: bool | None = None
14
+ source_format: str | None = None
15
+ fixed_event: bool | None = None
16
+ delta_merge: bool | None = None
17
+ event_id: str | None = None
18
+ publish: bool | None = None
19
+ override_ids: bool | None = None
20
+ settings: str | None = None
21
+ input_source: str | None = None
22
+ delete_local_file: bool | None = None
23
+ lookup_visible: bool | None = None
24
+ headers: str | None = None
25
+ caching_enabled: bool | None = None
26
+ force_to_ids: bool | None = None
27
+ orgc_id: str | None = None
28
+
29
+ class Config:
30
+ orm_mode = True
@@ -0,0 +1,10 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class FeedEnableDisableResponse(BaseModel):
5
+ name: str
6
+ message: str
7
+ url: str
8
+
9
+ class Config:
10
+ orm_mode = True
@@ -0,0 +1,8 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class FeedFetchResponse(BaseModel):
5
+ result: str
6
+
7
+ class Config:
8
+ orm_mode = True
@@ -0,0 +1,47 @@
1
+ from typing import Any, Dict, Optional
2
+
3
+ from pydantic import BaseModel, validator
4
+
5
+
6
+ class FeedAttributesResponse(BaseModel):
7
+ id: str
8
+ name: str
9
+ provider: str
10
+ url: str
11
+ rules: str | None = None
12
+ enabled: bool | None = None
13
+ distribution: str
14
+ sharing_group_id: str | None = None
15
+ tag_id: str
16
+ default: bool | None = None
17
+ source_format: str | None = None
18
+ fixed_event: bool
19
+ delta_merge: bool
20
+ event_id: str
21
+ publish: bool
22
+ override_ids: bool
23
+ settings: str | None = None
24
+ input_source: str
25
+ delete_local_file: bool | None = None
26
+ lookup_visible: bool | None = None
27
+ headers: str | None = None
28
+ caching_enabled: bool
29
+ force_to_ids: bool
30
+ orgc_id: str
31
+
32
+ @validator("sharing_group_id", always=True)
33
+ def check_sharing_group_id(cls, value: Any, values: Dict[str, Any]) -> Optional[int]: # noqa: ANN101
34
+ """
35
+ If distribution equals 4, sharing_group_id will be shown.
36
+ """
37
+ distribution = values.get("distribution", None)
38
+ if distribution == "4" and value is not None:
39
+ return value
40
+ return None
41
+
42
+
43
+ class FeedResponse(BaseModel):
44
+ Feed: FeedAttributesResponse
45
+
46
+ class Config:
47
+ orm_mode = True
@@ -0,0 +1,8 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class FeedToggleBody(BaseModel):
5
+ enable: bool
6
+
7
+ class Config:
8
+ orm_mode = True
@@ -0,0 +1,30 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class FeedUpdateBody(BaseModel):
5
+ name: str | None = None
6
+ provider: str | None = None
7
+ url: str | None = None
8
+ rules: str | None = None
9
+ enabled: bool | None = None
10
+ distribution: str | None = None
11
+ sharing_group_id: str | None = None
12
+ tag_id: str | None = None
13
+ default: bool | None = None
14
+ source_format: str | None = None
15
+ fixed_event: bool | None = None
16
+ delta_merge: bool | None = None
17
+ event_id: str | None = None
18
+ publish: bool | None = None
19
+ override_ids: bool | None = None
20
+ settings: str | None = None
21
+ input_source: str | None = None
22
+ delete_local_file: bool | None = None
23
+ lookup_visible: bool | None = None
24
+ headers: str | None = None
25
+ caching_enabled: bool | None = None
26
+ force_to_ids: bool | None = None
27
+ orgc_id: str | None = None
28
+
29
+ class Config:
30
+ orm_mode = True
File without changes
@@ -0,0 +1,12 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class AttachClusterGalaxyAttributes(BaseModel):
5
+ target_id: int
6
+
7
+
8
+ class AttachClusterGalaxyBody(BaseModel):
9
+ Galaxy: AttachClusterGalaxyAttributes
10
+
11
+ class Config:
12
+ orm_mode = True
@@ -0,0 +1,10 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class AttachClusterGalaxyResponse(BaseModel):
5
+ saved: bool
6
+ success: str
7
+ check_publish: bool
8
+
9
+ class Config:
10
+ orm_mode = True
@@ -0,0 +1,12 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class DeleteForceUpdateImportGalaxyResponse(BaseModel):
5
+ saved: bool | None = None
6
+ success: bool | None = None
7
+ name: str
8
+ message: str
9
+ url: str
10
+
11
+ class Config:
12
+ orm_mode = True
@@ -0,0 +1,16 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class ExportGalaxyAttributes(BaseModel):
5
+ default: bool
6
+ custom: bool | None = None
7
+ distribution: str
8
+ format: str | None = None
9
+ download: bool | None = None
10
+
11
+
12
+ class ExportGalaxyBody(BaseModel):
13
+ Galaxy: ExportGalaxyAttributes
14
+
15
+ class Config:
16
+ orm_mode = True
@@ -0,0 +1,44 @@
1
+ from pydantic import BaseModel
2
+
3
+ from mmisp.api_schemas.events.add_edit_get_event_response import AddEditGetEventGalaxyClusterRelation
4
+ from mmisp.api_schemas.events.get_all_events_response import GetAllEventsGalaxyClusterGalaxy
5
+ from mmisp.api_schemas.organisations.organisation import Organisation
6
+
7
+
8
+ class ExportGalaxyGalaxyElement(BaseModel):
9
+ id: str | None = None
10
+ galaxy_cluster_id: str | None = None
11
+ key: str
12
+ value: str
13
+
14
+
15
+ class ExportGalaxyClusterResponse(BaseModel):
16
+ id: str
17
+ uuid: str
18
+ collection_uuid: str
19
+ type: str
20
+ value: str
21
+ tag_name: str
22
+ description: str
23
+ galaxy_id: str
24
+ source: str
25
+ authors: list[str]
26
+ version: str
27
+ distribution: str
28
+ sharing_group_id: str
29
+ org_id: str
30
+ orgc_id: str
31
+ default: bool
32
+ locked: bool
33
+ extends_uuid: str
34
+ extends_version: str
35
+ published: bool
36
+ deleted: bool
37
+ GalaxyElement: list[ExportGalaxyGalaxyElement]
38
+ Galaxy: GetAllEventsGalaxyClusterGalaxy
39
+ GalaxyClusterRelation: list[AddEditGetEventGalaxyClusterRelation] = []
40
+ Org: Organisation
41
+ Orgc: Organisation
42
+
43
+ class Config:
44
+ orm_mode = True
@@ -0,0 +1,18 @@
1
+ from typing import List
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class GalaxySchema(BaseModel):
7
+ id: str
8
+ uuid: str
9
+ name: str
10
+ type: str
11
+ description: str
12
+ version: str
13
+ icon: str
14
+ namespace: str
15
+ kill_chain_order: List[str]
16
+
17
+ class Config:
18
+ orm_mode = True
@@ -0,0 +1,22 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class GetAllSearchGalaxiesAttributes(BaseModel):
5
+ id: str
6
+ uuid: str
7
+ name: str
8
+ type: str
9
+ description: str
10
+ version: str
11
+ icon: str
12
+ namespace: str
13
+ kill_chain_order: str | None = None
14
+ enabled: bool
15
+ local_only: bool
16
+
17
+
18
+ class GetAllSearchGalaxiesResponse(BaseModel):
19
+ Galaxy: GetAllSearchGalaxiesAttributes
20
+
21
+ class Config:
22
+ orm_mode = True
@@ -0,0 +1,37 @@
1
+ from pydantic import BaseModel
2
+
3
+ from .export_galaxies_response import ExportGalaxyGalaxyElement
4
+ from .get_all_search_galaxies_response import GetAllSearchGalaxiesAttributes
5
+
6
+
7
+ class GetGalaxyClusterResponse(BaseModel):
8
+ id: str | None = None
9
+ uuid: str | None = None
10
+ collection_uuid: str
11
+ type: str
12
+ value: str
13
+ tag_name: str
14
+ description: str
15
+ galaxy_id: str
16
+ source: str
17
+ authors: list[str]
18
+ version: str
19
+ distribution: str
20
+ sharing_group_id: str
21
+ org_id: str
22
+ orgc_id: str
23
+ default: bool
24
+ locked: bool
25
+ extends_uuid: str
26
+ extends_version: str
27
+ published: bool
28
+ deleted: bool
29
+ GalaxyElement: list[ExportGalaxyGalaxyElement]
30
+
31
+
32
+ class GetGalaxyResponse(BaseModel):
33
+ Galaxy: GetAllSearchGalaxiesAttributes
34
+ GalaxyCluster: list[GetGalaxyClusterResponse]
35
+
36
+ class Config:
37
+ orm_mode = True
@@ -0,0 +1,15 @@
1
+ from pydantic import BaseModel
2
+
3
+ from .get_galaxy_response import GetGalaxyClusterResponse
4
+
5
+
6
+ class ImportGalaxyGalaxy(BaseModel):
7
+ uuid: str
8
+
9
+
10
+ class ImportGalaxyBody(BaseModel):
11
+ GalaxyCluster: GetGalaxyClusterResponse
12
+ Galaxy: ImportGalaxyGalaxy
13
+
14
+ class Config:
15
+ orm_mode = True
@@ -0,0 +1,22 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class SearchGalaxiesbyValue(BaseModel):
5
+ value: str
6
+
7
+
8
+ class SearchGalaxiesBody(BaseModel):
9
+ id: str | None = None
10
+ uuid: str | None = None
11
+ name: str | None = None
12
+ type: str | None = None
13
+ description: str | None = None
14
+ version: str | None = None
15
+ icon: str | None = None
16
+ namespace: str | None = None
17
+ kill_chain_order: str | None = None
18
+ enabled: bool | None = None
19
+ local_only: bool | None = None
20
+
21
+ class Config:
22
+ orm_mode = True
File without changes
@@ -0,0 +1,10 @@
1
+ from pydantic import BaseModel
2
+
3
+ from mmisp.api_schemas.noticelists.get_noticelist_response import NoticelistAttributes
4
+
5
+
6
+ class GetAllNoticelists(BaseModel):
7
+ Noticelist: NoticelistAttributes
8
+
9
+ class Config:
10
+ orm_mode = True
@@ -0,0 +1,38 @@
1
+ from typing import Any
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class Data(BaseModel):
7
+ scope: str | list[str] | None
8
+ field: str | list[str] | None
9
+ value: str | list[str] | None
10
+ tags: str | list[str] | None
11
+ message: str | Any
12
+
13
+
14
+ class NoticelistEntryResponse(BaseModel):
15
+ id: str
16
+ noticelist_id: str
17
+ data: Data
18
+
19
+
20
+ class NoticelistAttributes(BaseModel):
21
+ id: str
22
+ name: str
23
+ expanded_name: str
24
+ ref: list[str]
25
+ geographical_area: list[str]
26
+ version: str
27
+ enabled: bool
28
+
29
+
30
+ class NoticelistAttributesResponse(NoticelistAttributes):
31
+ NoticelistEntry: list[NoticelistEntryResponse]
32
+
33
+
34
+ class NoticelistResponse(BaseModel):
35
+ Noticelist: NoticelistAttributesResponse
36
+
37
+ class Config:
38
+ orm_mode = True
File without changes
@@ -0,0 +1,19 @@
1
+ from pydantic import BaseModel, Field
2
+
3
+ from mmisp.api_schemas.attributes.add_attribute_body import AddAttributeBody
4
+
5
+
6
+ class ObjectCreateBody(BaseModel):
7
+ name: str = Field(min_length=1)
8
+ meta_category: str | None = None
9
+ description: str | None = None
10
+ distribution: str | None = None
11
+ sharing_group_id: str = Field(min_length=1)
12
+ comment: str = Field(min_length=1)
13
+ deleted: bool | None = None
14
+ first_seen: str | None = None
15
+ last_seen: str | None = None
16
+ Attribute: list[AddAttributeBody] | None = None
17
+
18
+ class Config:
19
+ orm_mode = True
@@ -0,0 +1,50 @@
1
+ from typing import Any, Dict, Optional
2
+
3
+ from pydantic import BaseModel, validator
4
+
5
+ from mmisp.api_schemas.attributes.get_all_attributes_response import GetAllAttributesResponse
6
+ from mmisp.api_schemas.events.get_event_response import ObjectEventResponse
7
+
8
+
9
+ class ObjectWithAttributesResponse(BaseModel):
10
+ id: str
11
+ uuid: str
12
+ name: str
13
+ meta_category: str | None = None
14
+ description: str | None = None
15
+ template_uuid: str | None = None
16
+ template_version: str | None = None
17
+ event_id: str | None = None
18
+ timestamp: str | None = None
19
+ distribution: str | None = None
20
+ sharing_group_id: str | None = None
21
+ comment: str | None = None
22
+ deleted: bool | None = None
23
+ first_seen: str | None = None
24
+ last_seen: str | None = None
25
+ Attribute: list[GetAllAttributesResponse] | None = None
26
+ Event: ObjectEventResponse | None = None
27
+
28
+ @validator("sharing_group_id", always=True)
29
+ def check_sharing_group_id(cls, value: Any, values: Dict[str, Any]) -> Optional[int]: # noqa: ANN101
30
+ """
31
+ If distribution equals 4, sharing_group_id will be shown.
32
+ """
33
+ distribution = values.get("distribution", None)
34
+ if distribution == "4" and value is not None:
35
+ return value
36
+ return None
37
+
38
+
39
+ class ObjectResponse(BaseModel):
40
+ Object: ObjectWithAttributesResponse
41
+
42
+ class Config:
43
+ orm_mode = True
44
+
45
+
46
+ class ObjectSearchResponse(BaseModel):
47
+ response: list[ObjectResponse]
48
+
49
+ class Config:
50
+ orm_mode = True
@@ -0,0 +1,49 @@
1
+ from typing import Any
2
+
3
+ from pydantic import BaseModel, validator
4
+
5
+
6
+ class ObjectSearchBody(BaseModel):
7
+ object_name: str | None = None
8
+ object_template_uuid: str | None = None
9
+ object_template_version: str | None = None
10
+ event_id: str | None = None
11
+ category: str | None = None
12
+ comment: str | None = None
13
+ first_seen: str | None = None
14
+ last_seen: str | None = None
15
+ quick_filter: str | None = None
16
+ timestamp: str | None = None
17
+ event_info: str | None = None
18
+ from_: str | None = None # 'from' is a reserved word in Python, so an underscore is added
19
+ to: str | None = None
20
+ date: str | None = None
21
+ last: str | None = None
22
+ event_timestamp: str | None = None
23
+ org_id: str | None = None
24
+ uuid: str | None = None
25
+ value1: str | None = None
26
+ value2: str | None = None
27
+ type: str | None = None
28
+ object_relation: str | None = None
29
+ attribute_timestamp: str | None = None
30
+ to_ids: bool | None = None
31
+ published: bool | None = None
32
+ deleted: bool | None = None
33
+ return_format: str | None = "json"
34
+ limit: str | None = "25"
35
+
36
+ @validator("limit")
37
+ def check_limit(cls, value: Any) -> str: # noqa: ANN101
38
+ if value:
39
+ try:
40
+ limit_int = int(value)
41
+ except ValueError:
42
+ raise ValueError("'limit' must be a valid integer")
43
+
44
+ if not 1 <= limit_int <= 500:
45
+ raise ValueError("'limit' must be between 1 and 500")
46
+ return value
47
+
48
+ class Config:
49
+ orm_mode = True
File without changes
@@ -0,0 +1,24 @@
1
+ from datetime import datetime
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class Organisation(BaseModel):
7
+ id: str
8
+ name: str
9
+ date_created: datetime
10
+ date_modified: datetime
11
+ description: str | None = None
12
+ type: str
13
+ nationality: str | None = None
14
+ sector: str | None = None
15
+ created_by: str
16
+ uuid: str
17
+ contacts: str | None = None
18
+ local: bool
19
+ """organisation gains access to the local instance, otherwise treated as external"""
20
+ restricted_to_domain: str | None = None
21
+ landingpage: str | None = None
22
+
23
+ class Config:
24
+ orm_mode = True
File without changes