Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import sys
- import time
- import re
- ip = re.compile(r"^((?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$")
- def is_ip(a):
- return ip.match(a) is not None
- def sleep(s):
- time.sleep(s + (0.1 * len(installed())))
- def bruteforce(a, b):
- global last
- if not is_ip(str(a)): raise SyntaxError('hey, ur not haking if u dont use ip!!!')
- optional_print('Bruteforcing', a)
- sleep(random.randint(1, 5))
- variables[a] = b
- last = b
- optional_print('Finished bruteforcing', a)
- return b
- def install(a):
- if a not in package_signatures.keys(): raise SyntaxError(f'man ur dumb as hell if u dont know that "{a}" is not even a package')
- optional_print(f"Installing package '{a}'. Please wait...")
- sleep(4)
- signatures[a] = package_signatures[a]
- commands.append(a)
- optional_print(f"Successfully installed '{a}'!")
- def uninstall(a):
- if a not in installed(): raise SyntaxError("lmao what are you uninstalling, if u keep doing that, ill uninstall u")
- optional_print(f"Uninstalling package '{a}'. Please wait...")
- sleep(1)
- del signatures[a]
- commands.remove(a)
- optional_print(f"Successfully uninstalled '{a}'")
- def call_signature(a, *args, **kwargs):
- sleep(0)
- return a(*args, **kwargs)
- def check_command(a):
- if a != 0: goto_command(current_line * 2)
- def goto_command(l):
- global current_line
- current_line = l - 1
- def ping(a):
- sleep(1)
- b = variables[a]
- return b
- def sum_command(a):
- if last is not None: return a + last
- return a
- def installed():
- return tuple(set(commands) - set(original))
- def optional_print(*args, **kwargs):
- if 'silence' not in flags: print(*args, **kwargs)
- def flag_appender(flag_name, wait_time=0):
- if flag_name not in flags:
- optional_print(f"Appending flag '{flag_name}'")
- sleep(wait_time)
- flags.append(flag_name)
- else:
- flags.remove(flag_name)
- optional_print(f"Removing flag '{flag_name}")
- sleep(wait_time)
- commands = ["install", "uninstall"]
- original = tuple(commands)
- flags = []
- variables = {}
- last = None
- package_signatures = {"newline": lambda: print(), "show": lambda a: print(a, end=""), "input": lambda: int(input()),
- "inputstr": lambda: input(), "bruteforce": bruteforce, "ping": ping,
- "sum": sum_command, "negate": lambda a: -a,
- "goto": goto_command, "check": check_command,
- "silence": lambda: flag_appender("silence", 5), "turtlejam": lambda: flag_appender("turtlejam", 1)}
- signatures = {"install": install, "uninstall": uninstall}
- def how_do_i_parse_this_AAAA(line: str, execute_commands: bool = True, max_params: int = 999):
- done = []
- while len(line) > 0 and len(done) < max_params:
- if line.startswith('"'):
- i = line[1:].find('"')
- done.append(parse_simple(line[:i + 2]))
- line = line[i + 2:]
- split = line.split()
- if len(split) == 0: continue
- if split[0] in commands:
- if execute_commands: done.append(parse_command(line))
- else: done.append(line)
- continue
- done.append(parse_simple(split[0]))
- line = line[len(split[0]) + 1:]
- return done[:max_params]
- def parse_command(line: str, stop_if_not_command: bool = False):
- split = line.split()
- if len(split) > 0 and split[0] in commands:
- joined = ' '.join(split[1:])
- args = how_do_i_parse_this_AAAA(joined, True)
- return call_signature(signatures[split[0]], *args)
- elif stop_if_not_command or line.isspace() or not line:
- return None
- return parse_simple(line)
- def parse_num(lit):
- if 'turtlejam' in flags:
- if lit == 'noturtle': return 0
- elif 'turtle' in lit:
- count = lit.count('turtle')
- if count * 6 < len(lit): raise Exception
- return count
- raise Exception
- return int(lit)
- def generate_error_message(exception: Exception):
- print(f"\n\t{exception.__class__.__name__}, line {current_line}: {' '.join(exception.args)}")
- exit()
- def parse_simple(line: str):
- split = line.split()
- if split[0].startswith('"'):
- end_quote_index = line[1:].find('"')
- if end_quote_index == -1:
- generate_error_message( SyntaxError('ur not real haker cuz you literally missed a quote') )
- return line[1:end_quote_index + 1]
- try:
- if len(split) > 1: raise Exception
- return parse_num(split[0])
- except:
- if is_ip(split[0]): return split[0]
- generate_error_message( SyntaxError(f"can u explain the hell is '{line}' it's not even a haker term") )
- argv_req = False
- if len(sys.argv) < 2 and argv_req:
- print('provide a file to start haking!1!!!!')
- exit()
- code = open(sys.argv[1] if argv_req else 'd.hs', 'r').read().strip('\n')
- split = code.split('\n')
- total_lines = len(split)
- current_line = 0
- while True:
- current_line += 1
- if current_line < 1 or current_line > total_lines: break
- parse_command(split[current_line - 1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement