-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpanoptic.py
More file actions
executable file
·46 lines (40 loc) · 1.26 KB
/
panoptic.py
File metadata and controls
executable file
·46 lines (40 loc) · 1.26 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
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
# panoptic.py — minimal, privacy-first, no-network, no-identity
# Read. Fork. Run. Exit.
import os
import sys
import tempfile
import hashlib
import time
__version__ = "0.1.0"
def deterministic_payload():
return "panoptic-null-python\nversion:" + __version__ + "\nstamp:" + time.strftime("%Y%m%dT%H%M%SZ", time.gmtime())
def sha256_of_text(text):
return hashlib.sha256(text.encode("utf-8")).hexdigest()
def main():
tmp = tempfile.mkdtemp(prefix="panoptic-null-")
try:
print("Panoptic Null Python CLI")
print("Temporary workspace:", tmp)
payload = deterministic_payload()
path = os.path.join(tmp, "data.txt")
with open(path, "w", encoding="utf-8") as f:
f.write(payload)
digest = sha256_of_text(payload)
print("sha256:", digest)
print("--- content ---")
print(payload)
print("---------------")
print("Read. Fork. Run. Exit.")
return 0
finally:
try:
for name in os.listdir(tmp):
p = os.path.join(tmp, name)
if os.path.isfile(p):
os.remove(p)
os.rmdir(tmp)
except Exception:
pass
if __name__ == "__main__":
sys.exit(main())