Agent: Add documentation to functions in brute_force.

This commit is contained in:
Mike Salvatore 2022-02-18 09:02:41 -05:00
parent 5c872a67c3
commit 4d6f552ba2
1 changed files with 17 additions and 2 deletions

View File

@ -5,6 +5,13 @@ from typing import Any, Iterable, Tuple
def generate_identity_secret_pairs(
identities: Iterable, secrets: Iterable
) -> Iterable[Tuple[Any, Any]]:
"""
Generates all possible combinations of identities and secrets (e.g. usernames and passwords).
:param identities: An iterable containing identity components of a credential pair
:param secrets: An iterable containing secret components of a credential pair
:return: An iterable of all combinations of identity/secret pairs. If either identities or
secrets is empty, an empty iterator is returned.
"""
return product(identities, secrets)
@ -15,8 +22,16 @@ def generate_username_password_or_ntlm_hash_combinations(
nt_hashes: Iterable[str],
) -> Iterable[Tuple[str, str, str, str]]:
"""
Returns all combinations of the configurations users and passwords or lm/ntlm hashes
:return:
Generates all possible combinations of the following: username/password, username/lm_hash,
username/nt_hash.
:param usernames: An iterable containing usernames
:param passwords: An iterable containing passwords
:param lm_hashes: An iterable containing lm_hashes
:param nt_hashes: An iterable containing nt_hashes
:return: An iterable containing tuples of all possible credentials combinations. Note that each
tuple will contain a username and at most one secret component (i.e. password, lm_hash,
nt_hash). If usernames is empty, an empty iterator is returned. If all secret component
iterators are empty, an empty iterator is returned.
"""
return chain(
product(usernames, passwords, [""], [""]),