def scan(addresses):
"""Scan a list of ip-addresses for netbios names"""
_logger.debug('Scanning %s addresses', len(addresses))
proc = Popen(['nbtscan', '-f-', '-s', SPLITCHAR], stdin=PIPE, stdout=PIPE)
stdout, stderr = proc.communicate('\n'.join(addresses))
if stderr:
raise Exception(stderr)
if isinstance(stdout, six.binary_type):
stdout = stdout.decode('cp850') # cp850 seems like netbios' standard
_logger.debug('Result from scan:\n%s', stdout)
return stdout
评论列表
文章目录