403Webshell
Server IP : 138.197.107.151  /  Your IP : 216.73.217.10
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User : wpbetasites_mrakzqskir ( 1022)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/shark/app/Helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/shark/app/Helpers/DomainHelper.php
<?php

namespace App\Helpers;

class DomainHelper
{
    protected static $psl = [];

    public static function loadPsl()
    {
        if (empty(self::$psl)) {
            $path = storage_path('app/public_suffix_list.dat');
            self::$psl = file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
        }
    }

    public static function getRootDomain(string $host): string
    {
        self::loadPsl();

        $host = strtolower($host);
        $host = preg_replace('/^www\./', '', $host); // strip www

        foreach (self::$psl as $suffix) {
            if ($suffix[0] === '/' || $suffix[0] === ' ') continue; // comments
            $suffix = trim($suffix);

            if (str_ends_with($host, '.' . $suffix) || $host === $suffix) {
                $parts = explode('.', $host);
                $suffixParts = explode('.', $suffix);
                $domainParts = array_slice($parts, -count($suffixParts)-1);
                return implode('.', $domainParts);
            }
        }

        return $host;
    }

    public static function isRootDomain(string $host): bool
    {
        return self::getRootDomain($host) === strtolower(preg_replace('/^www\./', '', $host));
    }
     public static function getSubdomain(string $host): ?string
    {
        $root = self::getRootDomain($host);
        $host = strtolower(preg_replace('/^www\./', '', $host));

        if ($host === $root) {
            return null; // no subdomain
        }

        // remove root part from host
        $sub = substr($host, 0, -strlen($root));
        return rtrim($sub, '.');
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit