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,71 @@
1
+ from datetime import datetime
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class Role(BaseModel):
7
+ id: str
8
+ name: str
9
+ created: datetime
10
+ modified: datetime
11
+ perm_add: bool
12
+ perm_modify: bool
13
+ """Manage Own Events."""
14
+ perm_modify_org: bool
15
+ """Manage Organisation Events."""
16
+ perm_publish: bool
17
+ """Publish Organisation Events."""
18
+ perm_delegate: bool
19
+ """Allow users to create delegation requests for their own org only events to trusted third parties."""
20
+ perm_sync: bool
21
+ """Synchronisation permission, can be used to connect two MISP instances create data on behalf of other users.
22
+ Make sure that the role with this permission has also access to tagging and tag editing rights."""
23
+ perm_admin: bool
24
+ """Limited organisation admin - create, manage users of their own organisation."""
25
+ perm_audit: bool
26
+ """Access to the audit logs of the user\'s organisation."""
27
+ perm_auth: bool
28
+ """Users with this permission have access to authenticating via their Auth keys,
29
+ granting them access to the API."""
30
+ perm_site_admin: bool
31
+ """Unrestricted access to any data and functionality on this instance."""
32
+ perm_regexp_access: bool
33
+ """Users with this role can modify the regex rules affecting how data is fed into MISP.
34
+ Make sure that caution is advised with handing out roles that include this permission,
35
+ user controlled executed regexes are dangerous."""
36
+ perm_tagger: bool
37
+ """Users with roles that include this permission can attach
38
+ or detach existing tags to and from events/attributes."""
39
+ perm_template: bool
40
+ """Create or modify templates, to be used when populating events."""
41
+ perm_sharing_group: bool
42
+ """Permission to create or modify sharing groups."""
43
+ perm_tag_editor: bool
44
+ """This permission gives users the ability to create tags."""
45
+ perm_sighting: bool
46
+ """Permits the user to push feedback on attributes into MISP by providing sightings."""
47
+ perm_object_template: bool
48
+ """Create or modify MISP Object templates."""
49
+ default_role: bool
50
+ memory_limit: str
51
+ max_execution_time: str
52
+ restricted_to_site_admin: bool
53
+ perm_publish_zmq: bool
54
+ """Allow users to publish data to the ZMQ pubsub channel via the publish event to ZMQ button."""
55
+ perm_publish_kafka: bool
56
+ """Allow users to publish data to Kafka via the publish event to Kafka button."""
57
+ perm_decaying: bool
58
+ """Create or modify MISP Decaying Models."""
59
+ enforce_rate_limit: bool
60
+ rate_limit_count: str # number as string
61
+ perm_galaxy_editor: bool
62
+ """Create or modify MISP Galaxies and MISP Galaxies Clusters."""
63
+ perm_warninglist: bool
64
+ """Allow to manage warninglists."""
65
+ perm_view_feed_correlations: bool
66
+ """Allow the viewing of feed correlations. Enabling this can come at a performance cost."""
67
+ permission: str | None # number as string
68
+ permission_description: str | None
69
+
70
+ class Config:
71
+ orm_mode = True
File without changes
@@ -0,0 +1,6 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class AddOrgToSharingGroupBody(BaseModel):
5
+ organisationId: str
6
+ extend: bool | None = None
@@ -0,0 +1,5 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class AddOrgToSharingGroupLegacyBody(BaseModel):
5
+ extend: bool | None = None
@@ -0,0 +1,6 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class AddServerToSharingGroupBody(BaseModel):
5
+ serverId: str
6
+ all_orgs: bool | None = None
@@ -0,0 +1,5 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class AddServerToSharingGroupLegacyBody(BaseModel):
5
+ all_orgs: bool | None = None
@@ -0,0 +1,12 @@
1
+ from pydantic import BaseModel, Field
2
+
3
+
4
+ class CreateSharingGroupBody(BaseModel):
5
+ uuid: str | None = None
6
+ name: str = Field(max_length=255)
7
+ description: str | None = Field(default=None, max_length=65535)
8
+ releasability: str = Field(max_length=65535)
9
+ organisation_uuid: str | None = Field(default=None, max_length=36)
10
+ active: bool | None = None
11
+ roaming: bool | None = None
12
+ local: bool | None = None
@@ -0,0 +1,23 @@
1
+ from datetime import datetime
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class CreateSharingGroupLegacyBody(BaseModel):
7
+ uuid: str | None = None
8
+ name: str = Field(max_length=255)
9
+ description: str | None = Field(default=None, max_length=65535)
10
+ releasability: str | None = Field(default=None, max_length=65535)
11
+ local: bool | None = None
12
+ active: bool | None = None
13
+ org_count: str | None = None
14
+ """attribute will be ignored"""
15
+ organisation_uuid: str | None = Field(default=None, max_length=36)
16
+ org_id: str | None = Field(default=None, max_length=10)
17
+ sync_user_id: str | None = Field(default=None, max_length=10)
18
+ """attribute will be ignored"""
19
+ created: datetime | None = None
20
+ """attribute will be ignored"""
21
+ modified: datetime | None = None
22
+ """attribute will be ignored"""
23
+ roaming: bool | None = None
@@ -0,0 +1,18 @@
1
+ from pydantic import BaseModel
2
+
3
+ from .sharing_group import SharingGroup
4
+ from .sharing_group_org import SharingGroupOrg
5
+ from .sharing_group_server import SharingGroupServer
6
+
7
+
8
+ class CreateSharingGroupLegacyResponseOrganisationInfo(BaseModel):
9
+ id: str
10
+ name: str
11
+ uuid: str
12
+
13
+
14
+ class CreateSharingGroupLegacyResponse(BaseModel):
15
+ SharingGroup: SharingGroup
16
+ Organisation: CreateSharingGroupLegacyResponseOrganisationInfo
17
+ SharingGroupOrg: list[SharingGroupOrg]
18
+ SharingGroupServer: list[SharingGroupServer]
@@ -0,0 +1,5 @@
1
+ from ..standard_status_response import StandardStatusResponse
2
+
3
+
4
+ class DeleteSharingGroupLegacyResponse(StandardStatusResponse):
5
+ id: str
@@ -0,0 +1,53 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class GetAllSharingGroupsResponseResponseItemSharingGroup(BaseModel):
5
+ id: str
6
+ uuid: str
7
+ name: str
8
+ description: str
9
+ releasability: str
10
+ local: bool
11
+ active: bool
12
+ roaming: bool
13
+ org_count: str
14
+
15
+
16
+ class GetAllSharingGroupsResponseOrganisationInfo(BaseModel):
17
+ id: str
18
+ uuid: str
19
+ name: str
20
+
21
+
22
+ class GetAllSharingGroupsResponseResponseItemSharingGroupOrgItem(BaseModel):
23
+ id: str
24
+ sharing_group_id: str
25
+ org_id: str
26
+ extend: bool
27
+ Organisation: GetAllSharingGroupsResponseOrganisationInfo
28
+
29
+
30
+ class GetAllSharingGroupsResponseResponseItemSharingGroupServerItemServer(BaseModel):
31
+ id: str
32
+ name: str
33
+ url: str
34
+
35
+
36
+ class GetAllSharingGroupsResponseResponseItemSharingGroupServerItem(BaseModel):
37
+ server_id: str
38
+ sharing_group_id: str
39
+ all_orgs: bool
40
+ Server: GetAllSharingGroupsResponseResponseItemSharingGroupServerItemServer
41
+
42
+
43
+ class GetAllSharingGroupsResponseResponseItem(BaseModel):
44
+ SharingGroup: GetAllSharingGroupsResponseResponseItemSharingGroup
45
+ Organisation: GetAllSharingGroupsResponseOrganisationInfo
46
+ SharingGroupOrg: list[GetAllSharingGroupsResponseResponseItemSharingGroupOrgItem]
47
+ SharingGroupServer: list[GetAllSharingGroupsResponseResponseItemSharingGroupServerItem]
48
+ editable: bool
49
+ deletable: bool
50
+
51
+
52
+ class GetAllSharingGroupsResponse(BaseModel):
53
+ response: list[GetAllSharingGroupsResponseResponseItem]
@@ -0,0 +1,44 @@
1
+ from pydantic import BaseModel
2
+
3
+ from ..organisations.organisation import Organisation
4
+ from .sharing_group import SharingGroup
5
+
6
+
7
+ class GetSharingGroupInfoResponseSharingGroupInfo(SharingGroup):
8
+ org_count: int
9
+
10
+
11
+ class GetSharingGroupInfoResponseOrganisationInfo(BaseModel):
12
+ id: str
13
+ uuid: str
14
+ name: str
15
+ local: bool
16
+
17
+
18
+ class GetSharingGroupInfoResponseSharingGroupOrgItem(BaseModel):
19
+ id: str
20
+ sharing_group_id: str
21
+ org_id: str
22
+ extend: bool
23
+ Organisation: GetSharingGroupInfoResponseOrganisationInfo
24
+
25
+
26
+ class GetSharingGroupInfoResponseServerInfo(BaseModel):
27
+ id: str
28
+ name: str
29
+ url: str
30
+
31
+
32
+ class GetSharingGroupInfoResponseSharingGroupServerItem(BaseModel):
33
+ id: str
34
+ sharing_group_id: str
35
+ server_id: str
36
+ all_orgs: bool
37
+ Server: GetSharingGroupInfoResponseServerInfo
38
+
39
+
40
+ class GetSharingGroupInfoResponse(BaseModel):
41
+ SharingGroup: GetSharingGroupInfoResponseSharingGroupInfo
42
+ Organisation: Organisation
43
+ SharingGroupOrg: list[GetSharingGroupInfoResponseSharingGroupOrgItem]
44
+ SharingGroupServer: list[GetSharingGroupInfoResponseSharingGroupServerItem]
@@ -0,0 +1,19 @@
1
+ from datetime import datetime
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class SharingGroup(BaseModel):
7
+ id: str
8
+ name: str
9
+ releasability: str
10
+ description: str
11
+ uuid: str
12
+ organisation_uuid: str
13
+ org_id: str
14
+ sync_user_id: str
15
+ active: bool
16
+ created: datetime
17
+ modified: datetime
18
+ local: bool
19
+ roaming: bool
@@ -0,0 +1,8 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class SharingGroupOrg(BaseModel):
5
+ id: str
6
+ sharing_group_id: str
7
+ org_id: str
8
+ extend: bool
@@ -0,0 +1,8 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class SharingGroupServer(BaseModel):
5
+ id: str
6
+ sharing_group_id: str
7
+ server_id: str
8
+ all_orgs: bool
@@ -0,0 +1,10 @@
1
+ from pydantic import BaseModel, Field
2
+
3
+
4
+ class UpdateSharingGroupBody(BaseModel):
5
+ name: str = Field(default=None, max_length=255)
6
+ description: str | None = Field(default=None, max_length=65535)
7
+ releasability: str = Field(default=None, max_length=65535)
8
+ active: bool | None = None
9
+ roaming: bool | None = None
10
+ local: bool | None = None
@@ -0,0 +1,28 @@
1
+ from datetime import datetime
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class UpdateSharingGroupLegacyBody(BaseModel):
7
+ id: str | None = None
8
+ """attribute will be ignored"""
9
+ uuid: str | None = Field(default=None, max_length=36)
10
+ """attribute will be ignored"""
11
+ name: str = Field(max_length=255)
12
+ description: str | None = Field(default=None, max_length=65535)
13
+ releasability: str | None = Field(default=None, max_length=65535)
14
+ local: bool | None = None
15
+ active: bool | None = None
16
+ org_count: str | None = None
17
+ """attribute will be ignored"""
18
+ organisation_uuid: str | None = Field(default=None, max_length=36)
19
+ """attribute will be ignored"""
20
+ org_id: str | None = Field(default=None, max_length=10)
21
+ """attribute will be ignored"""
22
+ sync_user_id: str | None = Field(default=None, max_length=10)
23
+ """attribute will be ignored"""
24
+ created: datetime | None = None
25
+ """attribute will be ignored"""
26
+ modified: datetime | None = None
27
+ """attribute will be ignored"""
28
+ roaming: bool | None = None
@@ -0,0 +1,40 @@
1
+ from pydantic import BaseModel
2
+
3
+ from ..organisations.organisation import Organisation
4
+ from .sharing_group import SharingGroup
5
+
6
+
7
+ class ViewUpdateSharingGroupLegacyResponseOrganisationInfo(BaseModel):
8
+ id: str
9
+ uuid: str
10
+ name: str
11
+ local: bool
12
+
13
+
14
+ class ViewUpdateSharingGroupLegacyResponseSharingGroupOrgItem(BaseModel):
15
+ id: str
16
+ sharing_group_id: str
17
+ org_id: str
18
+ extend: bool
19
+ Organisation: ViewUpdateSharingGroupLegacyResponseOrganisationInfo
20
+
21
+
22
+ class ViewUpdateSharingGroupLegacyResponseServerInfo(BaseModel):
23
+ id: str
24
+ name: str
25
+ url: str
26
+
27
+
28
+ class ViewUpdateSharingGroupLegacyResponseSharingGroupServerItem(BaseModel):
29
+ id: str
30
+ sharing_group_id: str
31
+ server_id: str
32
+ all_orgs: bool
33
+ Server: ViewUpdateSharingGroupLegacyResponseServerInfo
34
+
35
+
36
+ class ViewUpdateSharingGroupLegacyResponse(BaseModel):
37
+ SharingGroup: SharingGroup
38
+ Organisation: Organisation
39
+ SharingGroupOrg: list[ViewUpdateSharingGroupLegacyResponseSharingGroupOrgItem]
40
+ SharingGroupServer: list[ViewUpdateSharingGroupLegacyResponseSharingGroupServerItem]
File without changes
@@ -0,0 +1,49 @@
1
+ from typing import Any
2
+
3
+ from pydantic import BaseModel, validator
4
+
5
+
6
+ class SightingFiltersBody(BaseModel):
7
+ value1: str | None = None
8
+ value2: str | None = None
9
+ type: str | None = None
10
+ category: str | None = None
11
+ from_: str | None = None # 'from' is a reserved word in Python, so an underscore is added
12
+ to: str | None = None
13
+ last: str | None = None
14
+ timestamp: str | None = None
15
+ event_id: str | None = None
16
+ uuid: str | None = None
17
+ attribute_timestamp: str | None = None
18
+ to_ids: bool | None = None
19
+ deleted: bool | None = None
20
+ event_timestamp: str | None = None
21
+ eventinfo: str | None = None
22
+ sharinggroup: list[str] | None = None
23
+ first_seen: str | None = None
24
+ last_seen: str | None = None
25
+ requested_attributes: list[str] | None = None
26
+ returnFormat: str | None = "json"
27
+ limit: str | None = "25"
28
+
29
+ @validator("limit")
30
+ def check_limit(cls, value: Any) -> str: # noqa: ANN101
31
+ if value is not None:
32
+ try:
33
+ limit_int = int(value)
34
+ except ValueError:
35
+ raise ValueError("limit must be a valid integer")
36
+
37
+ if not 1 <= limit_int <= 500:
38
+ raise ValueError("limit must be between 1 and 500")
39
+ return value
40
+
41
+
42
+ class SightingCreateBody(BaseModel):
43
+ values: list[str]
44
+ source: str | None = None
45
+ timestamp: str | None = None
46
+ filters: SightingFiltersBody | None = None
47
+
48
+ class Config:
49
+ orm_mode = True
@@ -0,0 +1,27 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class SightingOrganisationResponse(BaseModel):
5
+ id: str
6
+ uuid: str
7
+ name: str
8
+
9
+
10
+ class SightingAttributesResponse(BaseModel):
11
+ id: str
12
+ uuid: str
13
+ attribute_id: str
14
+ attribute_uuid: str
15
+ event_id: str | None = None
16
+ org_id: str | None = None
17
+ date_sighting: str | None = None
18
+ source: str | None = None
19
+ type: str | None = None
20
+ Organisation: SightingOrganisationResponse | None = None
21
+
22
+
23
+ class SightingsGetResponse(BaseModel):
24
+ sightings: list[SightingAttributesResponse]
25
+
26
+ class Config:
27
+ orm_mode = True
@@ -0,0 +1,13 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class StandardStatusResponse(BaseModel):
5
+ saved: bool
6
+ success: bool
7
+ name: str
8
+ message: str
9
+ url: str
10
+
11
+
12
+ class StandardStatusIdentifiedResponse(StandardStatusResponse):
13
+ id: str
File without changes
@@ -0,0 +1,15 @@
1
+ from pydantic import BaseModel, Field
2
+
3
+
4
+ class TagCreateBody(BaseModel):
5
+ name: str = Field(min_length=1)
6
+ colour: str = Field(min_length=7, max_length=7)
7
+ exportable: bool
8
+ org_id: str | None = None
9
+ user_id: str | None = None
10
+ hide_tag: bool | None = None
11
+ numerical_value: str | None = None
12
+ local_only: bool | None = None
13
+
14
+ class Config:
15
+ orm_mode = True
@@ -0,0 +1,10 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class TagDeleteResponse(BaseModel):
5
+ name: str
6
+ message: str
7
+ url: str
8
+
9
+ class Config:
10
+ orm_mode = True
@@ -0,0 +1,31 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class TagAttributesResponse(BaseModel):
5
+ id: str
6
+ name: str
7
+ colour: str
8
+ exportable: bool
9
+ org_id: str | None = None
10
+ user_id: str | None = None
11
+ hide_tag: bool | None = None
12
+ numerical_value: str | None = None
13
+ is_galaxy: bool | None = None
14
+ is_custom_galaxy: bool | None = None
15
+ local_only: bool | None = None
16
+
17
+
18
+ class TagViewResponse(TagAttributesResponse):
19
+ count: int
20
+ attribute_count: int
21
+
22
+
23
+ class TagResponse(BaseModel):
24
+ Tag: TagAttributesResponse
25
+
26
+
27
+ class TagGetResponse(BaseModel):
28
+ Tag: list[TagAttributesResponse]
29
+
30
+ class Config:
31
+ orm_mode = True
@@ -0,0 +1,26 @@
1
+ from pydantic import BaseModel
2
+
3
+ from mmisp.api_schemas.tags.get_tag_response import TagAttributesResponse
4
+ from mmisp.api_schemas.taxonomies.export_taxonomies_response import TaxonomyPredicateSchema
5
+ from mmisp.api_schemas.taxonomies.get_taxonomy_response import TaxonomyView
6
+
7
+
8
+ class TaxonomyPredicateResponse(TaxonomyPredicateSchema):
9
+ id: str
10
+ taxonomy_id: str
11
+ colour: str
12
+ exclusive: bool
13
+ numerical_value: int
14
+
15
+
16
+ class TagCombinedModel(BaseModel):
17
+ Tag: TagAttributesResponse
18
+ Taxonomy: TaxonomyView
19
+ TaxonomyPredicate: TaxonomyPredicateResponse
20
+
21
+
22
+ class TagSearchResponse(BaseModel):
23
+ response: list[TagCombinedModel]
24
+
25
+ class Config:
26
+ orm_mode = True
@@ -0,0 +1,15 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class TagUpdateBody(BaseModel):
5
+ name: str | None = None
6
+ colour: str | None = None
7
+ exportable: bool | None = None
8
+ org_id: str | None = None
9
+ user_id: str | None = None
10
+ hide_tag: bool | None = None
11
+ numerical_value: str | None = None
12
+ local_only: bool | None = None
13
+
14
+ class Config:
15
+ orm_mode = True
File without changes
@@ -0,0 +1,30 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class TaxonomyPredicateSchema(BaseModel):
5
+ value: str
6
+ expanded: str
7
+ description: str
8
+
9
+
10
+ class ExportTaxonomyEntry(BaseModel):
11
+ value: str
12
+ expanded: str
13
+ description: str
14
+
15
+
16
+ class TaxonomyValueSchema(BaseModel):
17
+ predicate: str
18
+ entry: list[ExportTaxonomyEntry]
19
+
20
+
21
+ class ExportTaxonomyResponse(BaseModel):
22
+ namespace: str
23
+ description: str
24
+ version: int
25
+ exclusive: bool
26
+ predicates: list[TaxonomyPredicateSchema]
27
+ values: list[TaxonomyValueSchema]
28
+
29
+ class Config:
30
+ orm_mode = True
@@ -0,0 +1,30 @@
1
+ from pydantic import BaseModel
2
+
3
+ from mmisp.api_schemas.tags.get_tag_response import TagAttributesResponse
4
+
5
+
6
+ class TaxonomyEntrySchema(BaseModel):
7
+ tag: str
8
+ expanded: str
9
+ exclusive_predicate: bool
10
+ description: str
11
+ existing_tag: bool | TagAttributesResponse
12
+
13
+
14
+ class GetIdTaxonomyResponse(BaseModel):
15
+ id: str
16
+ namespace: str
17
+ description: str
18
+ version: str
19
+ enabled: bool
20
+ exclusive: bool
21
+ required: bool
22
+ highlighted: bool
23
+ entries: list[TaxonomyEntrySchema]
24
+
25
+ class Config:
26
+ orm_mode = True
27
+
28
+
29
+ class GetIdTaxonomyResponseWrapper(BaseModel):
30
+ Taxonomy: GetIdTaxonomyResponse
@@ -0,0 +1,21 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class TaxonomyView(BaseModel):
5
+ id: str
6
+ namespace: str
7
+ description: str
8
+ version: str
9
+ enabled: bool
10
+ exclusive: bool
11
+ required: bool
12
+ highlighted: bool
13
+
14
+
15
+ class ViewTaxonomyResponse(BaseModel):
16
+ Taxonomy: TaxonomyView
17
+ total_count: int
18
+ current_count: int
19
+
20
+ class Config:
21
+ orm_mode = True