本文整理汇总了Python中modules.signatures.append函数的典型用法代码示例。如果您正苦于以下问题:Python append函数的具体用法?Python append怎么用?Python append使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了append函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: find_signatures
def find_signatures(root):
signatures = []
for entry in os.listdir(root):
if entry.endswith(".yara") or entry.endswith(".yar"):
signatures.append(os.path.join(root, entry))
return signatures
开发者ID:pekeinfo,项目名称:cuckoo-modified,代码行数:7,代码来源:startup.py
示例2: init_yara
def init_yara():
"""Generates index for yara signatures."""
def find_signatures(root):
signatures = []
for entry in os.listdir(root):
if entry.endswith(".yara") or entry.endswith(".yar"):
signatures.append(os.path.join(root, entry))
return signatures
log.debug("Initializing Yara...")
# Generate root directory for yara rules.
yara_root = os.path.join(CUCKOO_ROOT, "data", "yara")
# We divide yara rules in three categories.
categories = ["binaries", "urls", "memory"]
generated = []
# Loop through all categories.
for category in categories:
# Check if there is a directory for the given category.
category_root = os.path.join(yara_root, category)
if not os.path.exists(category_root):
continue
# Check if the directory contains any rules.
signatures = []
for entry in os.listdir(category_root):
if entry.endswith(".yara") or entry.endswith(".yar"):
signatures.append(os.path.join(category_root, entry))
if not signatures:
continue
# Generate path for the category's index file.
index_name = "index_{0}.yar".format(category)
index_path = os.path.join(yara_root, index_name)
# Create index file and populate it.
with open(index_path, "w") as index_handle:
for signature in signatures:
index_handle.write("include \"{0}\"\n".format(signature))
generated.append(index_name)
for entry in generated:
if entry == generated[-1]:
log.debug("\t `-- %s", entry)
else:
log.debug("\t |-- %s", entry)
开发者ID:pekeinfo,项目名称:cuckoo-modified,代码行数:51,代码来源:startup.py
示例3: init_yara
def init_yara():
"""Generates index for yara signatures."""
def find_signatures(root):
signatures = []
for entry in os.listdir(root):
if entry.endswith(".yara") or entry.endswith(".yar"):
signatures.append(os.path.join(root, entry))
return signatures
log.debug("Initializing Yara...")
# Find the latest rules available on the http://yararules.com/rules/
# i did not include library like BeautifulSoup to parse HTML as it would create a new dependency
# used some RE do to it instead
root_url = "http://yararules.com/rules/"
yara_files = re.findall("\w+.yar", urllib2.urlopen(root_url).read())
# remove duplicate entries as it appear in the href and between the link anchor
yara_file_names = set(yara_files)
yara_file_names = list(yara_files)
# download the rules inside the "binaries" folder
yara_binaries = os.path.join(CUCKOO_ROOT, "data", "yara", "binaries")
for rule_name in yara_file_names:
url = root_url + rule_name
file = open( yara_binaries + "/" + rule_name, "w+")
file.write( urllib2.urlopen(url).read() )
file.close()
# Generate root directory for yara rules.
yara_root = os.path.join(CUCKOO_ROOT, "data", "yara")
# We divide yara rules in three categories.
categories = ["binaries", "urls", "memory"]
generated = []
# Loop through all categories.
for category in categories:
# Check if there is a directory for the given category.
category_root = os.path.join(yara_root, category)
if not os.path.exists(category_root):
continue
# Check if the directory contains any rules.
signatures = []
for entry in os.listdir(category_root):
if entry.endswith(".yara") or entry.endswith(".yar"):
signatures.append(os.path.join(category_root, entry))
if not signatures:
continue
# Generate path for the category's index file.
index_name = "index_{0}.yar".format(category)
index_path = os.path.join(yara_root, index_name)
# Create index file and populate it.
with open(index_path, "w") as index_handle:
for signature in signatures:
index_handle.write("include \"{0}\"\n".format(signature))
generated.append(index_name)
for entry in generated:
if entry == generated[-1]:
log.debug("\t `-- %s", entry)
else:
log.debug("\t |-- %s", entry)
开发者ID:SpoonBoy,项目名称:cuckoo,代码行数:69,代码来源:startup.py
注:本文中的modules.signatures.append函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论