Package ghidra.formats.gfilesystem.crypto

# Class CmdLinePasswordProvider

java.lang.Object
ghidra.formats.gfilesystem.crypto.CmdLinePasswordProvider

All Implemented Interfaces:
  `CryptoProvider`, `PasswordProvider`

public class CmdLinePasswordProvider extends Object implements PasswordProvider
A `PasswordProvider` that supplies passwords to decrypt files via the java jvm invocation.

Example:

    java -Dfilesystem.passwords=/fullpath/to/textfile

The password file is a plain text tabbed-csv file, where each line specifies a password and an optional file identifier.

Example file contents, where each line is divided into fields by a tab character where the first field is the password and the second optional field is the file's identifying information (name, path, etc):

     password1   [tab]   myfirstzipfile.zip ← supplies a password for the named file located in any directory
     someOtherPassword   [tab]   /full/path/tozipfile.zip ← supplies password for file at specified location
     anotherPassword [tab]   file:///full/path/tozipfile.zip|zip:///subdir/in/zip/somefile.txt ← supplies password for file embedded inside a zip
     yetAnotherPassword ← a password to try for any file that needs a password

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface ghidra.formats.gfilesystem.crypto.CryptoProvider

  `CryptoProvider.Session`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `CMDLINE_PASSWORD_PROVIDER_PROPERTY_NAME`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CmdLinePasswordProvider()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Iterator<Password>`
  `getPasswordsFor(FSRL fsrl, String prompt, CryptoProvider.Session session)`
  Returns a sequence of passwords (ordered by quality) that may apply to the specified file.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### CMDLINE_PASSWORD_PROVIDER_PROPERTY_NAME

    public static final String CMDLINE_PASSWORD_PROVIDER_PROPERTY_NAME
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### CmdLinePasswordProvider

    public CmdLinePasswordProvider()

- ## Method Details

  - ### getPasswordsFor

    public Iterator<Password> getPasswordsFor(FSRL fsrl, String prompt, CryptoProvider.Session session)
    Description copied from interface: `PasswordProvider`
    Returns a sequence of passwords (ordered by quality) that may apply to the specified file.
    Specified by:
      `getPasswordsFor` in interface `PasswordProvider`
    Parameters:
      `fsrl` - `FSRL` path to the password protected file
      `prompt` - optional prompt that may be displayed to a user
      `session` - a place to hold state values that persist across related queries
    Returns:
      `Iterator` of possible passwords