IP:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Ping</title>
</head>
<body>
    <form action="." method="GET">
        IP: <input type="text" name="ip"> <input type="submit" value="Ping">
    </form>
    <pre><?php
        $blacklist 
= [
            
'flag', 'cat', 'nc', 'sh', 'cp', 'touch', 'mv', 'rm', 'ps', 'top', 'sleep', 'sed',
            
'apt', 'yum', 'curl', 'wget', 'perl', 'python', 'zip', 'tar', 'php', 'ruby', 'kill',
            
'passwd', 'shadow', 'root',
            
'z',
            
'dir', 'dd', 'df', 'du', 'free', 'tempfile', 'touch', 'tee', 'sha', 'x64', 'g',
            
'xargs', 'PATH',
            
'$0', 'proc',
            
'/', '&', '|', '>', '<', ';', '"', '\'', '\\', "\n"
        
];

        
set_time_limit(2);

        function 
ping($ip) {
            global 
$blacklist;

            if(
strlen($ip) > 15) {
                return 
'IP toooooo longgggggggggg';
            } else {
                foreach(
$blacklist as $keyword) {
                    if(
strstr($ip, $keyword)) {
                        return 
"{$keyword} not allowed";
                    }
                }
                
$ret = [];
                
exec("ping -c 1 \"{$ip}\" 2>&1", $ret);
                return 
implode("\n", array_slice($ret, 0, 10));
            }
        }

        if(!empty(
$_GET['ip']))
            echo 
htmlentities(ping($_GET['ip']));
        else
            
highlight_file(__FILE__);
    
?></pre>
</body>
</html>