mmisp-lib 0.1.8__tar.gz → 0.1.10__tar.gz

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 (193) hide show
  1. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/PKG-INFO +2 -2
  2. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/pyproject.toml +5 -3
  3. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/auth_keys/add_auth_key_body.py +1 -1
  4. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/auth_keys/search_auth_keys_body.py +2 -2
  5. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/add_edit_get_event_response.py +2 -2
  6. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/noticelists/get_noticelist_response.py +2 -1
  7. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/warninglists/create_warninglist_body.py +5 -4
  8. mmisp_lib-0.1.10/src/mmisp/db/models/attribute.py +96 -0
  9. mmisp_lib-0.1.10/src/mmisp/db/models/auth_key.py +25 -0
  10. mmisp_lib-0.1.10/src/mmisp/db/models/event.py +63 -0
  11. mmisp_lib-0.1.10/src/mmisp/db/models/feed.py +33 -0
  12. mmisp_lib-0.1.10/src/mmisp/db/models/galaxy.py +23 -0
  13. mmisp_lib-0.1.10/src/mmisp/db/models/galaxy_cluster.py +59 -0
  14. mmisp_lib-0.1.10/src/mmisp/db/models/identity_provider.py +24 -0
  15. mmisp_lib-0.1.10/src/mmisp/db/models/noticelist.py +23 -0
  16. mmisp_lib-0.1.10/src/mmisp/db/models/object.py +41 -0
  17. mmisp_lib-0.1.10/src/mmisp/db/models/organisation.py +30 -0
  18. mmisp_lib-0.1.10/src/mmisp/db/models/role.py +35 -0
  19. mmisp_lib-0.1.10/src/mmisp/db/models/server.py +35 -0
  20. mmisp_lib-0.1.10/src/mmisp/db/models/sharing_group.py +45 -0
  21. mmisp_lib-0.1.10/src/mmisp/db/models/sighting.py +22 -0
  22. mmisp_lib-0.1.10/src/mmisp/db/models/tag.py +20 -0
  23. mmisp_lib-0.1.10/src/mmisp/db/models/taxonomy.py +45 -0
  24. mmisp_lib-0.1.10/src/mmisp/db/models/user.py +46 -0
  25. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/db/models/user_setting.py +7 -6
  26. mmisp_lib-0.1.10/src/mmisp/db/models/warninglist.py +34 -0
  27. mmisp_lib-0.1.10/src/mmisp/db/mypy.py +9 -0
  28. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp_lib.egg-info/PKG-INFO +2 -2
  29. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp_lib.egg-info/SOURCES.txt +1 -0
  30. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp_lib.egg-info/requires.txt +1 -1
  31. mmisp_lib-0.1.8/src/mmisp/db/models/attribute.py +0 -91
  32. mmisp_lib-0.1.8/src/mmisp/db/models/auth_key.py +0 -24
  33. mmisp_lib-0.1.8/src/mmisp/db/models/event.py +0 -62
  34. mmisp_lib-0.1.8/src/mmisp/db/models/feed.py +0 -32
  35. mmisp_lib-0.1.8/src/mmisp/db/models/galaxy.py +0 -22
  36. mmisp_lib-0.1.8/src/mmisp/db/models/galaxy_cluster.py +0 -52
  37. mmisp_lib-0.1.8/src/mmisp/db/models/identity_provider.py +0 -22
  38. mmisp_lib-0.1.8/src/mmisp/db/models/noticelist.py +0 -22
  39. mmisp_lib-0.1.8/src/mmisp/db/models/object.py +0 -40
  40. mmisp_lib-0.1.8/src/mmisp/db/models/organisation.py +0 -27
  41. mmisp_lib-0.1.8/src/mmisp/db/models/role.py +0 -34
  42. mmisp_lib-0.1.8/src/mmisp/db/models/server.py +0 -33
  43. mmisp_lib-0.1.8/src/mmisp/db/models/sharing_group.py +0 -44
  44. mmisp_lib-0.1.8/src/mmisp/db/models/sighting.py +0 -21
  45. mmisp_lib-0.1.8/src/mmisp/db/models/tag.py +0 -19
  46. mmisp_lib-0.1.8/src/mmisp/db/models/taxonomy.py +0 -41
  47. mmisp_lib-0.1.8/src/mmisp/db/models/user.py +0 -44
  48. mmisp_lib-0.1.8/src/mmisp/db/models/warninglist.py +0 -33
  49. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/LICENSE +0 -0
  50. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/README.md +0 -0
  51. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/setup.cfg +0 -0
  52. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/__init__.py +0 -0
  53. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/__init__.py +0 -0
  54. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/add_attribute_body.py +0 -0
  55. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/add_attribute_response.py +0 -0
  56. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/add_remove_tag_attribute_response.py +0 -0
  57. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/delete_attribute_response.py +0 -0
  58. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/delete_selected_attribute_body.py +0 -0
  59. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/delete_selected_attribute_response.py +0 -0
  60. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/edit_attribute_body.py +0 -0
  61. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/edit_attributes_response.py +0 -0
  62. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/get_all_attributes_response.py +0 -0
  63. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/get_attribute_response.py +0 -0
  64. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/get_attribute_statistics_response.py +0 -0
  65. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/get_describe_types_response.py +0 -0
  66. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/restore_attribute_reponse.py +0 -0
  67. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/search_attributes_body.py +0 -0
  68. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/attributes/search_attributes_response.py +0 -0
  69. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/auth_keys/__init__.py +0 -0
  70. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/auth_keys/add_auth_key_response.py +0 -0
  71. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/auth_keys/edit_auth_key_body.py +0 -0
  72. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/auth_keys/edit_auth_key_response.py +0 -0
  73. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/auth_keys/search_get_all_auth_keys_users_response.py +0 -0
  74. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/auth_keys/view_auth_key_response.py +0 -0
  75. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/authentication/__init__.py +0 -0
  76. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/authentication/exchange_token_login_body.py +0 -0
  77. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/authentication/password_login_body.py +0 -0
  78. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/authentication/start_login_body.py +0 -0
  79. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/authentication/start_login_response.py +0 -0
  80. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/authentication/token_response.py +0 -0
  81. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/FreeTextImportWorkerBody.py +0 -0
  82. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/__init__.py +0 -0
  83. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/add_attribute_via_free_text_import_event_body.py +0 -0
  84. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/add_attribute_via_free_text_import_event_response.py +0 -0
  85. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/add_event_body.py +0 -0
  86. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/add_remove_tag_events_response.py +0 -0
  87. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/delete_event_response.py +0 -0
  88. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/edit_event_body.py +0 -0
  89. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/get_all_events_response.py +0 -0
  90. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/get_event_response.py +0 -0
  91. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/index_events_body.py +0 -0
  92. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/index_events_response.py +0 -0
  93. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/publish_event_response.py +0 -0
  94. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/search_events_body.py +0 -0
  95. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/search_events_response.py +0 -0
  96. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/events/unpublish_event_response.py +0 -0
  97. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/feeds/__init__.py +0 -0
  98. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/feeds/cache_feed_response.py +0 -0
  99. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/feeds/create_feed_body.py +0 -0
  100. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/feeds/enable_disable_feed_response.py +0 -0
  101. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/feeds/fetch_feeds_response.py +0 -0
  102. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/feeds/get_feed_response.py +0 -0
  103. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/feeds/toggle_feed_body.py +0 -0
  104. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/feeds/update_feed_body.py +0 -0
  105. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/galaxies/__init__.py +0 -0
  106. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/galaxies/attach_galaxy_cluster_body.py +0 -0
  107. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/galaxies/attach_galaxy_cluster_response.py +0 -0
  108. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/galaxies/delete_force_update_import_galaxy_response.py +0 -0
  109. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/galaxies/export_galaxies_body.py +0 -0
  110. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/galaxies/export_galaxies_response.py +0 -0
  111. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/galaxies/galaxy_schema.py +0 -0
  112. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/galaxies/get_all_search_galaxies_response.py +0 -0
  113. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/galaxies/get_galaxy_response.py +0 -0
  114. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/galaxies/import_galaxies_body.py +0 -0
  115. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/galaxies/search_galaxies_body.py +0 -0
  116. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/noticelists/__init__.py +0 -0
  117. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/noticelists/get_all_noticelist_response.py +0 -0
  118. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/objects/__init__.py +0 -0
  119. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/objects/create_object_body.py +0 -0
  120. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/objects/get_object_response.py +0 -0
  121. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/objects/search_objects_body.py +0 -0
  122. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/organisations/__init__.py +0 -0
  123. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/organisations/organisation.py +0 -0
  124. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/py.typed +0 -0
  125. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/roles/__init__.py +0 -0
  126. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/roles/role.py +0 -0
  127. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/__init__.py +0 -0
  128. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/add_org_to_sharing_group_body.py +0 -0
  129. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/add_org_to_sharing_group_legacy_body.py +0 -0
  130. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/add_server_to_sharing_group_body.py +0 -0
  131. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/add_server_to_sharing_group_legacy_body.py +0 -0
  132. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/create_sharing_group_body.py +0 -0
  133. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/create_sharing_group_legacy_body.py +0 -0
  134. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/create_sharing_group_legacy_response.py +0 -0
  135. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/delete_sharing_group_legacy_response.py +0 -0
  136. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/get_all_sharing_groups_response.py +0 -0
  137. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/get_sharing_group_info_response.py +0 -0
  138. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/sharing_group.py +0 -0
  139. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/sharing_group_org.py +0 -0
  140. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/sharing_group_server.py +0 -0
  141. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/update_sharing_group_body.py +0 -0
  142. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/update_sharing_group_legacy_body.py +0 -0
  143. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sharing_groups/view_update_sharing_group_legacy_response.py +0 -0
  144. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sightings/__init__.py +0 -0
  145. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sightings/create_sighting_body.py +0 -0
  146. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/sightings/get_sighting_response.py +0 -0
  147. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/standard_status_response.py +0 -0
  148. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/tags/__init__.py +0 -0
  149. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/tags/create_tag_body.py +0 -0
  150. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/tags/delete_tag_response.py +0 -0
  151. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/tags/get_tag_response.py +0 -0
  152. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/tags/search_tags_response.py +0 -0
  153. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/tags/update_tag_body.py +0 -0
  154. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/taxonomies/__init__.py +0 -0
  155. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/taxonomies/export_taxonomies_response.py +0 -0
  156. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/taxonomies/get_taxonomy_by_id_response.py +0 -0
  157. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/taxonomies/get_taxonomy_response.py +0 -0
  158. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/taxonomies/get_taxonomy_tags_response.py +0 -0
  159. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/user_settings/__init__.py +0 -0
  160. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/user_settings/get_uid_user_setting_response.py +0 -0
  161. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/user_settings/get_user_settings_response.py +0 -0
  162. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/user_settings/search_user_setting_body.py +0 -0
  163. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/user_settings/search_user_setting_response.py +0 -0
  164. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/user_settings/set_user_setting_body.py +0 -0
  165. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/user_settings/set_user_setting_response.py +0 -0
  166. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/user_settings/view_user_setting_response.py +0 -0
  167. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/users/__init__.py +0 -0
  168. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/users/user.py +0 -0
  169. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/users/users_view_me_response.py +0 -0
  170. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/warninglists/__init__.py +0 -0
  171. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/warninglists/check_value_warninglists_body.py +0 -0
  172. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/warninglists/check_value_warninglists_response.py +0 -0
  173. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/warninglists/delete_warninglist_response.py +0 -0
  174. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/warninglists/get_selected_all_warninglists_response.py +0 -0
  175. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/warninglists/get_selected_warninglists_body.py +0 -0
  176. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/warninglists/toggle_enable_warninglists_body.py +0 -0
  177. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/warninglists/toggle_enable_warninglists_response.py +0 -0
  178. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/api_schemas/warninglists/warninglist_response.py +0 -0
  179. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/db/__init__.py +0 -0
  180. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/db/all_models.py +0 -0
  181. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/db/config.py +0 -0
  182. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/db/database.py +0 -0
  183. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/db/mixins.py +0 -0
  184. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/db/models/__init__.py +0 -0
  185. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/db/print_changes.py +0 -0
  186. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/db/py.typed +0 -0
  187. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/lib/__init__.py +0 -0
  188. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/lib/attributes.py +0 -0
  189. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/lib/permissions.py +0 -0
  190. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp/lib/py.typed +0 -0
  191. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp_lib.egg-info/dependency_links.txt +0 -0
  192. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/src/mmisp_lib.egg-info/top_level.txt +0 -0
  193. {mmisp_lib-0.1.8 → mmisp_lib-0.1.10}/tests/test_dummy.py +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mmisp-lib
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Requires-Python: >=3.11.0
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
7
7
  Requires-Dist: fastapi==0.104.1
8
- Requires-Dist: SQLAlchemy[asyncio]==1.4.46
8
+ Requires-Dist: SQLAlchemy[asyncio]~=1.4.46
9
9
  Requires-Dist: pydantic==1.10.13
10
10
  Requires-Dist: uvicorn==0.24.0.post1
11
11
  Requires-Dist: python-dotenv==1.0.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mmisp-lib"
3
- version = "0.1.8"
3
+ version = "0.1.10"
4
4
  description = ""
5
5
  authors = []
6
6
  readme = "README.md"
@@ -9,7 +9,7 @@ requires-python = ">=3.11.0"
9
9
 
10
10
  dependencies = [
11
11
  "fastapi==0.104.1",
12
- "SQLAlchemy[asyncio]==1.4.46",
12
+ "SQLAlchemy[asyncio]~=1.4.46",
13
13
  "pydantic==1.10.13",
14
14
  "uvicorn==0.24.0.post1",
15
15
  "python-dotenv==1.0.0",
@@ -47,9 +47,11 @@ dev = [
47
47
  fix = true
48
48
  line-length = 120
49
49
  required-version = ">=0.3.7"
50
+ src = ["src"]
51
+
52
+ [tool.ruff.lint]
50
53
  select = ["E", "F", "W", "I", "ICN", "ANN"]
51
54
  ignore = ["ANN002", "ANN003", "ANN401"]
52
- src = ["src"]
53
55
 
54
56
  [tool.coverage.run]
55
57
  concurrency = ["greenlet", "thread"]
@@ -4,7 +4,7 @@ from pydantic import BaseModel
4
4
  class AddAuthKeyBody(BaseModel):
5
5
  uuid: str | None = None
6
6
  read_only: bool | None = None
7
- user_id: str | None = None
7
+ user_id: int | None = None
8
8
  comment: str | None = None
9
9
  allowed_ips: list[str] | None = None
10
10
  expiration: int | str | None = 0
@@ -2,8 +2,8 @@ from pydantic import BaseModel, PositiveInt, conint
2
2
 
3
3
 
4
4
  class SearchAuthKeyBody(BaseModel):
5
- page: PositiveInt | None = 1
6
- limit: conint(gt=0, lt=500) | None = 25 # type: ignore
5
+ page: PositiveInt = 1
6
+ limit: conint(gt=0, lt=500) = 25 # type: ignore
7
7
  id: str | None = None
8
8
  uuid: str | None = None
9
9
  authkey_start: str | None = None
@@ -128,14 +128,14 @@ class AddEditGetEventTag(BaseModel):
128
128
  id: str
129
129
  name: str
130
130
  colour: str
131
- exportable: str
131
+ exportable: bool
132
132
  user_id: str
133
133
  hide_tag: bool
134
134
  numerical_value: int | None = None
135
135
  is_galaxy: bool
136
136
  is_custom_galaxy: bool
137
137
  local_only: bool
138
- local: int
138
+ local: bool
139
139
  relationship_type: str | None = None
140
140
 
141
141
 
@@ -1,3 +1,4 @@
1
+ from collections.abc import Sequence
1
2
  from typing import Any
2
3
 
3
4
  from pydantic import BaseModel
@@ -28,7 +29,7 @@ class NoticelistAttributes(BaseModel):
28
29
 
29
30
 
30
31
  class NoticelistAttributesResponse(NoticelistAttributes):
31
- NoticelistEntry: list[NoticelistEntryResponse]
32
+ NoticelistEntry: Sequence[NoticelistEntryResponse]
32
33
 
33
34
 
34
35
  class NoticelistResponse(BaseModel):
@@ -1,9 +1,9 @@
1
- from enum import Enum
1
+ from enum import StrEnum
2
2
 
3
3
  from pydantic import BaseModel, Field
4
4
 
5
5
 
6
- class WarninglistListType(str, Enum):
6
+ class WarninglistListType(StrEnum):
7
7
  CIDR = "cidr"
8
8
  HOSTNAME = "hostname"
9
9
  STRING = "string"
@@ -11,12 +11,13 @@ class WarninglistListType(str, Enum):
11
11
  REGEX = "regex"
12
12
 
13
13
 
14
- class WarninglistCategory(str, Enum):
14
+ class WarninglistCategory(StrEnum):
15
15
  FALSE_POSITIVE = "False positive"
16
16
  KNOWN_IDENTIFIER = "Known identifier"
17
17
 
18
18
 
19
- class ValidAttribute(str, Enum):
19
+ # todo: use something from the mmisp.lib.attributes
20
+ class ValidAttribute(StrEnum):
20
21
  MD5 = "md5"
21
22
  SHA12SHA256 = "sha12sha256"
22
23
  FILENAME = "filename"
@@ -0,0 +1,96 @@
1
+ from typing import Self, Type
2
+
3
+ from sqlalchemy import BigInteger, Boolean, ForeignKey, Integer, String, Text
4
+ from sqlalchemy.ext.hybrid import hybrid_property
5
+ from sqlalchemy.orm import relationship
6
+ from sqlalchemy.orm.decl_api import DeclarativeMeta
7
+
8
+ from mmisp.db.mixins import DictMixin
9
+ from mmisp.db.mypy import Mapped, mapped_column
10
+ from mmisp.lib.attributes import categories, default_category, mapper_safe_clsname_val, to_ids
11
+ from mmisp.util.uuid import uuid
12
+
13
+ from ..database import Base
14
+ from .event import Event
15
+ from .tag import Tag
16
+
17
+
18
+ class Attribute(Base, DictMixin):
19
+ __tablename__ = "attributes"
20
+
21
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
22
+ uuid: Mapped[str] = mapped_column(String(40), unique=True, default=uuid, index=True)
23
+ event_id: Mapped[int] = mapped_column(
24
+ Integer, ForeignKey("events.id", ondelete="CASCADE"), nullable=False, index=True
25
+ )
26
+ object_id: Mapped[int] = mapped_column(Integer, nullable=False, default=0, index=True)
27
+ object_relation: Mapped[str] = mapped_column(String(255), index=True)
28
+ category: Mapped[str] = mapped_column(String(255), nullable=False, index=True)
29
+ type: Mapped[str] = mapped_column(String(100), nullable=False, index=True)
30
+ value1: Mapped[str] = mapped_column(Text, nullable=False)
31
+ value2: Mapped[str] = mapped_column(Text, nullable=False, default="")
32
+ to_ids: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
33
+ timestamp: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
34
+ distribution: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
35
+ sharing_group_id: Mapped[int] = mapped_column(Integer, index=True, default=0)
36
+ comment: Mapped[str] = mapped_column(Text)
37
+ deleted: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
38
+ disable_correlation: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
39
+ first_seen: Mapped[int] = mapped_column(BigInteger, index=True)
40
+ last_seen: Mapped[int] = mapped_column(BigInteger, index=True)
41
+
42
+ event = relationship("Event", back_populates="attributes", lazy="joined")
43
+
44
+ __mapper_args__ = {"polymorphic_on": "type"}
45
+
46
+ def __init__(self: Self, *arg, **kwargs) -> None:
47
+ if kwargs["value1"] is None:
48
+ split_val = kwargs["value"].split("|", 1)
49
+ kwargs["value1"] = split_val[0]
50
+ if len(split_val) == 2:
51
+ kwargs["value2"] = split_val[1]
52
+
53
+ super().__init__(*arg, **kwargs)
54
+
55
+ @property
56
+ def event_uuid(self: "Attribute") -> str:
57
+ return self.event.uuid
58
+
59
+ @hybrid_property
60
+ def value(self: Self) -> str:
61
+ if self.value2 == "":
62
+ return self.value1
63
+ return f"{self.value1}|{self.value2}"
64
+
65
+ @value.setter
66
+ def value(self: Self, value: str) -> None:
67
+ split = value.split("|", 1)
68
+ self.value1 = split[0]
69
+ if len(split) == 2:
70
+ self.value2 = split[1]
71
+
72
+
73
+ class AttributeTag(Base):
74
+ __tablename__ = "attribute_tags"
75
+
76
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
77
+ attribute_id: Mapped[int] = mapped_column(
78
+ Integer, ForeignKey(Attribute.id, ondelete="CASCADE"), nullable=False, index=True
79
+ )
80
+ event_id: Mapped[int] = mapped_column(Integer, ForeignKey(Event.id, ondelete="CASCADE"), nullable=False, index=True)
81
+ tag_id: Mapped[int] = mapped_column(Integer, ForeignKey(Tag.id, ondelete="CASCADE"), nullable=False, index=True)
82
+ local: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
83
+
84
+
85
+ class AttributeMeta(DeclarativeMeta):
86
+ def __new__(cls: Type[type], clsname: str, bases: tuple, dct: dict) -> "AttributeMeta":
87
+ key = clsname[len("Attribute") :]
88
+ dct["default_category"] = default_category[mapper_safe_clsname_val[key]]
89
+ dct["categories"] = categories[mapper_safe_clsname_val[key]]
90
+ dct["default_to_ids"] = to_ids[mapper_safe_clsname_val[key]]
91
+ dct["__mapper_args__"] = {"polymorphic_identity": mapper_safe_clsname_val[key]}
92
+ return super().__new__(cls, clsname, bases, dct)
93
+
94
+
95
+ for k, _ in mapper_safe_clsname_val.items():
96
+ vars()["Attribute" + k] = AttributeMeta("Attribute" + k, (Attribute,), dict())
@@ -0,0 +1,25 @@
1
+ from time import time
2
+
3
+ from sqlalchemy import Boolean, ForeignKey, Integer, String
4
+
5
+ from mmisp.db.mypy import Mapped, mapped_column
6
+ from mmisp.util.uuid import uuid
7
+
8
+ from ..database import Base
9
+
10
+
11
+ class AuthKey(Base):
12
+ __tablename__ = "auth_keys"
13
+
14
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
15
+ uuid: Mapped[str] = mapped_column(String(255), unique=True, default=uuid, nullable=False)
16
+ authkey: Mapped[str] = mapped_column(String(255), nullable=False)
17
+ authkey_start: Mapped[str] = mapped_column(String(255), nullable=False)
18
+ authkey_end: Mapped[str] = mapped_column(String(255), nullable=False)
19
+ created: Mapped[int] = mapped_column(Integer, nullable=False, default=time)
20
+ expiration: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
21
+ read_only: Mapped[bool] = mapped_column(Boolean, nullable=False, default=0)
22
+ comment: Mapped[str] = mapped_column(String(255))
23
+ allowed_ips: Mapped[str] = mapped_column(String(255))
24
+ unique_ips: Mapped[str] = mapped_column(String(255))
25
+ user_id: Mapped[int] = mapped_column(Integer, ForeignKey("users.id"), nullable=False)
@@ -0,0 +1,63 @@
1
+ from datetime import datetime
2
+
3
+ from sqlalchemy import Boolean, DateTime, ForeignKey, Integer, String, Text
4
+ from sqlalchemy.orm import relationship
5
+
6
+ from mmisp.db.mypy import Mapped, mapped_column
7
+ from mmisp.util.uuid import uuid
8
+
9
+ from ..database import Base
10
+ from .organisation import Organisation
11
+ from .tag import Tag
12
+ from .user import User
13
+
14
+
15
+ class Event(Base):
16
+ __tablename__ = "events"
17
+
18
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
19
+ uuid: Mapped[str] = mapped_column(String(40), unique=True, default=uuid, nullable=False, index=True)
20
+ org_id: Mapped[int] = mapped_column(Integer, ForeignKey(Organisation.id), nullable=False, index=True)
21
+ date: Mapped[DateTime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
22
+ info: Mapped[str] = mapped_column(Text, nullable=False)
23
+ user_id: Mapped[int] = mapped_column(Integer, ForeignKey(User.id), nullable=False)
24
+ published: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
25
+ analysis: Mapped[int] = mapped_column(Integer, nullable=False)
26
+ attribute_count: Mapped[int] = mapped_column(Integer, default=0)
27
+ orgc_id: Mapped[int] = mapped_column(Integer, ForeignKey(Organisation.id), nullable=False, index=True)
28
+ timestamp: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
29
+ distribution: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
30
+ sharing_group_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, default=0)
31
+ proposal_email_lock: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
32
+ locked: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
33
+ threat_level_id: Mapped[int] = mapped_column(Integer, nullable=False)
34
+ publish_timestamp: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
35
+ sighting_timestamp: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
36
+ disable_correlation: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
37
+ extends_uuid: Mapped[str] = mapped_column(String(40), default="", index=True)
38
+ protected: Mapped[bool] = mapped_column(Boolean)
39
+
40
+ attributes = relationship("Attribute", back_populates="event")
41
+
42
+
43
+ class EventReport(Base):
44
+ __tablename__ = "event_reports"
45
+
46
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
47
+ uuid: Mapped[str] = mapped_column(String(40), unique=True, nullable=False, default=uuid)
48
+ event_id: Mapped[int] = mapped_column(Integer, ForeignKey(Event.id), nullable=False, index=True)
49
+ name: Mapped[str] = mapped_column(String(255), nullable=False, index=True)
50
+ content: Mapped[str] = mapped_column(Text)
51
+ distribution: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
52
+ sharing_group_id: Mapped[int] = mapped_column(Integer)
53
+ timestamp: Mapped[int] = mapped_column(Integer, nullable=False)
54
+ deleted: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
55
+
56
+
57
+ class EventTag(Base):
58
+ __tablename__ = "event_tags"
59
+
60
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
61
+ event_id: Mapped[int] = mapped_column(Integer, ForeignKey(Event.id, ondelete="CASCADE"), nullable=False, index=True)
62
+ tag_id: Mapped[int] = mapped_column(Integer, ForeignKey(Tag.id, ondelete="CASCADE"), nullable=False, index=True)
63
+ local: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
@@ -0,0 +1,33 @@
1
+ from sqlalchemy import Boolean, Integer, String, Text
2
+
3
+ from mmisp.db.database import Base
4
+ from mmisp.db.mypy import Mapped, mapped_column
5
+
6
+
7
+ class Feed(Base):
8
+ __tablename__ = "feeds"
9
+
10
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
11
+ name: Mapped[str] = mapped_column(String(255), nullable=False)
12
+ provider: Mapped[str] = mapped_column(String(255), nullable=False)
13
+ url: Mapped[str] = mapped_column(String(255), nullable=False)
14
+ rules: Mapped[str] = mapped_column(Text, default=None)
15
+ enabled: Mapped[bool] = mapped_column(Boolean, default=False)
16
+ distribution: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
17
+ sharing_group_id: Mapped[int] = mapped_column(Integer, nullable=False, default=0, index=True)
18
+ tag_id: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
19
+ default: Mapped[bool] = mapped_column(Boolean, default=False)
20
+ source_format: Mapped[str] = mapped_column(String(255), default="misp")
21
+ fixed_event: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
22
+ delta_merge: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
23
+ event_id: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
24
+ publish: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
25
+ override_ids: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
26
+ settings: Mapped[str] = mapped_column(Text)
27
+ input_source: Mapped[str] = mapped_column(String(255), nullable=False, default="network", index=True)
28
+ delete_local_file: Mapped[bool] = mapped_column(Boolean, default=False)
29
+ lookup_visible: Mapped[bool] = mapped_column(Boolean, default=False)
30
+ headers: Mapped[str] = mapped_column(Text)
31
+ caching_enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
32
+ force_to_ids: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
33
+ orgc_id: Mapped[int] = mapped_column(Integer, nullable=False, default=0, index=True)
@@ -0,0 +1,23 @@
1
+ from sqlalchemy import Boolean, Integer, String, Text
2
+
3
+ from mmisp.db.mypy import Mapped, mapped_column
4
+ from mmisp.util.uuid import uuid
5
+
6
+ from ..database import Base
7
+
8
+
9
+ class Galaxy(Base):
10
+ __tablename__ = "galaxies"
11
+
12
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
13
+ uuid: Mapped[str] = mapped_column(String(255), nullable=False, unique=True, default=uuid)
14
+ name: Mapped[str] = mapped_column(String(255), nullable=False, default="", index=True)
15
+ type: Mapped[str] = mapped_column(String(255), nullable=False, index=True)
16
+ description: Mapped[str] = mapped_column(Text, nullable=False)
17
+ version: Mapped[str] = mapped_column(String(255), nullable=False)
18
+ icon: Mapped[str] = mapped_column(String(255), nullable=False, default="")
19
+ namespace: Mapped[str] = mapped_column(String(255), nullable=False, default="misp", index=True)
20
+ kill_chain_order: Mapped[str] = mapped_column(String(255))
21
+ """must be serialized"""
22
+ enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
23
+ local_only: Mapped[bool] = mapped_column(Boolean, default=False)
@@ -0,0 +1,59 @@
1
+ from sqlalchemy import Boolean, ForeignKey, Integer, String, Text
2
+
3
+ from mmisp.db.mypy import Mapped, mapped_column
4
+ from mmisp.util.uuid import uuid
5
+
6
+ from ..database import Base
7
+ from .galaxy import Galaxy
8
+
9
+
10
+ class GalaxyCluster(Base):
11
+ __tablename__ = "galaxy_clusters"
12
+
13
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
14
+ uuid: Mapped[str] = mapped_column(String(255), unique=True, default=uuid, index=True)
15
+ collection_uuid: Mapped[str] = mapped_column(String(255), nullable=False, index=True, default="0")
16
+ type: Mapped[str] = mapped_column(String(255), nullable=False, index=True)
17
+ value: Mapped[str] = mapped_column(Text, nullable=False)
18
+ tag_name: Mapped[str] = mapped_column(String(255), nullable=False, default="", index=True)
19
+ description: Mapped[str] = mapped_column(Text, nullable=False)
20
+ galaxy_id: Mapped[int] = mapped_column(
21
+ Integer, ForeignKey(Galaxy.id, ondelete="CASCADE"), nullable=False, index=True
22
+ )
23
+ source: Mapped[str] = mapped_column(String(255), nullable=False, default="")
24
+ authors: Mapped[str] = mapped_column(Text, nullable=False)
25
+ version: Mapped[int] = mapped_column(Integer, default=0, index=True)
26
+ distribution: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
27
+ sharing_group_id: Mapped[int] = mapped_column(Integer, index=True, default=0)
28
+ org_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, default=0)
29
+ orgc_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, default=0)
30
+ default: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False, index=True)
31
+ locked: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
32
+ extends_uuid: Mapped[str] = mapped_column(String(40), index=True)
33
+ extends_version: Mapped[int] = mapped_column(Integer, default=0, index=True)
34
+ published: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
35
+ deleted: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
36
+
37
+
38
+ class GalaxyElement(Base):
39
+ __tablename__ = "galaxy_elements"
40
+
41
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
42
+ galaxy_cluster_id: Mapped[int] = mapped_column(
43
+ Integer, ForeignKey(GalaxyCluster.id, ondelete="CASCADE"), nullable=False, index=True
44
+ )
45
+ key: Mapped[str] = mapped_column(String(255), nullable=False, default="", index=True)
46
+ value: Mapped[str] = mapped_column(Text, nullable=False)
47
+
48
+
49
+ class GalaxyReference(Base):
50
+ __tablename__ = "galaxy_reference"
51
+
52
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
53
+ galaxy_cluster_id: Mapped[int] = mapped_column(
54
+ Integer, ForeignKey(GalaxyCluster.id, ondelete="CASCADE"), nullable=False, index=True
55
+ )
56
+ referenced_galaxy_cluster_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True)
57
+ referenced_galaxy_cluster_uuid: Mapped[str] = mapped_column(String(255), nullable=False, index=True)
58
+ referenced_galaxy_cluster_type: Mapped[str] = mapped_column(Text, nullable=False)
59
+ referenced_galaxy_cluster_value: Mapped[str] = mapped_column(Text, nullable=False)
@@ -0,0 +1,24 @@
1
+ from datetime import datetime
2
+
3
+ from sqlalchemy import Boolean, DateTime, Integer, String
4
+
5
+ from mmisp.db.mypy import Mapped, mapped_column
6
+
7
+ from ..database import Base
8
+
9
+
10
+ class OIDCIdentityProvider(Base):
11
+ __tablename__ = "oidc_identity_providers"
12
+
13
+ id: Mapped[int] = mapped_column(Integer, primary_key=True)
14
+ name: Mapped[str] = mapped_column(String(255), nullable=False)
15
+ org_id: Mapped[int] = mapped_column(Integer, nullable=False)
16
+ active: Mapped[bool] = mapped_column(Boolean, default=True)
17
+ base_url: Mapped[str] = mapped_column(String(255), nullable=False)
18
+ client_id: Mapped[str] = mapped_column(String(255), nullable=False)
19
+ client_secret: Mapped[str] = mapped_column(String(255), nullable=False)
20
+ scope: Mapped[str] = mapped_column(String(255))
21
+ """Possibility to add more scopes to be requested from the idp in addition to the default scopes,
22
+ currently not used."""
23
+ created: Mapped[DateTime] = mapped_column(DateTime, default=datetime.utcnow)
24
+ modified: Mapped[DateTime] = mapped_column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
@@ -0,0 +1,23 @@
1
+ from sqlalchemy import Boolean, ForeignKey, Integer, String, Text
2
+
3
+ from mmisp.db.database import Base
4
+ from mmisp.db.mypy import Mapped, mapped_column
5
+
6
+
7
+ class Noticelist(Base):
8
+ __tablename__ = "noticelists"
9
+
10
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
11
+ name: Mapped[str] = mapped_column(String(255), nullable=False, index=True)
12
+ expanded_name: Mapped[str] = mapped_column(String(255), nullable=False)
13
+ ref: Mapped[str] = mapped_column(String(255)) # data serialized as json
14
+ geographical_area: Mapped[str] = mapped_column(String(255)) # data serialized as json
15
+ version: Mapped[int] = mapped_column(Integer, nullable=False, default=1)
16
+ enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
17
+
18
+
19
+ class NoticelistEntry(Base):
20
+ __tablename__ = "noticelist_entries"
21
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
22
+ noticelist_id: Mapped[int] = mapped_column(Integer, ForeignKey(Noticelist.id, ondelete="CASCADE"), nullable=False)
23
+ data: Mapped[str] = mapped_column(Text, nullable=False) # data serialized as json
@@ -0,0 +1,41 @@
1
+ from sqlalchemy import Boolean, ForeignKey, Integer, String
2
+
3
+ from mmisp.db.database import Base
4
+ from mmisp.db.mixins import DictMixin
5
+ from mmisp.db.mypy import Mapped, mapped_column
6
+ from mmisp.util.uuid import uuid
7
+
8
+
9
+ class Object(Base, DictMixin):
10
+ __tablename__ = "objects"
11
+
12
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
13
+ uuid: Mapped[str] = mapped_column(String(255), unique=True, default=uuid, index=True)
14
+ name: Mapped[str] = mapped_column(String(255), index=True)
15
+ meta_category: Mapped[str] = mapped_column("meta-category", String(255), index=True, key="meta_category")
16
+ description: Mapped[str] = mapped_column(String(255))
17
+ template_uuid: Mapped[str] = mapped_column(String(255), index=True, default=None)
18
+ template_version: Mapped[int] = mapped_column(Integer, index=True, nullable=False)
19
+ event_id: Mapped[int] = mapped_column(Integer, ForeignKey("events.id"), index=True, nullable=False)
20
+ timestamp: Mapped[int] = mapped_column(Integer, index=True, nullable=False, default=0)
21
+ distribution: Mapped[int] = mapped_column(Integer, index=True, nullable=False, default=0)
22
+ sharing_group_id: Mapped[int] = mapped_column(Integer, ForeignKey("sharing_groups.id"), index=True)
23
+ comment: Mapped[str] = mapped_column(String(255), nullable=False)
24
+ deleted: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
25
+ first_seen: Mapped[int] = mapped_column(Integer, index=True, default=None)
26
+ last_seen: Mapped[int] = mapped_column(Integer, index=True, default=None)
27
+
28
+
29
+ class ObjectTemplate(Base, DictMixin):
30
+ __tablename__ = "object_templates"
31
+
32
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
33
+ uuid: Mapped[str] = mapped_column(String(255), unique=True, default=uuid, index=True)
34
+ name: Mapped[str] = mapped_column(String(255), index=True)
35
+ user_id: Mapped[int] = mapped_column(Integer, ForeignKey("users.id"), index=True, nullable=False)
36
+ org_id: Mapped[int] = mapped_column(Integer, ForeignKey("organisations.id"), index=True, nullable=False)
37
+ description: Mapped[str] = mapped_column(String(255))
38
+ version: Mapped[int] = mapped_column(Integer, nullable=False)
39
+ requirements: Mapped[str] = mapped_column(String(255))
40
+ fixed: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
41
+ active: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
@@ -0,0 +1,30 @@
1
+ from datetime import datetime
2
+
3
+ from sqlalchemy import Boolean, DateTime, Integer, String, Text
4
+
5
+ from mmisp.db.mixins import DictMixin
6
+ from mmisp.db.mypy import Mapped, mapped_column
7
+ from mmisp.util.uuid import uuid
8
+
9
+ from ..database import Base
10
+
11
+
12
+ class Organisation(Base, DictMixin):
13
+ __tablename__ = "organisations"
14
+
15
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
16
+ name: Mapped[str] = mapped_column(String(255), nullable=False, unique=True)
17
+ date_created: Mapped[DateTime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
18
+ date_modified: Mapped[DateTime] = mapped_column(
19
+ DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False
20
+ )
21
+ description: Mapped[str] = mapped_column(Text)
22
+ type: Mapped[str] = mapped_column(String(255))
23
+ nationality: Mapped[str] = mapped_column(String(255))
24
+ sector: Mapped[str] = mapped_column(String(255))
25
+ created_by: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
26
+ uuid: Mapped[str] = mapped_column(String(255), unique=True, default=uuid)
27
+ contacts: Mapped[str] = mapped_column(Text)
28
+ local: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
29
+ restricted_to_domain: Mapped[str] = mapped_column(Text)
30
+ landingpage: Mapped[str] = mapped_column(Text)
@@ -0,0 +1,35 @@
1
+ from typing import Self
2
+
3
+ from sqlalchemy import Boolean, DateTime, Integer, String
4
+
5
+ from mmisp.db.mypy import mapped_column
6
+ from mmisp.lib.permissions import Permission
7
+
8
+ from ..database import Base
9
+
10
+ RoleAttrs = {
11
+ "__tablename__": "roles",
12
+ "id": mapped_column(Integer, primary_key=True, nullable=False),
13
+ "name": mapped_column(String(255), nullable=False),
14
+ "created": mapped_column(DateTime, default=None),
15
+ "modified": mapped_column(DateTime, default=None),
16
+ "default_role": mapped_column(Boolean, nullable=False, default=False),
17
+ "memory_limit": mapped_column(String(255), default=""),
18
+ "max_execution_time": mapped_column(String(255), default=""),
19
+ "restricted_to_site_admin": mapped_column(Boolean, nullable=False, default=False),
20
+ "enforce_rate_limit": mapped_column(Boolean, nullable=False, default=False),
21
+ "rate_limit_count": mapped_column(Integer, nullable=False, default=0),
22
+ } | {f"perm_{x.value}": mapped_column(Boolean, default=False) for x in Permission}
23
+
24
+ RoleModel = type("RoleModel", (Base,), RoleAttrs)
25
+
26
+
27
+ class Role(RoleModel):
28
+ def get_permissions(self: Self) -> set[Permission]:
29
+ d: list[Permission] = []
30
+
31
+ for key in self.__mapper__.c.keys():
32
+ if key.startswith("perm_") and getattr(self, key):
33
+ d.append(Permission(key[len("perm_") :]))
34
+
35
+ return set(d)
@@ -0,0 +1,35 @@
1
+ from sqlalchemy import Boolean, Integer, String, Text
2
+
3
+ from mmisp.db.mypy import Mapped, mapped_column
4
+
5
+ from ..database import Base
6
+
7
+
8
+ class Server(Base):
9
+ __tablename__ = "servers"
10
+
11
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False)
12
+ name: Mapped[str] = mapped_column(String(255), nullable=False)
13
+ url: Mapped[str] = mapped_column(String(255), nullable=False)
14
+ authkey: Mapped[str] = mapped_column(String(40), nullable=False)
15
+ org_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True)
16
+ push: Mapped[bool] = mapped_column(Boolean, nullable=False)
17
+ pull: Mapped[bool] = mapped_column(Boolean, nullable=False)
18
+ push_sightings: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
19
+ push_galaxy_clusters: Mapped[bool] = mapped_column(Boolean, default=False)
20
+ pull_galaxy_clusters: Mapped[bool] = mapped_column(Boolean, default=False)
21
+ lastpulledid: Mapped[int] = mapped_column(Integer)
22
+ lastpushedid: Mapped[int] = mapped_column(Integer)
23
+ organization: Mapped[str] = mapped_column(String(10), default=None)
24
+ remote_org_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True)
25
+ publish_without_email: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
26
+ unpublish_event: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
27
+ self_signed: Mapped[bool] = mapped_column(Boolean, nullable=False)
28
+ pull_rules: Mapped[str] = mapped_column(Text, nullable=False)
29
+ push_rules: Mapped[str] = mapped_column(Text, nullable=False)
30
+ cert_file: Mapped[str] = mapped_column(String(255))
31
+ client_cert_file: Mapped[str] = mapped_column(String(255))
32
+ internal: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
33
+ skip_proxy: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
34
+ caching_enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
35
+ priority: Mapped[int] = mapped_column(Integer, nullable=False, default=0, index=True)