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,32 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
|
3
|
+
from mmisp.api_schemas.tags.get_tag_response import TagAttributesResponse
|
4
|
+
|
5
|
+
|
6
|
+
class TaxonomyTagEntrySchema(BaseModel):
|
7
|
+
tag: str
|
8
|
+
expanded: str
|
9
|
+
exclusive_predicate: bool
|
10
|
+
description: str
|
11
|
+
existing_tag: bool | TagAttributesResponse
|
12
|
+
events: int
|
13
|
+
attributes: int
|
14
|
+
|
15
|
+
|
16
|
+
class GetTagTaxonomyResponse(BaseModel):
|
17
|
+
id: str
|
18
|
+
namespace: str
|
19
|
+
description: str
|
20
|
+
version: str
|
21
|
+
enabled: bool
|
22
|
+
exclusive: bool
|
23
|
+
required: bool
|
24
|
+
highlighted: bool
|
25
|
+
entries: list[TaxonomyTagEntrySchema]
|
26
|
+
|
27
|
+
class Config:
|
28
|
+
orm_mode = True
|
29
|
+
|
30
|
+
|
31
|
+
class GetIdTaxonomyResponseWrapper(BaseModel):
|
32
|
+
Taxonomy: GetTagTaxonomyResponse
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
|
3
|
+
|
4
|
+
class Position(BaseModel):
|
5
|
+
x: str
|
6
|
+
y: str
|
7
|
+
width: str
|
8
|
+
height: str
|
9
|
+
|
10
|
+
|
11
|
+
class Value(BaseModel):
|
12
|
+
widget: str
|
13
|
+
position: Position
|
14
|
+
|
15
|
+
|
16
|
+
class GetUserSettingResponse(BaseModel):
|
17
|
+
id: str
|
18
|
+
setting: str
|
19
|
+
value: str
|
20
|
+
user_id: str
|
21
|
+
timestamp: str
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
|
3
|
+
|
4
|
+
class SetUserSettingResponseUserSetting(BaseModel):
|
5
|
+
id: str
|
6
|
+
setting: str
|
7
|
+
value: dict | list
|
8
|
+
user_id: str
|
9
|
+
timestamp: str
|
10
|
+
|
11
|
+
|
12
|
+
class SetUserSettingResponse(BaseModel):
|
13
|
+
UserSetting: SetUserSettingResponseUserSetting
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
|
3
|
+
|
4
|
+
class ViewUserSettingResponseUserSetting(BaseModel):
|
5
|
+
id: str
|
6
|
+
setting: str
|
7
|
+
value: dict | list
|
8
|
+
user_id: str
|
9
|
+
timestamp: str
|
10
|
+
|
11
|
+
|
12
|
+
class ViewUserSettingResponse(BaseModel):
|
13
|
+
UserSetting: ViewUserSettingResponseUserSetting
|
File without changes
|
@@ -0,0 +1,42 @@
|
|
1
|
+
from datetime import datetime
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
|
6
|
+
class User(BaseModel):
|
7
|
+
id: str
|
8
|
+
org_id: str
|
9
|
+
email: str
|
10
|
+
autoalert: bool
|
11
|
+
invited_by: str
|
12
|
+
gpgkey: str
|
13
|
+
certif_public: str
|
14
|
+
termsaccepted: bool
|
15
|
+
role_id: str
|
16
|
+
change_pw: bool
|
17
|
+
contactalert: bool
|
18
|
+
disabled: bool
|
19
|
+
expiration: datetime
|
20
|
+
current_login: str
|
21
|
+
"""time in seconds"""
|
22
|
+
last_login: str
|
23
|
+
"""time in seconds"""
|
24
|
+
force_logout: bool
|
25
|
+
date_created: str
|
26
|
+
"""time in seconds"""
|
27
|
+
date_modified: str
|
28
|
+
"""time in seconds"""
|
29
|
+
external_auth_required: bool
|
30
|
+
external_auth_key: str
|
31
|
+
last_api_access: str
|
32
|
+
"""time in seconds"""
|
33
|
+
notification_daily: bool
|
34
|
+
notification_weekly: bool
|
35
|
+
notification_monthly: bool
|
36
|
+
totp: str | None = None
|
37
|
+
hotp_counter: str | None = None
|
38
|
+
last_pw_change: str
|
39
|
+
"""time in seconds"""
|
40
|
+
|
41
|
+
class Config:
|
42
|
+
orm_mode = True
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
|
3
|
+
from ..organisations.organisation import Organisation
|
4
|
+
from ..roles.role import Role
|
5
|
+
from .user import User
|
6
|
+
|
7
|
+
|
8
|
+
class UsersViewMeResponse(BaseModel):
|
9
|
+
User: User
|
10
|
+
Role: Role
|
11
|
+
UserSetting: list = []
|
12
|
+
Organisation: Organisation
|
File without changes
|
@@ -0,0 +1,220 @@
|
|
1
|
+
from enum import Enum
|
2
|
+
|
3
|
+
from pydantic import BaseModel, Field
|
4
|
+
|
5
|
+
|
6
|
+
class WarninglistListType(str, Enum):
|
7
|
+
CIDR = "cidr"
|
8
|
+
HOSTNAME = "hostname"
|
9
|
+
STRING = "string"
|
10
|
+
SUBSTRING = "substring"
|
11
|
+
REGEX = "regex"
|
12
|
+
|
13
|
+
|
14
|
+
class WarninglistCategory(str, Enum):
|
15
|
+
FALSE_POSITIVE = "False positive"
|
16
|
+
KNOWN_IDENTIFIER = "Known identifier"
|
17
|
+
|
18
|
+
|
19
|
+
class ValidAttribute(str, Enum):
|
20
|
+
MD5 = "md5"
|
21
|
+
SHA12SHA256 = "sha12sha256"
|
22
|
+
FILENAME = "filename"
|
23
|
+
PDB = "pdb"
|
24
|
+
FILENAME_MD5 = "filename|md5"
|
25
|
+
FILENAME_SHA1 = "filename|sha1"
|
26
|
+
FILENAME_SHA256 = "filename|sha256"
|
27
|
+
IP_SRC = "ip-src"
|
28
|
+
IP_DST = "ip-dst"
|
29
|
+
HOSTNAME = "hostname"
|
30
|
+
DOMAIN = "domain"
|
31
|
+
DOMAIN_IP = "domain|ip"
|
32
|
+
EMAIL = "email"
|
33
|
+
EMAIL_SRC = "email-src"
|
34
|
+
EPPN = "eppn"
|
35
|
+
EMAIL_DST = "email-dst"
|
36
|
+
EMAIL_SUBJECT = "email-subject"
|
37
|
+
EMAIL_ATTACHMENT = "email-attachment"
|
38
|
+
EMAIL_BODY = "email-body"
|
39
|
+
FLOAT = "float"
|
40
|
+
GIT_COMMIT_ID = "git-commit-id"
|
41
|
+
URL = "url"
|
42
|
+
HTTP_METHOD = "http-method"
|
43
|
+
USER_AGENT = "user-agent"
|
44
|
+
JA3_FINGERPRINT_MD5 = "ja3-fingerprint-md5"
|
45
|
+
JARM_FINGERPRINT = "jarm-fingerprint"
|
46
|
+
FAVICON_MMH3 = "favicon-mmh3"
|
47
|
+
HASSH_MD5 = "hassh-md5"
|
48
|
+
HASSHSERVER_MD5 = "hasshserver-md5"
|
49
|
+
REGKEY = "regkey"
|
50
|
+
REGKEY_VALUE = "regkey|value"
|
51
|
+
AS = "AS"
|
52
|
+
SNORT = "snort"
|
53
|
+
BRO = "bro"
|
54
|
+
ZEEK = "zeek"
|
55
|
+
COMMUNITY_ID = "community-id"
|
56
|
+
PATTERN_IN_FILE = "pattern-in-file"
|
57
|
+
PATTERN_IN_TRAFFIC = "pattern-in-traffic"
|
58
|
+
PATTERN_IN_MEMORY = "pattern-in-memory"
|
59
|
+
FILENAME_PATTERN = "filename-pattern"
|
60
|
+
PGP_PUBLIC_KEY = "pgp-public-key"
|
61
|
+
PGP_PRIVATE_KEY = "pgp-private-key"
|
62
|
+
SSH_FINGERPRINT = "ssh-fingerprint"
|
63
|
+
YARA = "yara"
|
64
|
+
STIX2_PATTERN = "stix2-pattern"
|
65
|
+
SIGMA = "sigma"
|
66
|
+
GENE = "gene"
|
67
|
+
KUSTO_QUERY = "kusto-query"
|
68
|
+
MIME_TYPE = "mime-type"
|
69
|
+
IDENTITY_CARD_NUMBER = "identity-card-number"
|
70
|
+
COOKIE = "cookie"
|
71
|
+
VULNERABILITY = "vulnerability"
|
72
|
+
CPE = "cpe"
|
73
|
+
WEAKNESS = "weakness"
|
74
|
+
ATTACHMENT = "attachment"
|
75
|
+
MALWARE_SAMPLE = "malware-sample"
|
76
|
+
LINK = "link"
|
77
|
+
COMMENT = "comment"
|
78
|
+
TEXT = "text"
|
79
|
+
HEX = "hex"
|
80
|
+
OTHER = "other"
|
81
|
+
NAMED_PIPE = "named pipe"
|
82
|
+
MUTEX = "mutex"
|
83
|
+
PROCESS_STATE = "process-state"
|
84
|
+
TARGET_USER = "target-user"
|
85
|
+
TARGET_EMAIL = "target-email"
|
86
|
+
TARGET_MACHINE = "target-machine"
|
87
|
+
TARGET_ORG = "target-org"
|
88
|
+
TARGET_LOCATION = "target-location"
|
89
|
+
TARGET_EXTERNAL = "target-external"
|
90
|
+
BTC = "btc"
|
91
|
+
DASH = "dash"
|
92
|
+
XMR = "xmr"
|
93
|
+
IBAN = "iban"
|
94
|
+
BIC = "bic"
|
95
|
+
BANK_ACCOUNT_NR = "bank-account-nr"
|
96
|
+
ABA_RTN = "aba-rtn"
|
97
|
+
BIN = "bin"
|
98
|
+
CC_NUMBER = "cc-number"
|
99
|
+
PRTN = "prtn"
|
100
|
+
PHONE_NUMBER = "phone-number"
|
101
|
+
THREAT_ACTOR = "threat-actor"
|
102
|
+
CAMPAIGN_NAME = "campaign-name"
|
103
|
+
CAMPAIGN_ID = "campaign-id"
|
104
|
+
MALWARE_TYPE = "malware-type"
|
105
|
+
URI = "uri"
|
106
|
+
AUTHENTIHASH = "authentihash"
|
107
|
+
VHASH = "vhash"
|
108
|
+
SSDEEP = "ssdeep"
|
109
|
+
IMPHASH = "imphash"
|
110
|
+
TELFHASH = "telfhash"
|
111
|
+
PEHASH = "pehash"
|
112
|
+
IMPFUZZY = "impfuzzy"
|
113
|
+
SHA224 = "sha224"
|
114
|
+
SHA384 = "sha384"
|
115
|
+
SHA512 = "sha512"
|
116
|
+
SHA512_224 = "sha512/224"
|
117
|
+
SHA512_256 = "sha512/256"
|
118
|
+
SHA3_224 = "sha3-224"
|
119
|
+
SHA3_256 = "sha3-256"
|
120
|
+
SHA3_384 = "sha3-384"
|
121
|
+
SHA3_512 = "sha3-512"
|
122
|
+
TLSH = "tlsh"
|
123
|
+
CDHASH = "cdhash"
|
124
|
+
FILENAME_AUTHENTIHASH = "filename|authentihash"
|
125
|
+
FILENAME_VHASH = "filename|vhash"
|
126
|
+
FILENAME_SSDEEP = "filename|ssdeep"
|
127
|
+
FILENAME_IMPHASH = "filename|imphash"
|
128
|
+
FILENAME_IMPFUZZY = "filename|impfuzzy"
|
129
|
+
FILENAME_PEHASH = "filename|pehash"
|
130
|
+
ILENAME_SHA224 = "ilename|sha224"
|
131
|
+
FILENAME_SHA384 = "filename|sha384"
|
132
|
+
FILENAME_SHA512 = "filename|sha512"
|
133
|
+
FILENAME_SHA512_224 = "filename|sha512/224"
|
134
|
+
FILENAME_SHA512_256 = "filename|sha512/256"
|
135
|
+
FILENAME_SHA3_224 = "filename|sha3-224"
|
136
|
+
FILENAME_SHA3_256 = "filename|sha3-256"
|
137
|
+
FILENAME_SHA3_384 = "filename|sha3-384"
|
138
|
+
FILENAME_SHA3_512 = "filename|sha3-512"
|
139
|
+
FILENAME_TLSH = "filename|tlsh"
|
140
|
+
WINDOWS_SCHEDULED_TASK = "windows-scheduled-task"
|
141
|
+
WINDOWS_SERVICE_NAME = "windows-service-name"
|
142
|
+
WINDOWS_SERVICE_DISPLAYNAME = "windows-service-displayname"
|
143
|
+
WHOIS_REGISTRANT_EMAIL = "whois-registrant-email"
|
144
|
+
WHOIS_REGISTRANT_PHONE = "whois-registrant-phone"
|
145
|
+
WHOIS_REGISTRANT_NAME = "whois-registrant-name"
|
146
|
+
WHOIS_REGISTRANT_ORG = "whois-registrant-org"
|
147
|
+
WHOIS_REGISTRAR = "whois-registrar"
|
148
|
+
WHOIS_CREATION_DATE = "whois-creation-date"
|
149
|
+
X509_FINGERPRINT_SHA1 = "x509-fingerprint-sha1"
|
150
|
+
X509_FINGERPRINT_MD5 = "x509-fingerprint-md5"
|
151
|
+
X509_FINGERPRINT_SHA256 = "x509-fingerprint-sha256"
|
152
|
+
DNS_SOA_EMAIL = "dns-soa-email"
|
153
|
+
SIZE_IN_BYTES = "size-in-bytes"
|
154
|
+
COUNTER = "counter"
|
155
|
+
DATETIME = "datetime"
|
156
|
+
PORT = "port"
|
157
|
+
IP_DST_PORT = "ip-dst|port"
|
158
|
+
IP_SRC_PORT = "ip-src|port"
|
159
|
+
HOSTNAME_PORT = "hostname|port"
|
160
|
+
MAC_ADDRESS = "mac-address"
|
161
|
+
MAC_EUI_64 = "mac-eui-64"
|
162
|
+
EMAIL_DST_DISPLAY_NAME = "email-dst-display-name"
|
163
|
+
EMAIL_SRC_DISPLAY_NAME = "email-src-display-name"
|
164
|
+
EMAIL_HEADER = "email-header"
|
165
|
+
EMAIL_REPLY_TO = "email-reply-to"
|
166
|
+
EMAIL_X_MAILER = "email-x-mailer"
|
167
|
+
EMAIL_MIME_BOUNDARY = "email-mime-boundary"
|
168
|
+
EMAIL_THREAD_INDEX = "email-thread-index"
|
169
|
+
EMAIL_MESSAGE_ID = "email-message-id"
|
170
|
+
GITHUB_USERNAME = "github-username"
|
171
|
+
GITHUB_REPOSITORY = "github-repository"
|
172
|
+
GITHUB_ORGANISATION = "github-organisation"
|
173
|
+
JABBER_ID = "jabber-id"
|
174
|
+
TWITTER_ID = "twitter-id"
|
175
|
+
DKIM = "dkim"
|
176
|
+
DKIM_SIGNATURE = "dkim-signature"
|
177
|
+
FIRST_NAME = "first-name"
|
178
|
+
MIDDLE_NAME = "middle-name"
|
179
|
+
LAST_NAME = "last-name"
|
180
|
+
FULL_NAME = "full-name"
|
181
|
+
DATE_OF_BIRTH = "date-of-birth"
|
182
|
+
PLACE_OF_BIRTH = "place-of-birth"
|
183
|
+
GENDER = "gender"
|
184
|
+
PASSPORT_NUMBER = "passport-number"
|
185
|
+
PASSPORT_COUNTRY = "passport-country"
|
186
|
+
PASSPORT_EXPIRATION = "passport-expiration"
|
187
|
+
REDRESS_NUMBER = "redress-number"
|
188
|
+
NATIONALITY = "nationality"
|
189
|
+
VISA_NUMBER = "visa-number"
|
190
|
+
ISSUE_DATE_OF_THE_VISA = "issue-date-of-the-visa"
|
191
|
+
PRIMARY_RESIDENCE = "primary-residence"
|
192
|
+
COUNTRY_OF_RESIDENCE = "country-of-residence"
|
193
|
+
SPECIAL_SERVICE_REQUEST = "special-service-request"
|
194
|
+
FREQUENT_FLYER_NUMBER = "frequent-flyer-number"
|
195
|
+
TRAVEL_DETAILS = "travel-details"
|
196
|
+
PAYMENT_DETAILS = "payment-details"
|
197
|
+
PLACE_PORT_OF_ORIGINAL_EMBARKATION = "place-port-of-original-embarkation"
|
198
|
+
PLACE_PORT_OF_CLEARANCE = "place-port-of-clearance"
|
199
|
+
PLACE_PORT_OF_ONWARD_FOREIGN_DESTINATION = "place-port-of-onward-foreign-destination"
|
200
|
+
PASSENGER_NAME_RECORD_LOCATOR_NUMBER = "passenger-name-record-locator-number"
|
201
|
+
MOBILE_APPLICATION_ID = "mobile-application-id"
|
202
|
+
AZURE_APPLICATION_ID = "azure-application-id"
|
203
|
+
CHROME_EXTENSION_ID = "chrome-extension-id"
|
204
|
+
CORTEX = "cortex"
|
205
|
+
BOOLEAN = "boolean"
|
206
|
+
ANONYMISED = "anonymised"
|
207
|
+
|
208
|
+
|
209
|
+
class CreateWarninglistBody(BaseModel):
|
210
|
+
name: str = Field(min_length=1, max_length=255)
|
211
|
+
type: WarninglistListType
|
212
|
+
description: str = Field(min_length=1, max_length=65535)
|
213
|
+
enabled: bool
|
214
|
+
default: bool
|
215
|
+
category: WarninglistCategory
|
216
|
+
valid_attributes: list[ValidAttribute]
|
217
|
+
values: str = Field(min_length=1, max_length=65535)
|
218
|
+
|
219
|
+
class Config:
|
220
|
+
orm_mode = True
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
|
3
|
+
from mmisp.api_schemas.warninglists.warninglist_response import WarninglistAttributes
|
4
|
+
|
5
|
+
|
6
|
+
class WarninglistsResponse(BaseModel):
|
7
|
+
Warninglist: WarninglistAttributes
|
8
|
+
|
9
|
+
|
10
|
+
class GetSelectedAllWarninglistsResponse(BaseModel):
|
11
|
+
Warninglists: list[WarninglistsResponse]
|
12
|
+
|
13
|
+
class Config:
|
14
|
+
orm_mode = True
|
@@ -0,0 +1,42 @@
|
|
1
|
+
from pydantic import BaseModel, Field
|
2
|
+
|
3
|
+
|
4
|
+
class WarninglistEntryResponse(BaseModel):
|
5
|
+
id: str
|
6
|
+
value: str = Field(max_length=65535)
|
7
|
+
warninglist_id: str
|
8
|
+
comment: str | None = None
|
9
|
+
|
10
|
+
|
11
|
+
class WarninglistTypeResponse(BaseModel):
|
12
|
+
id: str
|
13
|
+
type: str
|
14
|
+
warninglist_id: str
|
15
|
+
|
16
|
+
|
17
|
+
class WarninglistBaseResponse(BaseModel):
|
18
|
+
id: str
|
19
|
+
name: str = Field(max_length=255)
|
20
|
+
type: str
|
21
|
+
description: str = Field(max_length=65535)
|
22
|
+
version: str
|
23
|
+
enabled: bool
|
24
|
+
default: bool
|
25
|
+
category: str
|
26
|
+
|
27
|
+
|
28
|
+
class WarninglistAttributes(WarninglistBaseResponse):
|
29
|
+
warninglist_entry_count: str
|
30
|
+
valid_attributes: str
|
31
|
+
|
32
|
+
|
33
|
+
class WarninglistAttributesResponse(WarninglistBaseResponse):
|
34
|
+
WarninglistEntry: list[WarninglistEntryResponse] | None = None
|
35
|
+
WarninglistType: list[WarninglistTypeResponse] | None = None
|
36
|
+
|
37
|
+
|
38
|
+
class WarninglistResponse(BaseModel):
|
39
|
+
Warninglist: WarninglistAttributesResponse
|
40
|
+
|
41
|
+
class Config:
|
42
|
+
orm_mode = True
|
mmisp/db/__init__.py
ADDED
File without changes
|
mmisp/db/config.py
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
from os import getenv
|
2
|
+
|
3
|
+
from dotenv import load_dotenv
|
4
|
+
|
5
|
+
from dataclasses import dataclass
|
6
|
+
|
7
|
+
@dataclass
|
8
|
+
class DatabaseConfig:
|
9
|
+
DATABASE_URL: str
|
10
|
+
|
11
|
+
|
12
|
+
load_dotenv(getenv("ENV_FILE", ".env"))
|
13
|
+
|
14
|
+
|
15
|
+
config: DatabaseConfig = DatabaseConfig(
|
16
|
+
DATABASE_URL=getenv("DATABASE_URL", "")
|
17
|
+
)
|
mmisp/db/database.py
ADDED
@@ -0,0 +1,42 @@
|
|
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
|