Exemplo n.º 1
0
 def crawl(self,
           root_dir='/',
           exclude_dirs=[
               '/boot', '/dev', '/proc', '/sys', '/mnt', '/tmp',
               '/var/cache', '/usr/share/man', '/usr/share/doc',
               '/usr/share/mime'
           ],
           **kwargs):
     return crawl_files(root_dir=root_dir, exclude_dirs=exclude_dirs)
 def crawl(
         self,
         root_dir='/',
         exclude_dirs=[
             '/boot',
             '/dev',
             '/proc',
             '/sys',
             '/mnt',
             '/tmp',
             '/var/cache',
             '/usr/share/man',
             '/usr/share/doc',
             '/usr/share/mime'],
         **kwargs):
     return crawl_files(root_dir=root_dir,
                        exclude_dirs=exclude_dirs)
Exemplo n.º 3
0
    def crawl(
            self,
            container_id=None,
            avoid_setns=False,
            root_dir='/',
            exclude_dirs=[
                '/boot',
                '/dev',
                '/proc',
                '/sys',
                '/mnt',
                '/tmp',
                '/var/cache',
                '/usr/share/man',
                '/usr/share/doc',
                '/usr/share/mime'],
            **kwargs):
        inspect = utils.dockerutils.exec_dockerinspect(container_id)
        state = inspect['State']
        pid = str(state['Pid'])
        logger.debug('Crawling file for container %s' % container_id)

        if avoid_setns:
            rootfs_dir = utils.dockerutils.get_docker_container_rootfs_path(
                container_id)
            exclude_dirs = [utils.misc.join_abs_paths(rootfs_dir, d)
                            for d in exclude_dirs]
            return crawl_files(
                root_dir=utils.misc.join_abs_paths(rootfs_dir, root_dir),
                exclude_dirs=exclude_dirs,
                root_dir_alias=root_dir)
        else:  # in all other cases, including wrong mode set
            return run_as_another_namespace(pid,
                                            ['mnt'],
                                            crawl_files,
                                            root_dir,
                                            exclude_dirs,
                                            None)