当前位置: 首页>>代码示例>>Python>>正文


Python PyMISP.add_mutex方法代码示例

本文整理汇总了Python中pymisp.PyMISP.add_mutex方法的典型用法代码示例。如果您正苦于以下问题:Python PyMISP.add_mutex方法的具体用法?Python PyMISP.add_mutex怎么用?Python PyMISP.add_mutex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymisp.PyMISP的用法示例。


在下文中一共展示了PyMISP.add_mutex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: mispBuildObject

# 需要导入模块: from pymisp import PyMISP [as 别名]
# 或者: from pymisp.PyMISP import add_mutex [as 别名]
def mispBuildObject(object_type, properties, event, args):
    
    # Set MISP instance
#    misp = PyMISP(misp_url, misp_key, False, 'json')
    misp = PyMISP(misp_url, misp_key, False, 'json', proxies=proxies)
    
    # Process Args
    if not args.ids:
        args.ids=True
    
    # Grab important info from File Objects
    if "FileObjectType" in str(object_type):
        # print dir(properties)
        print "        file_format: "+str(properties.file_format)
        print "        file_name: "+str(properties.file_name)
        print "        file_path: "+str(properties.file_path)
        print "        md5: "+str(properties.md5)
        print "        sha1: "+str(properties.sha1)
        print "        peak_entropy: "+str(properties.peak_entropy)
        print "        sha_224: "+str(properties.sha224)
        print "        size: "+str(properties.size)
        print "        size_in_bytes: "+str(properties.size_in_bytes)
        # print "        hashes_dir: "+str(dir(properties.hashes))
        
        # Get other file info
        if properties.file_name:
            file_name=str(properties.file_name)
        else:
            file_name=""
        if properties.file_path:
            file_path=str(properties.file_path)
        else:
            file_path=""
        if properties.size:
            size = str(properties.size)
        elif properties.size_in_bytes:
            size = str(properties.size_in_bytes)
        else:
            size = ""
        if properties.file_format:
            file_format = str(properties.file_format)
        else:
            file_format = ""
            
        # Build the comment w/ related info
        comment = ""
        if file_path:
            comment="[PATH] "+file_path
        if size:
            if comment:
                comment=comment+" | [SIZE] "+size
            else:
                comment="[SIZE] "+size
        if file_format:
            if comment:
                comment = comment+" | [FORMAT] "+file_format
            else:
                comment = "[FORMAT] "+file_format
        
        for hash in properties.hashes:
            print "        "+str(hash.type_)+": "+str(hash)

            # Add to MISP
            if str(hash.type_)=="MD5":
                # Add the hash by itself
                #misp.add_hashes(event, md5=str(hash))
                misp.add_hashes(event, filename=str(properties.file_name), md5=str(hash), comment=comment, to_ids=args.ids)
                
            elif str(hash.type_)=="SHA1":
                # Add the hash by itself
                #misp.add_hashes(event, sha1=str(hash))
                misp.add_hashes(event, filename=str(properties.file_name), sha1=str(hash), comment=comment, to_ids=args.ids)
                
            elif str(hash.type_)=="SHA256":
                # Add the hash by itself
                #misp.add_hashes(event, sha256=str(hash))
                misp.add_hashes(event, filename=str(properties.file_name), sha256=str(hash), comment=comment, to_ids=args.ids)
                
            elif str(hash.type_)=="SSDEEP":
                # Add the hash by itself
                #misp.add_hashes(event, ssdeep=str(hash))
                misp.add_hashes(event, filename=str(properties.file_name), ssdeep=str(hash), comment=comment, to_ids=args.ids)
                
        
    # Grab important info from Mutex Objects
    if "MutexObjectType" in str(object_type):
        print "        name: "+str(properties.name)
        
        # Add to MISP
        misp.add_mutex(event, str(properties.name), to_ids=args.ids)
        
    # Grab important info from Registry Keys:
    if "WindowsRegistryKeyObjectType" in str(object_type):
        print "        key: "+str(properties.key)
        if properties.values:
            for value in properties.values:
                print "        value.datatype: "+str(value.datatype)
                print "        value.data: "+str(value.data)
                #print "        value: "+str(dir(value))
                
#.........这里部分代码省略.........
开发者ID:TheDr1ver,项目名称:STIX2MISP,代码行数:103,代码来源:stix2misp.py


注:本文中的pymisp.PyMISP.add_mutex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。