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


Python Scanner.scan_urn方法代码示例

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


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

示例1: _Callback

# 需要导入模块: import Scanner [as 别名]
# 或者: from Scanner import scan_urn [as 别名]
    def _Callback(self, mode, packet, connection):
        if packet:
            try:
                ip = packet.find_type("IP")
            except AttributeError:
                ip = None

            try:
                tcp = packet.find_type("TCP")
            except AttributeError:
                try:
                    tcp = packet.find_type("UDP")
                except AttributeError:
                    tcp = None

        if mode == 'est':
            ## Now do the reverse connection
            if 'map' not in connection:
                base = "%s-%s/%s-%s/" % (
                    ip.source_addr, ip.dest_addr,
                    tcp.source, tcp.dest)

                ## Note that we hold the map locked while its in the
                ## reassembler - this prevents it from getting freed
                connection['map'] = forward_stream = self.make_stream("forward", base)
                connection['map.pkt'] = self.make_stream("forward.pkt", base, navigatable=False)
                timestamp = pyaff4.XSDDatetime()
                timestamp.set(packet.ts_sec)
                forward_stream.set(pyaff4.AFF4_TIMESTAMP, timestamp)

                ## Make the reverse map
                connection['reverse']['map'] = reverse_stream = self.make_stream("reverse", base)
                connection['reverse']['map.pkt'] = self.make_stream(
                    "reverse.pkt", base, navigatable=False)
                timestamp = pyaff4.XSDDatetime()
                timestamp.set(packet.ts_sec)
                reverse_stream.set(pyaff4.AFF4_TIMESTAMP, timestamp)

        elif mode == 'data':
            if tcp.data:
                if oracle.get_urn_by_id(packet.pcap_file_id, self.image_urn):
                    length = len(tcp.data)
                    connection['map'].write_from(self.image_urn, packet.offset + tcp.data_offset, length)
                    connection['map.pkt'].write_from(self.image_urn, packet.offset, length)

        elif mode == 'destroy':
            if connection['map'].size > 0 or connection['reverse']['map'].size > 0:
                map_stream = connection['map']
                map_stream_urn = map_stream.urn
                map_stream.close()

                r_map_stream = connection['reverse']['map']
                r_map_stream_urn = r_map_stream.urn
                r_map_stream.close()

                connection['map.pkt'].close()
                connection['reverse']['map.pkt'].close()

                ## Now scan the resulting with the active scanners
                Scanner.scan_urn(map_stream_urn, self.scanners)
                Scanner.scan_urn(r_map_stream_urn, self.scanners)
开发者ID:CarbonWolf,项目名称:aff4,代码行数:63,代码来源:PCAP.py

示例2: s

# 需要导入模块: import Scanner [as 别名]
# 或者: from Scanner import scan_urn [as 别名]
    Framework.post_event("create_volume")
except:
    pdb.post_mortem()

oracle = pyaff4.Resolver()

## Now make up a list of scanners to use
scanners = [ s() for s in Registry.SCANNERS.classes ]

for file in config.args:
    print "Will load %s" % file
    inurn = pyaff4.RDFURN()
    inurn.set(file)

    try:
        Scanner.scan_urn(inurn, scanners)
    except:
        pdb.post_mortem()
        raise

## Ok we are about to finish
Framework.post_event("finish")

## Now seal the volume - this is optional
if config.SEAL:
    Framework.RESULT_VOLUME.Seal_output_volume()

## Ok we are about to finish
Framework.post_event("exit")

开发者ID:CarbonWolf,项目名称:aff4,代码行数:31,代码来源:loader.py


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