def spider_shares(self):
        """This function enumerates all available shares for the SMB connection, spiders
        through the readable shares, and saves the metadata of the shares to a JSON file.
        """
        self.logger.info("Enumerating shares for spidering.")
        shares = self.smb.shares()

        try:
            # Get all available shares for the SMB connection
            for share in shares:
                share_perms = share["access"]
                share_name = share["name"]
                self.stats["shares"].append(share_name)

                self.logger.info(f'Share "{share_name}" has perms {share_perms}')
                if "WRITE" in share_perms:
                    self.stats["shares_writable"].append(share_name)
                if "READ" in share_perms:
                    self.stats["shares_readable"].append(share_name)
                else:
                    # We only want to spider readable shares
                    self.logger.debug(f'Share "{share_name}" not readable.')
                    continue

                # `exclude_filter` is applied to the shares name
                if share_name.lower() in self.exclude_filter:
                    self.logger.info(f'Share "{share_name}" has been excluded.')
                    self.stats["num_shares_filtered"] += 1
                    continue

                try:
                    # Start the spider at the root of the share folder
                    self.results[share_name] = {}
                    self.spider_folder(share_name, "")
                except SessionError:
                    traceback.print_exc()
                    self.logger.fail(f"Got a session error while spidering.")
                    self.reconnect()

        except Exception as e:
            traceback.print_exc()
            self.logger.fail(f"Error enumerating shares: {str(e)}")

        # Save the metadata.
        self.dump_folder_metadata(self.results)

        # Print stats.
        if self.stats_flag:
            self.print_stats()

        return self.results
This function enumerates all available shares for the SMB connection, spiders
        through the readable shares, and saves the metadata of the shares to a JSON file.
        
cme/modules/spider_plus.py