Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
function validate_api_request($dx) { $Mf = array(); $Mf["\x75\x73\1..
Decoded Output download
<? function validate_api_request($dx)
{
$Mf = array();
$Mf["user"] = null;
$Mf["status"] = "error";
$V8 = '';
if (!(!empty(\Drupal::config("rest_api_authentication.settings")->get("custom_header")) || \Drupal::config("rest_api_authentication.settings")->get("custom_header") != null)) {
goto p4;
}
$qt = $dx->headers->get(\Drupal::config("rest_api_authentication.settings")->get("custom_header"));
p4:
if (!($dx->headers->get("TOKEN") != null)) {
goto Q7;
}
$qt = $dx->headers->get("TOKEN") != null ? $dx->headers->get("TOKEN") : null;
Q7:
$qt = Html::escape(urldecode($qt));
if ($qt != null) {
goto An;
}
$Mf["message"] = "Invalid request: Token Not Found.";
goto b0;
An:
$Xw = \Drupal::config("rest_api_authentication.settings")->get("cert_key");
if (trim($Xw) != '') {
goto RY;
}
$cc = \Drupal::config("rest_api_authentication.settings")->get("user_info_endpoint") != null ? \Drupal::config("rest_api_authentication.settings")->get("user_info_endpoint") : null;
if (!(empty($cc) || is_null($cc))) {
goto l1;
}
$Mf["message"] = "Could not authenticate the token from your Provider. Please check your configurations.";
return $Mf;
l1:
$Mp = \Drupal::config("rest_api_authentication.settings")->get("username_attribute") != null ? \Drupal::config("rest_api_authentication.settings")->get("username_attribute") : null;
$IV = Utilities::getResourceOwner($cc, $qt);
if (empty($IV)) {
goto JX;
}
$pG = Utilities::getnestedattribute($IV, $Mp);
JX:
if (!empty($pG)) {
goto oy;
}
$Mf["message"] = "Invalid request: Could not get user information.";
return $Mf;
oy:
goto jb;
RY:
$y6 = ".";
list($xB, $uI, $tt) = explode($y6, $qt);
$wu = base64_decode(strtr($tt, "-_", "+/"));
$vh = utf8_decode($xB . $y6 . $uI);
$RY = $Xw;
$oK = openssl_verify($vh, $wu, $RY, OPENSSL_ALGO_SHA256);
if ($oK) {
goto O2;
}
$Mf["message"] = "Invalid Token: Your Token Could Not Be Verified.";
return $Mf;
O2:
$Mp = \Drupal::config("rest_api_authentication.settings")->get("username_attribute") != null ? \Drupal::config("rest_api_authentication.settings")->get("username_attribute") : null;
if (!($Mp == null)) {
goto l4;
}
$Mf["message"] = "Could Not Retrieve User on null.";
return $Mf;
l4:
$k2 = json_decode(base64_decode($uI), true);
$pG = $k2[$Mp];
if (!($pG == null || trim($pG) == '')) {
goto z0;
}
$Mf["message"] = "Could Not Retrieve Required User Information From Token.";
return $Mf;
z0:
jb:
$user = user_load_by_name($pG);
if (!empty($user)) {
goto C8;
}
$oG = \Drupal::service("password_generator")->generate(8);
$KY = array("name" => $pG, "mail" => $pG, "pass" => $oG, "status" => 1, "roles" => array());
$user = User::create($KY);
$user->save();
C8:
$Mf["status"] = "SUCCESS";
$Mf["user"] = $user;
b0:
return $Mf;
} ?>
Did this file decode correctly?
Original Code
function validate_api_request($dx)
{
$Mf = array();
$Mf["\x75\x73\145\162"] = null;
$Mf["\163\x74\141\164\x75\163"] = "\x65\x72\162\157\162";
$V8 = '';
if (!(!empty(\Drupal::config("\x72\145\x73\x74\x5f\x61\160\151\x5f\141\x75\164\150\x65\x6e\164\151\x63\x61\x74\151\x6f\x6e\x2e\163\145\164\164\151\156\x67\163")->get("\143\165\163\164\157\x6d\137\x68\145\141\x64\x65\162")) || \Drupal::config("\162\145\x73\x74\x5f\141\x70\151\x5f\141\x75\x74\x68\145\156\x74\151\143\x61\x74\x69\x6f\156\56\x73\145\164\x74\x69\x6e\147\163")->get("\143\x75\163\x74\x6f\x6d\x5f\150\x65\141\x64\145\x72") != null)) {
goto p4;
}
$qt = $dx->headers->get(\Drupal::config("\162\x65\x73\x74\137\141\x70\x69\137\x61\x75\164\x68\145\x6e\x74\151\x63\x61\x74\x69\x6f\x6e\x2e\163\145\164\x74\151\x6e\147\163")->get("\x63\x75\x73\164\157\155\137\x68\145\141\x64\x65\162"));
p4:
if (!($dx->headers->get("\x54\x4f\x4b\105\x4e") != null)) {
goto Q7;
}
$qt = $dx->headers->get("\124\x4f\x4b\x45\x4e") != null ? $dx->headers->get("\x54\117\113\105\x4e") : null;
Q7:
$qt = Html::escape(urldecode($qt));
if ($qt != null) {
goto An;
}
$Mf["\x6d\145\163\x73\x61\x67\x65"] = "\x49\x6e\x76\x61\x6c\x69\144\40\x72\x65\161\165\x65\163\x74\72\x20\124\157\x6b\145\156\40\116\157\x74\40\x46\157\x75\156\x64\56";
goto b0;
An:
$Xw = \Drupal::config("\x72\145\x73\x74\x5f\x61\160\x69\x5f\x61\165\x74\x68\x65\x6e\164\x69\x63\141\x74\151\157\156\56\163\x65\x74\x74\x69\x6e\147\x73")->get("\x63\145\162\x74\137\153\x65\x79");
if (trim($Xw) != '') {
goto RY;
}
$cc = \Drupal::config("\162\145\x73\x74\137\x61\x70\x69\x5f\x61\x75\164\150\x65\156\164\x69\x63\141\164\151\157\x6e\56\163\145\164\x74\151\x6e\147\163")->get("\165\163\145\162\x5f\x69\156\146\x6f\137\145\x6e\x64\x70\157\151\156\164") != null ? \Drupal::config("\x72\145\163\164\x5f\141\x70\x69\x5f\x61\165\164\150\x65\x6e\164\x69\x63\x61\x74\151\x6f\156\x2e\163\145\x74\164\151\156\x67\x73")->get("\x75\163\x65\x72\x5f\x69\x6e\x66\x6f\x5f\145\156\144\x70\157\x69\156\x74") : null;
if (!(empty($cc) || is_null($cc))) {
goto l1;
}
$Mf["\155\x65\x73\163\x61\x67\x65"] = "\x43\157\165\154\144\x20\x6e\157\164\40\141\x75\x74\150\x65\156\x74\x69\x63\141\164\145\40\x74\150\x65\40\x74\x6f\x6b\x65\156\40\x66\x72\x6f\155\x20\x79\157\x75\162\x20\x50\162\157\166\x69\144\145\162\56\40\120\154\145\141\163\x65\x20\143\x68\145\143\x6b\x20\x79\x6f\165\162\40\x63\x6f\156\x66\151\147\165\x72\x61\164\x69\157\x6e\x73\56";
return $Mf;
l1:
$Mp = \Drupal::config("\x72\x65\x73\164\x5f\x61\x70\151\x5f\141\165\x74\150\145\x6e\164\x69\x63\x61\164\x69\157\156\56\163\145\164\164\151\156\147\x73")->get("\x75\163\145\162\156\x61\x6d\x65\x5f\141\164\x74\x72\151\142\165\x74\145") != null ? \Drupal::config("\162\145\x73\x74\137\141\160\x69\x5f\141\165\164\x68\x65\x6e\164\x69\x63\141\164\x69\x6f\156\x2e\x73\145\x74\164\151\x6e\x67\163")->get("\165\163\145\162\x6e\x61\155\145\x5f\141\x74\164\162\x69\x62\165\164\145") : null;
$IV = Utilities::getResourceOwner($cc, $qt);
if (empty($IV)) {
goto JX;
}
$pG = Utilities::getnestedattribute($IV, $Mp);
JX:
if (!empty($pG)) {
goto oy;
}
$Mf["\x6d\145\x73\x73\x61\147\145"] = "\111\x6e\x76\141\x6c\151\144\x20\162\145\161\165\x65\x73\164\x3a\40\x43\x6f\165\x6c\x64\x20\x6e\x6f\164\x20\x67\145\164\x20\165\x73\145\162\x20\x69\156\146\157\162\x6d\x61\x74\x69\157\156\x2e";
return $Mf;
oy:
goto jb;
RY:
$y6 = "\56";
list($xB, $uI, $tt) = explode($y6, $qt);
$wu = base64_decode(strtr($tt, "\x2d\x5f", "\53\57"));
$vh = utf8_decode($xB . $y6 . $uI);
$RY = $Xw;
$oK = openssl_verify($vh, $wu, $RY, OPENSSL_ALGO_SHA256);
if ($oK) {
goto O2;
}
$Mf["\155\145\x73\163\141\x67\145"] = "\111\x6e\166\x61\154\x69\x64\x20\x54\157\x6b\x65\x6e\72\x20\131\157\165\162\x20\124\157\153\145\x6e\40\x43\x6f\x75\154\x64\40\x4e\x6f\x74\40\x42\145\x20\126\x65\x72\151\x66\x69\145\x64\x2e";
return $Mf;
O2:
$Mp = \Drupal::config("\x72\x65\x73\x74\137\141\x70\151\x5f\141\165\x74\150\x65\x6e\x74\x69\x63\141\x74\x69\157\x6e\56\163\145\x74\164\x69\x6e\x67\x73")->get("\165\163\145\162\x6e\x61\x6d\x65\137\x61\164\164\162\x69\x62\165\x74\x65") != null ? \Drupal::config("\x72\145\x73\164\x5f\141\x70\151\x5f\x61\165\164\150\x65\x6e\164\151\143\x61\x74\151\157\x6e\56\163\x65\164\x74\x69\x6e\147\163")->get("\165\163\x65\162\156\141\155\x65\x5f\141\164\164\x72\151\x62\165\x74\145") : null;
if (!($Mp == null)) {
goto l4;
}
$Mf["\155\x65\163\x73\x61\x67\145"] = "\x43\x6f\165\x6c\144\40\116\157\x74\40\x52\x65\164\x72\151\145\166\145\40\x55\163\x65\x72\40\157\x6e\40\156\x75\154\154\56";
return $Mf;
l4:
$k2 = json_decode(base64_decode($uI), true);
$pG = $k2[$Mp];
if (!($pG == null || trim($pG) == '')) {
goto z0;
}
$Mf["\x6d\x65\163\x73\141\x67\x65"] = "\103\157\x75\x6c\x64\40\116\x6f\x74\40\x52\145\x74\162\151\x65\166\x65\x20\x52\x65\161\165\x69\162\145\144\x20\x55\x73\145\162\40\111\156\x66\157\x72\x6d\x61\164\151\157\x6e\x20\x46\x72\x6f\x6d\x20\x54\157\153\x65\156\x2e";
return $Mf;
z0:
jb:
$user = user_load_by_name($pG);
if (!empty($user)) {
goto C8;
}
$oG = \Drupal::service("\160\141\x73\163\x77\157\x72\144\137\147\x65\x6e\145\x72\141\164\157\162")->generate(8);
$KY = array("\x6e\x61\x6d\145" => $pG, "\155\141\x69\154" => $pG, "\160\141\163\163" => $oG, "\x73\x74\141\164\165\163" => 1, "\x72\157\x6c\145\x73" => array());
$user = User::create($KY);
$user->save();
C8:
$Mf["\x73\x74\x61\x74\x75\x73"] = "\123\x55\x43\103\105\123\123";
$Mf["\x75\163\145\162"] = $user;
b0:
return $Mf;
}
Function Calls
None |
Stats
MD5 | 6269c0883082b15ba13dcfdf5561f6ee |
Eval Count | 0 |
Decode Time | 46 ms |