Add packaged DLP broker and protected Windows service foundation

This commit is contained in:
Karl committed 2026-10-14 14:19:22 +02:00
1 parent 95d23f4e0b
commit 7b5057901a
140 files changed
+11215 -60

No files matched your search

+8 -3
View File
@@ -24,10 +24,15 @@ def convert(data,protect):
if __name__=='__main__':
try:
if sys.platform!='win32' or len(sys.argv)!=2 or sys.argv[1] not in ['protect','unprotect']: raise ValueError()
data=sys.stdin.buffer.read(32769)
if not data or len(data)>32768:raise ValueError()
limit=32768 if sys.argv[1]=='protect' else 65536
data=sys.stdin.buffer.read(limit+1)
if not data or len(data)>limit:raise ValueError()
if sys.argv[1]=='protect':output=base64.b64encode(convert(data,True))
else:output=convert(base64.b64decode(data,validate=True),False)
else:
decoded=base64.b64decode(data,validate=True)
if base64.b64encode(decoded)!=data:raise ValueError()
output=convert(decoded,False)
if len(output)>(65536 if sys.argv[1]=='protect' else 32768):raise ValueError()
sys.stdout.buffer.write(output)
except Exception:
sys.stderr.write('Windows capability protection failed.\n');sys.exit(1)