builder.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:honeyd-python 作者: sookyp 项目源码 文件源码
def teardown_tunnels(self, tunnels, work_dir, config_file):
        """Function destroys the created tunnels
        Args:
            tunnels : list of existing tunnels
            work_dir : working directory path where the configuration files are located
            config_file : name of the honeypot configuration file
        """
        logging.debug('Destroying tunnel interfaces.')
        config_file_location = os.path.join(work_dir, config_file)
        parser = ConfigParser()
        parser.read(config_file)
        try:
            tunnel_id = int(parser.getint("tunnel", "startid"))
        except (NoSectionError, NoOptionError):
            logger.error('Error: Incomplete honeyd.cfg configuration.')
            sys.exit(1)

        for i in range(0, len(tunnels)):
            tunnel_id += 1
            name = 'tun' + str(tunnel_id)
            subprocess.Popen(['ip', 'link', 'set', name, 'down'])
            subprocess.Popen(['ip', 'tunnel', 'del', name])
        for mode in ['ipip', 'ip_gre']:
            subprocess.Popen(['modprobe', '-r', mode])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号