Skip to content

Instantly share code, notes, and snippets.

@ken5scal
Created April 17, 2024 10:50
Show Gist options
  • Save ken5scal/32909b237cf4c624ee952df57673fbaa to your computer and use it in GitHub Desktop.
Save ken5scal/32909b237cf4c624ee952df57673fbaa to your computer and use it in GitHub Desktop.
decode b64 encoded aaguid in authData. credentialData
import base64
import sys
def decode_and_convert_to_hex(encoded_str):
# Decode from Base64 to bytes
decoded_bytes = base64.b64decode(encoded_str)
# Convert bytes to hexadecimal
hex_string = decoded_bytes.hex()
aaguid = "-".join([hex_string[:8],hex_string[8:][:4],hex_string[12:][:4],hex_string[16:][:4],hex_string[20:]])
# Return the hexadecimal string
return aaguid
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python script.py <base64_encoded_string>")
sys.exit(1)
encoded_input = sys.argv[1]
hex_output = decode_and_convert_to_hex(encoded_input)
print("Hexadecimal representation:", hex_output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment