Japanese English

PHP deobfuscation, decryption, reconstruction tool

De-obfuscate PHP malware/viruses and tampering code on Wordpress to original readable code.

*Please note that not all obfuscation codes can be decoded.

Decoded the code below.

<?php /* __________________________________________________ | Obfuscated by YAK Pro - Php Obfuscator 2.0.3 | | on 2023-10-31 14:25:56 | | GitHub: https://github.com/pk-fr/yakpro-po | |__________________________________________________| */ namespace Plugin\AmazonPayV2_42\Controller;use Eccube\Cont...



Obfuscated php code

<?php
/*   __________________________________________________
    |  Obfuscated by YAK Pro - Php Obfuscator  2.0.3   |
    |              on 2023-10-31 14:25:56              |
    |    GitHub: https://github.com/pk-fr/yakpro-po    |
    |__________________________________________________|
*/
namespace Plugin\AmazonPayV2_42\Controller;use Eccube\Controller\AbstractController;use Eccube\Repository\CustomerRepository;use Eccube\Repository\ClassCategoryRepository;use Eccube\Repository\ProductRepository;use Eccube\Repository\ProductClassRepository;use Eccube\Common\EccubeConfig;use Eccube\Service\CartService;use Eccube\Service\OrderHelper;use Eccube\Service\PurchaseFlow\PurchaseContext;use Eccube\Service\PurchaseFlow\PurchaseFlow;use Plugin\AmazonPayV2_42\Repository\ConfigRepository;use Plugin\AmazonPayV2_42\Service\AmazonOrderHelper;use Plugin\AmazonPayV2_42\Service\AmazonRequestService;use Plugin\AmazonPayV2_42\Service\AmazonIPNService;use Symfony\Component\Routing\Annotation\Route;use Symfony\Component\HttpFoundation\ParameterBag;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;class AmazonRedirectController extends AbstractController{private $sessionAmazonProfileKey = 'amazon_pay_v2.profile';private $sessionAmazonCheckoutSessionIdKey = 'amazon_pay_v2.checkout_session_id';private $sessionIsShippingRefresh = 'amazon_pay_v2.is_shipping_refresh';private $sessionAmazonLoginStateKey = 'amazon_pay_v2.amazon_login_state';protected $cartService;protected $configRepository;protected $amazonRequestService;protected $amazonIPNService;public function __construct(PurchaseFlow $cartPurchaseFlow, OrderHelper $orderHelper, CartService $cartService, CustomerRepository $customerRepository, ClassCategoryRepository $classCategoryRepository, ProductRepository $productRepository, ProductClassRepository $productClassRepository, ConfigRepository $configRepository, AmazonOrderHelper $amazonOrderHelper, AmazonRequestService $amazonRequestService, AmazonIPNService $amazonIPNService, ParameterBag $parameterBag, EccubeConfig $eccubeConfig, TokenStorageInterface $tokenStorage){goto MhIOW;IP0xd:$this->productClassRepository = $productClassRepository;goto xHuD6;ZC4Ux:$this->parameterBag = $parameterBag;goto uCkcD;KxIn1:$this->customerRepository = $customerRepository;goto mJA_u;Re7Ck:$this->amazonRequestService = $amazonRequestService;goto lm2X1;XiSHL:$this->Config = $configRepository->get();goto KJQ_W;mqTSu:$this->productRepository = $productRepository;goto IP0xd;lm2X1:$this->amazonIPNService = $amazonIPNService;goto ZC4Ux;sIEnB:$this->orderHelper = $orderHelper;goto EbtuW;EbtuW:$this->cartService = $cartService;goto KxIn1;uCkcD:$this->eccubeConfig = $eccubeConfig;goto CunWo;MhIOW:$this->purchaseFlow = $cartPurchaseFlow;goto sIEnB;xHuD6:$this->configRepository = $configRepository;goto l_jHr;l_jHr:$this->amazonOrderHelper = $amazonOrderHelper;goto Re7Ck;CunWo:$this->tokenStorage = $tokenStorage;goto XiSHL;mJA_u:$this->classCategoryRepository = $classCategoryRepository;goto mqTSu;KJQ_W:}    /**
     * @Route("/amazon_checkout_review", name="amazon_checkout_review")
     *
     * @param Request $request
     *
     * @return RedirectResponse
     */
public function amazonCheckoutReview(Request $request){goto BYEHy;zxfrf:$this->tokenStorage->setToken($token);goto z4G9h;Cf3fX:$this->entityManager->persist($Customer);goto QOPUP;sTAlp:if (!($this->isGranted('IS_AUTHENTICATED_FULLY') && $this->Config->getOrderCorrect() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'])) {goto cIuZ_;}goto rRmOW;x3VlZ:$arrFixName = $this->amazonOrderHelper->reviseName($Customer->getName01());goto yDk2T;D57lD:$kana02 = $Customer->getKana02();goto gG7FE;kiol0:if (!$revise_flg) {goto EExDn;}goto Cf3fX;EWCVX:Z7UKW:goto kiol0;oSe0v:$this->cartService->mergeFromPersistedCart();goto zFnBM;p8yPT:$kana01 = $Customer->getKana01();goto D57lD;izvEH:$Customer->setName01($arrFixName['name01'])->setName02($arrFixName['name02']);goto IAPr7;s9uYZ:if (!(!$this->isGranted('ROLE_USER') && $this->Config->getAutoLogin() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'] && ($Customer = $this->customerRepository->getNonWithdrawingCustomers(['v2_amazon_user_id' => $buyer->buyerId])))) {goto XYfyl;}goto r7J6C;uDvaB:$this->cartService->save();goto kjjae;RuryG:try {$checkoutSession = $this->amazonRequestService->getCheckoutSession($request->get('amazonCheckoutSessionId'));$buyer = $checkoutSession->buyer;} catch (\Exception $e) {return $this->redirectToRoute('shopping_error');}goto ZrY_W;zwSnm:EExDn:goto EGP1i;yDk2T:if (empty($arrFixName)) {goto fCxE5;}goto izvEH;UG4bK:KQR7u:goto uDvaB;z4G9h:$request->getSession()->migrate(true);goto oSe0v;rRmOW:$Customer = $this->getUser();goto eDVnk;kjjae:XYfyl:goto sTAlp;eDVnk:$revise_flg = false;goto Nl4t1;hjRlJ:jRArl:goto EWCVX;BYEHy:logs('amazon_pay_v2')->info('AmazonRedirect::amazonCheckoutReview start.');goto RuryG;kGhWX:$this->cartService->save();goto s9uYZ;zFnBM:foreach ($this->cartService->getCarts() as $Cart) {$this->purchaseFlow->validate($Cart, new PurchaseContext($Cart, $Customer[0]));qXef9:}goto UG4bK;Hj9wC:logs('amazon_pay_v2')->info('*** 会員情報 フリガナ補正 *** customer_id = ' . $Customer->getId());goto hjRlJ;NChrK:if (!(empty($name02) || $name02 == ' ')) {goto pz_rS;}goto x3VlZ;QOPUP:$this->entityManager->flush();goto zwSnm;MFFNU:$arrFixKana = $this->amazonOrderHelper->reviseKana($Customer->getName01(), $Customer->getName02(), $Customer->getEmail());goto sjXcD;N8AP7:logs('amazon_pay_v2')->info('*** 会員情報 名前補正 *** customer_id = ' . $Customer->getId());goto ph2tA;EGP1i:cIuZ_:goto IGwsv;Nl4t1:$name02 = $Customer->getName02();goto NChrK;M5IXS:$Customer->setKana01($arrFixKana['kana01'])->setKana02($arrFixKana['kana02']);goto WFui7;TnPmo:logs('amazon_pay_v2')->info('AmazonRedirect::index end.');goto WzzS5;nFc_r:pz_rS:goto p8yPT;ph2tA:fCxE5:goto nFc_r;sjXcD:if (empty($arrFixKana)) {goto jRArl;}goto M5IXS;IGwsv:$this->session->set($this->sessionAmazonProfileKey, serialize($buyer));goto HqLBk;hKDWt:$this->cartService->setPrimary($cartKey);goto kGhWX;r7J6C:$token = new UsernamePasswordToken($Customer[0], null, 'customer', ['ROLE_USER']);goto zxfrf;OUDg0:$this->session->set($this->sessionIsShippingRefresh, true);goto TnPmo;IAPr7:$revise_flg = true;goto N8AP7;HqLBk:$this->session->set($this->sessionAmazonCheckoutSessionIdKey, $request->get('amazonCheckoutSessionId'));goto OUDg0;WzzS5:return $this->redirectToRoute('amazon_pay_shopping', []);goto AVKyN;gG7FE:if (!((empty($kana01) || $kana01 === ' ') && (empty($kana02) || $kana02 === ' '))) {goto Z7UKW;}goto MFFNU;ZrY_W:$cartKey = $request->get('cart');goto hKDWt;WFui7:$revise_flg = true;goto Hj9wC;AVKyN:}    /**
     * @Route("/amazon_instant_payment_notifications", name="instant_payment_notifications")
     */
public function instantPaymentNotifications(Request $request){goto mWx2S;d8bby:Xv282:goto CRIrg;CRIrg:logs('amazon_pay_v2')->info('AmazonRedirect::instantPaymentNotifications end.');goto eo8iZ;eo8iZ:return new Response();goto leCI4;r8yQn:if (isset($content['Type']) && $content['Type'] == 'Notification') {goto m5tBd;}goto R2KUB;SXHYH:$this->amazonIPNService->mainProcess($arrParam);goto d8bby;mWx2S:logs('amazon_pay_v2')->info('AmazonRedirect::instantPaymentNotifications start.');goto lRs9F;FLagl:goto Xv282;goto A5VWM;ZeFuk:$arrParam = json_decode($content['Message'], true);goto SXHYH;Sb8R0:$content = json_decode($json, true);goto r8yQn;R2KUB:throw new \Exception('IPN Type Error.');goto FLagl;lRs9F:$json = $request->getContent();goto Sb8R0;A5VWM:m5tBd:goto ZeFuk;leCI4:}    /**
     * @Route("/mypage/login_with_amazon", name="login_with_amazon")
     */
public function loginWithAmazon(Request $request){goto E7n7E;pi2Gw:if (!($state !== $sessionState)) {goto tztX1;}goto I_BYW;yZJzF:$this->session->remove($this->sessionAmazonLoginStateKey);goto MGLen;Gkrga:return $this->redirectToRoute($route);goto rTrds;pnqgy:$sessionState = $this->session->get($this->sessionAmazonLoginStateKey);goto f1pIf;YyZHn:$route = 'homepage';goto OWr7F;I_BYW:$this->addError('amazon_pay_v2.front.error', 'amazon_pay_v2');goto TnlgN;E7n7E:logs('amazon_pay_v2')->info('AmazonRedirect::loginWithAmazon start.');goto YyZHn;amI5T:$state = $request->get('state');goto pnqgy;lKUc4:return $this->redirectToRoute($route);goto tzNOg;rTrds:tztX1:goto yZJzF;OWr7F:$buyerToken = $request->get('buyerToken');goto amI5T;MGLen:try {goto KO5P8;Dtvxb:$buyer = $this->amazonRequestService->getBuyer($request->get('buyerToken'));goto NbECa;JU8qW:$isLogin = $this->amazonRequestService->loginWithBuyerId($request, $buyerId);goto He2eg;moSMa:$this->addError('amazon_pay_v2.front_mypage_fail_to_login', 'amazon_pay_v2');goto mkIrd;mkIrd:$route = 'mypage_login';goto TpaId;He2eg:if ($isLogin) {goto S7EFc;}goto moSMa;NbECa:$buyerId = $buyer->buyerId;goto JU8qW;KO5P8:if ($this->isGranted('ROLE_USER')) {goto oLiFi;}goto Dtvxb;gr_Lq:oLiFi:goto E2GKk;TpaId:S7EFc:goto gr_Lq;E2GKk:} catch (\Exception $e) {goto Sm_Sh;tyw7Z:$route = 'mypage_login';goto da6j2;Sm_Sh:logs('amazon_pay_v2')->info($e->getMessage());goto swXrI;swXrI:$this->addError('amazon_pay_v2.front.error', 'amazon_pay_v2');goto tyw7Z;da6j2:}goto drL8X;IHr0w:throw new AccessDeniedHttpException('不正なアクセスです。');goto Zv_3O;drL8X:logs('amazon_pay_v2')->info('AmazonRedirect::loginWithAmazon end.');goto lKUc4;TnlgN:$route = 'mypage_login';goto Gkrga;Zv_3O:q5ozT:goto pi2Gw;f1pIf:if (!(!isset($buyerToken) || !isset($state))) {goto q5ozT;}goto IHr0w;tzNOg:}}

Decoded(de-Obfuscated) php code

<?php

/*   __________________________________________________
    |  Obfuscated by YAK Pro - Php Obfuscator  2.0.3   |
    |              on 2023-10-31 14:25:56              |
    |    GitHub: https://github.com/pk-fr/yakpro-po    |
    |__________________________________________________|
*/
namespace Plugin\AmazonPayV2_42\Controller;

use Eccube\Controller\AbstractController;
use Eccube\Repository\CustomerRepository;
use Eccube\Repository\ClassCategoryRepository;
use Eccube\Repository\ProductRepository;
use Eccube\Repository\ProductClassRepository;
use Eccube\Common\EccubeConfig;
use Eccube\Service\CartService;
use Eccube\Service\OrderHelper;
use Eccube\Service\PurchaseFlow\PurchaseContext;
use Eccube\Service\PurchaseFlow\PurchaseFlow;
use Plugin\AmazonPayV2_42\Repository\ConfigRepository;
use Plugin\AmazonPayV2_42\Service\AmazonOrderHelper;
use Plugin\AmazonPayV2_42\Service\AmazonRequestService;
use Plugin\AmazonPayV2_42\Service\AmazonIPNService;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
class AmazonRedirectController extends AbstractController
{
    private $sessionAmazonProfileKey = 'amazon_pay_v2.profile';
    private $sessionAmazonCheckoutSessionIdKey = 'amazon_pay_v2.checkout_session_id';
    private $sessionIsShippingRefresh = 'amazon_pay_v2.is_shipping_refresh';
    private $sessionAmazonLoginStateKey = 'amazon_pay_v2.amazon_login_state';
    protected $cartService;
    protected $configRepository;
    protected $amazonRequestService;
    protected $amazonIPNService;
    public function __construct(PurchaseFlow $cartPurchaseFlow, OrderHelper $orderHelper, CartService $cartService, CustomerRepository $customerRepository, ClassCategoryRepository $classCategoryRepository, ProductRepository $productRepository, ProductClassRepository $productClassRepository, ConfigRepository $configRepository, AmazonOrderHelper $amazonOrderHelper, AmazonRequestService $amazonRequestService, AmazonIPNService $amazonIPNService, ParameterBag $parameterBag, EccubeConfig $eccubeConfig, TokenStorageInterface $tokenStorage)
    {
        $this->purchaseFlow = $cartPurchaseFlow;
        $this->orderHelper = $orderHelper;
        $this->cartService = $cartService;
        $this->customerRepository = $customerRepository;
        $this->classCategoryRepository = $classCategoryRepository;
        $this->productRepository = $productRepository;
        $this->productClassRepository = $productClassRepository;
        $this->configRepository = $configRepository;
        $this->amazonOrderHelper = $amazonOrderHelper;
        $this->amazonRequestService = $amazonRequestService;
        $this->amazonIPNService = $amazonIPNService;
        $this->parameterBag = $parameterBag;
        $this->eccubeConfig = $eccubeConfig;
        $this->tokenStorage = $tokenStorage;
        $this->Config = $configRepository->get();
    }
    /**
     * @Route("/amazon_checkout_review", name="amazon_checkout_review")
     *
     * @param Request $request
     *
     * @return RedirectResponse
     */
    public function amazonCheckoutReview(Request $request)
    {
        logs('amazon_pay_v2')->info('AmazonRedirect::amazonCheckoutReview start.');
        try {
            $checkoutSession = $this->amazonRequestService->getCheckoutSession($request->get('amazonCheckoutSessionId'));
            $buyer = $checkoutSession->buyer;
        } catch (\Exception $e) {
            return $this->redirectToRoute('shopping_error');
        }
        $cartKey = $request->get('cart');
        $this->cartService->setPrimary($cartKey);
        $this->cartService->save();
        if (!(!$this->isGranted('ROLE_USER') && $this->Config->getAutoLogin() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'] && ($Customer = $this->customerRepository->getNonWithdrawingCustomers(['v2_amazon_user_id' => $buyer->buyerId])))) {
            goto XYfyl;
        }
        $token = new UsernamePasswordToken($Customer[0], null, 'customer', ['ROLE_USER']);
        $this->tokenStorage->setToken($token);
        $request->getSession()->migrate(true);
        $this->cartService->mergeFromPersistedCart();
        foreach ($this->cartService->getCarts() as $Cart) {
            $this->purchaseFlow->validate($Cart, new PurchaseContext($Cart, $Customer[0]));
        }
        $this->cartService->save();
        XYfyl:
        if (!($this->isGranted('IS_AUTHENTICATED_FULLY') && $this->Config->getOrderCorrect() == $this->eccubeConfig['amazon_pay_v2']['toggle']['on'])) {
            goto cIuZ_;
        }
        $Customer = $this->getUser();
        $revise_flg = false;
        $name02 = $Customer->getName02();
        if (!(empty($name02) || $name02 == ' ')) {
            goto pz_rS;
        }
        $arrFixName = $this->amazonOrderHelper->reviseName($Customer->getName01());
        if (empty($arrFixName)) {
            goto fCxE5;
        }
        $Customer->setName01($arrFixName['name01'])->setName02($arrFixName['name02']);
        $revise_flg = true;
        logs('amazon_pay_v2')->info('*** 会員情報 名前補正 *** customer_id = ' . $Customer->getId());
        fCxE5:
        pz_rS:
        $kana01 = $Customer->getKana01();
        $kana02 = $Customer->getKana02();
        if (!((empty($kana01) || $kana01 === ' ') && (empty($kana02) || $kana02 === ' '))) {
            goto Z7UKW;
        }
        $arrFixKana = $this->amazonOrderHelper->reviseKana($Customer->getName01(), $Customer->getName02(), $Customer->getEmail());
        if (empty($arrFixKana)) {
            goto jRArl;
        }
        $Customer->setKana01($arrFixKana['kana01'])->setKana02($arrFixKana['kana02']);
        $revise_flg = true;
        logs('amazon_pay_v2')->info('*** 会員情報 フリガナ補正 *** customer_id = ' . $Customer->getId());
        jRArl:
        Z7UKW:
        if (!$revise_flg) {
            goto EExDn;
        }
        $this->entityManager->persist($Customer);
        $this->entityManager->flush();
        EExDn:
        cIuZ_:
        $this->session->set($this->sessionAmazonProfileKey, serialize($buyer));
        $this->session->set($this->sessionAmazonCheckoutSessionIdKey, $request->get('amazonCheckoutSessionId'));
        $this->session->set($this->sessionIsShippingRefresh, true);
        logs('amazon_pay_v2')->info('AmazonRedirect::index end.');
        return $this->redirectToRoute('amazon_pay_shopping', []);
    }
    /**
     * @Route("/amazon_instant_payment_notifications", name="instant_payment_notifications")
     */
    public function instantPaymentNotifications(Request $request)
    {
        logs('amazon_pay_v2')->info('AmazonRedirect::instantPaymentNotifications start.');
        $json = $request->getContent();
        $content = json_decode($json, true);
        if (isset($content['Type']) && $content['Type'] == 'Notification') {
            $arrParam = json_decode($content['Message'], true);
            $this->amazonIPNService->mainProcess($arrParam);
            Xv282:
            logs('amazon_pay_v2')->info('AmazonRedirect::instantPaymentNotifications end.');
            return new Response();
        }
        throw new \Exception('IPN Type Error.');
    }
    /**
     * @Route("/mypage/login_with_amazon", name="login_with_amazon")
     */
    public function loginWithAmazon(Request $request)
    {
        logs('amazon_pay_v2')->info('AmazonRedirect::loginWithAmazon start.');
        $route = 'homepage';
        $buyerToken = $request->get('buyerToken');
        $state = $request->get('state');
        $sessionState = $this->session->get($this->sessionAmazonLoginStateKey);
        if (!(!isset($buyerToken) || !isset($state))) {
            if (!($state !== $sessionState)) {
                $this->session->remove($this->sessionAmazonLoginStateKey);
                try {
                    if ($this->isGranted('ROLE_USER')) {
                        goto oLiFi;
                    }
                    $buyer = $this->amazonRequestService->getBuyer($request->get('buyerToken'));
                    $buyerId = $buyer->buyerId;
                    $isLogin = $this->amazonRequestService->loginWithBuyerId($request, $buyerId);
                    if ($isLogin) {
                        goto S7EFc;
                    }
                    $this->addError('amazon_pay_v2.front_mypage_fail_to_login', 'amazon_pay_v2');
                    $route = 'mypage_login';
                    S7EFc:
                    oLiFi:
                } catch (\Exception $e) {
                    logs('amazon_pay_v2')->info($e->getMessage());
                    $this->addError('amazon_pay_v2.front.error', 'amazon_pay_v2');
                    $route = 'mypage_login';
                }
                logs('amazon_pay_v2')->info('AmazonRedirect::loginWithAmazon end.');
                return $this->redirectToRoute($route);
            }
            $this->addError('amazon_pay_v2.front.error', 'amazon_pay_v2');
            $route = 'mypage_login';
            return $this->redirectToRoute($route);
        }
        throw new AccessDeniedHttpException('不正なアクセスです。');
    }
}


Malware detection & removal plugin for WordPress

(C)2020 Wordpress Doctor All rights reserved.