~ATH implementation attempt
Jump to navigation
Jump to search
TH12 12 User:TheMCoder's 4TT3MPT 4T M4K1NG ~ATH V14 PYTH0N. 4LL CR3D1T F0R TH3 C0NC3PT G032 T0 Andrew Hussie.
Syntax
It follows standard ~ATH code with a few differences. If you need a refresher, follow this link: ~ATH
First, it does not allow loops inside of loops. I might add that later. Second, the execute command only works for python files. Lastly, THIS.die() is required, if it is not added, an error will be returned.
Examples
A basic program would be
~ATH(Taskmgr.exe){}execute(test.py); THIS.die()
and assuming that test.py is in the same folder with the following contents:
print("Hello, World!")
and that the program is running on windows(I do not know if psutil supports the other Oses) It will return "Hello, World!" once Task Manager quits
My Code
import psutil import argparse import string command = "" parser = argparse.ArgumentParser() parser.add_argument("file", type=str) parser.parse_args() file = open(parser.parse_args().file, "r").read().replace('\n', ).split(';') def is_process_running(process_name): for process in psutil.process_iter(['name']): if process.info['name'] == process_name: return True return False def main(): if not "THIS.die()" in file: print("Error: This.die() not found") return for line in file: if line.startswith('~ATH('): process_name = line.split('(')[1].split(')')[0] if is_process_running(process_name): while is_process_running(process_name): pass if line.split('}')[1].split('(')[0] == "execute": program_name = line.split('(')[2].split(')')[0] if program_name != "NULL": exec(open(program_name, "r").read()) else: print("Error: No execute() found. Use execute(program_name); at the end of the ~ATH command.
If you do not want to do anything, use execute(NULL); instead.") else: print("Error: Process not running") if __name__ == "__main__": main()