id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
34,500 | possible_usernames.py | mozilla_MozDef/alerts/plugins/possible_usernames.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
import json
import os
import typing as types
from lib.config import ES
from m... | 3,453 | Python | .py | 87 | 32.712644 | 78 | 0.647625 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,501 | port_scan_enrichment.py | mozilla_MozDef/alerts/plugins/port_scan_enrichment.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import json
import os
from lib.config import ES
from mozdef_util.query_model... | 5,993 | Python | .py | 151 | 32.331126 | 79 | 0.651416 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,502 | vpn_assignment.py | mozilla_MozDef/alerts/plugins/vpn_assignment.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import json
import os
import typing as types
import netaddr
from lib.config ... | 3,625 | Python | .py | 101 | 29.009901 | 78 | 0.640401 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,503 | auth_sourceip_username.py | mozilla_MozDef/alerts/plugins/auth_sourceip_username.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import json
import os
import typing as types
from lib.config import ES
from m... | 3,264 | Python | .py | 91 | 29.021978 | 82 | 0.644699 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,504 | geomodel_ipintel_enrichment.py | mozilla_MozDef/alerts/plugins/geomodel_ipintel_enrichment.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import json
import os
import typing as types
CONFIG_FILE = os.path.join(
... | 3,663 | Python | .py | 94 | 32.404255 | 80 | 0.643626 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,505 | config.py | mozilla_MozDef/docker/compose/mozdef_alerts/files/config.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
from celery.schedules import crontab, timedelta
import ... | 2,078 | Python | .py | 71 | 23.591549 | 97 | 0.584461 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,506 | conf.py | mozilla_MozDef/docs/source/conf.py | import datetime
# -*- coding: utf-8 -*-
#
# MozDef documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 19 10:09:37 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenera... | 8,422 | Python | .py | 191 | 42.497382 | 127 | 0.724666 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,507 | index.py | mozilla_MozDef/loginput/index.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import os
from bottle import route, run, response, request, default_app
from b... | 6,727 | Python | .py | 159 | 34.45283 | 159 | 0.661571 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,508 | conftest.py | mozilla_MozDef/tests/conftest.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import time
def pytest_addoption(parser):
parser.... | 2,818 | Python | .py | 45 | 56.4 | 152 | 0.702752 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,509 | unit_test_suite.py | mozilla_MozDef/tests/unit_test_suite.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from datetime import datetime, timedelta
from dateutil.... | 5,543 | Python | .py | 112 | 40.401786 | 150 | 0.658397 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,510 | http_test_suite.py | mozilla_MozDef/tests/http_test_suite.py | from webtest import TestApp
from tests.unit_test_suite import UnitTestSuite
class HTTPTestSuite(UnitTestSuite):
def setup(self):
self.app = TestApp(self.application)
super().setup()
def response_per_route(self, route):
return self.app.get(route)
def test_route_endpoints(self):
... | 514 | Python | .py | 13 | 31.923077 | 59 | 0.682828 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,511 | alert_templater.py | mozilla_MozDef/tests/alert_templater.py | import os
import sys
# Handle python2
try:
input = raw_input
except NameError:
pass
alert_name = input('Enter your alert name (Example: proxy drop executable): ')
classname = ""
for token in alert_name.split(" "):
classname += token.title()
alert_classname = "Alert{0}".format(classname)
test_alert_clas... | 1,697 | Python | .py | 33 | 46.878788 | 110 | 0.728701 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,512 | suite_helper.py | mozilla_MozDef/tests/suite_helper.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from configlib import getConfig
from kombu import Conn... | 3,667 | Python | .py | 76 | 40.552632 | 112 | 0.693277 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,513 | alert_test_suite.py | mozilla_MozDef/tests/alerts/alert_test_suite.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import os.path
import sys
import logging
from tests.un... | 11,682 | Python | .py | 219 | 43.328767 | 160 | 0.630989 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,514 | test_ldap_delete.py | mozilla_MozDef/tests/alerts/test_ldap_delete.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_aler... | 3,564 | Python | .py | 82 | 35.463415 | 149 | 0.653226 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,515 | test_old_events.py | mozilla_MozDef/tests/alerts/test_old_events.py | from .positive_alert_test_case import PositiveAlertTestCase
from .negative_alert_test_case import NegativeAlertTestCase
from .alert_test_suite import AlertTestSuite
class TestOldEvents(AlertTestSuite):
# We just create a stub, so that we can replace timestamp fields
default_event = {
"_source": {}
... | 2,458 | Python | .py | 61 | 32.770492 | 104 | 0.671554 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,516 | test_nsm_scan_address.py | mozilla_MozDef/tests/alerts/test_nsm_scan_address.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_ale... | 4,730 | Python | .py | 119 | 31.420168 | 124 | 0.630033 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,517 | test_triagebot_escalation.py | mozilla_MozDef/tests/alerts/test_triagebot_escalation.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_ale... | 3,093 | Python | .py | 76 | 32.539474 | 144 | 0.649584 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,518 | test_ldap_group.py | mozilla_MozDef/tests/alerts/test_ldap_group.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_aler... | 3,932 | Python | .py | 97 | 32.247423 | 148 | 0.63886 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,519 | test_bruteforce_ssh.py | mozilla_MozDef/tests/alerts/test_bruteforce_ssh.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_ale... | 7,174 | Python | .py | 183 | 31.010929 | 124 | 0.641596 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,520 | test_proxy_drop_executable.py | mozilla_MozDef/tests/alerts/test_proxy_drop_executable.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_aler... | 4,404 | Python | .py | 103 | 34.854369 | 160 | 0.664256 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,521 | test_proxy_drop_non_standard_port.py | mozilla_MozDef/tests/alerts/test_proxy_drop_non_standard_port.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_ale... | 3,536 | Python | .py | 85 | 33.517647 | 136 | 0.65144 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,522 | test_ssh_lateral.py | mozilla_MozDef/tests/alerts/test_ssh_lateral.py | from .positive_alert_test_case import PositiveAlertTestCase
from .negative_alert_test_case import NegativeAlertTestCase
from .alert_test_suite import AlertTestSuite
class TestSSHLateral(AlertTestSuite):
alert_filename = 'ssh_lateral'
alert_classname = 'SshLateral'
# This event is the default positive ev... | 2,601 | Python | .py | 66 | 31.393939 | 153 | 0.646989 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,523 | test_promisc_audit.py | mozilla_MozDef/tests/alerts/test_promisc_audit.py | from .positive_alert_test_case import PositiveAlertTestCase
from .negative_alert_test_case import NegativeAlertTestCase
from .alert_test_suite import AlertTestSuite
class TestPromiscAudit(AlertTestSuite):
alert_filename = "promisc_audit"
# This event is the default positive event that will cause the
# a... | 2,916 | Python | .py | 75 | 30.786667 | 105 | 0.644751 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,524 | test_auth0_vertical_password_guessing.py | mozilla_MozDef/tests/alerts/test_auth0_vertical_password_guessing.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_ale... | 4,395 | Python | .py | 99 | 35.686869 | 134 | 0.649381 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,525 | test_write_audit.py | mozilla_MozDef/tests/alerts/test_write_audit.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_ale... | 4,301 | Python | .py | 106 | 32.084906 | 127 | 0.636211 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,526 | test_ssh_access_signreleng.py | mozilla_MozDef/tests/alerts/test_ssh_access_signreleng.py | from .positive_alert_test_case import PositiveAlertTestCase
from .negative_alert_test_case import NegativeAlertTestCase
from .alert_test_suite import AlertTestSuite
class TestAlertSSHAccessSignReleng(AlertTestSuite):
alert_classname = "AlertAuthSignRelengSSH"
alert_filename = "ssh_access_signreleng"
# T... | 5,991 | Python | .py | 147 | 32.659864 | 122 | 0.646524 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,527 | test_ldap_add.py | mozilla_MozDef/tests/alerts/test_ldap_add.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_aler... | 3,553 | Python | .py | 82 | 35.329268 | 146 | 0.652124 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,528 | test_guard_duty_probe.py | mozilla_MozDef/tests/alerts/test_guard_duty_probe.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_aler... | 2,607 | Python | .py | 69 | 29.15942 | 94 | 0.624604 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,529 | test_geomodel_location.py | mozilla_MozDef/tests/alerts/test_geomodel_location.py | from datetime import datetime, timedelta
from mozdef_util.utilities.toUTC import toUTC
from tests.alerts.alert_test_suite import AlertTestSuite
from tests.alerts.negative_alert_test_case import NegativeAlertTestCase
from tests.alerts.positive_alert_test_case import PositiveAlertTestCase
import alerts.geomodel.locali... | 35,955 | Python | .py | 1,035 | 20.383575 | 98 | 0.430931 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,530 | test_cloudtrail_logging_disabled.py | mozilla_MozDef/tests/alerts/test_cloudtrail_logging_disabled.py | from .positive_alert_test_case import PositiveAlertTestCase
from .negative_alert_test_case import NegativeAlertTestCase
from .alert_test_suite import AlertTestSuite
class TestAlertCloudtrailLoggingDisabled(AlertTestSuite):
alert_filename = "cloudtrail_logging_disabled"
# This event is the default positive e... | 2,982 | Python | .py | 77 | 30.402597 | 106 | 0.643277 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,531 | test_duo_authfail.py | mozilla_MozDef/tests/alerts/test_duo_authfail.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_ale... | 3,633 | Python | .py | 90 | 32.455556 | 143 | 0.650893 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,532 | test_duo_fail_open.py | mozilla_MozDef/tests/alerts/test_duo_fail_open.py | from .positive_alert_test_case import PositiveAlertTestCase
from .negative_alert_test_case import NegativeAlertTestCase
from .alert_test_suite import AlertTestSuite
class TestAlertDuoFailOpen(AlertTestSuite):
alert_filename = "duo_fail_open"
# This event is the default positive event that will cause the
... | 2,628 | Python | .py | 64 | 33.078125 | 125 | 0.666275 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,533 | alert_test_case.py | mozilla_MozDef/tests/alerts/alert_test_case.py | from tests.alerts.alert_test_suite import AlertTestSuite
class AlertTestCase(object):
def __init__(self, description, events=[], expected_alert=None):
self.description = description
# As a result of defining our test cases as class level variables
# we need to copy each event so that other... | 1,190 | Python | .py | 23 | 43.434783 | 128 | 0.679278 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,534 | test_ldap_bruteforce_user.py | mozilla_MozDef/tests/alerts/test_ldap_bruteforce_user.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_aler... | 3,600 | Python | .py | 90 | 30.211111 | 131 | 0.607888 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,535 | test_nsm_scan_random.py | mozilla_MozDef/tests/alerts/test_nsm_scan_random.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_ale... | 4,380 | Python | .py | 110 | 31.481818 | 124 | 0.629847 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,536 | test_proxy_drop_ip.py | mozilla_MozDef/tests/alerts/test_proxy_drop_ip.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_aler... | 3,804 | Python | .py | 95 | 32.126316 | 124 | 0.64881 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,537 | test_auth0_bruteforce_user.py | mozilla_MozDef/tests/alerts/test_auth0_bruteforce_user.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_ale... | 3,748 | Python | .py | 90 | 32.855556 | 147 | 0.634842 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,538 | test_proxy_exfil_domains.py | mozilla_MozDef/tests/alerts/test_proxy_exfil_domains.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_aler... | 4,459 | Python | .py | 102 | 36.039216 | 145 | 0.673041 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,539 | test_deadman.py | mozilla_MozDef/tests/alerts/test_deadman.py | from .positive_alert_test_case import PositiveAlertTestCase
from .negative_alert_test_case import NegativeAlertTestCase
from .alert_test_suite import AlertTestSuite
class TestAlertDeadman(AlertTestSuite):
alert_filename = "deadman"
alert_classname = "broNSM"
deadman = True
default_event = {
... | 2,680 | Python | .py | 77 | 26.480519 | 106 | 0.620224 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,540 | test_trace_audit.py | mozilla_MozDef/tests/alerts/test_trace_audit.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_ale... | 3,599 | Python | .py | 89 | 32.235955 | 124 | 0.644838 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,541 | test_promisc_kernel.py | mozilla_MozDef/tests/alerts/test_promisc_kernel.py | from .positive_alert_test_case import PositiveAlertTestCase
from .negative_alert_test_case import NegativeAlertTestCase
from .alert_test_suite import AlertTestSuite
class TestPromiscKernel(AlertTestSuite):
alert_filename = "promisc_kernel"
# This event is the default positive event that will cause the
#... | 3,136 | Python | .py | 80 | 30.95 | 124 | 0.646518 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,542 | test_ssh_access.py | mozilla_MozDef/tests/alerts/test_ssh_access.py | from .positive_alert_test_case import PositiveAlertTestCase
from .negative_alert_test_case import NegativeAlertTestCase
from .alert_test_suite import AlertTestSuite
class TestAlertSSHAccess(AlertTestSuite):
alert_classname = "AlertSSHAccess"
alert_filename = "ssh_access"
# This event is the default posi... | 3,596 | Python | .py | 91 | 31.296703 | 106 | 0.639462 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,543 | test_session_opened_sensitive_user.py | mozilla_MozDef/tests/alerts/test_session_opened_sensitive_user.py | #!/usr/bin/env python
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTes... | 6,240 | Python | .py | 149 | 33.879195 | 130 | 0.656126 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,544 | test_deadman_generic.py | mozilla_MozDef/tests/alerts/test_deadman_generic.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_aler... | 3,522 | Python | .py | 88 | 32.136364 | 124 | 0.652453 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,545 | test_nsm_scan_port.py | mozilla_MozDef/tests/alerts/test_nsm_scan_port.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from .positive_alert_test_case import PositiveAlertTestCase
from .negative_ale... | 4,957 | Python | .py | 119 | 33.394958 | 256 | 0.633555 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,546 | test_alerttask.py | mozilla_MozDef/tests/alerts/lib/test_alerttask.py | import mock
import socket
import os
import sys
def reverse_lookup(ip):
if ip == '10.1.1.1':
return ('test.domain.com', ip)
if ip == '8.8.8.8':
raise socket.herror
class AlertTaskTest(object):
def teardown(self):
sys.path.remove(self.alerts_path)
sys.path.remove(self.alert... | 1,964 | Python | .py | 44 | 37.181818 | 93 | 0.649895 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,547 | test_periodic_task.py | mozilla_MozDef/tests/alerts/lib/celery_scheduler/test_periodic_task.py | import json
from alerts.lib.celery_scheduler.periodic_task import PeriodicTask, Crontab, Interval
from celery.schedules import schedule as celery_sched
from celery.schedules import crontab as celery_crontab
from datetime import datetime
class TestIntervalPeriodicTask():
def setup(self):
self.task_dict = ... | 7,463 | Python | .py | 201 | 25.905473 | 85 | 0.523816 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,548 | test_locality.py | mozilla_MozDef/tests/alerts/geomodel/test_locality.py | from datetime import datetime, timedelta
from typing import Optional
from mozdef_util.utilities.toUTC import toUTC
from mozdef_util.query_models import SearchQuery
import alerts.geomodel.config as config
import alerts.geomodel.locality as locality
from tests.unit_test_suite import UnitTestSuite
def query_interface... | 8,037 | Python | .py | 205 | 25.22439 | 77 | 0.504559 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,549 | test_alert.py | mozilla_MozDef/tests/alerts/geomodel/test_alert.py | from datetime import datetime, timedelta
from mozdef_util.utilities.toUTC import toUTC
from alerts.geomodel.alert import alert
import alerts.geomodel.locality as locality
class TestAlert:
'''Unit tests for alert generation.
'''
def test_do_not_alert_when_travel_possible(self):
evts = [
... | 3,513 | Python | .py | 86 | 27.511628 | 76 | 0.53925 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,550 | test_factors.py | mozilla_MozDef/tests/alerts/geomodel/test_factors.py | from datetime import datetime
import alerts.geomodel.alert as alert
import alerts.geomodel.factors as factors
class MockMMDB:
'''Mocks a MaxMind database connection with a dictionary of records mapping
IP adresses to dictionaries containing information about ASNs.
'''
def __init__(self, records):
... | 2,475 | Python | .py | 71 | 28.352113 | 79 | 0.639832 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,551 | test_triage_bot.py | mozilla_MozDef/tests/alerts/actions/test_triage_bot.py | import json
import alerts.actions.triage_bot as bot
import requests_mock
def _ssh_sensitive_host_alert():
return {
"_index": "alerts-201911",
"_type": "_doc",
"_id": "jY29OGBBCfj908U9z3kd",
"_version": 1,
"_score": None,
"_source": {
"utctimestamp": "2... | 23,737 | Python | .py | 548 | 27.711679 | 107 | 0.476326 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,552 | test_vpn_assignment.py | mozilla_MozDef/tests/alerts/plugins/test_vpn_assignment.py | from datetime import datetime
import os
import sys
def mock_search_fn(results):
'''Creates a search function that returns a set of results on each call.
'''
def search_fn(_query):
return results['hits']
return search_fn
class TestVPNAssignment:
def setup(self):
self.orig_path =... | 2,673 | Python | .py | 77 | 23.38961 | 80 | 0.514208 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,553 | test_ip_source_enrichment.py | mozilla_MozDef/tests/alerts/plugins/test_ip_source_enrichment.py | from alerts.plugins.ip_source_enrichment import enrich
good_ipv4 = '255.0.1.2'
good_ipv6 = '3001:4d9c:b29:12f0::'
bad_ipv4 = '192.168.0.1'
bad_ipv6 = '2001:db8:a0b:12f0::'
known_ips = [
{
'range': good_ipv4 + '/8',
'site': 'office1',
'format': '{0} known',
},
{
'range': goo... | 2,874 | Python | .py | 76 | 31.723684 | 91 | 0.607773 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,554 | test_possible_usernames.py | mozilla_MozDef/tests/alerts/plugins/test_possible_usernames.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import os
import sys
class TestPossibleUsernames:
def setup(self):
... | 3,089 | Python | .py | 96 | 19.322917 | 76 | 0.458824 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,555 | test_dhcp_assignment.py | mozilla_MozDef/tests/alerts/plugins/test_dhcp_assignment.py | import os
import sys
def mock_search_fn(result_sets):
'''Creates a search function that returns a new set of results on each
call, cycling between each set in result_sets infinitely.
`result_sets` is a list of results. One set of results from this list is
returned on each call.
'''
calls = ... | 2,611 | Python | .py | 75 | 22.213333 | 85 | 0.486078 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,556 | test_auth_sourceip_username.py | mozilla_MozDef/tests/alerts/plugins/test_auth_sourceip_username.py | from datetime import datetime
import os
import sys
def mock_search_fn(results):
'''Creates a search function that returns a set of results on each call.
'''
def search_fn(_query):
return results['hits']
return search_fn
class TestUsernameAssignment:
def setup(self):
self.orig_p... | 1,575 | Python | .py | 48 | 21.625 | 76 | 0.513245 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,557 | test_port_scan_enrichment.py | mozilla_MozDef/tests/alerts/plugins/test_port_scan_enrichment.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import os
import sys
EXAMPLE_TIMESTAMP = '2016-07-13 22:33:31.625443+00:00'
... | 2,633 | Python | .py | 73 | 22.60274 | 108 | 0.473291 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,558 | test_geomodel_ipintel_enrichment.py | mozilla_MozDef/tests/alerts/plugins/test_geomodel_ipintel_enrichment.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from alerts.plugins.geomodel_ipintel_enrichment import enrich
class TestGeoM... | 2,589 | Python | .py | 73 | 20.383562 | 69 | 0.405104 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,559 | test_loginput_index.py | mozilla_MozDef/tests/loginput/test_loginput_index.py | from .loginput_test_suite import LoginputTestSuite
class TestTestRoute(LoginputTestSuite):
routes = ['/test', '/test/']
status_code = 200
body = ''
class TestStatusRoute(LoginputTestSuite):
routes = ['/status', '/status/']
status_code = 200
body = '{"status": "ok", "service": "loginput"}'
... | 790 | Python | .py | 21 | 35.142857 | 55 | 0.62336 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,560 | loginput_test_suite.py | mozilla_MozDef/tests/loginput/loginput_test_suite.py | import os
from mozdef_util.utilities.dot_dict import DotDict
import mock
from configlib import OptionParser
from tests.http_test_suite import HTTPTestSuite
class LoginputTestSuite(HTTPTestSuite):
def setup(self):
sample_config = DotDict()
sample_config.configfile = os.path.join(os.path.dirname... | 555 | Python | .py | 13 | 37.230769 | 88 | 0.738806 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,561 | test_auth02mozdef.py | mozilla_MozDef/tests/cron/test_auth02mozdef.py | from cron.auth02mozdef import process_msg
import mozdef_client as mozdef
from mozdef_util.utilities.dot_dict import DotDict
class TestAuth0Messages():
def setup(self):
sample_event = {
'_id': '123456789101112131415',
'auth0_client': {
'name': 'auth0.js',
... | 1,979 | Python | .py | 44 | 33.477273 | 104 | 0.575428 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,562 | test_esworker_sns_sqs.py | mozilla_MozDef/tests/mq/test_esworker_sns_sqs.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from mozdef_util.utilities.dot_dict import DotDict
from... | 3,449 | Python | .py | 72 | 38.333333 | 318 | 0.604513 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,563 | test_esworker_eventtask.py | mozilla_MozDef/tests/mq/test_esworker_eventtask.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import pytz
import tzlocal
import datetime
import os
im... | 3,284 | Python | .py | 84 | 30.714286 | 85 | 0.587626 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,564 | test_triage_bot.py | mozilla_MozDef/tests/mq/plugins/test_triage_bot.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import json
import requests_mock
import mq.plugins.triage_bot as bot
class... | 5,388 | Python | .py | 130 | 29.092308 | 89 | 0.525086 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,565 | test_filterlog.py | mozilla_MozDef/tests/mq/plugins/test_filterlog.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from mq.plugins.filterlog import message
class TestFilterlog():
def setu... | 1,859 | Python | .py | 45 | 27.622222 | 136 | 0.478694 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,566 | test_cloudtrail.py | mozilla_MozDef/tests/mq/plugins/test_cloudtrail.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from mq.plugins.cloudtrail import message
class TestCloudtrailPlugin():
... | 22,856 | Python | .py | 440 | 38.5 | 5,034 | 0.65582 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,567 | test_squidFixup.py | mozilla_MozDef/tests/mq/plugins/test_squidFixup.py | import mock
from mozdef_util.utilities.toUTC import toUTC
from mq.plugins.squidFixup import message
class TestSquidFixup(object):
def setup(self):
self.plugin = message()
self.metadata = {
'index': 'events'
}
# Should never match and be modified by the plugin
def tes... | 24,009 | Python | .py | 526 | 35.110266 | 179 | 0.568469 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,568 | test_stackdriver_syslog.py | mozilla_MozDef/tests/mq/plugins/test_stackdriver_syslog.py | from mozdef_util.utilities.toUTC import toUTC
from mq.plugins.stackdriver_syslog import message
class TestStackDriverSyslog(object):
def setup(self):
self.plugin = message()
self.metadata = {"index": "events"}
# Should never match and be modified by the plugin
def test_notags_log(self):
... | 7,496 | Python | .py | 173 | 30.236994 | 109 | 0.513891 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,569 | test_parse_sshd.py | mozilla_MozDef/tests/mq/plugins/test_parse_sshd.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import copy
from mq.plugins.parse_sshd import message
accept_message = {}
ac... | 12,383 | Python | .py | 250 | 42.436 | 166 | 0.675226 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,570 | test_vulnerability.py | mozilla_MozDef/tests/mq/plugins/test_vulnerability.py | from mq.plugins.vulnerability import message
class TestVulnerabilityMessageV1():
def setup(self):
self.msgobj = message()
self.msg = {}
self.msg['description'] = 'system vulnerability management automation'
self.msg['utctimestamp'] = '2015-01-21T15:33:51.136378+00:00'
self... | 4,212 | Python | .py | 85 | 38.952941 | 117 | 0.570595 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,571 | test_lower_keys.py | mozilla_MozDef/tests/mq/plugins/test_lower_keys.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from mq.plugins.lower_keys import message
class TestLowerKeysPlugin():
d... | 2,438 | Python | .py | 74 | 20.364865 | 69 | 0.470064 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,572 | test_stackdriver_audit.py | mozilla_MozDef/tests/mq/plugins/test_stackdriver_audit.py | from mozdef_util.utilities.toUTC import toUTC
from mq.plugins.stackdriver_audit import message
class TestStackDriverAudit(object):
def setup(self):
self.plugin = message()
self.metadata = {"index": "events"}
# Should never match and be modified by the plugin
def test_notags_log(self):
... | 16,321 | Python | .py | 309 | 36.139159 | 184 | 0.513786 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,573 | test_github_webhooks.py | mozilla_MozDef/tests/mq/plugins/test_github_webhooks.py | from mq.plugins.github_webhooks import message
class TestGithubWebhooksFixup(object):
def setup(self):
self.plugin = message()
self.metadata = {
'index': 'events'
}
def verify_metadata(self, metadata):
assert metadata['index'] == 'events'
def test_defaults(sel... | 217,979 | Python | .py | 3,226 | 47.295722 | 717 | 0.518336 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,574 | test_suricataFixup.py | mozilla_MozDef/tests/mq/plugins/test_suricataFixup.py | import json
import random
import string
from mozdef_util.utilities.toUTC import toUTC
from mq.plugins.suricataFixup import message
class TestSuricataFixup(object):
def setup(self):
self.plugin = message()
self.metadata = {
'index': 'events'
}
# Should never match and be ... | 22,584 | Python | .py | 563 | 28.046181 | 189 | 0.517378 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,575 | test_remove_dots.py | mozilla_MozDef/tests/mq/plugins/test_remove_dots.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from mq.plugins.remove_dots import message
class TestRemoveDotsPlugin():
... | 3,158 | Python | .py | 94 | 18.62766 | 69 | 0.409493 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,576 | test_stackdriver.py | mozilla_MozDef/tests/mq/plugins/test_stackdriver.py | from mozdef_util.utilities.toUTC import toUTC
from mq.plugins.stackdriver import message
class TestStackDriver(object):
def setup(self):
self.plugin = message()
self.metadata = {"index": "events"}
# Should never match and be modified by the plugin
def test_nodetails_log(self):
met... | 9,388 | Python | .py | 195 | 31.369231 | 156 | 0.482518 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,577 | test_parse_su.py | mozilla_MozDef/tests/mq/plugins/test_parse_su.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import copy
from mq.plugins.parse_su import message
session_su = {}
session_... | 4,219 | Python | .py | 93 | 38.849462 | 101 | 0.660396 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,578 | test_broFixup.py | mozilla_MozDef/tests/mq/plugins/test_broFixup.py | from mozdef_util.utilities.toUTC import toUTC
import mock
import json
from mq.plugins.broFixup import message
class TestBroFixup(object):
def setup(self):
self.plugin = message()
self.metadata = {
'index': 'events'
}
# Should never match and be modified by the plugin
... | 96,270 | Python | .py | 2,092 | 34.861855 | 1,913 | 0.560629 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,579 | test_large_strings.py | mozilla_MozDef/tests/mq/plugins/test_large_strings.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from mq.plugins.large_strings import message
class TestLargeStrings():
d... | 2,892 | Python | .py | 87 | 23.172414 | 69 | 0.518598 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,580 | test_stackdriver_gceactivity.py | mozilla_MozDef/tests/mq/plugins/test_stackdriver_gceactivity.py | from mozdef_util.utilities.toUTC import toUTC
from mq.plugins.stackdriver_gceactivity import message
class TestStackDriverGCEActivity(object):
def setup(self):
self.plugin = message()
self.metadata = {"index": "events"}
def test_notags_log(self):
metadata = {"index": "events"}
... | 10,898 | Python | .py | 228 | 32.267544 | 189 | 0.499859 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,581 | test_ldap_fixup.py | mozilla_MozDef/tests/mq/plugins/test_ldap_fixup.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from mq.plugins.ldap_fixup import message
class TestLdapFixupPlugin():
d... | 4,316 | Python | .py | 114 | 24.657895 | 79 | 0.471459 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,582 | test_guardduty.py | mozilla_MozDef/tests/mq/plugins/test_guardduty.py | from mozdef_util.utilities.toUTC import toUTC
from mq.plugins.guardDuty import message
class TestGuardDuty(object):
def setup(self):
self.plugin = message()
self.metadata = {"index": "events"}
# Should never match and be modified by the plugin
def test_nosource_log(self):
metadata... | 78,588 | Python | .py | 1,458 | 29.866255 | 264 | 0.42284 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,583 | test_zoom_fixup.py | mozilla_MozDef/tests/mq/plugins/test_zoom_fixup.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from mq.plugins.zoom_fixup import message
class TestZoomFixupPlugin():
d... | 17,118 | Python | .py | 467 | 21.56531 | 89 | 0.411981 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,584 | rest_test_suite.py | mozilla_MozDef/tests/rest/rest_test_suite.py | import os
import sys
import mock
import importlib
from configlib import OptionParser
from pymongo import MongoClient
from mozdef_util.utilities.dot_dict import DotDict
from tests.http_test_suite import HTTPTestSuite
class RestTestDict(DotDict):
@property
def __dict__(self):
return self
class RestT... | 1,038 | Python | .py | 28 | 31 | 88 | 0.7 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,585 | test_rest_index.py | mozilla_MozDef/tests/rest/test_rest_index.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from datetime import datetime
import json
import os
im... | 11,128 | Python | .py | 279 | 31.032258 | 95 | 0.599907 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,586 | test_event.py | mozilla_MozDef/tests/mozdef_util/test_event.py | from mozdef_util.event import Event
from mozdef_util.utilities.toUTC import toUTC
import socket
class MockHostname(object):
def hostname(self):
return 'randomhostname'
class TestEvent(object):
def setup(self):
self.params = {
'summary': 'example summary',
'somefield'... | 3,543 | Python | .py | 77 | 36.831169 | 100 | 0.608796 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,587 | test_geo_ip.py | mozilla_MozDef/tests/mozdef_util/test_geo_ip.py | from mozdef_util.geo_ip import GeoIP
class TestGeoIPLookup(object):
# Unfortunately since the db file is not present by default
# we verify the error
def test_without_db_file(self):
geo_ip = GeoIP("nonexistent_db")
geo_dict = geo_ip.lookup_ip('129.21.1.40')
assert geo_dict['error']... | 347 | Python | .py | 8 | 37.625 | 63 | 0.679525 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,588 | test_plugin_set.py | mozilla_MozDef/tests/mozdef_util/test_plugin_set.py | import os
from mozdef_util.plugin_set import PluginSet
class TestPluginSet(object):
def setup(self):
self.plugin_dir = os.path.join(os.path.dirname(__file__), 'test_plugins')
self.plugin_set = PluginSet(self.plugin_dir)
self.metadata = {
'index': 'test',
}
def tes... | 6,306 | Python | .py | 127 | 40.559055 | 93 | 0.642567 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,589 | test_bulk_queue.py | mozilla_MozDef/tests/mozdef_util/test_bulk_queue.py | import time
from mozdef_util.bulk_queue import BulkQueue
from mozdef_util.query_models import SearchQuery, ExistsMatch
from tests.unit_test_suite import UnitTestSuite
class BulkQueueTest(UnitTestSuite):
def setup(self):
super().setup()
def num_objects_saved(self):
self.refresh(self.event_in... | 4,352 | Python | .py | 105 | 33.028571 | 80 | 0.617062 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,590 | test_state.py | mozilla_MozDef/tests/mozdef_util/test_state.py | import pytest
import os
from mozdef_util.state import State, StateParsingError
states_directory_location = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'states')
class TestStateBasicInit(object):
def test_basic_initializer(self):
state_path = os.path.join(states_directory_location, 'example_... | 1,758 | Python | .py | 38 | 38.763158 | 94 | 0.680515 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,591 | test_elasticsearch_client.py | mozilla_MozDef/tests/mozdef_util/test_elasticsearch_client.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from datetime import datetime, timedelta
import json
im... | 21,670 | Python | .py | 461 | 36.843818 | 219 | 0.616544 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,592 | test_dict2List.py | mozilla_MozDef/tests/mozdef_util/utilities/test_dict2List.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://website.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import datetime
from mozdef_util.utilities.dict2List i... | 30,096 | Python | .py | 535 | 37.414953 | 1,617 | 0.466412 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,593 | test_toUTC.py | mozilla_MozDef/tests/mozdef_util/utilities/test_toUTC.py | from datetime import datetime, date
from dateutil.parser import parse
import importlib
import sys
import pytz
import tzlocal
from mozdef_util.utilities.toUTC import toUTC
UTC_TIMEZONE_COUNT = 0
def utc_timezone():
''' This is a mock function, so when we run tests
we trick the system into thinking we're... | 3,944 | Python | .py | 91 | 36.142857 | 78 | 0.653595 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,594 | test_key_exists.py | mozilla_MozDef/tests/mozdef_util/utilities/test_key_exists.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from mozdef_util.utilities.key_exists import key_exists... | 1,312 | Python | .py | 29 | 35.241379 | 94 | 0.613815 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,595 | test_dot_dict.py | mozilla_MozDef/tests/mozdef_util/utilities/test_dot_dict.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import pytest
from mozdef_util.utilities.dot_dict imp... | 1,707 | Python | .py | 45 | 29.311111 | 88 | 0.576015 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,596 | test_query_string_match.py | mozilla_MozDef/tests/mozdef_util/query_models/test_query_string_match.py | from .positive_test_suite import PositiveTestSuite
from .negative_test_suite import NegativeTestSuite
from mozdef_util.query_models import QueryStringMatch
hostname_test_regex = r'hostname: /(.*\.)*(groupa|groupb)\.(.*\.)*subdomain\.(.*\.)*.*/'
filename_matcher = r'summary: /.*\.(exe|sh)/'
# Note that this has pote... | 5,040 | Python | .py | 110 | 29.509091 | 109 | 0.469931 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,597 | test_terms_match.py | mozilla_MozDef/tests/mozdef_util/query_models/test_terms_match.py | from .positive_test_suite import PositiveTestSuite
from .negative_test_suite import NegativeTestSuite
from mozdef_util.query_models import TermsMatch
class TestTermsMatchPositiveTestSuite(PositiveTestSuite):
def query_tests(self):
tests = [
[
TermsMatch('summary', ['test']), [... | 1,509 | Python | .py | 42 | 21.952381 | 64 | 0.454856 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,598 | test_term_match.py | mozilla_MozDef/tests/mozdef_util/query_models/test_term_match.py | from .positive_test_suite import PositiveTestSuite
from .negative_test_suite import NegativeTestSuite
from mozdef_util.query_models import TermMatch
class TestTermMatchPositiveTestSuite(PositiveTestSuite):
def query_tests(self):
tests = [
[
TermMatch('summary', 'test'), [
... | 3,800 | Python | .py | 110 | 17.9 | 75 | 0.358752 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,599 | query_test_suite.py | mozilla_MozDef/tests/mozdef_util/query_models/query_test_suite.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from mozdef_util.query_models import SearchQuery
from ... | 1,606 | Python | .py | 34 | 35.705882 | 75 | 0.616517 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |