403Webshell
Server IP : 119.195.102.159  /  Your IP : 216.73.217.134
Web Server : nginx/1.18.0
System : Linux picell 5.15.0-181-generic #191-Ubuntu SMP Fri May 22 19:09:02 UTC 2026 x86_64
User : altablue ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /tmp/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /tmp/gen_constants.py
import glob
import re

keys = set()
files = glob.glob('/home2/haeyulhome/skhani/public_html/**/*.php', recursive=True) + glob.glob('/home2/haeyulhome/skhani/public_html/**/*.html', recursive=True)
for file in files:
    try:
        with open(file, 'rb') as f:
            c = f.read()
        
        matches = re.findall(br'\$[a-zA-Z0-9_]+\[([a-zA-Z_][a-zA-Z0-9_]*)\]', c)
        for m in matches:
            keys.add(m.decode('ascii', errors='ignore'))
    except Exception as e:
        pass

keys.discard('')
keys.discard('0')

out = b"<?php\n"
for k in sorted(keys):
    # Only alphanumeric and underscore
    if re.match(r'^[a-zA-Z_][a-zA-Z0-9_]*$', k):
        # some constants might be real constants, so check if not defined
        out += f"if(!defined('{k}')) define('{k}', '{k}');\n".encode('ascii')

with open('/home2/haeyulhome/skhani/public_html/lib/constants_polyfill.php', 'wb') as f:
    f.write(out)

# Inject into config.php
with open('/home2/haeyulhome/skhani/public_html/lib/config.php', 'rb') as f:
    c = f.read()

if b'constants_polyfill.php' not in c:
    c = c.replace(b'<?', b"<?\ninclude_once __DIR__ . '/constants_polyfill.php';\n", 1)
    with open('/home2/haeyulhome/skhani/public_html/lib/config.php', 'wb') as f:
        f.write(c)

print("Generated constants_polyfill.php with", len(keys), "keys")

Youez - 2016 - github.com/yon3zu
LinuXploit