Skip to content

Commit

Permalink
feat: add support for password extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
Tari-dev committed Jan 21, 2025
1 parent fde94fd commit 26fceaf
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion passgithelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,13 @@ def get_value(
),
"entry_name": EntryNameExtractor(option_suffix="_username"),
}
_password_extractors = {
_line_extractor_name: SpecificLineExtractor(0, 0, option_suffix="_password"),
"regex_search": RegexSearchExtractor(
r"^password: +(.*)$", option_suffix="_password"
),
"entry_name": EntryNameExtractor(option_suffix="_password"),
}


def find_mapping_section(
Expand Down Expand Up @@ -384,7 +391,14 @@ def get_password(

pass_target = define_pass_target(section, request)

password_extractor = SpecificLineExtractor(0, 0, option_suffix="_password")
password_extractor_name: str = section.get( # type: ignore
"password_extractor", fallback=_line_extractor_name
)
password_extractor = _password_extractors.get(password_extractor_name)
if password_extractor is None:
raise ValueError(
f"A password_extractor of type '{password_extractor_name}' does not exist"
)
password_extractor.configure(section)

username_extractor_name: str = section.get( # type: ignore
Expand Down

0 comments on commit 26fceaf

Please sign in to comment.