From f9bb8ec1394c0d51f02a08d4fa0ae7b2820f978f Mon Sep 17 00:00:00 2001 From: luihum <23081124+luihum@users.noreply.github.com> Date: Sat, 30 Apr 2022 10:54:47 -0300 Subject: [PATCH 1/7] Started work on ProgressDOS --- progressdos.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 progressdos.py diff --git a/progressdos.py b/progressdos.py new file mode 100644 index 0000000..5c2a530 --- /dev/null +++ b/progressdos.py @@ -0,0 +1,32 @@ +from tkinter import E +from clear import clear + +def shell(type = None): + wd = [] # working directory + dirs = [] + if type == "dos" or type == None: + clear() + while(True): + command = input(f"C:{chr(92).join(wd)}>").strip().split() + if command == []: + continue + elif command[0] == "dir": + print("..") + for dir in dirs: + print(dir.ljust(16) + "") + elif command[0] == "exit": + return + elif command[0] == "echo": + print(" ".join(command[1:])) + + else: + print("Invalid command") + elif type == "terminus": + print("Terminus is not implemented yet. Sorry!") + else: + raise ValueError(f"Unknown shell type {type}") + + + +shell() + From 2d4ff21424bfa3d67f0d02a4bfd9dff540614df4 Mon Sep 17 00:00:00 2001 From: luihum <23081124+luihum@users.noreply.github.com> Date: Sun, 1 May 2022 12:57:52 -0300 Subject: [PATCH 2/7] improved progressdos --- progressdos.py | 81 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 19 deletions(-) diff --git a/progressdos.py b/progressdos.py index 5c2a530..240d622 100644 --- a/progressdos.py +++ b/progressdos.py @@ -1,32 +1,75 @@ -from tkinter import E from clear import clear +from rich import print as rprint + +global directory, cwd def shell(type = None): - wd = [] # working directory - dirs = [] + # File types: + # @ Directory + # # Encrypted + # $ Executable + # ! System directory + # & Encrypted directory + # % Hidden directory + + cwd = [""] # current working directory + directory = {"": ["!PROGRESSBAR", "FILE"]} if type == "dos" or type == None: clear() while(True): - command = input(f"C:{chr(92).join(wd)}>").strip().split() - if command == []: - continue - elif command[0] == "dir": - print("..") - for dir in dirs: - print(dir.ljust(16) + "") - elif command[0] == "exit": - return - elif command[0] == "echo": - print(" ".join(command[1:])) + command = input(f"C:{chr(92).join(cwd)}>").lower().strip().split() + try: + match command[0]: + case "": continue + case "exit": return + case "dir": + if directory.get("\\".join(cwd)) == None: + print("") + continue + print("..") + for item in directory["\\".join(cwd)]: + match item[0]: + case "@"|"!"|"&": # if directory/system/encrypted directory + print(item[1:].ljust(16) + "") + case "$": # if executable + print(item[1:].ljust(17) + "EXE") + case "%": # if hidden directory + pass + case "#": # if encrypted file + print(item[1:].ljust(17) + "TXT") + case _: + print(item.ljust(17) + "TXT") - else: - print("Invalid command") + case "echo": + print(" ".join(command[1:])) + case "green": + clear() + rprint("[#00ff00]WAKE UP, THE ONE...") + case "lgr": + clear() + rprint("[#00ff00]WOODGRAIN!") + case "john": + if " ".join(command) == "john connor": + print("POLICE AUTOMATED INDEX") + print("NAME QUERY:") + print() + print("LAST NAME: CONNOR") + print("FIRST NAME: JOHN") + print("MALE") + print("DOB: 28/2/85") + print() + else: print("Invalid command") + case "mkdir": + directory["\\".join(cwd)].append("@"+command[1].upper()) + case _: + if command == []: continue + print(directory["\\".join(cwd)][0]) + if command[0] in directory["\\".join(cwd)]: + print("COOL") + except IndexError: pass elif type == "terminus": print("Terminus is not implemented yet. Sorry!") else: raise ValueError(f"Unknown shell type {type}") - - shell() - From 6959bff7c364f0d61a0e6cb960a5083dea4fa7da Mon Sep 17 00:00:00 2001 From: luihum <23081124+luihum@users.noreply.github.com> Date: Sun, 1 May 2022 13:05:59 -0300 Subject: [PATCH 3/7] forgor that only folders are encrypted --- progressdos.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/progressdos.py b/progressdos.py index 240d622..e54bd91 100644 --- a/progressdos.py +++ b/progressdos.py @@ -6,7 +6,6 @@ def shell(type = None): # File types: # @ Directory - # # Encrypted # $ Executable # ! System directory # & Encrypted directory @@ -22,6 +21,9 @@ def shell(type = None): match command[0]: case "": continue case "exit": return + case "help": + print(" BASIC PROGRESSDOS COMMANDS:") + case "dir": if directory.get("\\".join(cwd)) == None: print("") @@ -35,8 +37,6 @@ def shell(type = None): print(item[1:].ljust(17) + "EXE") case "%": # if hidden directory pass - case "#": # if encrypted file - print(item[1:].ljust(17) + "TXT") case _: print(item.ljust(17) + "TXT") @@ -63,9 +63,8 @@ def shell(type = None): directory["\\".join(cwd)].append("@"+command[1].upper()) case _: if command == []: continue - print(directory["\\".join(cwd)][0]) if command[0] in directory["\\".join(cwd)]: - print("COOL") + print("COOL") # debug except IndexError: pass elif type == "terminus": print("Terminus is not implemented yet. Sorry!") From 54086caea3ffc2159bf6cf101e4a5f1739c94b84 Mon Sep 17 00:00:00 2001 From: luihum <23081124+luihum@users.noreply.github.com> Date: Mon, 2 May 2022 09:29:59 -0300 Subject: [PATCH 4/7] Added CD and hexviewer --- progressdos.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/progressdos.py b/progressdos.py index e54bd91..1b1acf8 100644 --- a/progressdos.py +++ b/progressdos.py @@ -1,3 +1,4 @@ +import random from clear import clear from rich import print as rprint @@ -23,6 +24,12 @@ def shell(type = None): case "exit": return case "help": print(" BASIC PROGRESSDOS COMMANDS:") + case "cd"|"cd..": + if command[0] == "cd.." or command[1] == ".." and len(cwd) > 1: + cwd.pop() + else: + if any(command[1] in word for word in directory["\\".join(cwd)]): + print("CE-") case "dir": if directory.get("\\".join(cwd)) == None: @@ -61,14 +68,29 @@ def shell(type = None): else: print("Invalid command") case "mkdir": directory["\\".join(cwd)].append("@"+command[1].upper()) + case "hexview": hexviewer(int(command[1])) # debug command case _: if command == []: continue if command[0] in directory["\\".join(cwd)]: print("COOL") # debug - except IndexError: pass + except (IndexError,KeyError): pass elif type == "terminus": print("Terminus is not implemented yet. Sorry!") else: raise ValueError(f"Unknown shell type {type}") +def hexviewer(size): + # format(random.randrange(0,255), "02x").upper() + hexmatrix = [] + hexcode = format(random.randrange(0,255), "02x").upper() + hexmatrix = [hexcode] * 5 + while len(hexmatrix) != size: + randomhex = format(random.randrange(0,255), "02x").upper() + if randomhex != hexcode and hexmatrix.count(hexcode): + hexmatrix.append(randomhex) + for line in hexmatrix: print(" ".join(line)) + + # for i in range(6): + # random_loc = random.choice(hexmatrix[random.randrange(size)]) + # hexmatrix[random_loc] = hexcode shell() From d2f874f24d60aae7960fc91a17b3f6f155331eb3 Mon Sep 17 00:00:00 2001 From: luihum <23081124+luihum@users.noreply.github.com> Date: Mon, 2 May 2022 11:39:19 -0300 Subject: [PATCH 5/7] new hex printing code --- progressdos.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/progressdos.py b/progressdos.py index 1b1acf8..5b185e8 100644 --- a/progressdos.py +++ b/progressdos.py @@ -84,12 +84,19 @@ def hexviewer(size): hexmatrix = [] hexcode = format(random.randrange(0,255), "02x").upper() hexmatrix = [hexcode] * 5 - while len(hexmatrix) != size: + while len(hexmatrix) != size**2: randomhex = format(random.randrange(0,255), "02x").upper() - if randomhex != hexcode and hexmatrix.count(hexcode): + if randomhex != hexcode and hexmatrix.count(randomhex) < 5: hexmatrix.append(randomhex) - for line in hexmatrix: print(" ".join(line)) - + tmp = [] + for b in hexmatrix: + tmp.append([b]) + hexmatrix = tmp + for line in range(size): + for item in range(1, size+1): + sep = ' ' if item != size else '\n' + random.shuffle(hexmatrix) + print(hexmatrix[line], sep=sep) # for i in range(6): # random_loc = random.choice(hexmatrix[random.randrange(size)]) # hexmatrix[random_loc] = hexcode From cca4d8dbca0d4ae55b14f8ef44ea5dae9df315ea Mon Sep 17 00:00:00 2001 From: "J. Sandmiz" Date: Mon, 2 May 2022 17:33:17 -0300 Subject: [PATCH 6/7] Updated Hex Viewer --- progressdos.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/progressdos.py b/progressdos.py index 5b185e8..32770f4 100644 --- a/progressdos.py +++ b/progressdos.py @@ -80,7 +80,6 @@ def shell(type = None): raise ValueError(f"Unknown shell type {type}") def hexviewer(size): - # format(random.randrange(0,255), "02x").upper() hexmatrix = [] hexcode = format(random.randrange(0,255), "02x").upper() hexmatrix = [hexcode] * 5 @@ -88,16 +87,11 @@ def hexviewer(size): randomhex = format(random.randrange(0,255), "02x").upper() if randomhex != hexcode and hexmatrix.count(randomhex) < 5: hexmatrix.append(randomhex) - tmp = [] - for b in hexmatrix: - tmp.append([b]) - hexmatrix = tmp + + random.shuffle(hexmatrix) + for line in range(size): - for item in range(1, size+1): - sep = ' ' if item != size else '\n' - random.shuffle(hexmatrix) - print(hexmatrix[line], sep=sep) - # for i in range(6): - # random_loc = random.choice(hexmatrix[random.randrange(size)]) - # hexmatrix[random_loc] = hexcode + for item in range(size): + sep = ' ' if item != size-1 else '\n' + print(hexmatrix[(line*size)+item], end=sep) shell() From 4018a687cedbbdf364b9c18419e1b0bd6235e141 Mon Sep 17 00:00:00 2001 From: "J. Sandmiz" Date: Mon, 2 May 2022 19:22:52 -0300 Subject: [PATCH 7/7] Old numbers recycling Now its harder to guess correct number --- progressdos.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/progressdos.py b/progressdos.py index 32770f4..68fabbf 100644 --- a/progressdos.py +++ b/progressdos.py @@ -83,8 +83,10 @@ def hexviewer(size): hexmatrix = [] hexcode = format(random.randrange(0,255), "02x").upper() hexmatrix = [hexcode] * 5 + randomhex = format(random.randrange(0,255), "02x").upper() while len(hexmatrix) != size**2: - randomhex = format(random.randrange(0,255), "02x").upper() + if random.randint(1, 10) > 5: + randomhex = format(random.randrange(0,255), "02x").upper() if randomhex != hexcode and hexmatrix.count(randomhex) < 5: hexmatrix.append(randomhex)