mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
reporting: a bit of style in previous
* Init and use $cmd_args before going into the switch * Use exec_safe() where we return dynamic output * PSR 12 style
This commit is contained in:
parent
2a7a3a97e0
commit
c56d332f07
@ -87,22 +87,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$real_interface = get_real_interface($pconfig['if']);
|
||||
$intsubnet = find_interface_network($real_interface);
|
||||
if (is_subnetv4($intsubnet)) {
|
||||
$cmd_args = $pconfig['sort'] == 'out' ? ' -T' : ' -R';
|
||||
|
||||
switch ( $pconfig['filter'] ) {
|
||||
switch ($pconfig['filter']) {
|
||||
case 'local':
|
||||
$cmd_args = " -c " . $intsubnet . " ";
|
||||
$cmd_args .= exec_safe(' -c %s', $intsubnet);
|
||||
break;
|
||||
|
||||
case 'private':
|
||||
$cmd_args = " -c 172.16.0.0/12 -c 192.168.0.0/16 -c 10.0.0.0/8 ";
|
||||
$cmd_args .= ' -c 172.16.0.0/12 -c 192.168.0.0/16 -c 10.0.0.0/8';
|
||||
break;
|
||||
|
||||
default:
|
||||
$cmd_args = " -lc 0.0.0.0/0 ";
|
||||
$cmd_args .= ' -lc 0.0.0.0/0';
|
||||
break;
|
||||
}
|
||||
|
||||
$cmd_args .= $pconfig['sort'] == "out" ? " -T " : " -R ";
|
||||
$cmd_action = "/usr/local/bin/rate -v -i {$real_interface} -nlq 1 -Aba 20 {$cmd_args} | tr \"|\" \" \" | awk '{ printf \"%s:%s:%s:%s:%s\\n\", $1, $2, $4, $6, $8 }'";
|
||||
exec($cmd_action, $listedIPs);
|
||||
for ($idx = 2 ; $idx < count($listedIPs) ; ++$idx) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user