mmisp-lib 0.1.4__tar.gz → 0.1.6__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 (172) hide show
  1. mmisp_lib-0.1.6/LICENSE +21 -0
  2. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/PKG-INFO +2 -1
  3. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/pyproject.toml +1 -1
  4. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/add_attribute_body.py +5 -6
  5. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/add_attribute_response.py +4 -4
  6. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/objects/create_object_body.py +0 -3
  7. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/objects/get_object_response.py +5 -8
  8. mmisp_lib-0.1.6/src/mmisp/db/all_models.py +41 -0
  9. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/config.py +2 -1
  10. mmisp_lib-0.1.6/src/mmisp/db/database.py +89 -0
  11. mmisp_lib-0.1.6/src/mmisp/db/mixins.py +17 -0
  12. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/attribute.py +14 -15
  13. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/object.py +3 -2
  14. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/organisation.py +2 -1
  15. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/sharing_group.py +4 -3
  16. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/lib/attributes.py +4 -3
  17. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp_lib.egg-info/PKG-INFO +2 -1
  18. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp_lib.egg-info/SOURCES.txt +3 -0
  19. mmisp_lib-0.1.4/src/mmisp/db/database.py +0 -42
  20. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/README.md +0 -0
  21. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/setup.cfg +0 -0
  22. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/__init__.py +0 -0
  23. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/__init__.py +0 -0
  24. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/add_remove_tag_attribute_response.py +0 -0
  25. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/delete_attribute_response.py +0 -0
  26. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/delete_selected_attribute_body.py +0 -0
  27. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/delete_selected_attribute_response.py +0 -0
  28. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/edit_attribute_body.py +0 -0
  29. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/edit_attributes_response.py +0 -0
  30. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/get_all_attributes_response.py +0 -0
  31. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/get_attribute_response.py +0 -0
  32. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/get_attribute_statistics_response.py +0 -0
  33. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/get_describe_types_response.py +0 -0
  34. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/restore_attribute_reponse.py +0 -0
  35. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/search_attributes_body.py +0 -0
  36. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/attributes/search_attributes_response.py +0 -0
  37. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/auth_keys/__init__.py +0 -0
  38. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/auth_keys/add_auth_key_body.py +0 -0
  39. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/auth_keys/add_auth_key_response.py +0 -0
  40. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/auth_keys/edit_auth_key_body.py +0 -0
  41. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/auth_keys/edit_auth_key_response.py +0 -0
  42. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/auth_keys/search_auth_keys_body.py +0 -0
  43. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/auth_keys/search_get_all_auth_keys_users_response.py +0 -0
  44. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/auth_keys/view_auth_key_response.py +0 -0
  45. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/authentication/__init__.py +0 -0
  46. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/authentication/exchange_token_login_body.py +0 -0
  47. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/authentication/password_login_body.py +0 -0
  48. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/authentication/start_login_body.py +0 -0
  49. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/authentication/start_login_response.py +0 -0
  50. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/authentication/token_response.py +0 -0
  51. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/FreeTextImportWorkerBody.py +0 -0
  52. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/__init__.py +0 -0
  53. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/add_attribute_via_free_text_import_event_body.py +0 -0
  54. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/add_attribute_via_free_text_import_event_response.py +0 -0
  55. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/add_edit_get_event_response.py +0 -0
  56. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/add_event_body.py +0 -0
  57. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/add_remove_tag_events_response.py +0 -0
  58. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/delete_event_response.py +0 -0
  59. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/edit_event_body.py +0 -0
  60. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/get_all_events_response.py +0 -0
  61. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/get_event_response.py +0 -0
  62. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/index_events_body.py +0 -0
  63. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/index_events_response.py +0 -0
  64. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/publish_event_response.py +0 -0
  65. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/search_events_body.py +0 -0
  66. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/search_events_response.py +0 -0
  67. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/events/unpublish_event_response.py +0 -0
  68. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/feeds/__init__.py +0 -0
  69. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/feeds/cache_feed_response.py +0 -0
  70. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/feeds/create_feed_body.py +0 -0
  71. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/feeds/enable_disable_feed_response.py +0 -0
  72. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/feeds/fetch_feeds_response.py +0 -0
  73. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/feeds/get_feed_response.py +0 -0
  74. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/feeds/toggle_feed_body.py +0 -0
  75. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/feeds/update_feed_body.py +0 -0
  76. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/galaxies/__init__.py +0 -0
  77. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/galaxies/attach_galaxy_cluster_body.py +0 -0
  78. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/galaxies/attach_galaxy_cluster_response.py +0 -0
  79. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/galaxies/delete_force_update_import_galaxy_response.py +0 -0
  80. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/galaxies/export_galaxies_body.py +0 -0
  81. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/galaxies/export_galaxies_response.py +0 -0
  82. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/galaxies/galaxy_schema.py +0 -0
  83. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/galaxies/get_all_search_galaxies_response.py +0 -0
  84. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/galaxies/get_galaxy_response.py +0 -0
  85. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/galaxies/import_galaxies_body.py +0 -0
  86. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/galaxies/search_galaxies_body.py +0 -0
  87. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/noticelists/__init__.py +0 -0
  88. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/noticelists/get_all_noticelist_response.py +0 -0
  89. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/noticelists/get_noticelist_response.py +0 -0
  90. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/objects/__init__.py +0 -0
  91. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/objects/search_objects_body.py +0 -0
  92. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/organisations/__init__.py +0 -0
  93. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/organisations/organisation.py +0 -0
  94. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/roles/__init__.py +0 -0
  95. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/roles/role.py +0 -0
  96. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/__init__.py +0 -0
  97. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/add_org_to_sharing_group_body.py +0 -0
  98. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/add_org_to_sharing_group_legacy_body.py +0 -0
  99. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/add_server_to_sharing_group_body.py +0 -0
  100. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/add_server_to_sharing_group_legacy_body.py +0 -0
  101. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/create_sharing_group_body.py +0 -0
  102. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/create_sharing_group_legacy_body.py +0 -0
  103. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/create_sharing_group_legacy_response.py +0 -0
  104. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/delete_sharing_group_legacy_response.py +0 -0
  105. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/get_all_sharing_groups_response.py +0 -0
  106. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/get_sharing_group_info_response.py +0 -0
  107. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/sharing_group.py +0 -0
  108. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/sharing_group_org.py +0 -0
  109. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/sharing_group_server.py +0 -0
  110. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/update_sharing_group_body.py +0 -0
  111. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/update_sharing_group_legacy_body.py +0 -0
  112. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sharing_groups/view_update_sharing_group_legacy_response.py +0 -0
  113. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sightings/__init__.py +0 -0
  114. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sightings/create_sighting_body.py +0 -0
  115. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/sightings/get_sighting_response.py +0 -0
  116. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/standard_status_response.py +0 -0
  117. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/tags/__init__.py +0 -0
  118. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/tags/create_tag_body.py +0 -0
  119. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/tags/delete_tag_response.py +0 -0
  120. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/tags/get_tag_response.py +0 -0
  121. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/tags/search_tags_response.py +0 -0
  122. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/tags/update_tag_body.py +0 -0
  123. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/taxonomies/__init__.py +0 -0
  124. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/taxonomies/export_taxonomies_response.py +0 -0
  125. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/taxonomies/get_taxonomy_by_id_response.py +0 -0
  126. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/taxonomies/get_taxonomy_response.py +0 -0
  127. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/taxonomies/get_taxonomy_tags_response.py +0 -0
  128. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/user_settings/__init__.py +0 -0
  129. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/user_settings/get_uid_user_setting_response.py +0 -0
  130. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/user_settings/get_user_settings_response.py +0 -0
  131. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/user_settings/search_user_setting_body.py +0 -0
  132. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/user_settings/search_user_setting_response.py +0 -0
  133. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/user_settings/set_user_setting_body.py +0 -0
  134. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/user_settings/set_user_setting_response.py +0 -0
  135. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/user_settings/view_user_setting_response.py +0 -0
  136. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/users/__init__.py +0 -0
  137. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/users/user.py +0 -0
  138. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/users/users_view_me_response.py +0 -0
  139. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/warninglists/__init__.py +0 -0
  140. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/warninglists/check_value_warninglists_body.py +0 -0
  141. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/warninglists/check_value_warninglists_response.py +0 -0
  142. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/warninglists/create_warninglist_body.py +0 -0
  143. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/warninglists/delete_warninglist_response.py +0 -0
  144. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/warninglists/get_selected_all_warninglists_response.py +0 -0
  145. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/warninglists/get_selected_warninglists_body.py +0 -0
  146. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/warninglists/toggle_enable_warninglists_body.py +0 -0
  147. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/warninglists/toggle_enable_warninglists_response.py +0 -0
  148. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/api_schemas/warninglists/warninglist_response.py +0 -0
  149. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/__init__.py +0 -0
  150. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/__init__.py +0 -0
  151. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/auth_key.py +0 -0
  152. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/event.py +0 -0
  153. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/feed.py +0 -0
  154. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/galaxy.py +0 -0
  155. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/galaxy_cluster.py +0 -0
  156. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/identity_provider.py +0 -0
  157. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/noticelist.py +0 -0
  158. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/role.py +0 -0
  159. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/server.py +0 -0
  160. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/sighting.py +0 -0
  161. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/tag.py +0 -0
  162. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/taxonomy.py +0 -0
  163. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/user.py +0 -0
  164. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/user_setting.py +0 -0
  165. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/models/warninglist.py +0 -0
  166. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/db/print_changes.py +0 -0
  167. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/lib/__init__.py +0 -0
  168. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp/lib/permissions.py +0 -0
  169. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp_lib.egg-info/dependency_links.txt +0 -0
  170. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp_lib.egg-info/requires.txt +0 -0
  171. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/src/mmisp_lib.egg-info/top_level.txt +0 -0
  172. {mmisp_lib-0.1.4 → mmisp_lib-0.1.6}/tests/test_dummy.py +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Konstantin Zangerle
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,8 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mmisp-lib
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Requires-Python: >=3.11.0
5
5
  Description-Content-Type: text/markdown
6
+ License-File: LICENSE
6
7
  Requires-Dist: fastapi==0.104.1
7
8
  Requires-Dist: SQLAlchemy[asyncio]==1.4.46
8
9
  Requires-Dist: pydantic==1.10.13
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mmisp-lib"
3
- version = "0.1.4"
3
+ version = "0.1.6"
4
4
  description = ""
5
5
  authors = []
6
6
  readme = "README.md"
@@ -2,11 +2,13 @@ from typing import Any, Optional
2
2
 
3
3
  from pydantic import BaseModel, root_validator
4
4
 
5
+ from mmisp.lib.attributes import literal_valid_attribute_types
6
+
5
7
 
6
8
  class AddAttributeBody(BaseModel):
7
- type: str
8
- value: Optional[str]
9
- value1: Optional[str]
9
+ type: literal_valid_attribute_types
10
+ value: str | None = None
11
+ value1: str | None = None
10
12
  value2: str | None = None
11
13
  event_id: str | None = None
12
14
  object_id: str | None = None
@@ -29,6 +31,3 @@ class AddAttributeBody(BaseModel):
29
31
  if all(item is None for item in required_values):
30
32
  raise ValueError("value or value1 has to be set")
31
33
  return data
32
-
33
- class Config:
34
- orm_mode = True
@@ -18,12 +18,12 @@ class AddAttributeAttributes(BaseModel):
18
18
  timestamp: str
19
19
  distribution: str
20
20
  sharing_group_id: str
21
- comment: str
21
+ comment: str | None = None
22
22
  deleted: bool
23
23
  disable_correlation: bool
24
- first_seen: Optional[str] = Field(..., nullable=True)
25
- last_seen: Optional[str] = Field(..., nullable=True)
26
- attribute_tag: list[str] = Field([], alias="AttributeTag")
24
+ first_seen: str | None = None
25
+ last_seen: str | None = None
26
+ attribute_tag: list[str] | None = Field(default_factory=list, alias="AttributeTag")
27
27
 
28
28
 
29
29
  class AddAttributeResponse(BaseModel):
@@ -14,6 +14,3 @@ class ObjectCreateBody(BaseModel):
14
14
  first_seen: str | None = None
15
15
  last_seen: str | None = None
16
16
  Attribute: list[AddAttributeBody] | None = None
17
-
18
- class Config:
19
- orm_mode = True
@@ -1,6 +1,6 @@
1
1
  from typing import Any, Dict, Optional
2
2
 
3
- from pydantic import BaseModel, validator
3
+ from pydantic import BaseModel, Field, validator
4
4
 
5
5
  from mmisp.api_schemas.attributes.get_all_attributes_response import GetAllAttributesResponse
6
6
  from mmisp.api_schemas.events.get_event_response import ObjectEventResponse
@@ -22,7 +22,7 @@ class ObjectWithAttributesResponse(BaseModel):
22
22
  deleted: bool | None = None
23
23
  first_seen: str | None = None
24
24
  last_seen: str | None = None
25
- Attribute: list[GetAllAttributesResponse] | None = None
25
+ attributes: list[GetAllAttributesResponse] | None = Field(alias="Attribute", default=None)
26
26
  Event: ObjectEventResponse | None = None
27
27
 
28
28
  @validator("sharing_group_id", always=True)
@@ -35,16 +35,13 @@ class ObjectWithAttributesResponse(BaseModel):
35
35
  return value
36
36
  return None
37
37
 
38
+ class Config:
39
+ allow_population_by_field_name = True
40
+
38
41
 
39
42
  class ObjectResponse(BaseModel):
40
43
  Object: ObjectWithAttributesResponse
41
44
 
42
- class Config:
43
- orm_mode = True
44
-
45
45
 
46
46
  class ObjectSearchResponse(BaseModel):
47
47
  response: list[ObjectResponse]
48
-
49
- class Config:
50
- orm_mode = True
@@ -0,0 +1,41 @@
1
+ from mmisp.db.models import ( # noqa: F401
2
+ attribute,
3
+ auth_key,
4
+ event,
5
+ feed,
6
+ galaxy,
7
+ identity_provider,
8
+ noticelist,
9
+ object,
10
+ organisation,
11
+ role,
12
+ server,
13
+ sharing_group,
14
+ sighting,
15
+ tag,
16
+ taxonomy,
17
+ user,
18
+ user_setting,
19
+ warninglist,
20
+ )
21
+
22
+ __all__ = [
23
+ attribute,
24
+ auth_key,
25
+ event,
26
+ feed,
27
+ galaxy,
28
+ identity_provider,
29
+ noticelist,
30
+ object,
31
+ organisation,
32
+ role,
33
+ server,
34
+ sharing_group,
35
+ sighting,
36
+ tag,
37
+ taxonomy,
38
+ user,
39
+ user_setting,
40
+ warninglist,
41
+ ]
@@ -7,9 +7,10 @@ from dotenv import load_dotenv
7
7
  @dataclass
8
8
  class DatabaseConfig:
9
9
  DATABASE_URL: str
10
+ DEBUG: bool
10
11
 
11
12
 
12
13
  load_dotenv(getenv("ENV_FILE", ".env"))
13
14
 
14
15
 
15
- config: DatabaseConfig = DatabaseConfig(DATABASE_URL=getenv("DATABASE_URL", ""))
16
+ config: DatabaseConfig = DatabaseConfig(DATABASE_URL=getenv("DATABASE_URL", ""), DEBUG=bool(getenv("DEBUG", False)))
@@ -0,0 +1,89 @@
1
+ import contextlib
2
+ from typing import AsyncIterator, Self, TypeAlias
3
+
4
+ from sqlalchemy.engine.url import make_url
5
+ from sqlalchemy.ext.asyncio import AsyncConnection, AsyncEngine, AsyncSession, create_async_engine
6
+ from sqlalchemy.orm import declarative_base, sessionmaker
7
+
8
+ from mmisp.db.config import config
9
+
10
+ Session: TypeAlias = AsyncSession
11
+
12
+ # , poolclass=NullPool)
13
+ # async_session = sessionmaker(autoflush=False, expire_on_commit=False, class_=AsyncSession, bind=engine)
14
+
15
+ Base = declarative_base()
16
+
17
+
18
+ class DatabaseSessionManager:
19
+ def __init__(self: Self) -> None:
20
+ self._engine: AsyncEngine | None = None
21
+ self._sessionmaker: sessionmaker | None = None
22
+
23
+ self._url = make_url(config.DATABASE_URL)
24
+
25
+ def init(self: Self) -> None:
26
+ if config.DEBUG:
27
+ self._engine = create_async_engine(self._url, echo=True)
28
+ else:
29
+ self._engine = create_async_engine(self._url)
30
+ self._sessionmaker = sessionmaker(
31
+ autocommit=False, expire_on_commit=False, bind=self._engine, class_=AsyncSession
32
+ )
33
+
34
+ async def close(self: Self) -> None:
35
+ if self._engine is None:
36
+ raise Exception("DatabaseSessionManager is not initialized")
37
+ await self._engine.dispose()
38
+ self._engine = None
39
+ self._sessionmaker = None
40
+
41
+ @contextlib.asynccontextmanager
42
+ async def connect(self: Self) -> AsyncIterator[AsyncConnection]:
43
+ if self._engine is None:
44
+ raise Exception("DatabaseSessionManager is not initialized")
45
+
46
+ async with self._engine.begin() as connection:
47
+ try:
48
+ yield connection
49
+ except Exception:
50
+ await connection.rollback()
51
+ raise
52
+
53
+ @contextlib.asynccontextmanager
54
+ async def session(self: Self) -> AsyncIterator[AsyncSession]:
55
+ if self._sessionmaker is None:
56
+ raise Exception("DatabaseSessionManager is not initialized")
57
+
58
+ session = self._sessionmaker()
59
+ try:
60
+ yield session
61
+ except Exception:
62
+ await session.rollback()
63
+ raise
64
+ finally:
65
+ await session.close()
66
+
67
+ # Used for testing
68
+ async def create_all(self: Self, engine: AsyncEngine | None = None) -> None:
69
+ if engine is None:
70
+ engine = self._engine
71
+ async with engine.begin() as conn:
72
+ await conn.run_sync(Base.metadata.create_all)
73
+
74
+ async def drop_all(self: Self, engine: AsyncEngine | None = None) -> None:
75
+ if engine is None:
76
+ engine = self._engine
77
+ await engine.run_sync(Base.metadata.drop_all)
78
+
79
+
80
+ async def get_db() -> Session:
81
+ async with sessionmanager.session() as session:
82
+ yield session
83
+
84
+
85
+ async def create_all_models() -> None:
86
+ await sessionmanager.create_all()
87
+
88
+
89
+ sessionmanager = DatabaseSessionManager()
@@ -0,0 +1,17 @@
1
+ from typing import Self
2
+
3
+ from sqlalchemy import inspect
4
+ from sqlalchemy.ext.hybrid import hybrid_property
5
+
6
+
7
+ class DictMixin:
8
+ def asdict(self: Self) -> dict:
9
+ d = {}
10
+ for key in self.__mapper__.c.keys():
11
+ if not key.startswith("_"):
12
+ d[key] = getattr(self, key)
13
+
14
+ for key, prop in inspect(self.__class__).all_orm_descriptors.items():
15
+ if isinstance(prop, hybrid_property):
16
+ d[key] = getattr(self, key)
17
+ return d
@@ -1,10 +1,11 @@
1
1
  from typing import Self, Type
2
2
 
3
- from sqlalchemy import BigInteger, Boolean, Column, ForeignKey, Integer, String, Text, inspect
3
+ from sqlalchemy import BigInteger, Boolean, Column, ForeignKey, Integer, String, Text
4
4
  from sqlalchemy.ext.hybrid import hybrid_property
5
5
  from sqlalchemy.orm import relationship
6
6
  from sqlalchemy.orm.decl_api import DeclarativeMeta
7
7
 
8
+ from mmisp.db.mixins import DictMixin
8
9
  from mmisp.lib.attributes import categories, default_category, mapper_safe_clsname_val, to_ids
9
10
  from mmisp.util.uuid import uuid
10
11
 
@@ -13,19 +14,6 @@ from .event import Event
13
14
  from .tag import Tag
14
15
 
15
16
 
16
- class DictMixin:
17
- def asdict(self: Self) -> dict:
18
- d = {}
19
- for key in self.__mapper__.c.keys():
20
- if not key.startswith("_"):
21
- d[key] = getattr(self, key)
22
-
23
- for key, prop in inspect(self.__class__).all_orm_descriptors.items():
24
- if isinstance(prop, hybrid_property):
25
- d[key] = getattr(self, key)
26
- return d
27
-
28
-
29
17
  class Attribute(Base, DictMixin):
30
18
  __tablename__ = "attributes"
31
19
 
@@ -50,6 +38,17 @@ class Attribute(Base, DictMixin):
50
38
 
51
39
  event = relationship("Event", back_populates="attributes", lazy="joined")
52
40
 
41
+ __mapper_args__ = {"polymorphic_on": "type"}
42
+
43
+ def __init__(self: Self, *arg, **kwargs) -> None:
44
+ if kwargs["value1"] is None:
45
+ split_val = kwargs["value"].split("|", 1)
46
+ kwargs["value1"] = split_val[0]
47
+ if len(split_val) == 2:
48
+ kwargs["value2"] = split_val[1]
49
+
50
+ super().__init__(*arg, **kwargs)
51
+
53
52
  @property
54
53
  def event_uuid(self: "Attribute") -> str:
55
54
  return self.event.uuid
@@ -83,7 +82,7 @@ class AttributeMeta(DeclarativeMeta):
83
82
  key = clsname[len("Attribute") :]
84
83
  dct["default_category"] = default_category[mapper_safe_clsname_val[key]]
85
84
  dct["categories"] = categories[mapper_safe_clsname_val[key]]
86
- dct["to_ids"] = to_ids[mapper_safe_clsname_val[key]]
85
+ dct["default_to_ids"] = to_ids[mapper_safe_clsname_val[key]]
87
86
  dct["__mapper_args__"] = {"polymorphic_identity": mapper_safe_clsname_val[key]}
88
87
  return super().__new__(cls, clsname, bases, dct)
89
88
 
@@ -1,10 +1,11 @@
1
1
  from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
2
2
 
3
3
  from mmisp.db.database import Base
4
+ from mmisp.db.mixins import DictMixin
4
5
  from mmisp.util.uuid import uuid
5
6
 
6
7
 
7
- class Object(Base):
8
+ class Object(Base, DictMixin):
8
9
  __tablename__ = "objects"
9
10
 
10
11
  id = Column(Integer, primary_key=True, nullable=False)
@@ -24,7 +25,7 @@ class Object(Base):
24
25
  last_seen = Column(Integer, index=True, default=None)
25
26
 
26
27
 
27
- class ObjectTemplate(Base):
28
+ class ObjectTemplate(Base, DictMixin):
28
29
  __tablename__ = "object_templates"
29
30
 
30
31
  id = Column(Integer, primary_key=True, nullable=False)
@@ -2,12 +2,13 @@ from datetime import datetime
2
2
 
3
3
  from sqlalchemy import Boolean, Column, DateTime, Integer, String, Text
4
4
 
5
+ from mmisp.db.mixins import DictMixin
5
6
  from mmisp.util.uuid import uuid
6
7
 
7
8
  from ..database import Base
8
9
 
9
10
 
10
- class Organisation(Base):
11
+ class Organisation(Base, DictMixin):
11
12
  __tablename__ = "organisations"
12
13
 
13
14
  id = Column(Integer, primary_key=True, nullable=False)
@@ -2,12 +2,13 @@ from datetime import datetime
2
2
 
3
3
  from sqlalchemy import Boolean, Column, DateTime, Integer, String, Text
4
4
 
5
+ from mmisp.db.mixins import DictMixin
5
6
  from mmisp.util.uuid import uuid
6
7
 
7
8
  from ..database import Base
8
9
 
9
10
 
10
- class SharingGroup(Base):
11
+ class SharingGroup(Base, DictMixin):
11
12
  __tablename__ = "sharing_groups"
12
13
 
13
14
  id = Column(Integer, primary_key=True, nullable=False)
@@ -25,7 +26,7 @@ class SharingGroup(Base):
25
26
  roaming = Column(Boolean, default=False, nullable=False)
26
27
 
27
28
 
28
- class SharingGroupOrg(Base):
29
+ class SharingGroupOrg(Base, DictMixin):
29
30
  __tablename__ = "sharing_group_orgs"
30
31
 
31
32
  id = Column(Integer, primary_key=True, nullable=False)
@@ -34,7 +35,7 @@ class SharingGroupOrg(Base):
34
35
  extend = Column(Boolean, default=False, nullable=False)
35
36
 
36
37
 
37
- class SharingGroupServer(Base):
38
+ class SharingGroupServer(Base, DictMixin):
38
39
  __tablename__ = "sharing_group_servers"
39
40
 
40
41
  id = Column(Integer, primary_key=True, nullable=False)
@@ -1,8 +1,9 @@
1
1
  from collections import defaultdict
2
- from enum import Enum
2
+ from enum import StrEnum
3
+ from typing import Literal, Union
3
4
 
4
5
 
5
- class AttributeCategories(Enum):
6
+ class AttributeCategories(StrEnum):
6
7
  PAYLOAD_DELIVERY = "Payload delivery"
7
8
  ARTIFACTS_DROPPED = "Artifacts dropped"
8
9
  PAYLOAD_INSTALLATION = "Payload installation"
@@ -213,7 +214,7 @@ mapper_val_safe_clsname = {
213
214
  }
214
215
 
215
216
  mapper_safe_clsname_val = dict((v, k) for k, v in mapper_val_safe_clsname.items())
216
-
217
+ literal_valid_attribute_types = Union[*[Literal[k] for k in mapper_val_safe_clsname.keys()]]
217
218
 
218
219
  default_category = {
219
220
  "md5": AttributeCategories.PAYLOAD_DELIVERY,
@@ -1,8 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mmisp-lib
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Requires-Python: >=3.11.0
5
5
  Description-Content-Type: text/markdown
6
+ License-File: LICENSE
6
7
  Requires-Dist: fastapi==0.104.1
7
8
  Requires-Dist: SQLAlchemy[asyncio]==1.4.46
8
9
  Requires-Dist: pydantic==1.10.13
@@ -1,3 +1,4 @@
1
+ LICENSE
1
2
  README.md
2
3
  pyproject.toml
3
4
  src/mmisp/api_schemas/__init__.py
@@ -132,8 +133,10 @@ src/mmisp/api_schemas/warninglists/toggle_enable_warninglists_body.py
132
133
  src/mmisp/api_schemas/warninglists/toggle_enable_warninglists_response.py
133
134
  src/mmisp/api_schemas/warninglists/warninglist_response.py
134
135
  src/mmisp/db/__init__.py
136
+ src/mmisp/db/all_models.py
135
137
  src/mmisp/db/config.py
136
138
  src/mmisp/db/database.py
139
+ src/mmisp/db/mixins.py
137
140
  src/mmisp/db/print_changes.py
138
141
  src/mmisp/db/models/__init__.py
139
142
  src/mmisp/db/models/attribute.py
@@ -1,42 +0,0 @@
1
- from functools import wraps
2
- from typing import Any, Callable, TypeAlias
3
-
4
- from sqlalchemy.engine.url import make_url
5
- from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
6
- from sqlalchemy.orm import declarative_base, sessionmaker
7
- from sqlalchemy.pool import NullPool
8
-
9
- from mmisp.db.config import config
10
-
11
- Session: TypeAlias = AsyncSession
12
-
13
- url = make_url(config.DATABASE_URL)
14
- engine = create_async_engine(url, poolclass=NullPool)
15
- async_session = sessionmaker(autoflush=False, expire_on_commit=False, class_=AsyncSession, bind=engine)
16
-
17
- Base = declarative_base()
18
-
19
-
20
- def get_db() -> Session:
21
- return async_session()
22
-
23
-
24
- def with_session_management(fn: Callable) -> Callable:
25
- @wraps(fn)
26
- async def wrapper(*args, **kwargs) -> Any:
27
- db: Session = kwargs.pop("db")
28
- output: Any = None
29
-
30
- try:
31
- output = await fn(*args, **kwargs, db=db)
32
- finally:
33
- await db.close()
34
-
35
- return output
36
-
37
- return wrapper
38
-
39
-
40
- async def create_all_models() -> None:
41
- async with engine.begin() as db:
42
- await db.run_sync(Base.metadata.create_all)
File without changes
File without changes
File without changes