本文整理匯總了Python中scapy.config.conf.nmap_base方法的典型用法代碼示例。如果您正苦於以下問題:Python conf.nmap_base方法的具體用法?Python conf.nmap_base怎麽用?Python conf.nmap_base使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scapy.config.conf
的用法示例。
在下文中一共展示了conf.nmap_base方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: lazy_init
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import nmap_base [as 別名]
def lazy_init(self):
try:
fdesc = open(conf.nmap_base
if self.filename is None else
self.filename, "rb")
except (IOError, TypeError):
warning("Cannot open nmap database [%s]", self.filename)
self.filename = None
return
self.base = []
name = None
sig = {}
for line in fdesc:
line = plain_str(line)
line = line.split('#', 1)[0].strip()
if not line:
continue
if line.startswith("Fingerprint "):
if name is not None:
self.base.append((name, sig))
name = line[12:].strip()
sig = {}
continue
if line.startswith("Class "):
continue
line = _NMAP_LINE.search(line)
if line is None:
continue
test, values = line.groups()
sig[test] = dict(val.split('=', 1) for val in
(values.split('%') if values else []))
if name is not None:
self.base.append((name, sig))
fdesc.close()