def data_providers(): """Return dict of providers.""" with warnings.catch_warnings(): warnings.simplefilter("ignore", category=UserWarning) return { "ti_lookup": TILookup(), "geolite": GeoLiteLookup(), # "ip_stack": IPStackLookup(), }
def data_providers(): """Return dict of providers.""" return { "az_sent_prov": QueryProvider("AzureSentinel"), "mdatp_prov": QueryProvider("MDATP"), "splunk_prov": QueryProvider("Splunk"), "ti_lookup": TILookup(), "geolite": GeoLiteLookup(), "ip_stack": IPStackLookup(), }
def data_providers(): """Return dict of providers.""" prov_dict = {} with warnings.catch_warnings(): warnings.simplefilter("ignore", category=UserWarning) if _KQL_IMP_OK: prov_dict["az_sent_prov"] = QueryProvider("AzureSentinel") prov_dict["mdatp_prov"] = QueryProvider("MDE") if _SPLUNK_IMP_OK: prov_dict["splunk_prov"] = QueryProvider("Splunk") prov_dict["ti_lookup"] = TILookup() prov_dict["geolite"] = GeoLiteLookup() if _IPSTACK_IMP_OK: prov_dict["ip_stack"] = ip_stack_cls() return prov_dict
def test_notebooklet_create(self): """Test method.""" test_with_geop = True try: geoip = GeoLiteLookup() if not geoip._api_key: test_with_geop = False del geoip except MsticpyUserConfigError: test_with_geop = False if test_with_geop: # Should run because required providers are loaded init(query_provider="LocalData", providers=["tilookup", "geolitelookup"]) for _, nblt in nblts.iter_classes(): new_nblt = nblt() self.assertIsInstance(new_nblt, Notebooklet) self.assertIsNone(new_nblt.result) # Should throw a warning because of unrecognized provider init(query_provider="LocalData") with self.assertRaises(MsticnbDataProviderError) as err: for _, nblt in nblts.iter_classes(): curr_provs = nblt.metadata.req_providers bad_provs = [*curr_provs, "bad_provider"] try: nblt.metadata.req_providers = bad_provs new_nblt = nblt() self.assertIsInstance(new_nblt, Notebooklet) self.assertIsNone(new_nblt.result) finally: nblt.metadata.req_providers = curr_provs self.assertIn("bad_provider", err.exception.args[0]) test_nb = TstNBSummary() self.assertIsNotNone(test_nb.get_provider("LocalData")) with self.assertRaises(MsticnbDataProviderError): test_nb.get_provider("otherprovider")