feat: LambdaAccessKey module
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/python3
|
||||
import base64
|
||||
import hashlib
|
||||
import requests
|
||||
|
||||
def decrypt_data(encrypted_data: str) -> str:
|
||||
key_hash = hashlib.sha256('${encryption_pass}'.encode()).digest()
|
||||
encrypted_bytes = base64.b64decode(encrypted_data.encode())
|
||||
|
||||
decrypted = bytes(b ^ key_hash[i % len(key_hash)] for i, b in enumerate(encrypted_bytes))
|
||||
return decrypted.decode()
|
||||
|
||||
url = "${cloudfront_url}"
|
||||
try:
|
||||
response = requests.get(url, timeout=10)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
print(decrypt_data(data['result']))
|
||||
|
||||
except requests.exceptions.HTTPError as http_err:
|
||||
print(f"HTTP error occurred: {http_err}")
|
||||
except Exception as err:
|
||||
print(f"An error occurred: {err}")
|
||||
Reference in New Issue
Block a user