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,700 | initial_setup.py | mozilla_MozDef/scripts/setup/initial_setup.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
import argparse
from datetime import datetime, timedel... | 8,576 | Python | .py | 184 | 42.5 | 121 | 0.722954 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,701 | insert_loginput.py | mozilla_MozDef/scripts/ingest/insert_loginput.py | #!/usr/bin/env python
import time
import optparse
import mozdef_client as mozdef
parser = optparse.OptionParser()
parser.add_option('--loginput_host', help='MozDef Loginput host (default: http://127.0.0.1:8080)', default='http://127.0.0.1:8080')
parser.add_option('--num_times', help='Number of times event is sent to... | 1,168 | Python | .py | 33 | 28.909091 | 131 | 0.615044 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,702 | insert_sqs.py | mozilla_MozDef/scripts/ingest/insert_sqs.py | import json
import boto3
# AWS SQS Queue URL and access & secret keys
QUEUE = ''
ACCESS_KEY_ID = ''
SECRET_KEY = ''
REGION = 'us-west-2'
# Contents of the message to send to SQS
MESSAGE_BODY = {}
def main():
session = boto3.session.Session(
aws_access_key_id=ACCESS_KEY_ID,
aws_secret_access_ke... | 629 | Python | .py | 22 | 24 | 52 | 0.652685 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,703 | insert_rabbitmq.py | mozilla_MozDef/scripts/ingest/insert_rabbitmq.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
#
# Simple sample code to generate an event and deposit... | 2,656 | Python | .py | 64 | 37.828125 | 105 | 0.715614 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,704 | insert_elasticsearch.py | mozilla_MozDef/scripts/ingest/insert_elasticsearch.py | #!/usr/bin/env python
from datetime import datetime
import optparse
import random
import socket
import time
from mozdef_util.utilities.toUTC import toUTC
from mozdef_util.elasticsearch_client import ElasticsearchClient
# A utility function to generate random ips to fill into event
def random_ip():
return str(r... | 1,741 | Python | .py | 50 | 29.9 | 134 | 0.673615 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,705 | populate_sample_events.py | mozilla_MozDef/scripts/demo/populate_sample_events.py | import glob
import os
import optparse
import random
import hjson
import time
from datetime import datetime
from mozdef_util.utilities.toUTC import toUTC
from mozdef_util.elasticsearch_client import ElasticsearchClient
def handle_event(event):
timestamp = toUTC(datetime.now()).isoformat()
event['timestamp'] =... | 2,497 | Python | .py | 59 | 36.610169 | 138 | 0.685338 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,706 | setup.py | mozilla_MozDef/mozdef_util/setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
import os
from setuptools import setup, find_packages
readme_path = os.path.join(os.path.dirname(__file__), 'README.rst')
with open(readme_path) as readme_file:
readme = readme_file.read()
history_path = os.path.join(os.path.dirname(__file__)... | 1,831 | Python | .py | 57 | 27.157895 | 74 | 0.624434 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,707 | state.py | mozilla_MozDef/mozdef_util/mozdef_util/state.py | import json
class StateParsingError(ValueError):
pass
class State:
def __init__(self, filename):
'''Set the filename and populate self.data by calling self.read_stat_file()'''
self.filename = filename
self.read()
def read(self):
'''Populate self.data by reading and parsi... | 859 | Python | .py | 22 | 30.136364 | 89 | 0.595668 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,708 | geo_ip.py | mozilla_MozDef/mozdef_util/mozdef_util/geo_ip.py | import geoip2.database
class GeoIP(object):
def __init__(self, db_location):
try:
self.db = geoip2.database.Reader(db_location)
except IOError:
self.error = 'No Geolite DB Found!'
def lookup_ip(self, ip):
if hasattr(self, 'error'):
return {'error': ... | 1,338 | Python | .py | 32 | 32.375 | 76 | 0.59 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,709 | event.py | mozilla_MozDef/mozdef_util/mozdef_util/event.py | from datetime import datetime
import socket
from .utilities.toUTC import toUTC
class Event(dict):
# We set default vaules so that we can later
# create an alert around these, and know when events
# have to use defaults
DEFAULT_STRING = 'UNKNOWN'
DEFAULT_TYPE = 'event'
def add_required_field... | 1,716 | Python | .py | 42 | 31.547619 | 73 | 0.590174 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,710 | bulk_queue.py | mozilla_MozDef/mozdef_util/mozdef_util/bulk_queue.py | from threading import Thread, Lock
import time
class BulkQueue():
def __init__(self, es_client, threshold=10, flush_time=30):
self.es_client = es_client
self.threshold = threshold
self.list = list()
self.flush_time = flush_time
self.flush_thread = Thread(target=self.flush_... | 1,615 | Python | .py | 50 | 23.34 | 68 | 0.572347 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,711 | __init__.py | mozilla_MozDef/mozdef_util/mozdef_util/__init__.py | # -*- coding: utf-8 -*-
"""Top-level package for MozDef Util."""
__author__ = """Mozilla Infosec"""
__email__ = 'infosec@mozilla.com'
__version__ = '1.0.0'
| 158 | Python | .py | 5 | 30.2 | 40 | 0.596026 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,712 | plugin_set.py | mozilla_MozDef/mozdef_util/mozdef_util/plugin_set.py | import os
import pynsive
import importlib
from operator import itemgetter
from .utilities.dict2List import dict2List
from .utilities.logger import logger
class PluginSet(object):
def __init__(self, plugin_location, enabled_plugins=None):
self.plugin_location = plugin_location
self.enabled_plugins... | 4,225 | Python | .py | 84 | 37.630952 | 142 | 0.610276 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,713 | elasticsearch_client.py | mozilla_MozDef/mozdef_util/mozdef_util/elasticsearch_client.py | import json
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
from elasticsearch.exceptions import NotFoundError
from elasticsearch.helpers import bulk, BulkIndexError
from .query_models import SearchQuery, TermMatch, AggregatedResults, SimpleResults
from .bulk_queue import BulkQueue
from ... | 7,285 | Python | .py | 152 | 39.394737 | 151 | 0.653119 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,714 | toUTC.py | mozilla_MozDef/mozdef_util/mozdef_util/utilities/toUTC.py | from datetime import datetime
from dateutil.parser import parse
import pytz
import math
import tzlocal
LOCAL_TIMEZONE = tzlocal.get_localzone()
def toUTC(suspectedDate):
'''make a UTC date out of almost anything'''
utc = pytz.UTC
objDate = None
if type(suspectedDate) == datetime:
objDate = su... | 1,924 | Python | .py | 49 | 30.489796 | 97 | 0.627807 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,715 | is_ip.py | mozilla_MozDef/mozdef_util/mozdef_util/utilities/is_ip.py | import netaddr
def is_ip(ip):
try:
netaddr.IPNetwork(ip)
return True
except Exception:
return False
| 134 | Python | .py | 7 | 13.285714 | 29 | 0.632 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,716 | dot_dict.py | mozilla_MozDef/mozdef_util/mozdef_util/utilities/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
class DotDict(dict):
'''dict.item notation for dic... | 1,396 | Python | .py | 37 | 29.648649 | 69 | 0.577236 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,717 | key_exists.py | mozilla_MozDef/mozdef_util/mozdef_util/utilities/key_exists.py |
def key_exists(search_key, inputed_dict):
'''
Given a search key which is dot notated
return wether or not that key exists in a dictionary
'''
num_levels = search_key.split(".")
if len(num_levels) == 0:
return False
current_pointer = inputed_dict
for updated_key in num_levels:
... | 613 | Python | .py | 18 | 26.333333 | 58 | 0.627946 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,718 | __init__.py | mozilla_MozDef/mozdef_util/mozdef_util/utilities/__init__.py | from .dict2List import dict2List
from .toUTC import toUTC
from .logger import logger
__all__ = ['dict2List', 'toUTC', 'logger']
| 129 | Python | .py | 4 | 31 | 42 | 0.75 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,719 | is_cef.py | mozilla_MozDef/mozdef_util/mozdef_util/utilities/is_cef.py | def isCEF(aDict):
# determine if this is a CEF event
# could be an event posted to the /cef http endpoint
if 'endpoint' in aDict and aDict['endpoint'] == 'cef':
return True
# maybe it snuck in some other way
# check some key CEF indicators (the header fields)
if 'fields' in aDict and isi... | 824 | Python | .py | 16 | 44.5 | 105 | 0.669554 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,720 | logger.py | mozilla_MozDef/mozdef_util/mozdef_util/utilities/logger.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 logging
import sys
from datetime import datetime... | 1,164 | Python | .py | 31 | 33.064516 | 94 | 0.727921 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,721 | dict2List.py | mozilla_MozDef/mozdef_util/mozdef_util/utilities/dict2List.py | from datetime import datetime
def dict2List(value):
'''Convert dictionaries into a list of keys and values,
with strings in lowercase and datetimes converted to isoformat.
'''
if isinstance(value, dict):
for key, val in value.items():
yield from dict2List(key)
yield fr... | 606 | Python | .py | 18 | 26.5 | 67 | 0.654701 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,722 | remove_at.py | mozilla_MozDef/mozdef_util/mozdef_util/utilities/remove_at.py | def removeAt(astring):
'''remove the leading @ from a string'''
return astring.replace('@', '')
| 104 | Python | .py | 3 | 31 | 44 | 0.643564 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,723 | to_unicode.py | mozilla_MozDef/mozdef_util/mozdef_util/utilities/to_unicode.py | def toUnicode(obj):
if not isinstance(obj, str):
obj = str(obj)
return obj
| 91 | Python | .py | 4 | 17.75 | 32 | 0.62069 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,724 | aggregation.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/aggregation.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 elasticsearch_dsl import A
def Aggregation(fiel... | 413 | Python | .py | 8 | 49.5 | 69 | 0.7625 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,725 | phrase_match.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/phrase_match.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 elasticsearch_dsl import Q
def PhraseMatch(key,... | 374 | Python | .py | 8 | 44.625 | 69 | 0.742382 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,726 | term_match.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/term_match.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 elasticsearch_dsl import Q
def TermMatch(key, v... | 365 | Python | .py | 8 | 43.5 | 69 | 0.738636 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,727 | subnet_match.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/subnet_match.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 ipaddress
from .query_string_match import Query... | 528 | Python | .py | 11 | 45.454545 | 69 | 0.730469 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,728 | range_match.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/range_match.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 elasticsearch_dsl import Q
def RangeMatch(field... | 426 | Python | .py | 8 | 51.125 | 75 | 0.728814 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,729 | wildcard_match.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/wildcard_match.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 elasticsearch_dsl import Q
def WildcardMatch(ke... | 372 | Python | .py | 8 | 44.375 | 69 | 0.743733 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,730 | aggregated_results.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/aggregated_results.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
def AggregatedResults(input_results):
converted_re... | 1,113 | Python | .py | 29 | 30.551724 | 98 | 0.602041 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,731 | search_query.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/search_query.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.toUTC import toUTC
from da... | 2,554 | Python | .py | 53 | 40.075472 | 124 | 0.657407 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,732 | exists_match.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/exists_match.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 elasticsearch_dsl import Q
def ExistsMatch(fiel... | 370 | Python | .py | 8 | 44.125 | 69 | 0.756303 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,733 | __init__.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/__init__.py | from .aggregated_results import AggregatedResults
from .aggregation import Aggregation
from .boolean_match import BooleanMatch
from .exists_match import ExistsMatch
from .phrase_match import PhraseMatch
from .query_string_match import QueryStringMatch
from .range_match import RangeMatch
from .search_query import Search... | 561 | Python | .py | 14 | 39.071429 | 49 | 0.870201 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,734 | query_string_match.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/query_string_match.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 elasticsearch_dsl import Q
def QueryStringMatch... | 379 | Python | .py | 8 | 45.25 | 69 | 0.759563 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,735 | terms_match.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/terms_match.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 elasticsearch_dsl import Q
def TermsMatch(key, ... | 366 | Python | .py | 8 | 43.625 | 69 | 0.739377 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,736 | less_than_match.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/less_than_match.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 elasticsearch_dsl import Q
def LessThanMatch(fi... | 397 | Python | .py | 8 | 47.5 | 69 | 0.734375 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,737 | simple_results.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/simple_results.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
def SimpleResults(input_results):
converted_result... | 723 | Python | .py | 21 | 27.285714 | 69 | 0.601148 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,738 | boolean_match.py | mozilla_MozDef/mozdef_util/mozdef_util/query_models/boolean_match.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 elasticsearch_dsl import Q
def BooleanMatch(mus... | 417 | Python | .py | 8 | 50 | 69 | 0.735149 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,739 | mozdefalertactions.service | mozilla_MozDef/systemdfiles/alert/mozdefalertactions.service | [Unit]
Description=uWSGI MozDef Alert Actions Service
After=rabbitmq-server.service
[Service]
# Requires systemd version 211 or newer
PermissionsStartOnly=true
ExecStartPre=-/usr/bin/mkdir -p /var/run/mozdef-alerts
ExecStartPre=/usr/bin/chown -R mozdef:mozdef /var/run/mozdef-alerts
User=mozdef
Group=mozdef
ExecStart=/... | 585 | Python | .tac | 19 | 29.684211 | 134 | 0.842199 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,740 | alertactions.rst | mozilla_MozDef/docs/source/installation/manual/mozdef_services/alertactions.rst | Alert Actions
*************
The Alert Actions service consists of pluggable modules that perform certain actions if certain alerts are detected. These actions are simply python files, so actions like sending an email or triggering a pagerduty notification are possible.
These actions are stored in `/opt/mozdef/envs/mo... | 992 | Python | .tac | 17 | 55.294118 | 241 | 0.8 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,741 | 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 | .tac | 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,742 | 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 | .tac | 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,743 | 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 | .tac | 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,744 | 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 | .tac | 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,745 | stackdriver.py | mozilla_MozDef/mq/plugins/stackdriver.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 urllib
from mozdef_util.utilities.toUTC import toUTC
class message(ob... | 2,721 | Python | .tac | 55 | 36.327273 | 107 | 0.563958 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,746 | stackdriver_audit.py | mozilla_MozDef/mq/plugins/stackdriver_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 mozdef_util.utilities.toUTC import toUTC
import os
import yaml
import jme... | 3,230 | Python | .tac | 63 | 41.904762 | 151 | 0.629594 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,747 | stackdriver_gceactivity.yml | mozilla_MozDef/mq/plugins/stackdriver_gceactivity.yml | ---
gceactivity:
username: details.gceactivity.actor.user
action: details.gceactivity.event_subtype
actiongroup: details.gceactivity.event_type
resourcename: details.gceactivity.resource.name
resourcetype: details.gceactivity.resource.type
resourceid: details.gceactivity.resource.id
projec... | 438 | Python | .tac | 11 | 35.363636 | 51 | 0.803279 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,748 | stackdriver_syslog.py | mozilla_MozDef/mq/plugins/stackdriver_syslog.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 mozdef_util.utilities.toUTC import toUTC
class message(object):
def... | 1,828 | Python | .tac | 40 | 37.2 | 89 | 0.628652 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,749 | stackdriver_audit.yml | mozilla_MozDef/mq/plugins/stackdriver_audit.yml | ---
data_access:
username: details.gaudit.authenticationInfo.principalEmail
action: details.gaudit.methodName
service: details.gaudit.serviceName
serviceData: details.gaudit.serviceData
resourcename: details.gaudit.resourceName
resourcetype: details.resource.type
projectid: details.resourc... | 952 | Python | .tac | 23 | 36.695652 | 62 | 0.8125 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,750 | stackdriver_gceactivity.py | mozilla_MozDef/mq/plugins/stackdriver_gceactivity.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 mozdef_util.utilities.toUTC import toUTC
import os
import yaml
import jme... | 3,027 | Python | .tac | 62 | 39.822581 | 151 | 0.634609 | mozilla/MozDef | 2,167 | 327 | 0 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,751 | setup.py | mozilla-services_syncserver/setup.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 http://mozilla.org/MPL/2.0/.
from setuptools import setup
entry_points = """
[paste.app_factory]
main = syncserver:main
"""
setup(
name='syncser... | 408 | Python | .py | 14 | 26.857143 | 75 | 0.721939 | mozilla-services/syncserver | 1,862 | 142 | 69 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,752 | delete_user_data.py | mozilla-services_syncserver/bin/delete_user_data.py | from __future__ import print_function
#
# A helper script to delete user data from a Sync storage server.
#
# You can use this script to explicitly delete stored sync data
# for a user, without having to connect a Firefox profile and
# without having to reset their password. It may be useful if
# you've started runni... | 3,718 | Python | .py | 92 | 33.369565 | 77 | 0.649307 | mozilla-services/syncserver | 1,862 | 142 | 69 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,753 | staticnode.py | mozilla-services_syncserver/syncserver/staticnode.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 http://mozilla.org/MPL/2.0/.
"""
Simple node-assignment backend using a single, static node.
This is a greatly-simplified node-assignment backend. I... | 8,571 | Python | .py | 214 | 30.46729 | 79 | 0.588645 | mozilla-services/syncserver | 1,862 | 142 | 69 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,754 | __init__.py | mozilla-services_syncserver/syncserver/__init__.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 http://mozilla.org/MPL/2.0/.
import binascii
import os
import logging
try:
from urlparse import urlparse, urlunparse, urljoin
except ImportError:... | 12,238 | Python | .py | 247 | 42 | 79 | 0.681833 | mozilla-services/syncserver | 1,862 | 142 | 69 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,755 | syncserver.wsgi | mozilla-services_syncserver/syncserver.wsgi | # 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 http://mozilla.org/MPL/2.0/.
import os
import sys
import site
from logging.config import fileConfig
try:
from ConfigParser import NoSectionError
... | 1,204 | Python | .wsgi | 34 | 33.205882 | 86 | 0.745909 | mozilla-services/syncserver | 1,862 | 142 | 69 | MPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,756 | test_memleak.py | Alir3z4_html2text/test/test_memleak.py | import html2text
# See https://github.com/Alir3z4/html2text/issues/13 for more information.
INSTR = "miow "
def test_same_string():
h2t = html2text.HTML2Text()
result = h2t.handle(INSTR)
# Now, we shouldn't get leak of the previous run to the new one.
assert h2t.handle(INSTR) == result
def test_em... | 719 | Python | .py | 18 | 35.833333 | 87 | 0.686869 | Alir3z4/html2text | 1,794 | 273 | 95 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,757 | test_newlines_on_multiple_calls.py | Alir3z4_html2text/test/test_newlines_on_multiple_calls.py | import html2text
# See https://github.com/Alir3z4/html2text/issues/163 for more information.
def test_newline_on_multiple_calls():
h = html2text.HTML2Text()
html = "<p>test</p>"
md1 = h.handle(html)
md2 = h.handle(html)
md3 = h.handle(html)
assert md1 == md2 == md3
| 293 | Python | .py | 9 | 28.555556 | 75 | 0.676157 | Alir3z4/html2text | 1,794 | 273 | 95 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,758 | test_html2text.py | Alir3z4_html2text/test/test_html2text.py | import glob
import os
import re
import subprocess
import sys
import pytest
import html2text
skip = object()
def cleanup_eol(clean_str):
if os.name == "nt" or sys.platform == "cygwin":
# Fix the unwanted CR to CRCRLF replacement
# during text pipelining on Windows/cygwin
# on cygwin, os.... | 7,765 | Python | .py | 191 | 31.633508 | 85 | 0.585441 | Alir3z4/html2text | 1,794 | 273 | 95 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,759 | config.py | Alir3z4_html2text/html2text/config.py | import re
# Use Unicode characters instead of their ascii pseudo-replacements
UNICODE_SNOB = False
# Marker to use for marking tables for padding post processing
TABLE_MARKER_FOR_PAD = "special_marker_for_table_padding"
# Escape all special characters. Output is less readable, but avoids
# corner case formatting iss... | 4,023 | Python | .py | 143 | 25.013986 | 76 | 0.622049 | Alir3z4/html2text | 1,794 | 273 | 95 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,760 | cli.py | Alir3z4_html2text/html2text/cli.py | import argparse
import sys
from . import HTML2Text, __version__, config
def main() -> None:
baseurl = ""
class bcolors:
HEADER = "\033[95m"
OKBLUE = "\033[94m"
OKGREEN = "\033[92m"
WARNING = "\033[93m"
FAIL = "\033[91m"
ENDC = "\033[0m"
BOLD = "\033[1m... | 9,968 | Python | .py | 320 | 23.49375 | 87 | 0.591305 | Alir3z4/html2text | 1,794 | 273 | 95 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,761 | utils.py | Alir3z4_html2text/html2text/utils.py | import html.entities
from typing import Dict, List, Optional
from . import config
unifiable_n = {
html.entities.name2codepoint[k]: v
for k, v in config.UNIFIABLE.items()
if k != "nbsp"
}
def hn(tag: str) -> int:
if tag[0] == "h" and len(tag) == 2:
n = tag[1]
if "0" < n <= "9":
... | 8,279 | Python | .py | 233 | 28.67382 | 88 | 0.592565 | Alir3z4/html2text | 1,794 | 273 | 95 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,762 | __init__.py | Alir3z4_html2text/html2text/__init__.py | """html2text: Turn HTML into equivalent Markdown-structured text."""
import html.entities
import html.parser
import re
import string
import urllib.parse as urlparse
from textwrap import wrap
from typing import Dict, List, Optional, Tuple, Union
from . import config
from ._typing import OutCallback
from .elements impo... | 36,819 | Python | .py | 893 | 26.182531 | 88 | 0.471855 | Alir3z4/html2text | 1,794 | 273 | 95 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,763 | elements.py | Alir3z4_html2text/html2text/elements.py | from typing import Dict, Optional
class AnchorElement:
__slots__ = ["attrs", "count", "outcount"]
def __init__(self, attrs: Dict[str, Optional[str]], count: int, outcount: int):
self.attrs = attrs
self.count = count
self.outcount = outcount
class ListElement:
__slots__ = ["name"... | 423 | Python | .py | 12 | 29.083333 | 83 | 0.602469 | Alir3z4/html2text | 1,794 | 273 | 95 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,764 | pompem.py | rfunix_Pompem/pompem.py | #!/usr/bin/python3.5
# -*- coding: utf-8 -*-
import optparse
from core.exploit_finder import ExploitFinder
from common.print_messages import HELP_MESSAGE, BASIC_INFO_MESSAGE
def main():
parser = optparse.OptionParser(add_help_option=False)
parser.add_option("-s", "--search", dest="keywords", type="string",
... | 1,384 | Python | .py | 34 | 30.705882 | 77 | 0.571108 | rfunix/Pompem | 970 | 265 | 7 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,765 | writers.py | rfunix_Pompem/common/writers.py | #!/usr/bin/python3.5
import os
import sys
import subprocess
def write_html(dict_all_results):
"""
The write_html method read file base.html and stores in the variable
::html. In the file base.html we have two keys for usage later in
my_string.format(). These two keys are: word_search and l... | 3,454 | Python | .py | 85 | 27.435294 | 112 | 0.499256 | rfunix/Pompem | 970 | 265 | 7 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,766 | print_messages.py | rfunix_Pompem/common/print_messages.py | #!/usr/bin/python3.5
# -*- coding: utf-8 -*-
HELP_MESSAGE = """
Options:
-h, --help show this help message and exit
-s, --search <keyword,keyword,keyword> text for search
--txt Write txt File
--html Write html File
"""
BASI... | 1,972 | Python | .py | 44 | 33.590909 | 115 | 0.375065 | rfunix/Pompem | 970 | 265 | 7 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,767 | request_worker.py | rfunix_Pompem/core/request_worker.py | #!/usr/bin/python3.5
# -*- coding: utf-8 -*-
from threading import Thread
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import http.client
import json
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
class RequestWorker(Thread):
def __init__(self, url, d... | 2,036 | Python | .py | 52 | 31.365385 | 113 | 0.621266 | rfunix/Pompem | 970 | 265 | 7 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,768 | exploit_finder.py | rfunix_Pompem/core/exploit_finder.py | #!/usr/bin/python3.5
# -*- coding: utf-8 -*-
NUM_WORKERS = 5
from core.scrapers import PacketStorm, CXSecurity, ZeroDay, Vulners, \
NationaVulnerabilityDB, WpvulndbB
from common.print_messages import show_results
from common.writers import write_html, write_txt
from common.writers import open_url
from common.print... | 1,520 | Python | .py | 38 | 28.315789 | 78 | 0.571042 | rfunix/Pompem | 970 | 265 | 7 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,769 | scrapers.py | rfunix_Pompem/core/scrapers.py | #!/usr/bin/python3.5
# -*- coding: utf-8 -*-
from threading import Thread
import datetime
import re
from core.request_worker import RequestWorker, RequestWorkerHttpLib
import json
class Scraper(Thread):
def __init__(self):
Thread.__init__(self)
self.list_result = None
self.list_req_worker... | 11,219 | Python | .py | 249 | 32.975904 | 119 | 0.530122 | rfunix/Pompem | 970 | 265 | 7 | GPL-3.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,770 | setup.py | mqtt-tools_mqttwarn/setup.py | # -*- coding: utf-8 -*-
# (c) 2014-2023 The mqttwarn developers
import os
import platform
import sys
from setuptools import find_packages, setup
from versioningit import get_cmdclasses
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, "README.rst")).read()
requires = [
"attrs<23"... | 6,906 | Python | .py | 232 | 23.637931 | 95 | 0.580228 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,771 | configuration.py | mqtt-tools_mqttwarn/mqttwarn/configuration.py | # -*- coding: utf-8 -*-
# (c) 2014-2023 The mqttwarn developers
import ast
import codecs
import logging
import os
import re
import sys
import typing as t
from configparser import Interpolation, NoOptionError, NoSectionError, RawConfigParser
from mqttwarn.util import load_functions
HAVE_TLS = True
try:
import ssl
... | 8,992 | Python | .py | 211 | 33.379147 | 117 | 0.605115 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,772 | context.py | mqtt-tools_mqttwarn/mqttwarn/context.py | # -*- coding: utf-8 -*-
# (c) 2014-2023 The mqttwarn developers
import logging
import typing as t
import attr
from mqttwarn.configuration import Config
from mqttwarn.model import Service, TdataType, TopicTargetType
from mqttwarn.util import load_function, sanitize_function_name
logger = logging.getLogger(__name__)
... | 8,105 | Python | .py | 186 | 33.612903 | 117 | 0.602792 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,773 | util.py | mqtt-tools_mqttwarn/mqttwarn/util.py | # (c) 2014-2023 The mqttwarn developers
import functools
import importlib.machinery
try:
from importlib.resources import files as resource_files # type: ignore[attr-defined]
except ImportError:
from importlib_resources import files as resource_files # type: ignore[no-redef]
import importlib.util
import json... | 8,109 | Python | .py | 216 | 30.944444 | 109 | 0.64636 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,774 | cron.py | mqtt-tools_mqttwarn/mqttwarn/cron.py | # -*- coding: utf-8 -*-
# (c) 2014-2023 The mqttwarn developers
import logging
import threading
import typing as t
from mqttwarn.model import Service
logger = logging.getLogger(__name__)
# This class, shamelessly stolen from https://gist.github.com/cypreess/5481681
# The `srv` bits are added for mqttwarn
class Peri... | 2,539 | Python | .py | 82 | 22.536585 | 86 | 0.583061 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,775 | __init__.py | mqtt-tools_mqttwarn/mqttwarn/__init__.py | # -*- coding: utf-8 -*-
# (c) 2014-2023 The mqttwarn developers
__author__ = "Jan-Piet Mens <jpmens()gmail.com>, Ben Jones <ben.jones12()gmail.com>"
__copyright__ = "Copyright 2014-2022 Jan-Piet Mens"
__license__ = "Eclipse Public License - v 2.0 (http://www.eclipse.org/legal/epl-2.0/)"
try:
from importlib.metada... | 481 | Python | .py | 10 | 46 | 86 | 0.707265 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,776 | core.py | mqtt-tools_mqttwarn/mqttwarn/core.py | # -*- coding: utf-8 -*-
# (c) 2014-2023 The mqttwarn developers
try:
from importlib.resources import files as resource_files # type: ignore[attr-defined]
except ImportError:
from importlib_resources import files as resource_files # type: ignore[no-redef]
import logging
import os
import socket
import sys
impo... | 30,885 | Python | .py | 691 | 36.114327 | 119 | 0.640376 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,777 | model.py | mqtt-tools_mqttwarn/mqttwarn/model.py | # -*- coding: utf-8 -*-
# (c) 2021-2023 The mqttwarn developers
import dataclasses
import platform
import sys
import typing as t
from dataclasses import dataclass, field
from functools import total_ordering
from logging import Logger
from typing import Dict, Optional, Union
from mqttwarn import __version__
# Type def... | 4,053 | Python | .py | 108 | 31.407407 | 108 | 0.653885 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,778 | commands.py | mqtt-tools_mqttwarn/mqttwarn/commands.py | # -*- coding: utf-8 -*-
# (c) 2014-2023 The mqttwarn developers
from __future__ import print_function
import codecs
import json
import logging
import os
import signal
import sys
import typing as t
from docopt import docopt
from mqttwarn import __version__
from mqttwarn.configuration import Config, load_configuration... | 5,906 | Python | .py | 132 | 37.962121 | 110 | 0.664399 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,779 | udf.py | mqtt-tools_mqttwarn/mqttwarn/examples/basic/udf.py | # -*- coding: utf-8 -*-
# mqttwarn example function extensions
import time
import copy
try:
import json
except ImportError:
import simplejson as json # type: ignore[no-redef]
def OwnTracksTopic2Data(topic):
try:
# owntracks/username/device
parts = topic.split('/')
username = parts... | 3,060 | Python | .py | 72 | 36.291667 | 112 | 0.670933 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,780 | linuxnotify.py | mqtt-tools_mqttwarn/mqttwarn/services/linuxnotify.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Fabian Affolter <fabian()affolter-engineering.ch>'
__copyright__ = 'Copyright 2014 Fabian Affolter'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from gi.repository import Notify
def plugin(srv, item):
... | 1,022 | Python | .py | 25 | 34.28 | 92 | 0.645096 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,781 | slack.py | mqtt-tools_mqttwarn/mqttwarn/services/slack.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
from... | 3,480 | Python | .py | 80 | 34.7 | 117 | 0.637859 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,782 | http_urllib.py | mqtt-tools_mqttwarn/mqttwarn/services/http_urllib.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Ben Jones'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
try:
from urllib.parse import urlparse, urlencode, urljoin
from urllib.reque... | 4,411 | Python | .py | 107 | 30.626168 | 98 | 0.569792 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,783 | apprise_single.py | mqtt-tools_mqttwarn/mqttwarn/services/apprise_single.py | # -*- coding: utf-8 -*-
__author__ = 'Andreas Motl <andreas.motl@panodata.org>'
__copyright__ = 'Copyright 2020-2021 Andreas Motl'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
# https://github.com/caronc/apprise#developers
from collections import OrderedDict
import ... | 2,448 | Python | .py | 57 | 34.859649 | 116 | 0.65078 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,784 | slixmpp.py | mqtt-tools_mqttwarn/mqttwarn/services/slixmpp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Based on xmpp plugin
__originalauthor__ = 'Fabian Affolter <fabian()affolter-engineering.ch>'
__author__ = 'Remi Vincent <remi.vincent()gmail.com>'
__copyright__ = 'Copyright 2020 Remi Vincent'
__license__ = 'Eclipse Public License - v 1.0 (http://www... | 1,910 | Python | .py | 43 | 37.674419 | 107 | 0.646742 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,785 | sqlite.py | mqtt-tools_mqttwarn/mqttwarn/services/sqlite.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import sqlite3
def plugin(srv, item):
""" sqlite. Expects addrs to contain... | 1,157 | Python | .py | 30 | 32.833333 | 98 | 0.61325 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,786 | nsca.py | mqtt-tools_mqttwarn/mqttwarn/services/nsca.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import pynsca
from pynsca import NSCANotifier
def plugin(srv, item):
srv... | 1,135 | Python | .py | 30 | 32.533333 | 98 | 0.657509 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,787 | twitter.py | mqtt-tools_mqttwarn/mqttwarn/services/twitter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import twitter
def plugin(srv, item):
srv.logging.debug("*** MODULE=%s: service... | 1,070 | Python | .py | 27 | 33.740741 | 98 | 0.645411 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,788 | influxdb.py | mqtt-tools_mqttwarn/mqttwarn/services/influxdb.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Ben Jones <ben.jones12()gmail.com>'
__copyright__ = 'Copyright 2016 Ben Jones'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import requests
import logging
# disable info logging in requests module (e.g. con... | 3,671 | Python | .py | 69 | 44.826087 | 167 | 0.615818 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,789 | pushsafer.py | mqtt-tools_mqttwarn/mqttwarn/services/pushsafer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import dataclasses
from collections import OrderedDict
import os
import json
t... | 8,234 | Python | .py | 210 | 31.490476 | 111 | 0.621971 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,790 | mattermost.py | mqtt-tools_mqttwarn/mqttwarn/services/mattermost.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jp@mens.de>'
__copyright__ = 'Copyright 2018 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from six import string_types
import requests
try:
import simplejson as json
except Imp... | 2,491 | Python | .py | 64 | 31.59375 | 103 | 0.574979 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,791 | rrdtool.py | mqtt-tools_mqttwarn/mqttwarn/services/rrdtool.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'devsaurus <devsaurus@users.noreply.github.com>'
__copyright__ = 'Copyright 2015'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import re
import rrdtool
def plugin(srv, item):
srv.logging.debug("*** MOD... | 1,193 | Python | .py | 27 | 37.703704 | 98 | 0.648532 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,792 | osxsay.py | mqtt-tools_mqttwarn/mqttwarn/services/osxsay.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import subprocess
def plugin(srv, item):
srv.logging.debug("*** MODULE=%s... | 1,040 | Python | .py | 28 | 31.357143 | 98 | 0.61976 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,793 | pushover.py | mqtt-tools_mqttwarn/mqttwarn/services/pushover.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014-2019 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
# The code for pushover() between cuts was written by Mike Matz and
# grace... | 5,674 | Python | .py | 129 | 37.263566 | 112 | 0.646813 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,794 | tootpaste.py | mqtt-tools_mqttwarn/mqttwarn/services/tootpaste.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from builtins import str
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2017 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import os
import sys
f... | 1,780 | Python | .py | 51 | 27.529412 | 105 | 0.619159 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,795 | celery.py | mqtt-tools_mqttwarn/mqttwarn/services/celery.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Orhan Hirsch <orhanhenrik()gmail.com>'
__copyright__ = 'Copyright 2017 Orhan Hirsch'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import json
import celery
def plugin(srv, item):
srv.logging.debug("***... | 862 | Python | .py | 24 | 29.25 | 98 | 0.603614 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,796 | ssh.py | mqtt-tools_mqttwarn/mqttwarn/services/ssh.py | # -*- coding: utf-8 -*-
from six import string_types
__author__ = 'David Ventura'
__copyright__ = 'Copyright 2016 David Ventura'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import os
import json
import paramiko
from pipes import quote
def credentials(host, user=None, p... | 2,116 | Python | .py | 58 | 30.224138 | 109 | 0.606565 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,797 | sqlite_timestamp.py | mqtt-tools_mqttwarn/mqttwarn/services/sqlite_timestamp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__originalauthor__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__author__ = 'Kuthullu Himself <kuthullu()gmail.com>'
__copyright__ = 'Copyright 2016 Kuthullu Himself'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import sqlit... | 1,317 | Python | .py | 31 | 36.903226 | 140 | 0.630878 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,798 | dbus.py | mqtt-tools_mqttwarn/mqttwarn/services/dbus.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Fabian Affolter <fabian()affolter-engineering.ch>'
__copyright__ = 'Copyright 2014 Fabian Affolter'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import dbus
def plugin(srv, item):
"""Send a message thr... | 1,369 | Python | .py | 32 | 36.90625 | 98 | 0.646351 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |
34,799 | nntp.py | mqtt-tools_mqttwarn/mqttwarn/services/nntp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
import nntplib
from six import StringIO
from email.mime.text import MIMEText
fro... | 1,610 | Python | .py | 41 | 32.829268 | 98 | 0.617117 | mqtt-tools/mqttwarn | 952 | 183 | 45 | EPL-2.0 | 9/5/2024, 5:15:03 PM (Europe/Amsterdam) |