蓝鲸云数据库密码生成代码
前言:实战中碰到了蓝鲸云管控平台,情况是只拿到了数据库的权限,这边的话通过代码发现生成数据库密码内容,替换即可进行登录,这边进行简单的记录
参考文章:https://gitee.com/Tencent-BlueKing/bk-PaaS
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
from django.contrib.auth.hashers import make_password
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoProject1.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
# execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
print(make_password("SecSec@123!!!"))
将其中的pbkdf2_sha256$870000$uEe30cC2SlFVEE4unFMZxw$jaQxR4C6aoEl0CgQ7MVF6MYsCKjpo62hIhy+Bo8NNVc=
替换到数据库的密码字段,即可登录