guh
this is truly THE experiment: this code does not handle errors. its just a thing i came up when i think of code obfuscation. think exec(stuff that is generated by this program)
This commit is contained in:
1 parent
1804b94cf2
commit
5f05ca9910
2 files changed
+12
-5
No files matched your search
@@ -11,7 +11,7 @@ with open("./real/real.txt", "rb") as f:
|
|||||||
|
|
||||||
|
|
||||||
def restore_text1(target: bytes, cuh=Iterator[Iterator[tuple[int, int]]]):
|
def restore_text1(target: bytes, cuh=Iterator[Iterator[tuple[int, int]]]):
|
||||||
textin: list[int | None] = []
|
textin: list[int | None] = [] # [None] * len(cuh[0])
|
||||||
for key in cuh: # stfu # type: ignore
|
for key in cuh: # stfu # type: ignore
|
||||||
if len(key) != len(target):
|
if len(key) != len(target):
|
||||||
# raise "actually does happen error"
|
# raise "actually does happen error"
|
||||||
@@ -58,15 +58,17 @@ with open("./real/not_real.txt", "rb") as textin:
|
|||||||
key5 = getkey("./real/keyreal5.txt", "r")
|
key5 = getkey("./real/keyreal5.txt", "r")
|
||||||
key6 = getkey("./real/realkey6.txt", "r")
|
key6 = getkey("./real/realkey6.txt", "r")
|
||||||
key7 = getkey("./real/realkey7.bin", "rb")
|
key7 = getkey("./real/realkey7.bin", "rb")
|
||||||
print(list(map(len, [key5, key6, key7]))) # [141, 141, 141]
|
key8 = getkey("./real/realkey8.txt", "r")
|
||||||
|
key9 = getkey("./real/key9real.bin", "rb")
|
||||||
|
print(list(map(len, [key5, key6, key7, key8, key9]))) # [141, 141, 141]
|
||||||
# print(key5)
|
# print(key5)
|
||||||
content = textin.read()
|
content = textin.read()
|
||||||
print(len(content)) # 141 now not 145 anymore
|
print(len(content)) # 141 now not 145 anymore
|
||||||
print(
|
print(
|
||||||
bytes(
|
bytes(
|
||||||
map(
|
map(
|
||||||
lambda a: a or ord("Q"),
|
lambda a: a if a is not None else int.from_bytes(b"Z"),
|
||||||
restore_text1(content, [key5, key6, key7]), # type: ignore
|
restore_text1(content, [key5, key6, key7, key8, key9]), # type: ignore
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) # i love when Q is NEVER used
|
) # i love when Q is NEVER used
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import random
|
|||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import ast
|
import ast
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
def index_list(range_: range, length: int, seed=None) -> Iterator[int]:
|
def index_list(range_: range, length: int, seed=None) -> Iterator[int]:
|
||||||
@@ -158,7 +159,11 @@ def main():
|
|||||||
# help="Output file (default: stdout)"
|
# help="Output file (default: stdout)"
|
||||||
# )
|
# )
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
# if isinstance(args.bytes, int):
|
||||||
|
# if args.bytes <= 0:
|
||||||
|
# raise ValueError("how would i store your key stupid")
|
||||||
|
# if args.bytes & (args.bytes - 1) != 0:
|
||||||
|
# warnings.warn(UserWarning("not a power of two: wont be an easy life"))
|
||||||
match args.command:
|
match args.command:
|
||||||
case "encrypt":
|
case "encrypt":
|
||||||
with open(args.filein, "rb") as fin:
|
with open(args.filein, "rb") as fin:
|
||||||
|
|||||||
Reference in new issue
Block a user