repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eliben/code-for-blog | 2009/csp_for_euler68/csp_sample_problems.py | 13 | 12407 | """ A collection of "worlds" suitable by solution by a CSP.
Each world has a make_XXX_SCP function that creates a new
CSP object, and some auxiliary utilities.
"""
import re, math
from collections import defaultdict
from types import StringTypes
from csplib import CSP
#-------------------------------... | unlicense | fdf932c29891fed5b4b327c3abfaecfb | 25.683742 | 102 | 0.457725 | 3.681602 | false | false | false | false |
eliben/code-for-blog | 2012/plugins_python/htmlize/iplugin.py | 1 | 2327 | #-------------------------------------------------------------------------------
# htmlize: htmlize/iplugin.py
#
# The plugin interface. Plugins that want to register with htmlize must inherit
# IPlugin.
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#------------------------------------------... | unlicense | ce6e2ade599d0a51e65c55f68f4f9e4f | 35.936508 | 80 | 0.578427 | 4.654 | false | false | false | false |
cfpb/owning-a-home-api | ratechecker/tests/test_views.py | 1 | 14027 | import json
from datetime import datetime, timedelta
from django.test import override_settings
from django.utils import timezone
from model_mommy import mommy
from rest_framework import status
from rest_framework.test import APITestCase
from ratechecker.models import Adjustment, Product, Rate, Region
from ratechecke... | cc0-1.0 | 6de36e24864bf0c61ebf93e17eeb3121 | 25.871648 | 128 | 0.337563 | 4.296172 | false | false | false | false |
mozilla-services/tokenserver | tokenserver/tests/test_remote_browserid_verifier.py | 1 | 7579 | # 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 json
import contextlib
import unittest
from pyramid.config import Configurator
from tokenserver.verifiers impor... | mpl-2.0 | a1e616ea06cbc163187eaf27ab392136 | 45.213415 | 79 | 0.628315 | 4.255474 | false | true | false | false |
mozilla-services/tokenserver | tokenserver/scripts/count_users.py | 1 | 3191 | # 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/.
"""
Script to emit total-user-count metrics for exec dashboard.
This script takes a tokenserver config file, uses it to... | mpl-2.0 | 9d711a04ba8ad0911e62cee24f80b858 | 28.546296 | 79 | 0.633657 | 3.915337 | false | true | false | false |
mozilla-services/tokenserver | tokenserver/assignment/sqlnode/migrations/versions/6569dd9a060_populate_nodeid_column_and_index.py | 1 | 1476 | # flake8: noqa
"""populate nodeid column and index
Revision ID: 6569dd9a060
Revises: 846f28d1b6f
Create Date: 2014-04-14 05:26:44.146236
This updates the values in the "nodeid" column to ensure that they match
the value in the string-based "node" column, then indexes the column for fast
node-based lookup. It should... | mpl-2.0 | 6cfb5c119188fa22187982e801ab46ba | 27.384615 | 77 | 0.678184 | 3.522673 | false | false | false | false |
onecodex/onecodex | onecodex/exceptions.py | 1 | 3218 | class OneCodexException(Exception):
pass
class MethodNotSupported(OneCodexException):
"""The object does not support this operation."""
pass
class PermissionDenied(OneCodexException):
pass
class ServerError(OneCodexException):
pass
class UnboundObject(OneCodexException):
"""To use again... | mit | 032a57055ee2c3df5056122066d6c2a6 | 29.358491 | 100 | 0.646053 | 4.408219 | false | false | false | false |
pycket/pycket | pycket/hidden_classes.py | 4 | 7665 |
from rpython.rlib import jit, unroll, rweakref
from rpython.rlib.objectmodel import specialize
def make_map_type(getter, keyclass):
class Map(object):
""" A basic implementation of a map which assigns Racket values to an index
based on the identity of the Racket value. A Map consists ... | mit | 028a412064fdc174014f3ae690b597e3 | 35.15566 | 89 | 0.589954 | 4.246537 | false | false | false | false |
onecodex/onecodex | onecodex/models/analysis.py | 1 | 2826 | from onecodex.models import OneCodexBase
class Analyses(OneCodexBase):
_resource_path = "/api/v1/analyses"
_cached_result = None
def results(self, json=True):
"""Fetch the results of an Analyses resource.
Parameters
----------
json : bool, optional
Return a JS... | mit | 2edbee16baacc7d296318991ca00111c | 28.4375 | 99 | 0.601203 | 4.558065 | false | false | false | false |
pycket/pycket | pycket/prims/continuation_marks.py | 1 | 6193 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from pycket import impersonators as imp
from pycket import values
from pycket import vector
from pycket.cont import call_cont, Cont
from pycket.error import SchemeException
from pycket.prims.expose import default, expo... | mit | c5bff62c44675d9902975060a923101d | 37.70625 | 92 | 0.647021 | 3.397148 | false | false | false | false |
onecodex/onecodex | onecodex/vendored/potion_client/links.py | 2 | 4737 | # flake8: noqa
try:
import simplejson as json
except ImportError:
import json
import re
from requests import Request
from requests.exceptions import HTTPError
from .collection import PaginatedList
from .converter import PotionJSONEncoder, PotionJSONDecoder
from .schema import Schema
class Link(object):
... | mit | 3a2b9c1a07d5c0e67360ee797a1494a4 | 35.160305 | 118 | 0.594469 | 4.283002 | false | false | false | false |
pycket/pycket | pycket/test/test_impersonators.py | 4 | 23872 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from pycket.test.testhelper import *
from pycket.values import *
from pycket.impersonators import *
from pycket.values_struct import *
import pytest
import sys
sys.setrecursionlimit(10000)
def test_impersonator_properties():
m = run_mod(
"""
#lang pycket
... | mit | 2493efe3d6212f16fe9f6bc38fbfcc86 | 33.887427 | 146 | 0.568747 | 3.036005 | false | false | false | false |
pycket/pycket | pycket/values_parameter.py | 1 | 7530 |
from pycket import values
from pycket.arity import Arity
from pycket.base import W_Object
from pycket.cont import call_cont, continuation, BaseCont
from pycket.error import SchemeException
from pycket.hash.persistent... | mit | 87d4d46d7412e91b7ffe254d536e446c | 32.918919 | 96 | 0.62656 | 3.594272 | false | false | false | false |
pycket/pycket | pycket/hash/equal.py | 2 | 19602 |
from pycket import config
from pycket import values, values_string
from pycket.base import SingletonMeta, UnhashableType
from pycket.hash.base import W_HashTable, get_dict_item, next_valid_index, w_missing
from pycket.error import SchemeException
fro... | mit | 2d6ccdf6292434a5e34c8e209e945d17 | 32.97227 | 100 | 0.624477 | 3.531256 | false | false | false | false |
onecodex/onecodex | tests/test_dataframes.py | 2 | 3650 | import pytest
pytest.importorskip("pandas") # noqa
import pandas as pd
from onecodex.analyses import AnalysisMixin
from onecodex.dataframes import ClassificationsDataFrame, ClassificationsSeries, OneCodexAccessor
def test_pandas_subclass():
inner_df = pd.DataFrame({"datum1": [7, 4, 21], "datum2": [8, 16, 24]})... | mit | 4b2f8518150c8aff4303e7aa88df5e40 | 36.628866 | 101 | 0.650137 | 3.456439 | false | true | false | false |
pycket/pycket | pycket/values_struct.py | 1 | 55181 | import itertools, sys
from pycket import config
from pycket import values
from pycket import vector as values_vector
from pycket.arity import Arity
from pycket.base import SingleResultMixin, UnhashableType
from pycket.cont import continuation, label
from pycket.error import SchemeException
from pycket.prims.expose imp... | mit | b728a9604d4dd93aa25bfd261dec5bde | 38.841877 | 138 | 0.596238 | 3.692025 | false | false | false | false |
pycket/pycket | pycket/prims/logging.py | 2 | 4642 |
from pycket import values, values_parameter, values_string
from pycket.arity import Arity
from pycket.argument_parser import ArgParser, EndOfInput
from pycket.prims.expose import default, expose, expose_val
from rpython.rlib import jit
DEBUG = values.W_Symbol.make("debug")
LOG_... | mit | d0d247617ee0dd0f4a27ac5b5ed20794 | 33.132353 | 132 | 0.649289 | 3.393275 | false | false | false | false |
pycket/pycket | pycket/values.py | 1 | 67304 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from pycket import config
from pycket.base import W_Object, W_ProtoObject, UnhashableType
from pycket.cont import continuation, label, NilCont
from pycket.env import ConsEnv
from pycket.error import Sch... | mit | e08a3f0d7a4911481cee9ad1962468b7 | 28.173819 | 210 | 0.592669 | 3.537475 | false | false | false | false |
houtianze/bypy | bypy/const.py | 1 | 8705 | #!/usr/bin/env python
# encoding: utf-8
# PYTHON_ARGCOMPLETE_OK
# from __future__ imports must occur at the beginning of the file
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
import sys
import os
# https://packaging.python.org/single_source_version/
__... | mit | 661d1ee912f5cf86c1057156863d95bf | 37.772321 | 124 | 0.744732 | 3.062412 | false | false | false | false |
kibitzr/kibitzr | kibitzr/app.py | 1 | 5995 | import logging
import signal
import time
import code
import psutil
import os
import entrypoints
from .conf import settings, SettingsParser
from .fetcher import cleanup_fetchers, persistent_firefox
from .checker import Checker
from .bootstrap import create_boilerplate
from . import timeline
logger = logging.getLogge... | mit | e8c3793bca75b52f5a9321fb52cac2aa | 31.231183 | 98 | 0.551626 | 4.447329 | false | false | false | false |
demisto/content | Packs/CommonScripts/Scripts/CalculateEntropy/CalculateEntropy.py | 2 | 1737 | import demistomock as demisto
from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import]
from CommonServerUserPython import * # noqa: E402 lgtm [py/polluting-import]
import math
import string
def calculate_shannon_entropy(data, minimum_entropy):
"""Algorithm to determine the randomness of a given ... | mit | dc34451e286ce66ad453ad0c8eaf13cc | 38.477273 | 104 | 0.640184 | 3.974828 | false | false | false | false |
demisto/content | Packs/PANWComprehensiveInvestigation/Scripts/PanwIndicatorCreateQueries/PanwIndicatorCreateQueries_test.py | 2 | 3263 | from PanwIndicatorCreateQueries import generate_ip_queries, generate_hash_queries, generate_domain_queries
def test_generate_ip_queries():
"""Unit test
Given
- generate_ip_queries command
- command args(single and multiple ips)
When
- executing generate_ip_queries command
Then
- Valida... | mit | f2508b05dc08c9ed15d6f0b8c42ff271 | 40.833333 | 109 | 0.667177 | 3.391892 | false | true | false | false |
demisto/content | Packs/ShiftManagement/Scripts/CreateChannelWrapper/CreateChannelWrapper.py | 2 | 2075 | from CommonServerPython import *
def main():
args = demisto.args()
channel_type = args.get('type')
channel_name = args.get('name')
channel_desc = args.get('description')
channel_team = args.get('team')
errors = []
integrations_to_create = []
channels_created = []
modules = demist... | mit | 31f00d97dde9ac7235a8a437ed9554d0 | 36.727273 | 127 | 0.623133 | 4.036965 | false | false | false | false |
demisto/content | Packs/Workday/Integrations/Workday_IAM/test_data/fetch_incidents_source_priority_mock_data.py | 2 | 1396 | full_report = {
"Report_Entry": [{
"Employment_Status": "Active",
"Last_Day_Of_Work": "10/05/2035",
"Last_Hire_Date": "10/05/2020",
"Emp_ID": "100122",
"Email_Address": "rrahardjo@paloaltonetworks.com"
}]
}
employee_id_to_user_profile = {
"100122": {
"employm... | mit | 6214c1a4290d998305670f9c4094d87f | 26.92 | 57 | 0.576648 | 2.902287 | false | false | true | false |
demisto/content | Packs/LogRhythmRest/Integrations/LogRhythmRest/LogRhythmRest.py | 2 | 83553 | # -*- coding: utf-8 -*-
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import json
import requests
import random
import string
from datetime import datetime, timedelta
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' ... | mit | 11eb08bdce97ed2be39f3f157a197500 | 40.713929 | 129 | 0.635537 | 2.938799 | false | false | false | false |
demisto/content | Packs/CIRCL/Integrations/CIRCL/CIRCL.py | 2 | 7040 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import requests
import json
# disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' GLOBAL VARS '''
BASE_URL = demisto.getParam('url')
USERNAME = demisto.getParam('credentials')['identifier']
PASSW... | mit | 857d08fdb467386c8697032edc84d60b | 24.6 | 113 | 0.613352 | 3.54303 | false | false | false | false |
demisto/content | Packs/NCSCCyberAsssessmentFramework/Scripts/NCSCReportDetailsC/NCSCReportDetailsC.py | 2 | 3754 | import json
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
def calculate_overall(data: dict = None) -> str:
if not data:
return ""
results = [x['Result'] for x in data]
if "Not Achieved" in results:
return "Not Achieved"
elif "Partially Achi... | mit | 075ac3d0ed7b97ce31bdab3e06b99c8d | 42.149425 | 118 | 0.570858 | 4.040904 | false | false | false | false |
demisto/content | Packs/CortexXDR/Scripts/CortexXDRIdentityInformationWidget/CortexXDRIdentityInformationWidget_test.py | 2 | 1049 | import io
import pytest
from CommonServerPython import *
import CortexXDRIdentityInformationWidget
def util_load_json(path):
with io.open(path, mode='r', encoding='utf-8') as f:
return json.loads(f.read())
@pytest.mark.parametrize('context_data, expected_result', [
(util_load_json('test_data/context... | mit | a5f6cc55ef63261c30654b534336239e | 44.608696 | 116 | 0.722593 | 3.48505 | false | true | false | false |
demisto/content | Packs/MalwareInvestigationAndResponse/Scripts/InvestigationSummaryToTable/InvestigationSummaryToTable_test.py | 2 | 1584 | import json
from pathlib import Path
from InvestigationSummaryToTable import Result, get_findings, findings_to_command_results
TEST_DATA_DIR = Path(__file__).parent / 'test_data'
def _load_test_file(file_name: str):
return json.loads((TEST_DATA_DIR / file_name).read_text())
def _dump_test_file(file_name: str,... | mit | b84bbc585c8e4ee2e4268a507030ce1e | 39.615385 | 114 | 0.67298 | 3.6 | false | true | false | false |
demisto/content | Packs/Stealthwatch_Cloud/Integrations/Stealthwatch_Cloud/Stealthwatch_Cloud.py | 2 | 17438 | import demistomock as demisto
from CommonServerPython import *
''' IMPORTS '''
import requests
import json
import os
from datetime import datetime, timedelta
import collections
# disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' GLOBAL VARS '''
SERVER = demisto.params().get('serverURL', '').s... | mit | 47303f1f4fa5f60a61809808c9d20139 | 29.91844 | 116 | 0.608212 | 3.794995 | false | false | false | false |
demisto/content | Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py | 2 | 97247 | import demistomock as demisto
from CommonServerPython import *
import json
import requests
import time
import re
class ParameterError(Exception):
""" Raised when the function parameters do not meet requirements """
pass
"""
Remediation Configuration String (RCS) that use to select SIA.
"""
class RCS:
... | mit | c2a79ba65c4a8027a295e9f74464b405 | 40.972763 | 125 | 0.566309 | 3.806132 | false | false | false | false |
demisto/content | Packs/CommonScripts/Scripts/ProvidesCommand/ProvidesCommand_test.py | 2 | 1741 | import demistomock as demisto
import json
def executeCommand(name, args=None):
if name == 'demisto-api-get' and args and 'uri' in args and args['uri'] == "/settings/integration-commands":
file_name = 'TestData/integration_commands.json'
elif name == 'demisto-api-post' and args and 'uri' in args and ar... | mit | f3ab3cdea9d19fcaf05aa0367bdd0e10 | 33.137255 | 113 | 0.649627 | 3.524291 | false | true | false | false |
demisto/content | Packs/Cryptocurrency/Scripts/CryptoCurrenciesFormat/CryptoCurrenciesFormat.py | 2 | 1206 | import demistomock as demisto
from hashlib import sha256
from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import]
from typing import Union
DIGITS58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
def decode_base58(address, length) -> bytes:
n = 0
for char in address:
... | mit | 158d3eb39603925c4de1c392808478ee | 29.15 | 107 | 0.668325 | 3.610778 | false | false | false | false |
demisto/content | Packs/Base/Scripts/WordTokenizerV2/word_tokenizer_test.py | 2 | 3412 | # coding=utf-8
from collections import defaultdict
import demistomock
from CommonServerPython import *
def get_args():
args = defaultdict(lambda: "yes")
args['encoding'] = 'utf8'
args['removeNonEnglishWords'] = 'no'
args['hashWordWithSeed'] = "5381"
args['language'] = 'English'
return args
... | mit | 8baf0378ab46646f6c309f2941e4e5fc | 36.340659 | 118 | 0.665097 | 3.230038 | false | true | false | false |
demisto/content | Packs/ProofpointServerProtection/Integrations/ProofpointProtectionServerV2/ProofpointProtectionServerV2.py | 2 | 19087 | from typing import Any, Dict, Union
import demistomock as demisto # noqa: F401
import urllib3
from CommonServerPython import * # noqa: F401
from dateparser import parse
from requests import Response
urllib3.disable_warnings()
class Client(BaseClient):
def health_check(self) -> Dict[str, str]:
return s... | mit | 9fa1dd1847d8f1c1ef4a9607de5ae19f | 38.681913 | 116 | 0.52837 | 4.193102 | false | false | false | false |
demisto/content | Packs/Attlasian/Integrations/Attlasian_IAM/Attlasian_IAM.py | 2 | 8380 | import demistomock as demisto
from CommonServerPython import *
import traceback
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
'''CLIENT CLASS'''
class Client(BaseClient):
"""
Atlassian IAM Client class that implements logic to authenticate with Atlassian.
"""
def __init__(... | mit | 99b62aecfc75d037b9144a7507af345b | 33.628099 | 114 | 0.594391 | 3.833486 | false | false | false | false |
demisto/content | Packs/UnisysStealth/Integrations/UnisysStealth/UnisysStealth.py | 2 | 6075 | import json
import os
import demistomock as demisto # noqa: F401
import requests
from CommonServerPython import * # noqa: F401
from requests.auth import HTTPBasicAuth
# disable insecure warnings
requests.packages.urllib3.disable_warnings()
USERNAME = demisto.params().get('credentials')['identifier']
PASSWORD = dem... | mit | 4b9d220442a4c1e51dcd8504ec86099e | 28.347826 | 119 | 0.564774 | 3.975785 | false | false | false | false |
demisto/content | Packs/CortexAttackSurfaceManagement/Scripts/GenerateASMReport/GenerateASMReport_test.py | 2 | 3260 | import json
import demistomock as demisto # noqa: F401
from CommonServerPython import EntryType
def util_load_json(path):
with open(path, mode="r") as f:
return json.loads(f.read())
def test_get_asm_args(mocker):
"""Tests get_asm_args helper function.
Given:
- Mock JSON that mi... | mit | bbad3661e6383345ba513a422f80869f | 29.185185 | 81 | 0.598773 | 4.064838 | false | true | false | false |
demisto/content | Packs/CortexXDR/Integrations/CortexXDRIR/CortexXDRIR.py | 2 | 63140 | import hashlib
import secrets
import string
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from CoreIRApiModule import *
from itertools import zip_longest
# Disable insecure warnings
urllib3.disable_warnings()
TIME_FORMAT = "%Y-%m-%dT%H:%M:%S"
NONCE_LENGTH = 64
API_KEY_LENG... | mit | b1e3193b464313de80ea8a66766ed6ad | 41.951701 | 126 | 0.55872 | 4.238939 | false | false | false | false |
demisto/content | Packs/Netskope/Integrations/NetskopeAPIv1/NetskopeAPIv1.py | 2 | 38749 | # type: ignore
from copy import deepcopy
from typing import Any, Dict, List, Optional, Tuple
from urllib.parse import urljoin
import urllib3
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
# disable insecure warnings
urllib3.disable_warnings()
DEFAULT_PAGE = 1
DEF... | mit | b46a704b1e57d0896fc8590fa386027f | 39.574869 | 129 | 0.569434 | 4.331917 | false | false | false | false |
demisto/content | Packs/FortiSandbox/Integrations/FortiSandbox/FortiSandbox.py | 2 | 17497 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
"""IMPORTS"""
import base64
import hashlib
import json
import os
import requests
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
"""HELPER FUNCTIONS"""
def _handle_post(post_url, data):
try:
... | mit | 1a40515ecfd0b8967b9f86257de8a909 | 33.307843 | 117 | 0.525176 | 3.955018 | false | false | false | false |
demisto/content | Packs/IronPort/Integrations/CiscoEmailSecurityApplianceIronPortV2/CiscoEmailSecurityApplianceIronPortV2.py | 1 | 64731 | from typing import Callable, Tuple
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import uuid
JWT_TOKEN_EXPIRATION_PERIOD = 30
DEFAULT_FETCH = 50
TIMESTAMP_FORMAT = "%d %b %Y %H:%M:%S (%Z +00:00)"
QUARANTINE_TIMESTAMP_FORMAT = "%d %b %Y %H:%M (%Z +00:00)"
DATETIME_FORMAT ... | mit | 47e86d13c92163d5cfefb9b5bca45f89 | 32.57417 | 110 | 0.600763 | 3.996728 | false | false | false | false |
demisto/content | Packs/ShiftManagement/Scripts/GetOnCallHoursPerUser/GetOnCallHoursPerUser_test.py | 2 | 2316 | import json
import demistomock as demisto
from GetOnCallHoursPerUser import main
ROLES = [
{
'name': 'Shift1',
'shifts': [
{'fromDay': 0, 'fromHour': 8, 'fromMinute': 0, 'toDay': 3, 'toHour': 12, 'toMinute': 0},
{'fromDay': 4, 'fromHour': 16, 'fromMinute': 0, 'toDay': 6, 't... | mit | 8042995753f7122d12d87a7c72332d63 | 24.733333 | 101 | 0.412349 | 3.472264 | false | false | false | false |
demisto/content | Packs/CommonScripts/Scripts/MarkAsNoteByTag/MarkAsNoteByTag.py | 2 | 1144 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
def mark_as_note(entries):
if isError(entries[0]):
demisto.results(
{'Type': entryTypes['error'], 'ContentsFormat': formats['text'], 'Contents': 'Unable to retrieve entries'})
else:
ids = ''
... | mit | f33ac595ba7b2c8ee5cedd4f45ec0400 | 33.666667 | 119 | 0.51049 | 4.071174 | false | false | false | false |
demisto/content | Packs/CommonScripts/Scripts/RemoveKeyFromList/RemoveKeyFromList.py | 2 | 2173 | """RemoveKeyFromList
Removes a Key from a JSON-backed List
"""
import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
from typing import Dict, Any
import traceback
''' STANDALONE FUNCTION '''
def remove_key_from_... | mit | 7351a7d1257b8d1acb64adce3aa9799b | 26.858974 | 97 | 0.64381 | 3.621667 | false | false | false | false |
demisto/content | Tests/scripts/create_artifacts_graph/create_artifacts.py | 2 | 2802 | from argparse import ArgumentParser
from pathlib import Path
from demisto_sdk.commands.content_graph.interface.neo4j.neo4j_graph import Neo4jContentGraphInterface
from demisto_sdk.commands.common.constants import MarketplaceVersions
from demisto_sdk.commands.content_graph.objects.repository import ContentDTO
from Tests... | mit | 0ffcc1afe4957a6eabc17f24ca0ffe7d | 42.78125 | 118 | 0.697359 | 3.902507 | false | false | false | false |
demisto/content | Packs/QRadar/Scripts/QRadarPrintAssets/QRadarPrintAssets.py | 2 | 1126 | import json
import demistomock as demisto # noqa: F401
import yaml
from CommonServerPython import * # noqa: F401
def main():
try:
incident = demisto.incident()
assets = incident.get('CustomFields', {}).get('assettable', {})
if not assets:
return ''
if not isinstanc... | mit | 02a98023483d47a32e6d0409060e7f76 | 29.432432 | 104 | 0.587034 | 4.398438 | false | false | false | false |
demisto/content | Packs/ThreatGrid/Integrations/FeedCiscoSecureMalwareAnalytics/FeedCiscoSecureMalwareAnalytics_test.py | 2 | 3414 | from FeedCiscoSecureMalwareAnalytics import Client, fetch_indicators, fetch_indicators_command, \
create_entity_relationships
from CommonServerPython import *
from test_data.feed_data import banking_dns_response, sinkholed_ip_dns_response
def test_fetch_indicators(requests_mock):
"""Unit test
Given
- ... | mit | b87d81fbaad0749aa41feacb45d402bc | 34.5625 | 109 | 0.650557 | 3.659164 | false | true | false | false |
demisto/content | Packs/Cybersixgill-DVE/Integrations/CybersixgillDVEEnrichment/CybersixgillDVEEnrichment_test.py | 2 | 21133 | import requests
import pytest
import json
import demistomock as demisto
cve_enrich = {
"created": "2020-06-26T00:00:00.001000Z",
"description": "A vulnerability exists that could allow the execution of unauthorized code or operating "
"system commands on systems running exacqVision Web Service versions 20... | mit | 2e55478549d57515bb9f8673fd54d491 | 43.102296 | 113 | 0.466982 | 3.904084 | false | false | false | false |
demisto/content | Packs/Nmap/Integrations/Nmap/Nmap.py | 2 | 2589 | import demistomock as demisto
from CommonServerPython import *
from libnmap.process import NmapProcess
from libnmap.parser import NmapParser
from libnmap.reportjson import ReportEncoder
if demisto.command() == 'test-module':
demisto.results('ok')
sys.exit(0)
if demisto.command() == 'nmap-scan':
nm = NmapPr... | mit | 42267751f93074624afd05f1b1e10174 | 32.192308 | 98 | 0.527231 | 3.829882 | false | false | false | false |
demisto/content | Packs/Binalyze/Integrations/BinalyzeAIR/BinalyzeAIR.py | 2 | 6625 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from typing import Dict, Any
import requests
requests.packages.urllib3.disable_warnings()
class Client(BaseClient):
def test_api(self):
return self._http_request(
method='GET',
url_suffix=... | mit | 267828e430566291fc8607e42c3e5076 | 34.810811 | 109 | 0.589736 | 4.161432 | false | false | false | false |
demisto/content | Packs/AbuseDB/Integrations/AbuseDB/AbuseDB.py | 2 | 11031 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
''' IMPORTS '''
import csv
import os
import requests
# disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' GLOBALS '''
VERBOSE = True
SERVER = demisto.params().get('server')
if not SERVER.endswith('/'):... | mit | 0c2a7bc7f304baff822e58549d89811d | 33.151703 | 120 | 0.616807 | 3.475425 | false | false | false | false |
demisto/content | Packs/FeedFireEye/Integrations/FeedFireEye/FeedFireEye_test.py | 2 | 10505 | import random
from typing import Optional
import pytest
import requests_mock
from FeedFireEye import Client, STIX21Processor, FE_CONFIDENCE_TO_REPUTATION, parse_timestamp, \
handle_first_fetch_timestamp
from freezegun import freeze_time
import demistomock as demisto
def create_client(public_key: str = 'public_k... | mit | cc50a06bca5bc690efa6803a5e536684 | 25.867008 | 120 | 0.548786 | 3.74777 | false | false | false | false |
demisto/content | Packs/illuminate/Integrations/illuminate/illuminate.py | 2 | 14661 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import requests
import traceback
from typing import Dict, Optional, List, Any, Callable, Collection
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' CONSTANTS '''
# Integrat... | mit | 005b63ed8450d56e69433e0636405423 | 36.981865 | 128 | 0.63836 | 3.489883 | false | false | false | false |
demisto/content | Utils/test_upload_flow/TestUploadFlow/Integrations/TestUploadFlow/TestUploadFlow.py | 2 | 2641 | from typing import Dict
import demistomock as demisto # noqa: F401
from CommonServerPython import *
class Client(BaseClient): # type: ignore
pass
def test_module(client: Client) -> str:
"""Tests API connectivity and authentication'
Returning 'ok' indicates that the integration works like it is suppos... | mit | 0964e862d1cd2326d8b112e32f44fc37 | 29.011364 | 105 | 0.61454 | 4.159055 | false | true | false | false |
demisto/content | Packs/BreachRx/Integrations/BreachRx/BreachRx.py | 2 | 8796 | from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
from collections.abc import Callable
import requests
import traceback
from urllib.parse import urlparse
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
fr... | mit | 6cd0c82d88e0959f5d9bb8af1a88408e | 26.232198 | 127 | 0.620282 | 3.895483 | false | false | false | false |
demisto/content | Packs/EmailCommunication/Scripts/SummarizeEmailThreads/SummarizeEmailThreads.py | 2 | 4870 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
no_entries_message = """<!DOCTYPE html>
<html>
<body>
<h3>This Incident does not contain any email threads yet.</h3>
</body>
</html>
"""
def fetch_email_threads(incident_id):
"""Fetch all Email Threads stored in the curren... | mit | cca6fef6bb5b3a2f761848a2332d196e | 38.274194 | 103 | 0.585216 | 4.30212 | false | false | false | false |
demisto/content | Packs/HealthCheck/Scripts/HealthCheckWorkers/HealthCheckWorkers.py | 2 | 4112 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from datetime import datetime
DESCRIPTION = '{} busy workers has reached {} of total workers'
RESOLUTION = 'Performance Tuning of Cortex XSOAR Server: https://docs.paloaltonetworks.com/cortex/cortex-xsoar/6-0/' \
'... | mit | b88a550b0a9f4031f4e91e2dc30ce78f | 37.792453 | 118 | 0.566391 | 3.786372 | false | false | false | false |
demisto/content | Packs/DigitalGuardian/Integrations/DigitalGuardian/DigitalGuardian.py | 2 | 20822 | from CommonServerPython import *
import json
import requests
import urllib3
from typing import List, Dict, Any, Union
# Disable insecure warnings
urllib3.disable_warnings()
'''Constants'''
CATEGORY = 'alarm' # only focus on alarms
AUTH_SERVER = demisto.getParam('auth_url')
AUTH_URL = AUTH_SERVER + '/as/token.oauth2... | mit | 497fee97740d7483ed7d5f87a3c7d98e | 37.487985 | 120 | 0.584238 | 3.738241 | false | false | false | false |
demisto/content | Packs/Ansible_Powered_Integrations/Integrations/CiscoNXOS/CiscoNXOS.py | 2 | 18209 | import json
import traceback
from typing import Dict, cast
import ansible_runner
import demistomock as demisto # noqa: F401
import ssh_agent_setup
from CommonServerPython import * # noqa: F401
# Dict to Markdown Converter adapted from https://github.com/PolBaladas/torsimany/
def dict2md(json_block, depth=0):
m... | mit | f08a8d5f21941c237e20696d92898eed | 46.792651 | 107 | 0.59866 | 3.603602 | false | false | false | false |
demisto/content | Packs/FeedSOCRadarThreatFeed/Integrations/FeedSOCRadarThreatFeed/FeedSOCRadarThreatFeed_test.py | 2 | 9049 | import io
import json
import pytest
from CommonServerPython import DemistoException, CommandResults, FeedIndicatorType
SOCRADAR_API_ENDPOINT = 'https://platform.socradar.com/api'
def util_load_json(path):
with io.open(path, mode='r', encoding='utf-8') as f:
return json.loads(f.read())
def test_test_m... | mit | 21dc6a0366f3e2e5e521e14ff89fe9b1 | 34.347656 | 114 | 0.700298 | 3.506005 | false | true | false | false |
demisto/content | Packs/CommonScripts/Scripts/ScheduleGenericPolling/ScheduleGenericPolling.py | 2 | 2748 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
# Returns a comma-separated string representation of a list
# Possible inputs: null, int, str, bytes, ["","",...], [int, int], 'a,b,...', '"a","b",...', '["","",...]'
def parseIds(idsArg):
if idsArg is None:
return
... | mit | e2e7bfa16e3516c831c540d6f9400861 | 48.963636 | 120 | 0.599709 | 3.892351 | false | false | false | false |
demisto/content | Packs/ServiceNow/Integrations/ServiceNow/ServiceNow.py | 2 | 52303 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import re
import requests
import json
from datetime import datetime
import shutil
# disable insecure warnings
requests.packages.urllib3.disable_warnings()
if not demisto.params().get('proxy', False):
del os.environ... | mit | 2aa10857d998b1445834800bc5b21c77 | 32.853074 | 120 | 0.584632 | 3.698416 | false | false | false | false |
demisto/content | Packs/dnstwist/Integrations/dnstwist/dnstwist.py | 2 | 3329 | import json
import subprocess
from CommonServerPython import *
TWIST_EXE = '/dnstwist/dnstwist.py'
if demisto.command() == 'dnstwist-domain-variations':
KEYS_TO_MD = ["whois_updated", "whois_created", "dns_a", "dns_mx", "dns_ns"]
DOMAIN = demisto.args()['domain']
LIMIT = int(demisto.args()['limit'])
... | mit | 66d2581633ae2595e86ded61ddc3b160 | 35.582418 | 117 | 0.567738 | 3.460499 | false | false | false | false |
demisto/content | Utils/github_workflow_scripts/send_slack_message.py | 2 | 6814 | #!/usr/bin/env python3
from typing import List
from slack_sdk import WebClient
from blessings import Terminal
from utils import get_env_var
import json
import requests
from github import Github, File, PullRequest
import urllib3
from pprint import pformat
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWar... | mit | 80961f277d5a70e8578072eff9edaff6 | 29.832579 | 116 | 0.624596 | 3.918344 | false | false | false | false |
demisto/content | Packs/MalwareInvestigationAndResponse/Scripts/ReadProcessesFileXDR/ReadProcessesFileXDR.py | 2 | 2893 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from typing import Union
import re
CONTEXT_PATH_TO_READ_PROCESS_FILE_NAME_FROM_XDR_DATA = "PaloAltoNetworksXDR.ScriptResult"
def read_xdr_context():
script_results = demisto.get(demisto.context(), CONTEXT_PATH_TO_READ_PROC... | mit | 5ff0c4bde4e9f7f0ef184cb5fb60e4bf | 28.520408 | 105 | 0.6215 | 3.941417 | false | false | false | false |
nylas/nylas-python | nylas/client/scheduler_models.py | 1 | 1698 | from nylas.client.restful_models import RestfulModel
class SchedulerTimeSlot(RestfulModel):
attrs = ["account_id", "calendar_id", "host_name", "emails"]
datetime_attrs = {"start": "start", "end": "end"}
def __init__(self, api):
RestfulModel.__init__(self, SchedulerTimeSlot, api)
class Scheduler... | mit | e95f0342805b467785586e0a42c47151 | 27.779661 | 78 | 0.574794 | 3.798658 | false | false | false | false |
demisto/content | Packs/Workday/Integrations/WorkdayIAMEventsGenerator/WorkdayIAMEventsGenerator.py | 2 | 28056 | # noqa: F401
from flask import Flask, jsonify
from gevent.pywsgi import WSGIServer
from CommonServerPython import *
FIRST_RUN_REPORT = {
"Report_Entry": [
{
"Employee_Type": "Regular",
"Leadership": "Yes-HQ",
"Work_Country_Code": "840",
"Street_Address": "300... | mit | c81b6cbadc20b0f4c0791dcd26d7eac7 | 39.897959 | 116 | 0.524772 | 3.41688 | false | true | false | false |
demisto/content | Packs/ExpanseV2/Integrations/ExpanseV2/ExpanseV2.py | 2 | 110763 | """Cortex XSOAR Integration for Expanse Expander and Behavior
"""
import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
import urllib3
import copy
import json
import base64
import re
from typing import (
Any, ... | mit | 9779ed37bf99925da08d5629198ade5f | 38.543734 | 129 | 0.594256 | 3.915373 | false | false | false | false |
demisto/content | Packs/CiscoEmailSecurity/Integrations/CiscoEmailSecurity/CiscoEmailSecurity.py | 2 | 27604 | import demistomock as demisto
from CommonServerPython import *
import urllib3
from typing import Any, Dict
# Disable insecure warnings
urllib3.disable_warnings()
MAX_MESSAGES_TO_GET = 20
class Client(BaseClient):
def __init__(self, params):
self.username = params.get('credentials').get('identifier')
... | mit | e0684391683c1bf5f4f5f63136afb324 | 41.015221 | 120 | 0.641429 | 3.69482 | false | false | false | false |
demisto/content | Packs/PrismaCloud/Scripts/PrismaCloudAttribution/PrismaCloudAttribution_test.py | 2 | 2207 | from PrismaCloudAttribution import attribution_command
import demistomock as demisto # noqa # pylint: disable=unused-wildcard-import
import json
import io
MOCK_RESULT = [
{
"accountId": "123456",
"accountName": "aws-user-personal",
"cloudType": "aws",
"fqdn": [
"applica... | mit | a38a79f0d2a944cec1795d84f4ca6fa8 | 31.455882 | 111 | 0.606253 | 3.25997 | false | false | false | false |
demisto/content | Packs/HealthCheck/Scripts/HealthCheckDockerLog/HealthCheckDockerLog.py | 2 | 5467 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import re
DESCRIPTION = [
"Too many running containers: There are {} containers running on the server",
"There are {} containers that are running with over 10% CPU Usage - Please check docker.log",
"There are {} co... | mit | bf80690c76ffa0cbb3696d90a50635a7 | 39.798507 | 114 | 0.550576 | 3.618134 | false | false | false | false |
demisto/content | Packs/AWS-EC2/Scripts/AwsEC2GetPublicSGRules/AwsEC2GetPublicSGRules.py | 2 | 4157 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import json
import copy
def get_dict_value(data, key):
""" Returns dict value for a given key (case insensitive) """
for key_name in data.keys():
if key_name.lower() == key.lower():
return d... | mit | 47c716bd4bf77fa6d9e22163cceb646d | 29.792593 | 105 | 0.533317 | 3.888681 | false | false | false | false |
demisto/content | Packs/Campaign/Scripts/CollectCampaignRecipients/CollectCampaignRecipients.py | 2 | 2180 |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
ALL_INCIDENTS = 'All'
CAMPAIGN_EMAIL_TO_FIELD = 'campaignemailto'
def get_campaign_incidents():
"""
Get the campaign incidents form the incident's context
:rtype: ``list``
:return: list of campa... | mit | 6abcb9b0ad5fe8254ab3e2e04c2cb22b | 30.142857 | 117 | 0.651376 | 3.720137 | false | false | false | false |
demisto/content | Packs/CommonScripts/Scripts/ExtractIndicatorsFromWordFile/ExtractIndicatorsFromWordFile.py | 2 | 5641 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import subprocess
from docx import Document
from typing import List, Dict
from docx.opc.constants import RELATIONSHIP_TYPE as RT
from docx.opc.exceptions import PackageNotFoundError
class WordParser:
def __init__(... | mit | 1e28db7cabef7e97821d1d8e3243a0f4 | 38.447552 | 119 | 0.594221 | 3.821816 | false | false | false | false |
demisto/content | Packs/fireeye/Scripts/FireEyeDetonateFile/FireEyeDetonateFile.py | 2 | 4649 | import json
from time import sleep
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
TIMEOUT = 960
INTERVAL = 10
def detonate_file(args):
should_continue = True
file = demisto.get(args, 'file')
feDone = False
feSubmissionKeys = {}
# profiles = ['win10x64... | mit | a1731600f3899ffc985b7a62f24b4c8c | 35.896825 | 122 | 0.550441 | 4.188288 | false | false | false | false |
demisto/content | Packs/ShiftManagement/Scripts/GetOnCallHoursPerUser/GetOnCallHoursPerUser.py | 2 | 2350 | import operator
from functools import reduce
from typing import Dict, List
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
def count_hours_in_shift(shift: Dict) -> int:
from_day = shift.get('fromDay', 0)
to_day = shift.get('toDay', 0)
from_hour = shift.... | mit | ed33c7e5e4590f84c337e63de5b76b13 | 35.71875 | 114 | 0.552766 | 3.71248 | false | false | false | false |
demisto/content | Packs/Campaign/Scripts/GetCampaignLowSimilarityIncidentsInfo/GetCampaignLowSimilarityIncidentsInfo.py | 2 | 5796 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import copy
"""
This Script is a duplicate of Packs/Campaign/Scripts/GetCampaignIncidentsInfo with the only change of the context field
the data is taken from. The reason is that dynamic section in layout cannot use arguments i... | mit | 8d6d9d1bae4dd3fe99fe76984b5bc7c1 | 32.310345 | 119 | 0.636646 | 3.768531 | false | false | false | false |
demisto/content | Packs/RiskSense/Scripts/RiskSenseGetRansomewareCVEScript/RiskSenseGetRansomewareCVEScript_test.py | 2 | 3156 | EXPECTED_RANSOMWARE_CVES = [
{
"Cve": "CVE-0000-0000",
"CVSS": 7.5,
"VRR": 5.67,
"ThreatCount": 1,
"Trending": "false",
"VulnLastTrendingOn": "2018-05-01",
"Description": "remote code execution",
"Threats": [{
"Title": "Hunter Exploit Kit",... | mit | e2503172be8290fc2e0c658c77bbf7a2 | 31.536082 | 88 | 0.569708 | 3.263702 | false | false | false | false |
demisto/content | Packs/Base/Scripts/CheckDockerImageAvailable/CheckDockerImageAvailable_test.py | 2 | 3306 | from CheckDockerImageAvailable import docker_auth, main, docker_min_layer, parse_www_auth
import demistomock as demisto
import json
import pytest
RETURN_ERROR_TARGET = 'CheckDockerImageAvailable.return_error'
@pytest.mark.filterwarnings('ignore::urllib3.exceptions.InsecureRequestWarning')
def test_auth():
token... | mit | 533f199e4c3249dbf0c0def8791477c0 | 35.32967 | 108 | 0.668179 | 3.038603 | false | true | false | false |
demisto/content | Packs/Malwr/Integrations/Malwr/Malwr_test.py | 2 | 4058 | from Malwr import MalwrAPI
from requests_mock import Mocker
import tempfile
import pytest
TEST_HTML = """
<form action="/action_page.php">
<label for="math_captcha_question">Math Captcha Question:</label>
<input type="text" id="math_captcha_question" name="math_captcha_question" value="what is the answer?"><br><b... | mit | f8e22e4cf9fa13fcdb746e76f46bdf53 | 38.019231 | 113 | 0.669049 | 3.750462 | false | true | false | false |
demisto/content | Packs/CommonScripts/Scripts/GetDomainDNSDetails/GetDomainDNSDetails.py | 2 | 2841 | import demistomock as demisto # noqa # pylint: disable=unused-wildcard-import
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa # pylint: disable=unused-wildcard-import
from typing import (
Dict, Any, Optional,
Union, List
)
import t... | mit | 86d25bbcdeb4ed3bda6ca416932d96b6 | 23.067797 | 105 | 0.617606 | 3.567839 | false | false | false | false |
demisto/content | Packs/Slack/Scripts/SlackAsk/SlackAsk_test.py | 2 | 9406 | import demistomock as demisto
from CommonServerPython import entryTypes
import json
import dateparser
import datetime
import SlackAsk
BLOCKS = [{
'type': 'section',
'text': {
'type': 'mrkdwn',
'text': 'wat up'
}
}, {
'type': 'actions',
'elements': [{
'type': 'button',
... | mit | 72a846ecf5454584cbbb5ca54cc0af56 | 34.360902 | 120 | 0.565384 | 3.174485 | false | false | false | false |
demisto/content | Packs/CommonScripts/Scripts/ReadFile/ReadFile_test.py | 2 | 1115 | import pytest
from ReadFile import *
def test_extract_indicators(mocker):
"""
Given:
A file containing text.
When:
Running script on file
Then:
Validate the right output returns.
"""
mocker.patch.object(demisto, 'executeCommand', return_val... | mit | 38fd53e78dfe0a2e47f1c6ac3f6ed52e | 27.589744 | 124 | 0.567713 | 4.114391 | false | true | false | false |
demisto/content | Packs/FeedThreatConnect/Integrations/FeedThreatConnect/FeedThreatConnect_test.py | 2 | 6906 | import json
import demistomock as demisto
import pytest
from FeedThreatConnect import create_or_query, parse_indicator, set_tql_query, create_types_query, should_send_request, \
build_url_with_query_params, set_fields_query, get_updated_last_run
def load_json_file(path):
with open(path, 'r') as _json_file:
... | mit | 68b4dacc9469837ba74f1360e3d854c6 | 42.433962 | 127 | 0.5766 | 4.045694 | false | true | false | false |
demisto/content | Packs/CTIX/Integrations/CTIXv3/CTIXv3.py | 2 | 54051 | # Uncomment while development
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
"""IMPORTS"""
import base64
import hashlib
import hmac
import json
import time
import urllib.parse
from typing import Any, Dict
import requests
import urllib3
# Disable insecure warnings
urllib3... | mit | 057961a5d5ac5b9c0be9cbda67111adf | 34.556579 | 123 | 0.592995 | 3.837404 | false | false | false | false |
demisto/content | Packs/CiscoUmbrellaReporting/Integrations/CiscoUmbrellaReporting/CiscoUmbrellaReporting.py | 1 | 53522 | import demistomock as demisto
from CommonServerPython import *
from typing import Dict, List, Optional
from datetime import datetime
import requests
import urllib3
# Disable insecure warnings
urllib3.disable_warnings() # pylint: disable=no-member
''' CONSTANTS '''
DEFAULT_PAGE_SIZE = 50
DEFAULT_FROM_DATE = "-7day... | mit | 651af63fcacffeab31726edfd4790f57 | 38.763744 | 147 | 0.61556 | 3.93602 | false | false | false | false |
demisto/content | Packs/CounterCraft/Integrations/CounterCraft/CounterCraft.py | 2 | 24930 | import demistomock as demisto
from CommonServerPython import *
""" IMPORTS """
import json
import urllib.parse
import requests
import hmac
from datetime import datetime
import time
import binascii
import uuid
from typing import Dict, List
from hashlib import sha1
# Disable insecure warnings
requests.packages.urllib... | mit | 625fb6d20cbd952816fffc6a0cb27a2d | 26.425743 | 119 | 0.572282 | 3.741558 | false | false | false | false |
demisto/content | Packs/DB2/Integrations/DB2/DB2.py | 2 | 12942 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
"""Integration for DB2"""
import re
import traceback
from typing import Any, Callable, Dict, List, Tuple
from urllib.parse import parse_qsl
import ibm_db
import urllib3
# Disable insecure warnings
urllib3.disable_warnings()
... | mit | e4e2f183a8ad1f73dbaa8ef4254a024e | 31.114144 | 111 | 0.599212 | 3.886486 | false | false | false | false |
demisto/content | Packs/CarbonBlackDefense/Integrations/CarbonBlackEndpointStandard/CarbonBlackEndpointStandard_test.py | 2 | 3668 | def create_client():
from CarbonBlackEndpointStandard import Client
client = Client(base_url='example.com',
verify=False,
proxies=1234,
api_secret_key="api_secret_key",
api_key="api_key",
policy_api_key="policy_a... | mit | c977be7699a2d719149bf83654ef3b57 | 32.045045 | 106 | 0.613413 | 3.832811 | false | false | false | false |
demisto/content | Packs/ShiftManagement/Scripts/ManageOOOusers/ManageOOOusers.py | 2 | 3253 | from CommonServerPython import * # noqa: F401
def _get_current_user():
current_username = demisto.executeCommand("getUsers", {"current": True})
if isError(current_username):
demisto.debug(f"failed to get current username - {get_error(current_username)}")
return
else:
return curren... | mit | 957d74874542f3beda4ccd79f4784656 | 38.192771 | 112 | 0.62158 | 3.622494 | false | false | false | false |
demisto/content | Packs/Telegram/Integrations/Telegram/Telegram.py | 2 | 3885 | from CommonServerPython import *
''' IMPORTS '''
import json
import requests
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' GLOBALS/PARAMS '''
TOKEN = demisto.params().get('token')
BASE_URL = 'https://api.telegram.org/bot{}/'.format(TOKEN)
''' HELPER FUNCTIONS '''
def http_request(... | mit | cf842c21f408adbc974c33ccb93814ed | 24.9 | 113 | 0.603604 | 3.77551 | false | false | false | false |
demisto/content | Packs/Kenna/Integrations/KennaV2/KennaV2.py | 2 | 24424 | from typing import Tuple, Callable
import urllib3
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
# Disable insecure warnings
urllib3.disable_warnings()
def parse_response(raw_data: List[Dict[str, Any]], wanted_keys: List[Any], actual_keys: List[Any]) -> \
List[Di... | mit | 2126037d89295a7e73103a2c2a37dc6d | 39.706667 | 125 | 0.578079 | 3.884842 | false | false | false | false |
demisto/content | Packs/SOCRadar/Integrations/SOCRadarThreatFusion/SOCRadarThreatFusion.py | 2 | 26163 | from json.decoder import JSONDecodeError
import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
import requests
import traceback
from typing import Dict, Any
# Disable insecure warnings
requests.packages.urllib3.dis... | mit | c3362bc90a19bc25ff1a5e8e40823d3b | 37.588496 | 125 | 0.596797 | 3.953309 | false | false | false | false |
demisto/content | Packs/GoogleSafeBrowsing/Integrations/GoogleSafeBrowsingV2/GoogleSafeBrowsingV2.py | 2 | 8902 | import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
import urllib3
from typing import Dict, Any
# Disable insecure warnings
urllib3.disable_warnings()
TYPES = {
'threatTypes': ["MALWARE", "SOCIAL_ENGINEERING"... | mit | 8fcfea9b53047a26087ed2766c122527 | 32.466165 | 120 | 0.588182 | 3.995512 | false | false | false | false |
demisto/content | Packs/EWS/Scripts/GetEWSFolder/GetWESFolder_test.py | 2 | 1729 | import json
from GetEWSFolder import main, convert_mail_to_json
import demistomock as demisto
def create_mail(subject, body):
return {'subject': subject, 'textBody': body, 'body': '<body>{}<\\body>'.format(body)}
mails_folder_1 = [create_mail(subject='subject 1', body='body 1'), create_mail(subject='subject 2... | mit | c8b121ba1096cdd317fd6f8964fcbc5b | 36.586957 | 115 | 0.639676 | 3.312261 | false | false | false | false |
demisto/content | Packs/PaloAltoNetworks_Threat_Vault/Integrations/Threat_Vault/Threat_Vault.py | 2 | 19996 | from CommonServerPython import *
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
class Client(BaseClient):
"""
Client to use in the Threat Vault integration. Overrides BaseClient.
"""
def __init__(self, api_key: str, verify: bool, proxy: bool, reliability: str):
supe... | mit | f4a8295089b7ef6f8ed1bc20ada8b2e4 | 34.39115 | 120 | 0.589418 | 4.08749 | false | false | false | false |
demisto/content | Packs/rasterize/Integrations/rasterize/rasterize.py | 2 | 29696 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import base64
import os
import re
import subprocess
import tempfile
import time
import traceback
from enum import Enum
from io import BytesIO
from pathlib import Path
from typing import Callable, Tuple
import numpy as np
from p... | mit | b8a6d924d901ed25767c7509e239279e | 39.12973 | 151 | 0.634261 | 3.597335 | false | false | false | false |
demisto/content | Packs/Remedy_AR/Integrations/RemedyAR/RemedyAR.py | 2 | 3834 | from urllib.parse import quote_plus
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from CommonServerUserPython import * # noqa
''' IMPORTS '''
import json
import os
import urllib3
import requests
# disable insecure warnings
urllib3.disable_warnings()
if not demisto.para... | mit | e641892821024593d62229b333f8add8 | 26.985401 | 101 | 0.614502 | 3.826347 | false | false | false | false |
demisto/content | Packs/CommonScripts/Scripts/MaliciousRatioReputation/MaliciousRatioReputation_test.py | 2 | 3878 | import demistomock as demisto
def test_main_malicious_ratio_reputation(mocker):
"""
Given:
- The script args.
When:
- Running the main with valid indicator.
Then:
- Validating after calling the helper functions the results is as expected.
"""
import MaliciousRatioReputa... | mit | f73ce8c8f1a8606196f66f2aeda4fefd | 43.574713 | 118 | 0.60624 | 3.843409 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.