Island: small style improvements in stolen_credentials.py

This commit is contained in:
vakarisz 2022-02-28 16:45:36 +02:00
parent 40820a5ba5
commit 748178a00c
1 changed files with 2 additions and 9 deletions

View File

@ -16,11 +16,7 @@ def get_stolen_creds() -> Sequence[Mapping]:
def extract_ssh_keys(credentials: Sequence[Mapping]) -> Sequence[Mapping]: def extract_ssh_keys(credentials: Sequence[Mapping]) -> Sequence[Mapping]:
ssh_keys = [] return [c for c in credentials if c["_type"] == CredentialComponentType.SSH_KEYPAIR.name]
for credential in credentials:
if credential["_type"] == CredentialComponentType.SSH_KEYPAIR.name:
ssh_keys.append(credential)
return ssh_keys
def _fetch_from_db() -> Sequence[StolenCredentials]: def _fetch_from_db() -> Sequence[StolenCredentials]:
@ -53,7 +49,4 @@ def _format_creds_for_reporting(credentials: Sequence[StolenCredentials]):
def _get_username(credentials: StolenCredentials) -> str: def _get_username(credentials: StolenCredentials) -> str:
if credentials.identities: return credentials.identities[0]["username"] if credentials.identities else ""
return credentials.identities[0]["username"]
else:
return ""