规范化yara签名的python libary
yaratool的Python项目详细描述
#概述
yaratool的创建是为了规范化yara签名,以便很好地格式化签名,检测重复项,并通过哈希(类似于我们如何表示恶意软件)来表示特定的签名。此工具中的哈希方法与ruby yara normalize模块相同。
ynhash设计用于标识yara签名。
import yaratool
ruletext=“”rule debuggercheck_api:antiebug debuggercheck{
meta:
author=“some dude or dudette”
weight=1
字符串:
$=“isdebuggerpresent”
条件:
其中任何一个
}“
yr=yaratool.yararule(ruletext)
print yr.normalize()
print”name:%s,tags:%s,author:%s“%(yr.name,“&;”。join(yr.tags),yr.metas['author'])
print”strings:
对于yr中的字符串。strings:
打印%s%(字符串)
打印“条件:”
对于年条件:
打印%s%(条件)
打印年哈希()
输出
rule debuggercheck\uu api:antiebug debuggercheck{
元:
author=“some dude or dudette”
权重=1
字符串:
$=“isdebuggerpresent”
条件:
其中任何一个
}
名称:debuggercheck\uu api,标记:antebug&;debuggercheck,作者:“some dude or dudette”
字符串:
$=“isdebuggerpresent”
条件:
其中任何一个
yn01:d28d649e24c37244:d936fceff
它将显示任何重复规则的规范化版本。
import yaratool
import sys
'r')
sigrules=fh.read()
fh.close()
rules=yaratool.split(sigrules)
对于规则中的规则:
ynhash=rule.hash()
res=drf.check(rule)
如果res:
重复数+=1
对于res中的r:
print r.normalize()
pass
print rule.normalize()
print
count+=len(规则)
print“计数为%d,重复次数为%d”%(计数,重复次数)
yaratool的创建是为了规范化yara签名,以便很好地格式化签名,检测重复项,并通过哈希(类似于我们如何表示恶意软件)来表示特定的签名。此工具中的哈希方法与ruby yara normalize模块相同。
ynhash设计用于标识yara签名。
import yaratool
meta:
author=“some dude or dudette”
weight=1
字符串:
$=“isdebuggerpresent”
条件:
其中任何一个
}“
yr=yaratool.yararule(ruletext)
print yr.normalize()
print”name:%s,tags:%s,author:%s“%(yr.name,“&;”。join(yr.tags),yr.metas['author'])
print”strings:
对于yr中的字符串。strings:
打印%s%(字符串)
打印“条件:”
对于年条件:
打印%s%(条件)
打印年哈希()
输出
rule debuggercheck\uu api:antiebug debuggercheck{
元:
author=“some dude or dudette”
权重=1
字符串:
$=“isdebuggerpresent”
条件:
其中任何一个
}
名称:debuggercheck\uu api,标记:antebug&;debuggercheck,作者:“some dude or dudette”
字符串:
$=“isdebuggerpresent”
条件:
其中任何一个
yn01:d28d649e24c37244:d936fceff
它将显示任何重复规则的规范化版本。
import yaratool
import sys
'r')
sigrules=fh.read()
fh.close()
rules=yaratool.split(sigrules)
对于规则中的规则:
ynhash=rule.hash()
res=drf.check(rule)
如果res:
重复数+=1
对于res中的r:
print r.normalize()
pass
print rule.normalize()
count+=len(规则)
print“计数为%d,重复次数为%d”%(计数,重复次数)