- shell_exec: documentation ( source)
- var_dump: documentation ( source)
- file_exists: documentation ( source)
<?php
function match ($ip){
$file_check = '/var/log/iptables.log';
if (file_exists($file_check))
{
#$out=shell_exec('awk -v ip="$ip" \'$10 == ip\' /var/log/iptables.log');
#$out=shell_exec("grep 'SRC=10.1.1.103' /var/log/iptables.log || echo \$?");
#var_dump($out);
$out = shell_exec("(grep 'SRC=10.1.1.103' /var/log/iptables.log 2>&1 || echo \$?) && echo \$?"); var_dump($out);
}
else
{
echo "naah";
exit;
}
}
match($argv[1]);