Online PHP and Javascript Decoder decode hidden script to uncover its real functionality


Show other level


namespace MO_CAW\Common\Functionality;

use MO_CAW\Common\Utils;
use MO_CAW\Common\DB_Utils;
use MO_CAW\Common\Constants;
class API_Creation
{
    public function __construct()
    {
        $yO = current_action();
        if (!(Constants::REST_API_INIT_HOOK === $yO)) {
            goto ya;
        }
        $this->rest_init_functionalities();
        ya:
    }
    private function rest_init_functionalities()
    {
        $this->register_custom_endpoints();
    }
    protected function register_custom_endpoints()
    {
        $e8 = DB_Utils::get_configuration(array("type" => Constants::GUI_ENDPOINT));
        foreach ($e8 as $Wk) {
            $Qi = $Wk["namespace"];
            $G8 = $Wk["connection_name"];
            $aj = $Wk["configuration"];
            if (empty($aj["value_specific_filter"]["filter_details"])) {
                goto vx;
            }
            $qe = $aj["value_specific_filter"]["filter_details"];
            $G8 = $G8 . "/(?P<" . $qe[0]["column"] . ">\S+)";
            vx:
            $PG["endpoint_configuration"] = $Wk;
            register_rest_route($Qi, $G8, array("methods" => \strtoupper(Constants::HTTP_GET), "callback" => array($this, "custom_endpoint_callback"), "args" => $PG, "user" => wp_get_current_user(), "permission_callback" => array(Constants::PLAN_NAMESPACE . "\Functionality\API_Security", "authorize_custom_api_request")));
            I1:
        }
        cH:
    }
    public function custom_endpoint_callback($uV)
    {
        global $wpdb;
        $xz = $uV->get_attributes();
        $we = $uV->get_method();
        $A6 = $xz["args"]["endpoint_configuration"];
        $Xi = $A6["configuration"];
        $PT = !empty($Xi["response"]["response_content"]["success"]) ? json_decode($Xi["response"]["response_content"]["success"], true) : false;
        if ($A6["is_enabled"]) {
            goto mr;
        }
        $nm = array("status" => Constants::ERROR, "code" => 403, "error" => Constants::ENDPOINT_DEACTIVATED, "error_description" => Constants::API_DISABLED);
        wp_send_json($nm, 403);
        mr:
        if (!(\strtoupper(Constants::HTTP_GET) === $we)) {
            goto zn;
        }
        $WF = "SELECT " . implode(",", $Xi["request_columns"]) . " FROM " . $Xi["table"];
        $qe = $Xi["value_specific_filter"]["filter_details"] ?? array();
        if (empty($qe)) {
            goto Lq;
        }
        $ky = $uV[$qe[0]["column"]] ?? '';
        $ky = esc_sql(urldecode($ky));
        $WQ = esc_sql($qe[0]["condition"]);
        $WF = $WF . " WHERE " . esc_sql($qe[0]["column"]);
        if (!(gettype($ky) === "string")) {
            goto AJ;
        }
        if ("like" === $WQ) {
            goto G1;
        }
        if ("not-like" === $WQ) {
            goto Ha;
        }
        goto HU;
        G1:
        $WQ = " LIKE ";
        $ky = "%" . $ky . "%";
        goto HU;
        Ha:
        $WQ = " NOT LIKE ";
        $ky = "%" . $ky . "%";
        HU:
        AJ:
        $WF = $WF . esc_sql($WQ) . "'" . $ky . "'";
        Lq:
        $Ih = $wpdb->get_results($WF);
        zn:
        if ($wpdb->last_error) {
            goto rL;
        }
        $T3["status"] = Constants::SUCCESS;
        $T3["status_code"] = 200;
        $T3["data"] = $Ih;
        goto Nl;
        rL:
        $PT = !empty($Xi["response"]["response_content"]["error"]) ? json_decode($Xi["response"]["response_content"]["error"], true) : false;
        $T3["status"] = Constants::BAD_REQUEST;
        $T3["status_code"] = 400;
        $T3["data"] = $wpdb->last_error;
        Nl:
        Utils::send_custom_api_response($T3, $PT);
    }
}


namespace MO_CAW\Common\Functionality;

use MO_CAW\Common\Utils;
use MO_CAW\Common\DB_Utils;
use MO_CAW\Common\Constants;
class API_Creation
{
    public function __construct()
    {
        $yO = current_action();
        if (!(Constants::REST_API_INIT_HOOK === $yO)) {
            goto ya;
        }
        $this->rest_init_functionalities();
        ya:
    }
    private function rest_init_functionalities()
    {
        $this->register_custom_endpoints();
    }
    protected function register_custom_endpoints()
    {
        $e8 = DB_Utils::get_configuration(array("type" => Constants::GUI_ENDPOINT));
        foreach ($e8 as $Wk) {
            $Qi = $Wk["namespace"];
            $G8 = $Wk["connection_name"];
            $aj = $Wk["configuration"];
            if (empty($aj["value_specific_filter"]["filter_details"])) {
                goto vx;
            }
            
            $G8 = $G8 . "/(?P<$"["column"] . ">\S+)";
            vx:
            $PG["endpoint_configuration"] = $Wk;
            register_rest_route($Qi, $G8, array("methods" => \strtoupper(Constants::HTTP_GET), "callback" => array($this, "custom_endpoint_callback"), "args" => $PG, "user" => wp_get_current_user(), "permission_callback" => array(Constants::PLAN_NAMESPACE . "\Functionality\API_Security", "authorize_custom_api_request")));
            I1:
        }
        cH:
    }
    public function custom_endpoint_callback($uV)
    {
        global $wpdb;
        $xz = $uV->get_attributes();
        $we = $uV->get_method();
        $A6 = $xz["args"]["endpoint_configuration"];
        $Xi = $A6["configuration"];
        $PT = !empty($Xi["response"]["response_content"]["success"]) ? json_decode($Xi["response"]["response_content"]["success"], true) : false;
        if ($A6["is_enabled"]) {
            goto mr;
        }
        $nm = array("status" => Constants::ERROR, "code" => 403, "error" => Constants::ENDPOINT_DEACTIVATED, "error_description" => Constants::API_DISABLED);
        wp_send_json($nm, 403);
        mr:
        if (!(\strtoupper(Constants::HTTP_GET) === $we)) {
            goto zn;
        }
        $WF = "SELECT " . implode(",", $Xi["request_columns"]) . " FROM " . $Xi["table"];
        
        if (empty($qe)) {
            goto Lq;
        }
        $ky = $uV["$"["column"]] ?? '';
        $ky = esc_sql(urldecode($ky));
        $WQ = esc_sql("$"["condition"]);
        $WF = $WF . " WHERE " . esc_sql("$"["column"]);
        if (!(gettype($ky) === "string")) {
            goto AJ;
        }
        if ("like" === $WQ) {
            goto G1;
        }
        if ("not-like" === $WQ) {
            goto Ha;
        }
        goto HU;
        G1:
        $WQ = " LIKE ";
        $ky = "%" . $ky . "%";
        goto HU;
        Ha:
        $WQ = " NOT LIKE ";
        $ky = "%" . $ky . "%";
        HU:
        AJ:
        $WF = $WFesc_sql($WQ) . "'" . $ky . "'";
        Lq:
        $Ih = $wpdb->get_results($WF);
        zn:
        if ($wpdb->last_error) {
            goto rL;
        }
        $T3["status"] = Constants::SUCCESS;
        $T3["status_code"] = 200;
        $T3["data"] = $Ih;
        goto Nl;
        rL:
        $PT = !empty($Xi["response"]["response_content"]["error"]) ? json_decode($Xi["response"]["response_content"]["error"], true) : false;
        $T3["status"] = Constants::BAD_REQUEST;
        $T3["status_code"] = 400;
        $T3["data"] = $wpdb->last_error;
        Nl:
        Utils::send_custom_api_response($T3, $PT);
    }
}



© 2023 Quttera Ltd. All rights reserved.