本文整理汇总了Python中OTXv2.OTXv2方法的典型用法代码示例。如果您正苦于以下问题:Python OTXv2.OTXv2方法的具体用法?Python OTXv2.OTXv2怎么用?Python OTXv2.OTXv2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTXv2
的用法示例。
在下文中一共展示了OTXv2.OTXv2方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: otx
# 需要导入模块: import OTXv2 [as 别名]
# 或者: from OTXv2 import OTXv2 [as 别名]
def otx(self):
otx_server = 'https://otx.alienvault.com/'
otx_conn = OTXv2(self.otx_api_key, server=otx_server)
domains = []
try:
query = otx_conn.get_indicator_details_full(IndicatorTypes.DOMAIN, self.artifact['name'])
domain_info = query['url_list']['url_list']
for item in domain_info:
if item['hostname'] not in domains:
domains.append(item['hostname'])
except Exception as err:
warning('Caught unknown exception: %s' % str(err))
self.artifact['data']['dnsbrute']['otx'] = domains
示例2: connect
# 需要导入模块: import OTXv2 [as 别名]
# 或者: from OTXv2 import OTXv2 [as 别名]
def connect(self, params):
api_key, otx_server = params.get(Input.API_KEY).get("secretKey", None), params.get(Input.URL)
try:
self.client = OTXv2(api_key, server=otx_server)
except Exception as e:
raise Exception(f"An error has occurred while connecting: {e}")
示例3: __init__
# 需要导入模块: import OTXv2 [as 别名]
# 或者: from OTXv2 import OTXv2 [as 别名]
def __init__(self, *args, **kwargs):
super(OtxFeed, self).__init__(*args, **kwargs)
self.otx = OTXv2(yeti_config.get('otx', 'key'))
self.get_pulses()
示例4: __init__
# 需要导入模块: import OTXv2 [as 别名]
# 或者: from OTXv2 import OTXv2 [as 别名]
def __init__(self):
self.otx = OTXv2(API_KEY, server=OTX_SERVER)
示例5: setUp
# 需要导入模块: import OTXv2 [as 别名]
# 或者: from OTXv2 import OTXv2 [as 别名]
def setUp(self, api_key=''):
self.maxDiff = None
self.api_key = api_key or ALIEN_API_APIKEY
self.otx = OTXv2(self.api_key, server=ALIEN_DEV_SERVER)
示例6: setUpClass
# 需要导入模块: import OTXv2 [as 别名]
# 或者: from OTXv2 import OTXv2 [as 别名]
def setUpClass(cls):
cls.otx2 = OTXv2(create_user(cls.user1, "password", cls.user1 + "@aveng.us", group_ids=[51, 64, 2931]), server=ALIEN_DEV_SERVER)
示例7: test_user_agent
# 需要导入模块: import OTXv2 [as 别名]
# 或者: from OTXv2 import OTXv2 [as 别名]
def test_user_agent(self):
o = OTXv2(self.api_key, server=ALIEN_DEV_SERVER, project='foo')
self.assertEqual(o.headers['User-Agent'], 'OTX Python foo/1.5.10')
o = OTXv2(self.api_key, server=ALIEN_DEV_SERVER, user_agent='foo')
self.assertEqual(o.headers['User-Agent'], 'foo')
示例8: Search
# 需要导入模块: import OTXv2 [as 别名]
# 或者: from OTXv2 import OTXv2 [as 别名]
def Search(self):
mod.display(self.module_name, "", "INFO", "Search in Alienvault OTX ...")
try:
if "otx_api_keys" in self.config:
otx = OTXv2(self.config["otx_api_keys"])
if self.type == "IPv4":
indicator = IndicatorTypes.IPv4
if self.type == "IPv6":
indicator = IndicatorTypes.IPv6
if self.type == "domain":
indicator = IndicatorTypes.DOMAIN
if self.type == "URL":
indicator = IndicatorTypes.URL
if self.type == "MD5":
indicator = IndicatorTypes.FILE_HASH_MD5
if self.type == "SHA1":
indicator = IndicatorTypes.FILE_HASH_SHA1
if self.type == "SHA256":
indicator = IndicatorTypes.FILE_HASH_SHA256
result = otx.get_indicator_details_full(indicator, self.ioc)
else:
mod.display(self.module_name,
self.ioc,
message_type="ERROR",
string="Please check if you have otx_api_keys field in btg.cfg")
return None
except:
mod.display(self.module_name,
self.ioc,
"ERROR",
"Could not perform the request, either you did not fill the otx_api_keys field or the key maximum request is reached")
return None
try:
if self.ioc == str(result["general"]["indicator"]):
_id = str(result["general"]["pulse_info"]["pulses"][0]["id"])
tags = ""
for tag in result["general"]["pulse_info"]["pulses"][0]["tags"]:
tags = tags + "%s " % tag
mod.display(self.module_name,
self.ioc,
"FOUND",
"Tags: %s| https://otx.alienvault.com/pulse/%s/" % (tags, _id))
except:
mod.display(self.module_name,
self.ioc,
message_type="NOT_FOUND",
string="Nothing found in OTX")
return None