本文整理汇总了Python中scanner.Scanner.check_directories方法的典型用法代码示例。如果您正苦于以下问题:Python Scanner.check_directories方法的具体用法?Python Scanner.check_directories怎么用?Python Scanner.check_directories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scanner.Scanner
的用法示例。
在下文中一共展示了Scanner.check_directories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from scanner import Scanner [as 别名]
# 或者: from scanner.Scanner import check_directories [as 别名]
def handle(self):
from scanner import Scanner
s = Scanner()
s.check_directories()
s.initialize_logger()
s.check_yara_file()
# Check in case client terminates connection mid xfer
self.request.settimeout(10.0)
try:
raw_msg_len = self.request.recv(4)
msg_len = struct.unpack('>I', raw_msg_len)[0]
data = ''
# Basic client request integrity check, not fullproof
proto_check = self.request.recv(7)
if proto_check != 'FSF_RPC':
s.dbg_h.error('%s Client request integrity check failed. Invalid FSF protocol used.' % dt.now())
raise ValueError()
while len(data) < msg_len:
recv_buff = self.request.recv(msg_len - len(data))
data += recv_buff
self.request.settimeout(None)
self.process_data(data, s)
except:
e = sys.exc_info()[0]
s.dbg_h.error('%s There was a problem processing the connection request from %s. Error: %s' % (dt.now(), self.request.getpeername()[0], e))
finally:
self.request.close()
示例2: handle
# 需要导入模块: from scanner import Scanner [as 别名]
# 或者: from scanner.Scanner import check_directories [as 别名]
def handle(self):
from scanner import Scanner
s = Scanner()
s.check_directories()
s.initialize_logger()
s.check_yara_file()
try:
raw_msg_len = self.request.recv(4)
msg_len = struct.unpack('>I', raw_msg_len)[0]
data = ''
while len(data) < msg_len:
recv_buff = self.request.recv(msg_len - len(data))
data += recv_buff
self.process_data(data, s)
except:
e = sys.exc_info()[0]
s.dbg_h.error('%s There was a problem processing the connection request from %s. Error: %s' % (dt.now(), self.request.getpeername()[0], e))
finally:
self.request.close()