import subprocess from os import path import os import random class Hacker: def run_bash(self): try: subprocess.run("bash hacker.sh", shell=True, cwd=path.dirname(__file__)) except KeyboardInterrupt: pass def run_py(self): 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")