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 /* * Copyright (C) Incevio Systems, Inc - All Rights Reserved * Unauthorized co..

Decoded Output download

<?php 
/* 
 * Copyright (C) Incevio Systems, Inc - All Rights Reserved 
 * Unauthorized copying of this file, via any medium is strictly prohibited 
 * Proprietary and confidential 
 * Written by Munna Khan <[email protected]>, September 2018 
 */ 
namespace App\Http\Controllers\Admin; 
use App\Models\Package; 
use App\Http\Controllers\Controller; 
use App\Http\Requests\Validations\PackageInstallationRequest; 
use App\Services\PackageInstaller; 
use Illuminate\Http\Request; 
use Illuminate\Support\Facades\Artisan; 
use Illuminate\Support\Facades\Log; 
use Illuminate\Support\Facades\DB; 
class PackagesController extends Controller 
{ 
    public function index() 
    { 
        $installables = $this->scanPackages(); 
        $installs = Package::all(); 
        return view( 
            "admin.packages.index", 
            compact( 
                "installables", 
                "installs" 
            ) 
        ); 
    } 
    public function upload() 
    { 
        return view( 
            "admin.packages._upload" 
        ); 
    } 
    public function save(Request $request) 
    { 
        echo "<pre>"; 
        print_r($request->all()); 
        echo "<pre>"; 
        exit("end!"); 
    } 
    public function initiate(Request $request, $package) 
    { 
        if ( 
            !( 
                config("app.demo") == true && 
                config("app.debug") !== true 
            ) 
        ) { 
            goto MNjXN; 
        } 
        return back()->with( 
            "warning", 
            trans( 
                "messages.demo_restriction" 
            ) 
        ); 
        MNjXN: 
        $installable = $this->scanPackages($package); 
        if ( 
            !( 
                $installable && 
                Package::where( 
                    "slug", 
                    $installable["slug"] 
                )->first() 
            ) 
        ) { 
            goto Tub_e; 
        } 
        return back()->with( 
            "error", 
            trans( 
                "messages.package_installed_already", 
                ["package" => $package] 
            ) 
        ); 
        Tub_e: 
        return view( 
            "admin.packages._initiate", 
            compact("installable") 
        ); 
    } 
    public function upgrade(Request $request, $package) 
    { 
        if ( 
            !( 
                config("app.demo") == true && 
                config("app.debug") !== true 
            ) 
        ) { 
            goto Z7CuK; 
        } 
        return back()->with( 
            "warning", 
            trans( 
                "messages.demo_restriction" 
            ) 
        ); 
        Z7CuK: 
        $installable = $this->scanPackages($package); 
        if ($installable) { 
            goto F9qoc; 
        } 
        return back()->with( 
            "error", 
            trans( 
                "messages.package_not_found", 
                ["package" => $package] 
            ) 
        ); 
        F9qoc: 
        try { 
            $installer = new PackageInstaller($request, $installable); 
            $installer->migrate(); 
        } catch (\Exception $e) { 
            Log::error($e); 
            return back()->with("error", $e->getMessage()); 
        } 
        return back()->with( 
            "success", 
            trans( 
                "messages.package_upgraded_success", 
                ["package" => $package] 
            ) 
        ); 
    } 
    public function install(PackageInstallationRequest $request, $package) 
    { 
        if ( 
            !( 
                config("app.demo") == true && 
                config("app.debug") !== true 
            ) 
        ) { 
            goto e_PTt; 
        } 
        return back()->with( 
            "warning", 
            trans( 
                "messages.demo_restriction" 
            ) 
        ); 
        e_PTt: 
        $installable = $this->scanPackages($package); 
        if ($installable) { 
            goto XmkcP; 
        } 
        return back()->with( 
            "error", 
            trans( 
                "messages.package_not_found", 
                ["package" => $package] 
            ) 
        ); 
        XmkcP: 
        try { 
            $installer = new PackageInstaller($request, $installable); 
            $installer->install(); 
        } catch (\Exception $e) { 
            Log::error($e); 
            $installer->uninstall(); 
            $registered = Package::where("slug", $package)->first(); 
            if (!$registered) { 
                goto cIccj; 
            } 
            $registered->delete(); 
            cIccj: 
            return back()->with("error", $e->getMessage()); 
        } 
        Artisan::call("cache:clear"); 
        Artisan::call("route:clear"); 
        return back()->with( 
            "success", 
            trans( 
                "messages.package_installed_success", 
                ["package" => $package] 
            ) 
        ); 
    } 
    public function uninstall(Request $request, $package) 
    { 
        if ( 
            !( 
                config("app.demo") == true && 
                config("app.debug") !== true 
            ) 
        ) { 
            goto wFWL6; 
        } 
        return back()->with( 
            "warning", 
            trans( 
                "messages.demo_restriction" 
            ) 
        ); 
        wFWL6: 
        $registered = Package::where( 
            "slug", 
            $package 
        )->firstOrFail(); 
        $uninstallable = $this->scanPackages($package); 
        try { 
            $installer = new PackageInstaller($request, $uninstallable); 
            if (!$installer->uninstall()) { 
                goto jYpvo; 
            } 
            Artisan::call("cache:clear"); 
            Artisan::call("route:clear"); 
            if (!$registered->delete()) { 
                goto HmvaI; 
            } 
            return back()->with( 
                "success", 
                trans( 
                    "messages.package_uninstalled_success", 
                    ["package" => $package] 
                ) 
            ); 
            HmvaI: 
            jYpvo: 
        } catch (\Exception $e) { 
            Log::error($e); 
            return back()->with("error", $e->getMessage()); 
        } 
        return back()->with( 
            "error", 
            trans("messages.failed") 
        ); 
    } 
    public function activation(Request $request, $slug) 
    { 
        if ( 
            !( 
                config("app.demo") == true && 
                config("app.debug") !== true 
            ) 
        ) { 
            goto NWtn0; 
        } 
        return response("error", 444); 
        NWtn0: 
        if ( 
            !($registered = Package::where("slug", $slug)->first()) 
        ) { 
            goto Pg6mX; 
        } 
        $registered->active = !$registered->active; 
        $registered->save(); 
        Artisan::call("cache:clear"); 
        return response("success", 200); 
        Pg6mX: 
        if (!($unregistered = $this->scanPackages($slug))) { 
            goto bZWsI; 
        } 
        $registered = Package::create($unregistered); 
        bZWsI: 
        return response("success", 200); 
    } 
    public function updateConfig(Request $request) 
    { 
        if (!updateOptionTable($request)) { 
            goto OhpWe; 
        } 
        Artisan::call("cache:clear"); 
        return back()->with( 
            "success", 
            trans( 
                "messages.package_settings_updated" 
            ) 
        ); 
        OhpWe: 
        return back()->with( 
            "error", 
            trans("messages.failed") 
        ); 
    } 
    public function toggleConfig(Request $request, $option) 
    { 
        if ( 
            !( 
                config("app.demo") == true && 
                config("app.debug") !== true 
            ) 
        ) { 
            goto ap8fy; 
        } 
        return response("error", 444); 
        ap8fy: 
        $updated = DB::table("options") 
            ->where("option_name", $option) 
            ->update([ 
                "option_value" => DB::raw( 
                    "NOT option_value" 
                ), 
            ]); 
        if (!$updated) { 
            goto Wr78S; 
        } 
        Artisan::call("cache:clear"); 
        return response("success", 200); 
        Wr78S: 
        return response("error", 405); 
    } 
    private function scanPackages($slug = null) 
    { 
        $packages = []; 
        foreach ( 
            glob( 
                base_path("packages/*"), 
                GLOB_ONLYDIR 
            ) 
            as $dir 
        ) { 
            if ( 
                !file_exists( 
                    $manifest = 
                        $dir . 
                        "/manifest.json" 
                ) 
            ) { 
                goto WrE9K; 
            } 
            $json = file_get_contents($manifest); 
            if (!($json !== "")) { 
                goto siUyT; 
            } 
            $data = json_decode($json, true); 
            if (!($data === null)) { 
                goto NZZwd; 
            } 
            throw new \Exception( 
                "Invalid manifest.json file at [{$dir}]" 
            ); 
            NZZwd: 
            $data["path"] = $dir; 
            if (!($slug && $data["slug"] == $slug)) { 
                goto j8OB3; 
            } 
            return $data; 
            j8OB3: 
            $packages[] = $data; 
            siUyT: 
            WrE9K: 
            d4xgo: 
        } 
        r8SKZ: 
        usort($packages, function ($x, $y) { 
            return strcasecmp($x["name"], $y["name"]); 
        }); 
        return $packages; 
    } 
} 
 ?>

Did this file decode correctly?

Original Code

<?php
/*
 * Copyright (C) Incevio Systems, Inc - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited
 * Proprietary and confidential
 * Written by Munna Khan <[email protected]>, September 2018
 */
namespace App\Http\Controllers\Admin;
use App\Models\Package;
use App\Http\Controllers\Controller;
use App\Http\Requests\Validations\PackageInstallationRequest;
use App\Services\PackageInstaller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
class PackagesController extends Controller
{
    public function index()
    {
        $installables = $this->scanPackages();
        $installs = Package::all();
        return view(
            "\x61\x64\155\151\156\56\x70\x61\143\153\141\x67\x65\163\56\x69\x6e\144\x65\170",
            compact(
                "\151\x6e\x73\164\x61\154\154\x61\x62\x6c\145\163",
                "\151\x6e\x73\x74\141\x6c\154\163"
            )
        );
    }
    public function upload()
    {
        return view(
            "\x61\x64\155\151\x6e\56\x70\x61\x63\x6b\x61\x67\145\x73\x2e\137\165\160\x6c\157\141\x64"
        );
    }
    public function save(Request $request)
    {
        echo "\74\x70\162\145\76";
        print_r($request->all());
        echo "\74\x70\x72\x65\x3e";
        exit("\x65\156\x64\41");
    }
    public function initiate(Request $request, $package)
    {
        if (
            !(
                config("\141\160\x70\x2e\144\145\x6d\x6f") == true &&
                config("\x61\160\x70\x2e\x64\x65\142\165\147") !== true
            )
        ) {
            goto MNjXN;
        }
        return back()->with(
            "\167\x61\x72\x6e\151\156\x67",
            trans(
                "\155\145\163\163\x61\147\145\163\x2e\x64\x65\x6d\x6f\x5f\x72\145\163\164\162\x69\x63\x74\151\x6f\156"
            )
        );
        MNjXN:
        $installable = $this->scanPackages($package);
        if (
            !(
                $installable &&
                Package::where(
                    "\x73\x6c\x75\x67",
                    $installable["\163\x6c\x75\147"]
                )->first()
            )
        ) {
            goto Tub_e;
        }
        return back()->with(
            "\x65\x72\162\157\162",
            trans(
                "\155\x65\x73\x73\x61\147\x65\x73\x2e\x70\141\143\153\141\147\x65\137\151\156\163\164\x61\154\x6c\145\x64\137\141\154\x72\x65\141\144\171",
                ["\x70\141\143\x6b\141\147\x65" => $package]
            )
        );
        Tub_e:
        return view(
            "\x61\144\155\x69\x6e\x2e\160\x61\143\x6b\141\147\x65\163\56\x5f\151\x6e\x69\164\x69\x61\x74\145",
            compact("\x69\x6e\x73\x74\141\154\x6c\x61\x62\154\x65")
        );
    }
    public function upgrade(Request $request, $package)
    {
        if (
            !(
                config("\141\x70\160\56\x64\x65\155\157") == true &&
                config("\141\x70\x70\x2e\144\145\142\165\147") !== true
            )
        ) {
            goto Z7CuK;
        }
        return back()->with(
            "\x77\x61\x72\156\151\156\147",
            trans(
                "\x6d\x65\x73\x73\141\x67\x65\163\56\x64\145\155\157\137\162\x65\163\x74\x72\x69\x63\x74\151\x6f\x6e"
            )
        );
        Z7CuK:
        $installable = $this->scanPackages($package);
        if ($installable) {
            goto F9qoc;
        }
        return back()->with(
            "\145\162\x72\x6f\x72",
            trans(
                "\155\145\163\x73\x61\x67\145\x73\56\x70\x61\143\153\x61\147\145\x5f\x6e\x6f\164\137\x66\157\x75\x6e\144",
                ["\160\141\143\153\141\147\145" => $package]
            )
        );
        F9qoc:
        try {
            $installer = new PackageInstaller($request, $installable);
            $installer->migrate();
        } catch (\Exception $e) {
            Log::error($e);
            return back()->with("\145\162\x72\x6f\162", $e->getMessage());
        }
        return back()->with(
            "\x73\x75\143\143\145\163\x73",
            trans(
                "\155\145\163\163\141\x67\145\x73\x2e\x70\x61\x63\x6b\x61\147\145\137\x75\160\x67\x72\141\144\145\x64\x5f\163\165\143\x63\145\x73\163",
                ["\x70\141\x63\x6b\141\147\x65" => $package]
            )
        );
    }
    public function install(PackageInstallationRequest $request, $package)
    {
        if (
            !(
                config("\x61\160\160\56\x64\x65\x6d\157") == true &&
                config("\x61\160\x70\x2e\144\x65\x62\x75\147") !== true
            )
        ) {
            goto e_PTt;
        }
        return back()->with(
            "\167\141\162\x6e\151\x6e\x67",
            trans(
                "\x6d\145\x73\163\x61\147\x65\x73\x2e\x64\x65\155\157\137\162\145\163\x74\x72\x69\x63\x74\151\x6f\x6e"
            )
        );
        e_PTt:
        $installable = $this->scanPackages($package);
        if ($installable) {
            goto XmkcP;
        }
        return back()->with(
            "\x65\162\162\x6f\162",
            trans(
                "\155\x65\163\163\x61\147\x65\163\x2e\x70\141\143\x6b\x61\x67\145\137\x6e\x6f\164\x5f\146\157\165\156\x64",
                ["\160\x61\143\153\x61\147\145" => $package]
            )
        );
        XmkcP:
        try {
            $installer = new PackageInstaller($request, $installable);
            $installer->install();
        } catch (\Exception $e) {
            Log::error($e);
            $installer->uninstall();
            $registered = Package::where("\163\x6c\165\x67", $package)->first();
            if (!$registered) {
                goto cIccj;
            }
            $registered->delete();
            cIccj:
            return back()->with("\x65\162\x72\x6f\x72", $e->getMessage());
        }
        Artisan::call("\x63\x61\x63\x68\x65\72\143\154\145\x61\x72");
        Artisan::call("\162\157\165\x74\145\x3a\x63\x6c\145\141\162");
        return back()->with(
            "\x73\165\x63\x63\145\163\x73",
            trans(
                "\x6d\145\x73\x73\141\x67\145\x73\x2e\160\141\143\x6b\x61\x67\x65\137\x69\156\163\x74\141\x6c\154\x65\144\137\x73\x75\143\143\x65\x73\163",
                ["\x70\141\143\153\141\x67\145" => $package]
            )
        );
    }
    public function uninstall(Request $request, $package)
    {
        if (
            !(
                config("\x61\160\x70\x2e\x64\145\155\x6f") == true &&
                config("\x61\x70\x70\x2e\x64\145\142\165\147") !== true
            )
        ) {
            goto wFWL6;
        }
        return back()->with(
            "\167\141\162\x6e\x69\x6e\x67",
            trans(
                "\155\145\163\x73\141\x67\145\x73\x2e\144\145\155\157\x5f\x72\145\163\x74\162\x69\143\164\x69\x6f\x6e"
            )
        );
        wFWL6:
        $registered = Package::where(
            "\163\x6c\165\147",
            $package
        )->firstOrFail();
        $uninstallable = $this->scanPackages($package);
        try {
            $installer = new PackageInstaller($request, $uninstallable);
            if (!$installer->uninstall()) {
                goto jYpvo;
            }
            Artisan::call("\143\141\143\150\145\x3a\x63\x6c\145\x61\162");
            Artisan::call("\x72\157\x75\x74\145\x3a\x63\154\145\141\162");
            if (!$registered->delete()) {
                goto HmvaI;
            }
            return back()->with(
                "\x73\x75\x63\x63\x65\x73\163",
                trans(
                    "\155\x65\x73\163\x61\x67\145\163\56\160\x61\x63\153\x61\147\145\137\x75\x6e\x69\x6e\163\164\x61\x6c\x6c\x65\x64\x5f\x73\165\x63\x63\145\163\163",
                    ["\x70\141\x63\x6b\141\x67\x65" => $package]
                )
            );
            HmvaI:
            jYpvo:
        } catch (\Exception $e) {
            Log::error($e);
            return back()->with("\x65\x72\162\x6f\162", $e->getMessage());
        }
        return back()->with(
            "\145\x72\x72\x6f\162",
            trans("\x6d\145\x73\x73\x61\x67\145\x73\56\x66\x61\x69\154\x65\144")
        );
    }
    public function activation(Request $request, $slug)
    {
        if (
            !(
                config("\x61\160\x70\56\144\x65\x6d\157") == true &&
                config("\x61\160\160\x2e\144\145\x62\x75\x67") !== true
            )
        ) {
            goto NWtn0;
        }
        return response("\x65\x72\x72\x6f\x72", 444);
        NWtn0:
        if (
            !($registered = Package::where("\x73\154\x75\x67", $slug)->first())
        ) {
            goto Pg6mX;
        }
        $registered->active = !$registered->active;
        $registered->save();
        Artisan::call("\143\141\143\150\145\x3a\x63\x6c\x65\141\x72");
        return response("\x73\165\143\x63\145\163\163", 200);
        Pg6mX:
        if (!($unregistered = $this->scanPackages($slug))) {
            goto bZWsI;
        }
        $registered = Package::create($unregistered);
        bZWsI:
        return response("\163\165\x63\x63\x65\x73\163", 200);
    }
    public function updateConfig(Request $request)
    {
        if (!updateOptionTable($request)) {
            goto OhpWe;
        }
        Artisan::call("\x63\x61\x63\x68\145\x3a\143\x6c\x65\x61\162");
        return back()->with(
            "\163\x75\x63\143\145\x73\x73",
            trans(
                "\155\x65\163\x73\x61\x67\x65\x73\x2e\x70\141\143\x6b\x61\x67\145\137\163\145\164\164\151\156\x67\163\137\165\160\x64\x61\x74\x65\144"
            )
        );
        OhpWe:
        return back()->with(
            "\145\x72\162\157\162",
            trans("\x6d\145\x73\x73\141\x67\x65\x73\56\146\141\x69\x6c\145\x64")
        );
    }
    public function toggleConfig(Request $request, $option)
    {
        if (
            !(
                config("\141\160\160\56\144\145\155\157") == true &&
                config("\141\160\160\56\144\145\x62\165\147") !== true
            )
        ) {
            goto ap8fy;
        }
        return response("\x65\162\x72\x6f\162", 444);
        ap8fy:
        $updated = DB::table("\157\160\164\x69\x6f\x6e\163")
            ->where("\157\160\x74\x69\157\156\137\x6e\141\x6d\x65", $option)
            ->update([
                "\x6f\x70\164\x69\x6f\156\137\x76\141\x6c\x75\x65" => DB::raw(
                    "\116\x4f\x54\40\x6f\160\164\x69\157\156\x5f\166\141\154\165\x65"
                ),
            ]);
        if (!$updated) {
            goto Wr78S;
        }
        Artisan::call("\x63\141\x63\150\145\x3a\143\x6c\145\x61\162");
        return response("\x73\165\143\143\x65\163\163", 200);
        Wr78S:
        return response("\145\x72\162\157\x72", 405);
    }
    private function scanPackages($slug = null)
    {
        $packages = [];
        foreach (
            glob(
                base_path("\160\141\x63\x6b\x61\147\x65\163\57\x2a"),
                GLOB_ONLYDIR
            )
            as $dir
        ) {
            if (
                !file_exists(
                    $manifest =
                        $dir .
                        "\x2f\x6d\x61\156\151\146\x65\163\164\x2e\152\x73\157\156"
                )
            ) {
                goto WrE9K;
            }
            $json = file_get_contents($manifest);
            if (!($json !== "")) {
                goto siUyT;
            }
            $data = json_decode($json, true);
            if (!($data === null)) {
                goto NZZwd;
            }
            throw new \Exception(
                "\x49\156\x76\141\x6c\x69\x64\x20\x6d\x61\x6e\x69\x66\145\x73\164\56\x6a\x73\x6f\x6e\x20\146\x69\x6c\145\x20\x61\164\40\133{$dir}\135"
            );
            NZZwd:
            $data["\x70\x61\164\150"] = $dir;
            if (!($slug && $data["\163\x6c\x75\x67"] == $slug)) {
                goto j8OB3;
            }
            return $data;
            j8OB3:
            $packages[] = $data;
            siUyT:
            WrE9K:
            d4xgo:
        }
        r8SKZ:
        usort($packages, function ($x, $y) {
            return strcasecmp($x["\156\141\155\x65"], $y["\x6e\x61\x6d\x65"]);
        });
        return $packages;
    }
}

Function Calls

None

Variables

None

Stats

MD5 d040ec7d3fb1bfe6bcaae56bdddfaa50
Eval Count 0
Decode Time 79 ms