<?php
# main
if ( ! isset( $_GET['check'] ) ) {
echo "ERROR: NO IP-GIVEN. ### USAGE: SET ?check=IPv4";
}
$_GET['check'] = ip2dec
( trim( $_GET['check'] ) );
if ( false === $_GET['check'] ) {
echo "<pre>ERROR: Not a IPv4-Address: " , $ipOut , "</pre></body></html>";
}
$ips = explode( "\n" , `
/opt
/fwlist`
);
foreach( $ips as $ip ) {
if( $ip ) {
if( false === strpos( $ip , '/' ) ) {
$ip = $ip . '/32';
$firstIP = ip2dec( $ip );
$lastIP = $firstIP;
$netMask = 32;
} else {
$firstIP = ip2dec( $firstIP );
$lastIP = $firstIP + pow( 2 , 32-$netMask );
}
if( $_GET['check'] >= $firstIP && $_GET['check'] <= $lastIP ) {
header( 'Content-Type: text/plain' );
echo 'BLOCKED';
}
}
}
header( 'Content-Type: text/plain' );
echo 'NOT BLOCKED';
function ip2dec( $ip ) {
}