Class: Ronin::Exploits::Loot Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ronin/exploits/loot.rb,
lib/ronin/exploits/loot/file.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represents an exploit's loot store.

Since:

  • 1.0.0

API:

  • private

Defined Under Namespace

Classes: File

Instance Method Summary collapse

Constructor Details

#initializeLoot

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes the loot store.

Since:

  • 1.0.0

API:

  • private



42
43
44
# File 'lib/ronin/exploits/loot.rb', line 42

def initialize
  @files = {}
end

Instance Method Details

#[](path) ⇒ File?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Accesses a loot file in the loot store.

Parameters:

  • The file name or relative path for the loot file.

Returns:

  • The matching loot file for the given path.

Since:

  • 1.0.0

API:

  • private



76
77
78
# File 'lib/ronin/exploits/loot.rb', line 76

def [](path)
  @files[path]
end

#add(path, contents, **kwargs) ⇒ Object

Adds a captured loot file to the loot store.

Parameters:

Options Hash (**kwargs):

  • :format (:json, :yaml, :csv, nil)

    Optional export format to use.

Since:

  • 1.0.0

API:

  • public



63
64
65
# File 'lib/ronin/exploits/loot.rb', line 63

def add(path,contents,**kwargs)
  @files[path] = File.new(path,contents,**kwargs)
end

#each {|file| ... } ⇒ Enumerator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Enumerates over each loot file.

Yields:

  • (file)

    The given block will be passed each loot file.

Yield Parameters:

  • file (File)

    A loot file in the loot store.

Returns:

  • If no block is given, an Enumerator will be returned.

Since:

  • 1.0.0

API:

  • private



92
93
94
# File 'lib/ronin/exploits/loot.rb', line 92

def each(&block)
  @files.each_value(&block)
end

#empty?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Determines if the loot store is empty or not.

Returns:

Since:

  • 1.0.0

API:

  • private



101
102
103
# File 'lib/ronin/exploits/loot.rb', line 101

def empty?
  @files.empty?
end

#save(output_dir) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Saves the loot files to the output directory.

Parameters:

Since:

  • 1.0.0

API:

  • private



110
111
112
113
114
115
116
# File 'lib/ronin/exploits/loot.rb', line 110

def save(output_dir)
  FileUtils.mkdir_p(output_dir)

  @files.each_value do |file|
    file.save(output_dir)
  end
end