- Rename functions, variables, parameters and imports with scope-aware AST passes - Generalise Flask route and template paths to unique /route_N and tpl_N names - Replace descriptive strings with length-preserving, word-consistent msg tokens - Strip docstrings and comments - Add verification for parse validity and leaked benchmark identifiers - Include SAST prompt and expected labels
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
from flask import redirect as mod_1, url_for as mod_2, request as mod_3, make_response as mod_4, render_template as mod_5
|
|
from helpers.utils import escape_for_html as mod_6
|
|
|
|
def init(var_1):
|
|
|
|
@var_1.route('/route_86', methods=['GET'])
|
|
def func_171():
|
|
return func_172()
|
|
|
|
@var_1.route('/route_86', methods=['POST'])
|
|
def func_172():
|
|
var_2 = ''
|
|
var_3 = mod_3.headers.get('msg00000000000001k')
|
|
if not var_3:
|
|
var_3 = ''
|
|
var_4 = 'msg0000a'
|
|
if var_3:
|
|
var_5 = []
|
|
var_5.append('m008')
|
|
var_5.append(var_3)
|
|
var_5.append('msg00005')
|
|
var_5.pop(0)
|
|
var_4 = var_5[1]
|
|
import hashlib as mod_7, base64 as mod_8
|
|
import io as mod_9, helpers.utils
|
|
var_6 = ''
|
|
if isinstance(var_4, str):
|
|
var_6 = var_4.encode('utf-8')
|
|
elif isinstance(var_4, mod_9.IOBase):
|
|
var_6 = var_4.read(1000)
|
|
if len(var_6) == 0:
|
|
var_2 += 'msg006 msg00006 m00e: msg0e boz msg0f.'
|
|
return var_2
|
|
var_7 = mod_7.new('sha512')
|
|
var_7.update(var_6)
|
|
var_8 = var_7.digest()
|
|
var_9 = open(f'{helpers.utils.TESTFILES_DIR}/passwordFile.txt', 'a')
|
|
var_9.write(f'm00e_msg0d={mod_8.b64encode(var_8)}\n')
|
|
var_2 += f"msg000002 msg0d '{helpers.utils.escape_for_html(var_6.decode('utf-8'))}' msg007 ods msg008."
|
|
var_9.close()
|
|
return var_2
|