本文整理汇总了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)
示例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")