2023-11-01 01:16:32 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
|
|
|
|
|
|
oldexcepthook = sys.excepthook
|
|
|
|
def newexcepthook(type,value,traceback):
|
|
|
|
oldexcepthook(type,value,traceback)
|
|
|
|
#input("Press ENTER to quit.")
|
|
|
|
sys.excepthook = newexcepthook
|
|
|
|
|
|
|
|
import os
|
|
|
|
p = os.path.join
|
|
|
|
pUp = os.path.dirname
|
|
|
|
s = False
|
|
|
|
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
|
|
|
s = os.path.realpath(sys.executable)
|
|
|
|
else:
|
|
|
|
s = os.path.realpath(__file__)
|
|
|
|
sp = pUp(s)
|
|
|
|
|
|
|
|
# script start
|
|
|
|
try:
|
|
|
|
from Cryptodome.Cipher import AES
|
|
|
|
except:
|
|
|
|
from Crypto.Cipher import AES
|
2023-11-01 01:21:55 +00:00
|
|
|
bufferSize = int(os.environ["fstream_aesbuffer"])
|
2023-11-01 01:16:32 +00:00
|
|
|
unbufferedStdout = os.fdopen(sys.stdout.fileno(),"wb",0) # Make unbuffered stdout
|
|
|
|
|
2023-12-28 04:53:20 +00:00
|
|
|
pw = os.environ["fstream_aespass"].encode("utf-8")
|
|
|
|
while len(pw) < 32: pw = pw + pw
|
|
|
|
pw = pw[:32]
|
2023-11-01 01:16:32 +00:00
|
|
|
|
|
|
|
while True:
|
|
|
|
data = sys.stdin.buffer.read(bufferSize)
|
|
|
|
if len(data) != bufferSize: sys.exit(0)
|
|
|
|
cipher = AES.new(pw, AES.MODE_CBC)
|
|
|
|
unbufferedStdout.write(cipher.iv)
|
|
|
|
unbufferedStdout.write(cipher.encrypt(data))
|