Module: Ronin::Repos

Defined in:
lib/ronin/repos.rb,
lib/ronin/repos/cli.rb,
lib/ronin/repos/root.rb,
lib/ronin/repos/version.rb,
lib/ronin/repos/cache_dir.rb,
lib/ronin/repos/class_dir.rb,
lib/ronin/repos/exceptions.rb,
lib/ronin/repos/repository.rb,
lib/ronin/repos/cli/command.rb,
lib/ronin/repos/cli/commands/new.rb,
lib/ronin/repos/cli/commands/list.rb,
lib/ronin/repos/cli/commands/purge.rb,
lib/ronin/repos/cli/commands/remove.rb,
lib/ronin/repos/cli/commands/update.rb,
lib/ronin/repos/cli/commands/install.rb

Overview

Top-level methods for accessing repositories.

Defined Under Namespace

Modules: ClassDir Classes: CLI, CacheDir, CommandFailed, CommandNotInstalled, Exception, Repository, RepositoryNotFound

Constant Summary collapse

ROOT =

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

Path to ronin-repos root directory.

File.expand_path(File.join(__dir__,'..','..','..'))
VERSION =

ronin-repos version

'0.1.1'

Class Method Summary collapse

Class Method Details

.find_file(path) ⇒ String?

Finds the first matching file.

Examples:

repos.find_file("wordlists/wordlist.txt")
# => "/home/user/.cache/ronin-repos/foo-repo/wordlists/wordlist.txt"

Parameters:

  • path (String)

    The relative path of the file.

Returns:

  • (String, nil)

    The absolute path of the matching file or nil if no matching file could be found.



44
45
46
# File 'lib/ronin/repos.rb', line 44

def self.find_file(path)
  @cache_dir.find_file(path)
end

.glob(pattern, &block) ⇒ Array<String>

Finds all files in all repos that matches the glob pattern

Examples:

repos.glob("wordlists/*.txt")
# => ["/home/user/.cache/ronin-repos/foo-repo/wordlists/cities.txt",
#     "/home/user/.cache/ronin-repos/foo-repo/wordlists/states.txt",
#     "/home/user/.cache/ronin-repos/bar-repo/wordlists/bands.txt",
#     "/home/user/.cache/ronin-repos/bar-repo/wordlists/beers.txt"]

Parameters:

  • pattern (String)

    The file glob pattern to search for.

Returns:

  • (Array<String>)

    The absolute paths to the files that match the glob pattern.



64
65
66
# File 'lib/ronin/repos.rb', line 64

def self.glob(pattern,&block)
  @cache_dir.glob(pattern,&block)
end

.list_files(pattern = '{**/}*.*') ⇒ Set<String>

Lists all files across all installed repos.

Parameters:

  • pattern (String) (defaults to: '{**/}*.*')

    The glob pattern to use to list specific files.

Returns:

  • (Set<String>)

    The matching files within all repositories.



77
78
79
# File 'lib/ronin/repos.rb', line 77

def self.list_files(pattern='{**/}*.*')
  @cache_dir.list_files(pattern)
end