@app.route('/send', methods=['POST']) defsend(): if request.form.get('content'): content = escape_index(request.form['content']) if session.get('contents'): content_list = session['contents'] content_list.append(content) else: content_list = [content] session['contents'] = content_list return"post has been sent." else: return"WELCOME TO HGAME 2021 :)"
@app.route('/search', methods=["POST"]) defreplace(): if request.form.get('substr'): session['substr'] = escape_replace(request.form['substr']) return"replace success" else: return"There is no content to search any more"
@app.route('/contents', methods=["GET"]) defget_contents(): if session.get('contents'): content_list = jsonify(session['contents']) else: content_list = jsonify('<i>2021-02-12</i><p>Happy New Year every guys! ' 'Maybe it is nearly done now.</p>', '<i>2021-02-11</i><p>Busy preparing for the Chinese New Year... ' 'And I add some new features to this editor, maybe you can take a try. ' 'But it has not done yet, I\'m not sure if it can be safe from attacks.</p>', '<i>2021-02-07</i><p>so many hackers here, I am going to add some strict rules.</p>', '<i>2021-02-06</i><p>I have tried to learn HTML the whole yesterday, ' 'and I finally made this ONLINE BLOG EDITOR. Feel free to write down your thoughts.</p>', '<i>2021-02-05</i><p>Yesterday, I watched <i>The Social Network</i>. ' 'It really astonished me. Something flashed me.</p>') return content_list
@app.route('/flag') defshow_flag(): if request.cookies.get('token') == "29342ru89j3thisisfakecookieq983h23ijfq2ojifrnq92h2": return"hgame{G3t_fl@g_s0_Easy?No_way!!wryyyyyyyyy}" else: return"Only admin can get the flag, your token shows that you're not admin!"
@app.route('/clear') defclear_session(): session['contents'] = [] return"ALL contents are cleared."
defescape_index(original): content = original content_iframe = re.sub( r"^(<?/?iframe)\s+.*?(src=[\"'][a-zA-Z/]{1,8}[\"']).*?(>?)$", r"\1 \2 \3", content) if content_iframe != content or re.match(r"^(<?/?iframe)\s+(src=[\"'][a-zA-Z/]{1,8}[\"'])$", content): return content_iframe else: content = re.sub(r"<*/?(.*?)>?", r"\1", content) return content
<body> <divid="header"> <ahref="#">Online Blog Editor</a> </div> <divid="navigation"> <ol> <li><ahref="#">Editor</a></li> <li><ahref="/flag">Flag</a></li> <li><ahref="#">About</a></li> <li><ahref="#">Help</a></li> </ol> </div> <divid="main"> <h1id="title">Post to Zuckonit</h1> <divid="main-content"> <divid="filter"> <fieldset> <legend>Write Down What On your Mind</legend> <divid="textarea"> <label> <textareaid="content"cols="30"rows="1"></textarea> </label> </div> <pclass="lead">Attention: you can freely <strong>post</strong> your thoughts to this page. But this online editor is vulnerable to attack, so you can write down <strong>XSS</strong> sentences and <strong>submit</strong> them to bot backend, and CAPTCHA is necessary. </p> <divid="controls"> <divclass="buttons"> <labelfor="content"></label><inputtype="text"placeholder="what do you want to search?"id="substr" autocomplete="off"> <buttonid="search"class="button">Search!</button> </div> <divclass="buttons"> <buttonid="send"class="button">Post it !</button> <labelfor="captcha"></label><inputtype="text"placeholder=""id="captcha"autocomplete="off"> <buttonid="submit"class="button">Submit</button> <buttonid="clear"class="button">Clear posts</button> </div>
list = string.ascii_letters + string.digits for a inlist: for b inlist: for c inlist: for d inlist: for e inlist: for f inlist: str4 = (a + b + c + d + e + f).encode("UTF-8") value = hashlib.md5(str4) value1 = value.hexdigest() # print(value1) s4 = value1[:6] # print(s4) if s4 == 'de6404': print(str4)