import os import random import subprocess from os import path def run_bash(): try: subprocess.run("bash hacker.sh", shell=True, cwd=path.dirname(__file__)) except KeyboardInterrupt: pass def run_py(): columns = int(os.popen('stty size', 'r').read().split()[1]) # length of current line try: while True: num_to_show = random.randint(0, 1) count = random.randint(3, columns // 20) hacker = " " * columns for i in range(count): pos = random.randint(0, columns) hacker = hacker[:pos] + str(num_to_show) + hacker[pos + 1:] print("\033[92m" + hacker) except KeyboardInterrupt: print(columns) print("Finished") print("\033[0m") functions = { "runBash": run_bash, "runPy": run_py }