本文整理汇总了Python中Scanner.scan_inode_distributed方法的典型用法代码示例。如果您正苦于以下问题:Python Scanner.scan_inode_distributed方法的具体用法?Python Scanner.scan_inode_distributed怎么用?Python Scanner.scan_inode_distributed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scanner
的用法示例。
在下文中一共展示了Scanner.scan_inode_distributed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
# 需要导入模块: import Scanner [as 别名]
# 或者: from Scanner import scan_inode_distributed [as 别名]
def process(self, scanners):
print "Opening %s as a HTTP Request" % self.forward_fd.urn.parser.query
while True:
parse = False
request_body = response_body = None
request = {}
response = {}
## First parse both request and response
## Get the current timestamp of the request
packet = PCAP.dissect_packet(self.forward_fd, self.forward_pkt_fd)
if self.read_request(request, self.forward_fd):
try:
request['timestamp'] = packet.ts_sec
except AttributeError:
request['timestamp'] = 0
parse = True
request_body_urn = self.skip_body(request, self.forward_fd)
try: Framework.set_metadata(request_body_urn, HTTP_URL, request['url'])
except KeyError: pass
try: Framework.set_metadata(request_body_urn, HTTP_METHOD, request['method'])
except KeyError: pass
try: Framework.set_metadata(request_body_urn, HTTP_CODE, response['HTTP_code'])
except KeyError: pass
try: Framework.set_metadata(request_body_urn, HOST_TLD,
Framework.make_tld(request['host']))
except KeyError: pass
## Finalise the object
request_body = oracle.open(request_body_urn, 'w')
request_body.close()
packet = PCAP.dissect_packet(self.reverse_fd, self.reverse_pkt_fd)
if self.read_response(response, self.reverse_fd):
try:
response['timestamp'] = packet.ts_sec
except AttributeError:
response['timestamp'] = 0
parse = True
response_body_urn = self.skip_body(response, self.reverse_fd)
response_body = oracle.open(response_body_urn, 'w')
response_body.close()
return
## We hang all the parameters on the response object
## (i.e. file attachment, post parameters, cookies)
if response_body and request_body:
self.process_cookies(request, response_body)
self.process_post_body(request, request_body, response_body)
if request_body.size > 0:
request_body.close()
if response_body and response_body.size > 0:
## Store information about the object in the http table:
url = request.get('url','/')
## We try to store the url in a normalized form so we
## can find it regardless of the various permutations
## it can go through
response_body.insert_to_table("http",
dict(method = request.get('method'),
url = url,
status = response.get('HTTP_code'),
content_type = response.get('content-type'),
useragent = request.get('user-agent'),
host = request.get('host'),
tld = make_tld(request.get('host',''))
)
)
response_body.close()
Scanner.scan_inode_distributed(forward_fd.case, response_body.inode_id,
scanners, self.cookie)