def testString(a, b): # {{{ src = a tgt = b if str(src) == str(tgt): pwn.success("{} est un palindrome".format(tgt)) else: pwn.warn("{} n'est pas un palindrome".format(tgt)) return # }}}
def FlagFinder(cible, flag): # {{{ regex = flag file = cible t = pwn.read(file) c = re.findall(regex, str(t)) if not c: pwn.warn("Flag non trouvé") else: for a in c: pwn.success("Yeah !!!! flag found: {result}\n".format(result=a)) pwn.warn("flag is now copied in flag.txt") pwn.write("flag.txt", a)
def Exploit(fichier, pattern): regex = pattern file = fichier pwn.info("Opening file: {fichier}\n".format(fichier=file)) s = pwn.read(file) pwn.info("Searching for pattern: {flag}\n".format(flag=regex)) c = re.findall(regex, str(s)) if not c: pwn.warn("No flag for you my friend, check your regex") else: for a in c: pwn.success("Yeah !!!! flag found: {result}\n".format(result=a)) pwn.warn("flag is now copied in flag.txt") pwn.write("flag.txt", a)
def Online(url, pattern): regex = pattern file = url pwn.info("Opening file: {fichier}\n".format(fichier=file)) r = requests.session() s = r.get(file) s = s.content pwn.info("Search for pattern: {flag}\n".format(flag=regex)) c = re.findall(regex, str(s)) if not c: pwn.warn("No flag for you my friend, check your regex") else: for a in c: pwn.success("Yeah !!!! flag found: {result}\n".format(result=a)) pwn.warn("flag is now copied in flag.txt") pwn.write("flag.txt", a)
def rsaFindDfromPhi(phi, e): # {{{ d = pow(int(e), -1, int(phi)) return d # }}} def rsaFindDfromPQ(p, q, e): # {{{ phi = rsaFindPhi(int(p), int(q)) d = pow(int(e), -1, phi) return d # }}} def rsaCipherMessage(m, e, n): # {{{ c = pow(int(m), int(e), int(n)) return c # }}} def rsaUncipherMessage(c, d, n): # {{{ m = pow(int(c), int(d), int(n)) return m # }}} if __name__ == "__main__": pwn.warn("Ceci est à utiliser en tant que module") else: pwn.warn("Module chargé")
else: if args != None: args = " ".join(args) else: args = "" command = f"{IDA_PATH} -A -S\"{script_path} {output_path} {arch} {args}\" {bin_abs_path}" command = f"IDALOG=\"{log_path}\" {command} " try: debug(F"Running script for {bin_abs_path}...") debug(command) subprocess.run(command, shell=True).check_returncode() debug("Done") except subprocess.CalledProcessError as e: warn(f"error happened in {bin_abs_path}, {e}") return None if os.path.exists(output_path): if handler!=None and script_path!=None : output = handler(output_path) return output def worker(paths, script=None, args=None, handler=None): result = {} for path in paths: tmp = run_ida_script(path, script, args, handler)