List all audits for the vault.

 @example
   Vault.sys.audits #=> { :file => #<Audit> }

 @return [Hash<Symbol, Audit>]
481268
def audits
      json = client.get("/v1/sys/audit")
      json = json[:data] if json[:data]
      return Hash[*json.map do |k,v|
        [k.to_s.chomp("/").to_sym, Audit.decode(v)]
      end.flatten]
    end
163450
def mod_codes
      return @mod_codes if @mod_codes

      @mod_codes = []
      snapshots.each do |s|
        s.content.each.each do |i|
          i.mod_codes.each do |mod_code|
            @mod_codes << {:mod_code => mod_code, :name => i.name}
          end
        end
      end

      return @mod_codes
    end
131556
def listSecrets(region=None, table="credential-store", **kwargs):
    '''
    
    '''
    session = get_session(**kwargs)

    dynamodb = session.resource('dynamodb', region_name=region)
    secrets = dynamodb.Table(table)

    last_evaluated_key = True
    items = []

    while last_evaluated_key:
        params = dict(
            ProjectionExpression="#N, version, #C",
            ExpressionAttributeNames={"#N": "name", "#C": "comment"}
        )
        if last_evaluated_key is not True:
            params['ExclusiveStartKey'] = last_evaluated_key

        response = secrets.scan(**params)

        last_evaluated_key = response.get('LastEvaluatedKey')  # will set last evaluated key to a number
        items.extend(response['Items'])

    return items
103322
def all
      results = []

      with_collection_lock do
        @logger.debug("Finding all boxes in: #{@directory}")
        @directory.children(true).each do |child|
          # Ignore non-directories, since files are not interesting to
          # us in our folder structure.
          next if !child.directory?

          box_name = undir_name(child.basename.to_s)

          # Otherwise, traverse the subdirectories and see what versions
          # we have.
          child.children(true).each do |versiondir|
            next if !versiondir.directory?
            next if versiondir.basename.to_s.start_with?(".")

            version = versiondir.basename.to_s

            versiondir.children(true).each do |provider|
              # Ensure version of box is correct before continuing
              if !Gem::Version.correct?(version)
                ui = Vagrant::UI::Prefixed.new(Vagrant::UI::Colored.new, "vagrant")
                ui.warn(I18n.t("vagrant.box_version_malformed",
                              version: version, box_name: box_name))
                @logger.debug("Invalid version #{version} for box #{box_name}")
                next
              end

              # Verify this is a potentially valid box. If it looks
              # correct enough then include it.
              if provider.directory? && provider.join("metadata.json").file?
                provider_name = provider.basename.to_s.to_sym
                @logger.debug("Box: #{box_name} (#{provider_name}, #{version})")
                results << [box_name, version, provider_name]
              else
                @logger.debug("Invalid box #{box_name}, ignoring: #{provider}")
              end
            end
          end
        end
      end
      # Sort the list to group like providers and properly ordered versions
      results.sort_by! do |box_result|
        [box_result[0], box_result[2], Gem::Version.new(box_result[1])]
      end
      results
    end
281108
def snapshot_list(self):
        '''
        
        '''
        NO_SNAPSHOTS_TAKEN = 'No snapshots have been taken yet!'
        output = self._run_vagrant_command(['snapshot', 'list'])
        if NO_SNAPSHOTS_TAKEN in output:
            return []
        else:
            return output.splitlines()
652000
def snapshots
      return @snapshots if @snapshots

      @snapshots = []
      @files.each do |f|
        io = File.open(f)
        @parser.read(io)
        @snapshots << @parser.snapshot
      end

      return @snapshots
    end
893695
def app_folders
      # Find all app folders
      @app_folders ||= begin
        volt_app    = File.expand_path(File.join(File.dirname(__FILE__), '../../../../app'))
        app_folders = [volt_app, "#{@root}/app", "#{@root}/vendor/app"].map { |f| File.expand_path(f) }

        # Gem folders with volt in them
        # TODO: we should probably qualify this a bit more
        app_folders += Gem.loaded_specs.values
                       .select {|gem| gem.name =~ /^volt/ }
                       .map {|gem| "#{gem.full_gem_path}/app" }

        app_folders.uniq
      end

      # Yield each app folder and return a flattened array with
      # the results

      files        = []
      @app_folders.each do |app_folder|
        files << yield(app_folder)
      end

      files.flatten
    end
273902
def get_all_accounts(self):
        """"""
        for address_hash, rlpdata in self.secure_trie.trie.iter_branch():
            if rlpdata != trie.BLANK_NODE:
                yield rlp.decode(rlpdata, Account, db=self.db, addr=address_hash)
1026398
def audit_logs_list(self, filter_actor_id=None, filter_created_at=None, filter_ip_address=None, filter_source_type=None, **kwargs):
        ""
        api_path = "/api/v2/audit_logs.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if filter_actor_id:
            api_query.update({
                "filter[actor_id]": filter_actor_id,
            })
        if filter_created_at:
            api_query.update({
                "filter[created_at]": filter_created_at,
            })
        if filter_ip_address:
            api_query.update({
                "filter[ip_address]": filter_ip_address,
            })
        if filter_source_type:
            api_query.update({
                "filter[source_type]": filter_source_type,
            })
        return self.call(api_path, query=api_query, **kwargs)
1357107
def get_audits():
    
    if subprocess.call(['which', 'apache2'], stdout=subprocess.PIPE) != 0:
        log("Apache server does not appear to be installed on this node - "
            "skipping apache hardening", level=INFO)
        return []

    context = ApacheConfContext()
    settings = utils.get_settings('apache')
    audits = [
        FilePermissionAudit(paths=os.path.join(
                            settings['common']['apache_dir'], 'apache2.conf'),
                            user='root', group='root', mode=0o0640),

        TemplatedFile(os.path.join(settings['common']['apache_dir'],
                                   'mods-available/alias.conf'),
                      context,
                      TEMPLATES_DIR,
                      mode=0o0640,
                      user='root',
                      service_actions=[{'service': 'apache2',
                                        'actions': ['restart']}]),

        TemplatedFile(os.path.join(settings['common']['apache_dir'],
                                   'conf-enabled/99-hardening.conf'),
                      context,
                      TEMPLATES_DIR,
                      mode=0o0640,
                      user='root',
                      service_actions=[{'service': 'apache2',
                                        'actions': ['restart']}]),

        DirectoryPermissionAudit(settings['common']['apache_dir'],
                                 user='root',
                                 group='root',
                                 mode=0o0750),

        DisabledModuleAudit(settings['hardening']['modules_to_disable']),

        NoReadWriteForOther(settings['common']['apache_dir']),

        DeletedFile(['/var/www/html/index.html'])
    ]

    return audits
1103171
def index
      @audit_events = MnoEnterprise::AuditEvent
      @audit_events = @audit_events.limit(params[:limit]) if params[:limit]
      @audit_events = @audit_events.skip(params[:offset]) if params[:offset]
      @audit_events = @audit_events.order_by(params[:order_by]) if params[:order_by]
      @audit_events = @audit_events.where(params[:where]) if params[:where]
      @audit_events = @audit_events.all.fetch

      response.headers['X-Total-Count'] = @audit_events.metadata[:pagination][:count]

      respond_to do |format|
        format.json
        format.csv do
          headers['Content-Disposition'] = 'attachment; filename="audit-log.csv"'
          headers['Content-Type'] ||= 'text/csv'
        end
      end
    end
1346870
def [](key)
      hashed_key = hash_key(key)
      unless (entry = @btree.get(hashed_key))
        return nil
      end

      if entry.is_a?(PEROBS::Array)
        entry.each do |ae|
          return ae.value if ae.key == key
        end
      else
        return entry.value if entry.key == key
      end

      nil
    end
1254004
public static audit_log[] get(nitro_service client) throws Exception
	{
		audit_log resource = new audit_log();
		resource.validate("get");
		return (audit_log[]) resource.get_resources(client);
	}
671766
def records_for(query)
#      STDERR.puts "records_for(#{query})"
#      STDERR.puts "records_for(#{query.inspect})"
      records = []
      if query.conditions.nil?
	raise "query.conditions.nil?" # FIXME
      else
	query.conditions.operands.each do |operand|
	  if operand.is_a?(DataMapper::Query::Conditions::OrOperation)
	    operand.each do |op|
	      records = records + perform_query(query, op)
	    end
	  else
	    records = perform_query(query, operand)
	  end
	end
      end      
      records
    end
1345086
def get_audits():
    
    audits = []
    settings = utils.get_settings('os')

    # Apply the sysctl settings which are configured to be applied.
    audits.append(SysctlConf())
    # Make sure that only root has access to the sysctl.conf file, and
    # that it is read-only.
    audits.append(FilePermissionAudit('/etc/sysctl.conf',
                                      user='root',
                                      group='root', mode=0o0440))
    # If module loading is not enabled, then ensure that the modules
    # file has the appropriate permissions and rebuild the initramfs
    if not settings['security']['kernel_enable_module_loading']:
        audits.append(ModulesTemplate())

    return audits
704029
def returnListOfCreds():
    '''
        
    '''
    listCreds = []
    # If a accounts.cfg has not been found, creating it by copying from default
    configPath = os.path.join(configuration.getConfigPath()["appPath"], "accounts.cfg")

    # Checking if the configuration file exists
    if not os.path.exists(configPath):
        # Copy the data from the default folder
        defaultConfigPath = os.path.join(configuration.getConfigPath()["appPathDefaults"], "accounts.cfg")

        try:
            with open(defaultConfigPath) as iF:
                cont = iF.read()
                with open(configPath, "w") as oF:
                    oF.write(cont)
        except Exception, e:
            raise errors.ConfigurationFileNotFoundError(configPath, defaultConfigPath);
            return listCreds

    # Reading the configuration file
    config = ConfigParser.ConfigParser()
    config.read(configPath)

    # Iterating through all the sections, which contain the platforms
    for platform in config.sections():
        # Initializing values
        creds = {}

        incomplete = False

        # Iterating through parametgers
        for (param, value) in config.items(platform):
            if value == '':
                incomplete = True
                break
            creds[param] = value

        # Appending credentials if possible
        try:
            if not incomplete:
                listCreds.append((platform, creds["login"], creds["password"]))
        except:
            pass

    return listCreds
1221914
def vaults(options = {})
      batches = Enumerator.new do |y|
        options = options.merge(account_id: @id)
        resp = @client.list_vaults(options)
        resp.each_page do |page|
          batch = []
          page.data.vault_list.each do |v|
            batch << Vault.new(
              account_id: @id,
              name: v.vault_name,
              data: v,
              client: @client
            )
          end
          y.yield(batch)
        end
      end
      Vault::Collection.new(batches)
    end