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.
- mmisp/api_schemas/__init__.py +0 -0
- mmisp/api_schemas/attributes/__init__.py +0 -0
- mmisp/api_schemas/attributes/add_attribute_body.py +34 -0
- mmisp/api_schemas/attributes/add_attribute_response.py +33 -0
- mmisp/api_schemas/attributes/add_remove_tag_attribute_response.py +13 -0
- mmisp/api_schemas/attributes/delete_attribute_response.py +8 -0
- mmisp/api_schemas/attributes/delete_selected_attribute_body.py +9 -0
- mmisp/api_schemas/attributes/delete_selected_attribute_response.py +13 -0
- mmisp/api_schemas/attributes/edit_attribute_body.py +24 -0
- mmisp/api_schemas/attributes/edit_attributes_response.py +42 -0
- mmisp/api_schemas/attributes/get_all_attributes_response.py +38 -0
- mmisp/api_schemas/attributes/get_attribute_response.py +41 -0
- mmisp/api_schemas/attributes/get_attribute_statistics_response.py +137 -0
- mmisp/api_schemas/attributes/get_describe_types_response.py +29 -0
- mmisp/api_schemas/attributes/restore_attribute_reponse.py +25 -0
- mmisp/api_schemas/attributes/search_attributes_body.py +74 -0
- mmisp/api_schemas/attributes/search_attributes_response.py +52 -0
- mmisp/api_schemas/auth_keys/__init__.py +0 -0
- mmisp/api_schemas/auth_keys/add_auth_key_body.py +10 -0
- mmisp/api_schemas/auth_keys/add_auth_key_response.py +20 -0
- mmisp/api_schemas/auth_keys/edit_auth_key_body.py +8 -0
- mmisp/api_schemas/auth_keys/edit_auth_key_response.py +24 -0
- mmisp/api_schemas/auth_keys/search_auth_keys_body.py +17 -0
- mmisp/api_schemas/auth_keys/search_get_all_auth_keys_users_response.py +28 -0
- mmisp/api_schemas/auth_keys/view_auth_key_response.py +24 -0
- mmisp/api_schemas/authentication/__init__.py +0 -0
- mmisp/api_schemas/authentication/exchange_token_login_body.py +5 -0
- mmisp/api_schemas/authentication/password_login_body.py +6 -0
- mmisp/api_schemas/authentication/start_login_body.py +5 -0
- mmisp/api_schemas/authentication/start_login_response.py +21 -0
- mmisp/api_schemas/authentication/token_response.py +5 -0
- mmisp/api_schemas/events/FreeTextImportWorkerBody.py +17 -0
- mmisp/api_schemas/events/__init__.py +0 -0
- mmisp/api_schemas/events/add_attribute_via_free_text_import_event_body.py +12 -0
- mmisp/api_schemas/events/add_attribute_via_free_text_import_event_response.py +14 -0
- mmisp/api_schemas/events/add_edit_get_event_response.py +234 -0
- mmisp/api_schemas/events/add_event_body.py +30 -0
- mmisp/api_schemas/events/add_remove_tag_events_response.py +11 -0
- mmisp/api_schemas/events/delete_event_response.py +14 -0
- mmisp/api_schemas/events/edit_event_body.py +28 -0
- mmisp/api_schemas/events/get_all_events_response.py +99 -0
- mmisp/api_schemas/events/get_event_response.py +8 -0
- mmisp/api_schemas/events/index_events_body.py +30 -0
- mmisp/api_schemas/events/index_events_response.py +40 -0
- mmisp/api_schemas/events/publish_event_response.py +13 -0
- mmisp/api_schemas/events/search_events_body.py +43 -0
- mmisp/api_schemas/events/search_events_response.py +10 -0
- mmisp/api_schemas/events/unpublish_event_response.py +13 -0
- mmisp/api_schemas/feeds/__init__.py +0 -0
- mmisp/api_schemas/feeds/cache_feed_response.py +12 -0
- mmisp/api_schemas/feeds/create_feed_body.py +30 -0
- mmisp/api_schemas/feeds/enable_disable_feed_response.py +10 -0
- mmisp/api_schemas/feeds/fetch_feeds_response.py +8 -0
- mmisp/api_schemas/feeds/get_feed_response.py +47 -0
- mmisp/api_schemas/feeds/toggle_feed_body.py +8 -0
- mmisp/api_schemas/feeds/update_feed_body.py +30 -0
- mmisp/api_schemas/galaxies/__init__.py +0 -0
- mmisp/api_schemas/galaxies/attach_galaxy_cluster_body.py +12 -0
- mmisp/api_schemas/galaxies/attach_galaxy_cluster_response.py +10 -0
- mmisp/api_schemas/galaxies/delete_force_update_import_galaxy_response.py +12 -0
- mmisp/api_schemas/galaxies/export_galaxies_body.py +16 -0
- mmisp/api_schemas/galaxies/export_galaxies_response.py +44 -0
- mmisp/api_schemas/galaxies/galaxy_schema.py +18 -0
- mmisp/api_schemas/galaxies/get_all_search_galaxies_response.py +22 -0
- mmisp/api_schemas/galaxies/get_galaxy_response.py +37 -0
- mmisp/api_schemas/galaxies/import_galaxies_body.py +15 -0
- mmisp/api_schemas/galaxies/search_galaxies_body.py +22 -0
- mmisp/api_schemas/noticelists/__init__.py +0 -0
- mmisp/api_schemas/noticelists/get_all_noticelist_response.py +10 -0
- mmisp/api_schemas/noticelists/get_noticelist_response.py +38 -0
- mmisp/api_schemas/objects/__init__.py +0 -0
- mmisp/api_schemas/objects/create_object_body.py +19 -0
- mmisp/api_schemas/objects/get_object_response.py +50 -0
- mmisp/api_schemas/objects/search_objects_body.py +49 -0
- mmisp/api_schemas/organisations/__init__.py +0 -0
- mmisp/api_schemas/organisations/organisation.py +24 -0
- mmisp/api_schemas/roles/__init__.py +0 -0
- mmisp/api_schemas/roles/role.py +71 -0
- mmisp/api_schemas/sharing_groups/__init__.py +0 -0
- mmisp/api_schemas/sharing_groups/add_org_to_sharing_group_body.py +6 -0
- mmisp/api_schemas/sharing_groups/add_org_to_sharing_group_legacy_body.py +5 -0
- mmisp/api_schemas/sharing_groups/add_server_to_sharing_group_body.py +6 -0
- mmisp/api_schemas/sharing_groups/add_server_to_sharing_group_legacy_body.py +5 -0
- mmisp/api_schemas/sharing_groups/create_sharing_group_body.py +12 -0
- mmisp/api_schemas/sharing_groups/create_sharing_group_legacy_body.py +23 -0
- mmisp/api_schemas/sharing_groups/create_sharing_group_legacy_response.py +18 -0
- mmisp/api_schemas/sharing_groups/delete_sharing_group_legacy_response.py +5 -0
- mmisp/api_schemas/sharing_groups/get_all_sharing_groups_response.py +53 -0
- mmisp/api_schemas/sharing_groups/get_sharing_group_info_response.py +44 -0
- mmisp/api_schemas/sharing_groups/sharing_group.py +19 -0
- mmisp/api_schemas/sharing_groups/sharing_group_org.py +8 -0
- mmisp/api_schemas/sharing_groups/sharing_group_server.py +8 -0
- mmisp/api_schemas/sharing_groups/update_sharing_group_body.py +10 -0
- mmisp/api_schemas/sharing_groups/update_sharing_group_legacy_body.py +28 -0
- mmisp/api_schemas/sharing_groups/view_update_sharing_group_legacy_response.py +40 -0
- mmisp/api_schemas/sightings/__init__.py +0 -0
- mmisp/api_schemas/sightings/create_sighting_body.py +49 -0
- mmisp/api_schemas/sightings/get_sighting_response.py +27 -0
- mmisp/api_schemas/standard_status_response.py +13 -0
- mmisp/api_schemas/tags/__init__.py +0 -0
- mmisp/api_schemas/tags/create_tag_body.py +15 -0
- mmisp/api_schemas/tags/delete_tag_response.py +10 -0
- mmisp/api_schemas/tags/get_tag_response.py +31 -0
- mmisp/api_schemas/tags/search_tags_response.py +26 -0
- mmisp/api_schemas/tags/update_tag_body.py +15 -0
- mmisp/api_schemas/taxonomies/__init__.py +0 -0
- mmisp/api_schemas/taxonomies/export_taxonomies_response.py +30 -0
- mmisp/api_schemas/taxonomies/get_taxonomy_by_id_response.py +30 -0
- mmisp/api_schemas/taxonomies/get_taxonomy_response.py +21 -0
- mmisp/api_schemas/taxonomies/get_taxonomy_tags_response.py +32 -0
- mmisp/api_schemas/user_settings/__init__.py +0 -0
- mmisp/api_schemas/user_settings/get_uid_user_setting_response.py +21 -0
- mmisp/api_schemas/user_settings/get_user_settings_response.py +13 -0
- mmisp/api_schemas/user_settings/search_user_setting_body.py +7 -0
- mmisp/api_schemas/user_settings/search_user_setting_response.py +11 -0
- mmisp/api_schemas/user_settings/set_user_setting_body.py +5 -0
- mmisp/api_schemas/user_settings/set_user_setting_response.py +13 -0
- mmisp/api_schemas/user_settings/view_user_setting_response.py +13 -0
- mmisp/api_schemas/users/__init__.py +0 -0
- mmisp/api_schemas/users/user.py +42 -0
- mmisp/api_schemas/users/users_view_me_response.py +12 -0
- mmisp/api_schemas/warninglists/__init__.py +0 -0
- mmisp/api_schemas/warninglists/check_value_warninglists_body.py +8 -0
- mmisp/api_schemas/warninglists/check_value_warninglists_response.py +14 -0
- mmisp/api_schemas/warninglists/create_warninglist_body.py +220 -0
- mmisp/api_schemas/warninglists/delete_warninglist_response.py +13 -0
- mmisp/api_schemas/warninglists/get_selected_all_warninglists_response.py +14 -0
- mmisp/api_schemas/warninglists/get_selected_warninglists_body.py +9 -0
- mmisp/api_schemas/warninglists/toggle_enable_warninglists_body.py +10 -0
- mmisp/api_schemas/warninglists/toggle_enable_warninglists_response.py +10 -0
- mmisp/api_schemas/warninglists/warninglist_response.py +42 -0
- mmisp/db/__init__.py +0 -0
- mmisp/db/config.py +17 -0
- mmisp/db/database.py +42 -0
- mmisp/db/models/__init__.py +0 -0
- mmisp/db/models/attribute.py +92 -0
- mmisp/db/models/auth_key.py +24 -0
- mmisp/db/models/event.py +62 -0
- mmisp/db/models/feed.py +32 -0
- mmisp/db/models/galaxy.py +22 -0
- mmisp/db/models/galaxy_cluster.py +52 -0
- mmisp/db/models/identity_provider.py +22 -0
- mmisp/db/models/noticelist.py +22 -0
- mmisp/db/models/object.py +39 -0
- mmisp/db/models/organisation.py +26 -0
- mmisp/db/models/role.py +42 -0
- mmisp/db/models/server.py +33 -0
- mmisp/db/models/sharing_group.py +43 -0
- mmisp/db/models/sighting.py +21 -0
- mmisp/db/models/tag.py +19 -0
- mmisp/db/models/taxonomy.py +41 -0
- mmisp/db/models/user.py +44 -0
- mmisp/db/models/user_setting.py +29 -0
- mmisp/db/models/warninglist.py +33 -0
- mmisp/db/print_changes.py +59 -0
- mmisp/lib/__init__.py +0 -0
- mmisp/lib/attributes.py +1386 -0
- mmisp_lib-0.1.0.dist-info/METADATA +77 -0
- mmisp_lib-0.1.0.dist-info/RECORD +161 -0
- mmisp_lib-0.1.0.dist-info/WHEEL +5 -0
- mmisp_lib-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
from enum import Enum
|
2
|
+
from time import time
|
3
|
+
|
4
|
+
from sqlalchemy import Column, ForeignKey, Integer, String, Text
|
5
|
+
|
6
|
+
from mmisp.db.database import Base
|
7
|
+
|
8
|
+
from .user import User
|
9
|
+
|
10
|
+
|
11
|
+
class SettingName(Enum):
|
12
|
+
PUBLISH_ALERT_FILTER = "publish_alert_filter"
|
13
|
+
DASHBOARD_ACCESS = "dashboard_access"
|
14
|
+
DASHBOARD = "dashboard"
|
15
|
+
HOMEPAGE = "homepage"
|
16
|
+
DEFAULT_RESTSEARCH_PARAMETERS = "default_restsearch_parameters"
|
17
|
+
TAG_NUMERICAL_VALUE_OVERRIDE = "tag_numerical_value_override"
|
18
|
+
EVENT_INDEX_HIDE_COLUMNS = "event_index_hide_columns"
|
19
|
+
PERIODIC_NOTIFICATION_FILTERS = "periodic_notification_filters"
|
20
|
+
|
21
|
+
|
22
|
+
class UserSetting(Base):
|
23
|
+
__tablename__ = "user_settings"
|
24
|
+
|
25
|
+
id = Column(Integer, primary_key=True, nullable=False)
|
26
|
+
setting = Column(String(255), nullable=False, index=True)
|
27
|
+
value = Column(Text, nullable=False)
|
28
|
+
user_id = Column(Integer, ForeignKey(User.id), nullable=False, index=True)
|
29
|
+
timestamp = Column(Integer, default=time, onupdate=time, nullable=False, index=True)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
|
2
|
+
|
3
|
+
from mmisp.db.database import Base
|
4
|
+
|
5
|
+
|
6
|
+
class Warninglist(Base):
|
7
|
+
__tablename__ = "warninglists"
|
8
|
+
|
9
|
+
id = Column(Integer, primary_key=True, nullable=False)
|
10
|
+
name = Column(String(255), nullable=False)
|
11
|
+
type = Column(String(255), nullable=False, default="string")
|
12
|
+
description = Column(String(255), nullable=False)
|
13
|
+
version = Column(Integer, nullable=False, default=1)
|
14
|
+
enabled = Column(Boolean, default=False, nullable=False)
|
15
|
+
default = Column(Boolean, default=True)
|
16
|
+
category = Column(String(255))
|
17
|
+
|
18
|
+
|
19
|
+
class WarninglistEntry(Base):
|
20
|
+
__tablename__ = "warninglist_entries"
|
21
|
+
|
22
|
+
id = Column(Integer, primary_key=True, nullable=False)
|
23
|
+
value = Column(String(255), nullable=False)
|
24
|
+
warninglist_id = Column(Integer, ForeignKey(Warninglist.id, ondelete="CASCADE"), nullable=False)
|
25
|
+
comment = Column(String(255))
|
26
|
+
|
27
|
+
|
28
|
+
class WarninglistType(Base):
|
29
|
+
__tablename__ = "warninglist_types"
|
30
|
+
|
31
|
+
id = Column(Integer, primary_key=True, nullable=False)
|
32
|
+
type = Column(String(255), nullable=False)
|
33
|
+
warninglist_id = Column(Integer, ForeignKey(Warninglist.id, ondelete="CASCADE"), nullable=False)
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
|
3
|
+
"""
|
4
|
+
USAGE:
|
5
|
+
- Create env file with the variables
|
6
|
+
MYSQL_USER
|
7
|
+
MYSQL_PASSWORD
|
8
|
+
MYSQL_HOST
|
9
|
+
MYSQL_DBNAME
|
10
|
+
- Populate your environment `export $(cat ENVFILE)`
|
11
|
+
- Run `python -m mmisp.db.print_changes`
|
12
|
+
"""
|
13
|
+
|
14
|
+
|
15
|
+
import os
|
16
|
+
import pprint
|
17
|
+
|
18
|
+
from alembic.autogenerate import compare_metadata
|
19
|
+
from alembic.migration import MigrationContext
|
20
|
+
from sqlalchemy import MetaData, create_engine
|
21
|
+
|
22
|
+
from .database import Base
|
23
|
+
|
24
|
+
# import all models, so Base is populated
|
25
|
+
from .models import ( # noqa: F401
|
26
|
+
attribute,
|
27
|
+
auth_key,
|
28
|
+
event,
|
29
|
+
feed,
|
30
|
+
galaxy,
|
31
|
+
galaxy_cluster,
|
32
|
+
noticelist,
|
33
|
+
object,
|
34
|
+
organisation,
|
35
|
+
role,
|
36
|
+
server,
|
37
|
+
sharing_group,
|
38
|
+
sighting,
|
39
|
+
tag,
|
40
|
+
taxonomy,
|
41
|
+
user,
|
42
|
+
user_setting,
|
43
|
+
warninglist,
|
44
|
+
)
|
45
|
+
|
46
|
+
myuser = os.getenv("MYSQL_USER")
|
47
|
+
password = os.getenv("MYSQL_PASSWORD")
|
48
|
+
host = os.getenv("MYSQL_HOST")
|
49
|
+
db_name = os.getenv("MYSQL_DBNAME")
|
50
|
+
|
51
|
+
engine = create_engine(f"mysql+mysqlconnector://{myuser}:{password}@{host}/{db_name}")
|
52
|
+
|
53
|
+
|
54
|
+
metadata = MetaData()
|
55
|
+
|
56
|
+
mc = MigrationContext.configure(engine.connect())
|
57
|
+
|
58
|
+
diff = compare_metadata(mc, Base.metadata)
|
59
|
+
pprint.pprint(diff, indent=2, width=20)
|
mmisp/lib/__init__.py
ADDED
File without changes
|