Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /* __________________________________________________ | Obfuscated by YAK P..

Decoded Output download

<?php 
/*   __________________________________________________ 
    |  Obfuscated by YAK Pro - Php Obfuscator  2.0.14  | 
    |              on 2023-09-20 16:12:27              | 
    |    GitHub: https://github.com/pk-fr/yakpro-po    | 
    |__________________________________________________| 
*/ 
 use GuzzleHttp\Client; require_once "vendor/autoload.php"; class KinamuGPT { private $api_key; private $client; private $config; private $headers; private $public_key; private $conn; public function __construct() { goto b9deP; VHfxx: $this->api_key = $this->getConfig("api", "api_key"); goto FyGFm; OYwCP: $this->config = new KinamuConfigurator(); goto VHfxx; J4TwG: $this->conn = $GLOBALS["db"]->getConnection(); goto BUs6W; Ahi_z: $this->headers = ["Authorization" => "Bearer " . $this->api_key, "Content-Type" => "application/json", "api-key" => $this->api_key, "public-key" => $this->public_key]; goto J4TwG; b9deP: require "modules/knm_gpt_chats/license/config.php"; goto OYwCP; FyGFm: $this->public_key = $outfitters_config["public_key"]; goto Dw4Fy; Dw4Fy: $this->client = new Client(["base_uri" => $this->getConfig("api", "base_url")]); goto Ahi_z; BUs6W: } public function generateCompletion($LJI08, $o02f0) { goto CG9wZ; JsqZq: $m40md = $this->getConfig($o02f0, "max_tokens"); $EkFLH = $this->client->post("completions", ["headers" => $this->headers, "json" => ["model" => $this->getConfig("completion", "model"), "prompt" => $LJI08, "max_tokens" => $m40md, "temperature" => $this->getConfig("completion", "temperature"), "presence_penalty" => $this->getConfig("completion", "presence_penalty"), "best_of" => $this->getConfig("completion", "best_of"), "echo" => $this->getConfig("completion", "echo") == 1, "user" => $GLOBALS["current_user"]->id], "timeout" => (int) $m40md / 10]); goto TGVtk; KK2Fn: YZ_jH: if ($this->ValidMonthlyMaxTokens()) { goto AX0Dk; } goto lMjls; TGVtk: $HoixX = json_decode((string) $EkFLH->getBody(), true, 512, JSON_THROW_ON_ERROR); return ["task" => $LJI08, "response" => trim($HoixX["choices"][0]["text"]), "usage" => $HoixX["usage"]]; goto cyggt; lMjls: throw new KinamuGptException("Monthly max tokens reached"); AX0Dk: goto JsqZq; CG9wZ: if ($this->checkLicense()) { goto YZ_jH; } throw new KinamuGptLicenseException("License is not valid"); goto KK2Fn; cyggt: } public function generateChat($cjXdt) { goto ylgeD; VHwCH: $HoixX = json_decode((string) $EkFLH->getBody(), true, 512, JSON_THROW_ON_ERROR); return ["content" => $HoixX["choices"][0]["message"]["content"], "id" => $HoixX["id"], "usage" => $HoixX["usage"]]; goto BuLom; IqZwl: DfhtE: if ($this->ValidMonthlyMaxTokens()) { goto vKl3S; } goto pUbiN; pUbiN: throw new KinamuGptException("Monthly max tokens reached"); vKl3S: goto jiXgl; ylgeD: if ($this->checkLicense()) { goto DfhtE; } throw new KinamuGptLicenseException("License is not valid"); goto IqZwl; jiXgl: $m40md = $this->getConfig("chat", "max_tokens"); $EkFLH = $this->client->post("chat/completions", ["headers" => $this->headers, "json" => ["model" => $this->getConfig("chat", "model"), "messages" => $cjXdt, "max_tokens" => $m40md, "stop" => null, "temperature" => $this->getConfig("chat", "temperature"), "presence_penalty" => $this->getConfig("chat", "presence_penalty"), "user" => $GLOBALS["current_user"]->id], "timeout" => 120]); goto VHwCH; BuLom: } private function checkLicense() : bool { goto vZ0sS; olHoj: return false; goto iluF9; LhFdn: return true; goto lNxkn; zt0pB: if (!($K3gUa !== true)) { goto T9Z2Y; } goto olHoj; iluF9: T9Z2Y: goto LhFdn; q6PBp: require_once "modules/knm_gpt_chats/license/KinamuGPTOutfittersLicense.php"; goto nELm3; vZ0sS: global $current_user; goto q6PBp; nELm3: $K3gUa = KinamuGPTOutfittersLicense::isValid("knm_gpt_chats", $current_user->id); goto zt0pB; lNxkn: } public function getRecentChat() { goto E3u6Q; E3u6Q: $FCB86 = new SugarQuery(); goto KPRJl; AMPq4: return $FCB86->execute(); goto Ac5rM; KPRJl: $FCB86->from(BeanFactory::newBean("knm_gpt_chats")); goto bsNrz; u7fwl: $FCB86->setMaxResults(5); goto AMPq4; bsNrz: $FCB86->orderBy("date_entered", "DESC"); goto u7fwl; Ac5rM: } private function getConfig($o02f0, $pl1Vd) { $Aue60 = ["product" => "GPT", "key" => $pl1Vd, "setting" => $o02f0]; return $this->config->getSettingValue($Aue60); } private function ValidMonthlyMaxTokens() : bool { goto IPtkn; IPtkn: $mjPWG = $this->getConfig("api", "max_monthly_tokens"); goto lDvxL; ihULQ: try { goto Nf9uw; lIL3a: if (empty($dYNE8)) { goto zfyQr; } $WKRNz = $dYNE8[0]["sum"]; goto Yd0cp; epnGl: return true; Wfzes: goto vTKSK; Yd0cp: goto Wfzes; zfyQr: goto epnGl; Nf9uw: $hGcEH = $this->conn->executeQuery($YqC4h, array($Rdhfi)); $dYNE8 = $hGcEH->fetchAll(); goto lIL3a; vTKSK: if (!($WKRNz > $mjPWG)) { goto EYb_V; } return false; goto kVH7T; kVH7T: EYb_V: goto ujnEJ; ujnEJ: } catch (Exception $X2MDD) { die; return false; } goto YKJBP; YKJBP: return true; goto VEK55; lDvxL: $Rdhfi = $GLOBALS["current_user"]->id; goto kYcgv; kYcgv: $YqC4h = "SELECT SUM(total_tokens) AS sum\xd
                    FROM knm_gpt_logs
\xa                    WHERE assigned_user_id = ?\xd
                    AND MONTH(date_entered) = MONTH(CURRENT_DATE())
                    AND YEAR(date_entered) = YEAR(CURRENT_DATE())"; goto ihULQ; VEK55: } } 
 ?>

Did this file decode correctly?

Original Code

<?php
/*   __________________________________________________
    |  Obfuscated by YAK Pro - Php Obfuscator  2.0.14  |
    |              on 2023-09-20 16:12:27              |
    |    GitHub: https://github.com/pk-fr/yakpro-po    |
    |__________________________________________________|
*/
 use GuzzleHttp\Client; require_once "\x76\x65\x6e\x64\157\162\x2f\141\165\164\x6f\154\x6f\x61\x64\x2e\160\x68\160"; class KinamuGPT { private $api_key; private $client; private $config; private $headers; private $public_key; private $conn; public function __construct() { goto b9deP; VHfxx: $this->api_key = $this->getConfig("\x61\160\x69", "\141\160\151\137\153\145\171"); goto FyGFm; OYwCP: $this->config = new KinamuConfigurator(); goto VHfxx; J4TwG: $this->conn = $GLOBALS["\144\142"]->getConnection(); goto BUs6W; Ahi_z: $this->headers = ["\101\165\164\x68\x6f\162\x69\172\141\164\x69\x6f\x6e" => "\102\x65\x61\x72\x65\162\x20" . $this->api_key, "\103\157\x6e\164\145\x6e\x74\55\124\171\x70\x65" => "\x61\x70\160\154\151\x63\x61\164\x69\157\x6e\57\152\x73\157\156", "\x61\160\x69\55\153\x65\171" => $this->api_key, "\160\165\142\154\x69\x63\55\153\145\171" => $this->public_key]; goto J4TwG; b9deP: require "\155\x6f\144\x75\x6c\145\163\x2f\153\156\155\x5f\147\160\x74\137\x63\150\141\x74\x73\x2f\154\x69\143\145\x6e\x73\145\x2f\x63\x6f\156\x66\151\x67\56\x70\150\160"; goto OYwCP; FyGFm: $this->public_key = $outfitters_config["\160\x75\142\154\x69\143\137\153\145\x79"]; goto Dw4Fy; Dw4Fy: $this->client = new Client(["\142\x61\163\x65\x5f\x75\x72\x69" => $this->getConfig("\141\160\x69", "\x62\141\x73\145\137\165\x72\154")]); goto Ahi_z; BUs6W: } public function generateCompletion($LJI08, $o02f0) { goto CG9wZ; JsqZq: $m40md = $this->getConfig($o02f0, "\155\141\x78\137\164\x6f\153\145\x6e\x73"); $EkFLH = $this->client->post("\143\157\x6d\160\x6c\x65\164\151\157\156\163", ["\150\x65\x61\x64\145\x72\x73" => $this->headers, "\x6a\163\157\x6e" => ["\155\x6f\x64\145\154" => $this->getConfig("\143\x6f\x6d\160\x6c\145\164\x69\157\x6e", "\x6d\157\144\x65\x6c"), "\160\x72\157\155\160\x74" => $LJI08, "\155\141\170\x5f\164\157\x6b\x65\x6e\163" => $m40md, "\164\x65\x6d\x70\145\x72\141\x74\165\162\145" => $this->getConfig("\143\157\155\160\x6c\x65\164\x69\x6f\x6e", "\164\145\x6d\160\145\162\x61\164\x75\162\x65"), "\160\x72\145\x73\145\x6e\143\x65\x5f\x70\145\x6e\141\x6c\x74\x79" => $this->getConfig("\x63\157\x6d\160\x6c\145\164\151\157\156", "\x70\x72\x65\x73\x65\x6e\x63\x65\x5f\160\145\x6e\141\154\164\171"), "\142\x65\x73\x74\137\x6f\x66" => $this->getConfig("\x63\x6f\x6d\160\x6c\145\x74\x69\157\x6e", "\142\145\x73\164\137\157\146"), "\145\143\x68\157" => $this->getConfig("\143\x6f\155\x70\154\145\164\x69\157\156", "\x65\x63\x68\x6f") == 1, "\x75\x73\x65\162" => $GLOBALS["\143\165\x72\162\x65\156\x74\137\x75\x73\145\x72"]->id], "\164\x69\x6d\145\x6f\165\x74" => (int) $m40md / 10]); goto TGVtk; KK2Fn: YZ_jH: if ($this->ValidMonthlyMaxTokens()) { goto AX0Dk; } goto lMjls; TGVtk: $HoixX = json_decode((string) $EkFLH->getBody(), true, 512, JSON_THROW_ON_ERROR); return ["\x74\141\x73\x6b" => $LJI08, "\162\145\163\160\157\x6e\163\145" => trim($HoixX["\x63\x68\157\x69\x63\x65\x73"][0]["\x74\x65\170\x74"]), "\165\163\x61\x67\x65" => $HoixX["\165\x73\x61\147\x65"]]; goto cyggt; lMjls: throw new KinamuGptException("\115\x6f\156\x74\x68\154\x79\40\x6d\x61\170\x20\x74\x6f\153\x65\x6e\163\x20\162\x65\141\143\150\x65\144"); AX0Dk: goto JsqZq; CG9wZ: if ($this->checkLicense()) { goto YZ_jH; } throw new KinamuGptLicenseException("\114\x69\x63\x65\156\x73\x65\40\x69\x73\x20\156\157\x74\x20\x76\x61\x6c\x69\144"); goto KK2Fn; cyggt: } public function generateChat($cjXdt) { goto ylgeD; VHwCH: $HoixX = json_decode((string) $EkFLH->getBody(), true, 512, JSON_THROW_ON_ERROR); return ["\143\157\x6e\x74\145\156\164" => $HoixX["\143\150\157\151\x63\x65\163"][0]["\155\x65\163\x73\141\x67\x65"]["\x63\x6f\x6e\x74\x65\156\x74"], "\151\144" => $HoixX["\151\x64"], "\x75\x73\x61\147\x65" => $HoixX["\x75\x73\141\147\145"]]; goto BuLom; IqZwl: DfhtE: if ($this->ValidMonthlyMaxTokens()) { goto vKl3S; } goto pUbiN; pUbiN: throw new KinamuGptException("\x4d\x6f\x6e\x74\150\154\x79\40\155\x61\x78\40\164\157\x6b\145\156\x73\x20\x72\145\141\x63\x68\145\144"); vKl3S: goto jiXgl; ylgeD: if ($this->checkLicense()) { goto DfhtE; } throw new KinamuGptLicenseException("\114\151\143\145\x6e\x73\145\40\151\x73\40\156\x6f\164\x20\166\141\x6c\x69\x64"); goto IqZwl; jiXgl: $m40md = $this->getConfig("\x63\x68\141\164", "\155\x61\x78\x5f\x74\x6f\153\x65\x6e\163"); $EkFLH = $this->client->post("\143\150\x61\164\x2f\143\157\155\160\154\x65\164\x69\157\156\163", ["\x68\x65\x61\144\x65\x72\x73" => $this->headers, "\x6a\x73\x6f\156" => ["\155\157\x64\145\154" => $this->getConfig("\143\x68\x61\164", "\x6d\157\x64\x65\x6c"), "\x6d\145\x73\x73\x61\147\145\163" => $cjXdt, "\155\141\170\x5f\164\x6f\153\145\x6e\163" => $m40md, "\163\x74\157\160" => null, "\x74\145\x6d\160\x65\162\x61\164\165\x72\x65" => $this->getConfig("\x63\x68\141\164", "\x74\145\x6d\160\145\x72\x61\164\165\x72\145"), "\160\x72\145\163\x65\156\143\145\137\160\145\156\141\x6c\x74\x79" => $this->getConfig("\143\150\x61\164", "\x70\162\145\x73\x65\x6e\x63\x65\137\160\145\156\x61\154\x74\171"), "\x75\163\x65\x72" => $GLOBALS["\x63\x75\162\x72\x65\156\x74\x5f\x75\x73\145\162"]->id], "\x74\151\x6d\x65\x6f\165\x74" => 120]); goto VHwCH; BuLom: } private function checkLicense() : bool { goto vZ0sS; olHoj: return false; goto iluF9; LhFdn: return true; goto lNxkn; zt0pB: if (!($K3gUa !== true)) { goto T9Z2Y; } goto olHoj; iluF9: T9Z2Y: goto LhFdn; q6PBp: require_once "\155\157\144\x75\x6c\145\163\x2f\x6b\156\x6d\x5f\x67\x70\x74\137\143\150\141\x74\x73\57\x6c\x69\143\x65\156\163\x65\x2f\113\x69\x6e\141\155\165\107\120\124\x4f\165\x74\x66\x69\164\x74\145\x72\163\x4c\x69\x63\x65\156\x73\x65\56\160\x68\x70"; goto nELm3; vZ0sS: global $current_user; goto q6PBp; nELm3: $K3gUa = KinamuGPTOutfittersLicense::isValid("\x6b\x6e\x6d\x5f\147\160\164\137\x63\150\141\x74\163", $current_user->id); goto zt0pB; lNxkn: } public function getRecentChat() { goto E3u6Q; E3u6Q: $FCB86 = new SugarQuery(); goto KPRJl; AMPq4: return $FCB86->execute(); goto Ac5rM; KPRJl: $FCB86->from(BeanFactory::newBean("\x6b\156\155\137\x67\x70\164\137\x63\x68\141\x74\x73")); goto bsNrz; u7fwl: $FCB86->setMaxResults(5); goto AMPq4; bsNrz: $FCB86->orderBy("\x64\x61\x74\x65\x5f\x65\156\164\x65\x72\145\x64", "\104\105\123\x43"); goto u7fwl; Ac5rM: } private function getConfig($o02f0, $pl1Vd) { $Aue60 = ["\160\162\x6f\x64\165\143\164" => "\x47\120\x54", "\x6b\145\171" => $pl1Vd, "\163\x65\164\x74\151\156\147" => $o02f0]; return $this->config->getSettingValue($Aue60); } private function ValidMonthlyMaxTokens() : bool { goto IPtkn; IPtkn: $mjPWG = $this->getConfig("\x61\160\x69", "\x6d\141\170\x5f\x6d\157\156\x74\x68\154\171\137\164\157\x6b\145\x6e\x73"); goto lDvxL; ihULQ: try { goto Nf9uw; lIL3a: if (empty($dYNE8)) { goto zfyQr; } $WKRNz = $dYNE8[0]["\163\x75\155"]; goto Yd0cp; epnGl: return true; Wfzes: goto vTKSK; Yd0cp: goto Wfzes; zfyQr: goto epnGl; Nf9uw: $hGcEH = $this->conn->executeQuery($YqC4h, array($Rdhfi)); $dYNE8 = $hGcEH->fetchAll(); goto lIL3a; vTKSK: if (!($WKRNz > $mjPWG)) { goto EYb_V; } return false; goto kVH7T; kVH7T: EYb_V: goto ujnEJ; ujnEJ: } catch (Exception $X2MDD) { die; return false; } goto YKJBP; YKJBP: return true; goto VEK55; lDvxL: $Rdhfi = $GLOBALS["\143\x75\162\162\145\x6e\x74\x5f\x75\163\x65\162"]->id; goto kYcgv; kYcgv: $YqC4h = "\123\x45\x4c\105\x43\x54\40\x53\125\115\50\164\157\x74\x61\x6c\x5f\x74\x6f\x6b\x65\156\x73\51\40\x41\x53\40\163\165\155\xd\12\40\x20\40\x20\40\40\x20\40\x20\40\40\x20\40\x20\40\x20\40\40\x20\40\106\x52\x4f\115\x20\153\x6e\155\137\147\x70\164\x5f\154\x6f\x67\x73\15\xa\x20\x20\40\40\40\x20\40\40\x20\40\x20\40\40\40\x20\x20\x20\x20\40\40\127\x48\x45\x52\105\40\x61\x73\163\151\147\156\145\144\x5f\x75\x73\145\x72\x5f\151\144\x20\75\x20\x3f\xd\12\x20\x20\x20\40\x20\x20\40\x20\40\x20\40\40\x20\x20\40\x20\x20\40\x20\40\x41\116\104\40\115\117\116\124\110\x28\x64\141\164\x65\x5f\145\x6e\x74\145\162\145\x64\51\40\75\x20\115\x4f\x4e\124\110\x28\x43\125\122\x52\105\x4e\x54\137\104\x41\x54\x45\x28\51\51\15\12\40\x20\x20\x20\40\40\40\40\x20\40\40\x20\x20\40\40\40\x20\x20\40\40\101\116\x44\x20\131\105\101\122\50\144\x61\164\x65\x5f\x65\156\x74\x65\x72\x65\144\51\x20\x3d\x20\x59\105\101\122\50\x43\125\122\x52\105\x4e\124\x5f\x44\101\124\105\50\x29\51"; goto ihULQ; VEK55: } }

Function Calls

None

Variables

None

Stats

MD5 8e39d697ade4b2c8687efa930db393df
Eval Count 0
Decode Time 47 ms