Clean up utils (still need more)

This commit is contained in:
573dev 2020-10-13 22:59:26 -05:00
parent 3fe53599eb
commit f43eee8553
3 changed files with 8 additions and 3 deletions

2
TODO.txt Normal file
View File

@ -0,0 +1,2 @@
- Implement proper logging (is there some sort of flask logging, or should I just log to a file?)
- Add typing

View File

@ -5,7 +5,7 @@ from Crypto.Hash import MD5
class EamuseARC4(object):
def __init__(self, eamuse_key):
# fmt: off
self.internal_key = bytearray([
internal_key = bytearray([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0xd7,
0x46, 0x27, 0xd9, 0x85, 0xee, 0x21, 0x87, 0x16,
0x15, 0x70, 0xd0, 0x8d, 0x93, 0xb1, 0x24, 0x55,
@ -13,8 +13,8 @@ class EamuseARC4(object):
])
# fmt: on
self.key = MD5.new(eamuse_key + self.internal_key[6:]).digest()
self.arc = ARC4.new(self.key)
key = MD5.new(eamuse_key + internal_key[6:]).digest()
self.arc = ARC4.new(key)
def decrypt(self, data):
return self.arc.decrypt(bytes(data))

View File

@ -2,4 +2,7 @@ from time import time
def get_timestamp() -> str:
"""
Make a timestamp int for logging purposes
"""
return str(int(round(time() * 1000)))