-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathscript.py
More file actions
38 lines (29 loc) · 1 KB
/
Copy pathscript.py
File metadata and controls
38 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import random
import os
import requests
import time
from datetime import datetime, timezone
from Crypto.Cipher import AES
FLAG = os.environ.get("FLAG", "glovo{f4k3_fl4g}").encode()
def blend_key(key_bytes):
key_int = int(key_bytes.hex(), 16)
current_ts = int(time.time())
print(
f"{datetime.fromtimestamp(current_ts, tz=timezone.utc).strftime('%Y-%m-%d %H:%M:%S UTC')} - Starting shuffling process"
)
key_int *= random.randint(1, 9999999)
key_int *= random.randint(1, 1234567)
key_int *= random.randint(1, 99999)
key_int += 998877665544332211 * 13 // 9833 + 123456789
key_int *= current_ts
return key_int
def main():
key = os.getenv("SECRET_KEY").encode()
iv = b"product_security"
cipher = AES.new(key, AES.MODE_OFB, iv)
encrypted_flag = cipher.encrypt(FLAG)
shuffled_key = blend_key(key)
body = f"Your shuffled key:\n{shuffled_key}\n\nHere's your encrypted flag:\n{encrypted_flag.hex()}"
print(body)
if __name__ == "__main__":
main()