From a5c40093adcb507d8d5991568a36702fcc649cdb Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Wed, 19 Feb 2014 23:10:40 -0500 Subject: Use system calls instead of wrappers for getting interface names. --- config/suricata/suricata_alerts.php | 2 +- config/suricata/suricata_app_parsers.php | 2 +- config/suricata/suricata_barnyard.php | 2 +- config/suricata/suricata_check_for_rule_updates.php | 4 ++-- config/suricata/suricata_define_vars.php | 4 ++-- config/suricata/suricata_flow_stream.php | 2 +- config/suricata/suricata_interfaces.php | 14 +++++++------- config/suricata/suricata_interfaces_edit.php | 6 +++--- config/suricata/suricata_libhtp_policy_engine.php | 2 +- config/suricata/suricata_logs_browser.php | 4 ++-- config/suricata/suricata_os_policy_engine.php | 2 +- config/suricata/suricata_rules.php | 4 ++-- config/suricata/suricata_rulesets.php | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) (limited to 'config') diff --git a/config/suricata/suricata_alerts.php b/config/suricata/suricata_alerts.php index d21f7388..c36c0dd7 100644 --- a/config/suricata/suricata_alerts.php +++ b/config/suricata/suricata_alerts.php @@ -132,7 +132,7 @@ if (!is_array($config['installedpackages']['suricata']['rule'])) $config['installedpackages']['suricata']['rule'] = array(); $a_instance = &$config['installedpackages']['suricata']['rule']; $suricata_uuid = $a_instance[$instanceid]['uuid']; -$if_real = suricata_get_real_interface($a_instance[$instanceid]['interface']); +$if_real = get_real_interface($a_instance[$instanceid]['interface']); $suricatalogdir = SURICATALOGDIR; // Load up the arrays of force-enabled and force-disabled SIDs diff --git a/config/suricata/suricata_app_parsers.php b/config/suricata/suricata_app_parsers.php index bf6650cd..0be45c32 100644 --- a/config/suricata/suricata_app_parsers.php +++ b/config/suricata/suricata_app_parsers.php @@ -143,7 +143,7 @@ elseif ($_POST['Submit']) { } } -$if_friendly = suricata_get_friendly_interface($pconfig['interface']); +$if_friendly = convert_friendly_interface_to_friendly_descr($pconfig['interface']); $pgtitle = gettext("Suricata: Interface {$if_friendly} - Layer 7 Application Parsers"); include_once("head.inc"); ?> diff --git a/config/suricata/suricata_barnyard.php b/config/suricata/suricata_barnyard.php index a65c5402..f0bdbd17 100644 --- a/config/suricata/suricata_barnyard.php +++ b/config/suricata/suricata_barnyard.php @@ -162,7 +162,7 @@ if ($_POST) { } } -$if_friendly = suricata_get_friendly_interface($pconfig['interface']); +$if_friendly = convert_friendly_interface_to_friendly_descr($pconfig['interface']); $pgtitle = gettext("Suricata: Interface {$if_friendly} - Barnyard2 Settings"); include_once("head.inc"); diff --git a/config/suricata/suricata_check_for_rule_updates.php b/config/suricata/suricata_check_for_rule_updates.php index ec39c203..9aa14f6e 100644 --- a/config/suricata/suricata_check_for_rule_updates.php +++ b/config/suricata/suricata_check_for_rule_updates.php @@ -617,14 +617,14 @@ if ($snortdownload == 'on' || $emergingthreats == 'on' || $snortcommunityrules = /* Create configuration for each active Suricata interface */ foreach ($config['installedpackages']['suricata']['rule'] as $value) { - $if_real = suricata_get_real_interface($value['interface']); + $if_real = get_real_interface($value['interface']); // Make sure the interface subdirectory exists. We need to re-create // it during a pkg reinstall on the intial rules set download. if (!is_dir("{$suricatadir}suricata_{$value['uuid']}_{$if_real}")) safe_mkdir("{$suricatadir}suricata_{$value['uuid']}_{$if_real}"); if (!is_dir("{$suricatadir}suricata_{$value['uuid']}_{$if_real}/rules")) safe_mkdir("{$suricatadir}suricata_{$value['uuid']}_{$if_real}/rules"); - $tmp = "Updating rules configuration for: " . suricata_get_friendly_interface($value['interface']) . " ..."; + $tmp = "Updating rules configuration for: " . convert_friendly_interface_to_friendly_descr($value['interface']) . " ..."; if ($pkg_interface <> "console"){ update_status(gettext($tmp)); update_output_window(gettext("Please wait while Suricata interface files are being updated...")); diff --git a/config/suricata/suricata_define_vars.php b/config/suricata/suricata_define_vars.php index c9ec2bcd..b1cbfee9 100644 --- a/config/suricata/suricata_define_vars.php +++ b/config/suricata/suricata_define_vars.php @@ -77,7 +77,7 @@ ksort($suricata_ports); $pconfig = $a_nat[$id]; /* convert fake interfaces to real */ -$if_real = suricata_get_real_interface($pconfig['interface']); +$if_real = get_real_interface($pconfig['interface']); $suricata_uuid = $config['installedpackages']['suricata']['rule'][$id]['uuid']; if ($_POST) { @@ -131,7 +131,7 @@ if ($_POST) { } } -$if_friendly = suricata_get_friendly_interface($pconfig['interface']); +$if_friendly = convert_friendly_interface_to_friendly_descr($pconfig['interface']); $pgtitle = gettext("Suricata: Interface {$if_friendly} Variables - Servers and Ports"); include_once("head.inc"); diff --git a/config/suricata/suricata_flow_stream.php b/config/suricata/suricata_flow_stream.php index a994593c..3a677d3a 100644 --- a/config/suricata/suricata_flow_stream.php +++ b/config/suricata/suricata_flow_stream.php @@ -212,7 +212,7 @@ elseif ($_POST['Submit']) { } } -$if_friendly = suricata_get_friendly_interface($pconfig['interface']); +$if_friendly = convert_friendly_interface_to_friendly_descr($pconfig['interface']); $pgtitle = gettext("Suricata: Interface {$if_friendly} - Flow and Stream"); include_once("head.inc"); ?> diff --git a/config/suricata/suricata_interfaces.php b/config/suricata/suricata_interfaces.php index 47a3ba11..26ccada3 100644 --- a/config/suricata/suricata_interfaces.php +++ b/config/suricata/suricata_interfaces.php @@ -52,7 +52,7 @@ if (isset($_POST['del_x'])) { conf_mount_rw(); foreach ($_POST['rule'] as $rulei) { /* convert fake interfaces to real */ - $if_real = suricata_get_real_interface($a_nat[$rulei]['interface']); + $if_real = get_real_interface($a_nat[$rulei]['interface']); $suricata_uuid = $a_nat[$rulei]['uuid']; suricata_stop($a_nat[$rulei], $if_real); exec("/bin/rm -r {$suricatalogdir}suricata_{$if_real}{$suricata_uuid}"); @@ -109,8 +109,8 @@ if (isset($_POST['del_x'])) { /* start/stop Barnyard2 */ if ($_GET['act'] == 'bartoggle' && is_numeric($id)) { $suricatacfg = $config['installedpackages']['suricata']['rule'][$id]; - $if_real = suricata_get_real_interface($suricatacfg['interface']); - $if_friendly = suricata_get_friendly_interface($suricatacfg['interface']); + $if_real = get_real_interface($suricatacfg['interface']); + $if_friendly = convert_friendly_interface_to_friendly_descr($suricatacfg['interface']); if (suricata_is_running($suricatacfg['uuid'], $if_real, 'barnyard2') == 'no') { log_error("Toggle (barnyard starting) for {$if_friendly}({$suricatacfg['descr']})..."); @@ -129,8 +129,8 @@ if ($_GET['act'] == 'bartoggle' && is_numeric($id)) { /* start/stop Suricata */ if ($_GET['act'] == 'toggle' && is_numeric($id)) { $suricatacfg = $config['installedpackages']['suricata']['rule'][$id]; - $if_real = suricata_get_real_interface($suricatacfg['interface']); - $if_friendly = suricata_get_friendly_interface($suricatacfg['interface']); + $if_real = get_real_interface($suricatacfg['interface']); + $if_friendly = convert_friendly_interface_to_friendly_descr($suricatacfg['interface']); if (suricata_is_running($suricatacfg['uuid'], $if_real) == 'yes') { log_error("Toggle (suricata stopping) for {$if_friendly}({$suricatacfg['descr']})..."); @@ -234,8 +234,8 @@ if ($pfsense_stable == 'yes') /* convert fake interfaces to real and check if iface is up */ /* There has to be a smarter way to do this */ - $if_real = suricata_get_real_interface($natent['interface']); - $natend_friendly= suricata_get_friendly_interface($natent['interface']); + $if_real = get_real_interface($natent['interface']); + $natend_friendly= convert_friendly_interface_to_friendly_descr($natent['interface']); $suricata_uuid = $natent['uuid']; if (suricata_is_running($suricata_uuid, $if_real) == 'no'){ $iconfn = 'block'; diff --git a/config/suricata/suricata_interfaces_edit.php b/config/suricata/suricata_interfaces_edit.php index 4a805ea2..74344072 100644 --- a/config/suricata/suricata_interfaces_edit.php +++ b/config/suricata/suricata_interfaces_edit.php @@ -196,10 +196,10 @@ if ($_POST["Submit"]) { if ($_POST['alertsystemlog'] == "on") { $natent['alertsystemlog'] = 'on'; }else{ $natent['alertsystemlog'] = 'off'; } if ($_POST['configpassthru']) $natent['configpassthru'] = base64_encode($_POST['configpassthru']); else unset($natent['configpassthru']); - $if_real = suricata_get_real_interface($natent['interface']); + $if_real = get_real_interface($natent['interface']); if (isset($id) && $a_rule[$id]) { if ($natent['interface'] != $a_rule[$id]['interface']) { - $oif_real = suricata_get_real_interface($a_rule[$id]['interface']); + $oif_real = get_real_interface($a_rule[$id]['interface']); suricata_stop($a_rule[$id], $oif_real); exec("rm -r /var/log/suricata_{$oif_real}" . $a_rule[$id]['uuid']); exec("mv -f {$suricatadir}/suricata_" . $a_rule[$id]['uuid'] . "_{$oif_real} {$suricatadir}/suricata_" . $a_rule[$id]['uuid'] . "_{$if_real}"); @@ -302,7 +302,7 @@ if ($_POST["Submit"]) { $pconfig = $_POST; } -$if_friendly = suricata_get_friendly_interface($pconfig['interface']); +$if_friendly = convert_friendly_interface_to_friendly_descr($pconfig['interface']); $pgtitle = gettext("Suricata: Interface {$if_friendly} - Edit Settings"); include_once("head.inc"); ?> diff --git a/config/suricata/suricata_libhtp_policy_engine.php b/config/suricata/suricata_libhtp_policy_engine.php index 6b710e85..e7cf4135 100644 --- a/config/suricata/suricata_libhtp_policy_engine.php +++ b/config/suricata/suricata_libhtp_policy_engine.php @@ -156,7 +156,7 @@ if ($_POST['Submit']) { } } -$if_friendly = suricata_get_friendly_interface($config['installedpackages']['suricata']['rule'][$id]['interface']); +$if_friendly = convert_friendly_interface_to_friendly_descr($config['installedpackages']['suricata']['rule'][$id]['interface']); $pgtitle = gettext("Suricata: Interface {$if_friendly} HTTP Server Policy Engine"); include_once("head.inc"); diff --git a/config/suricata/suricata_logs_browser.php b/config/suricata/suricata_logs_browser.php index dfa56146..ab16a350 100644 --- a/config/suricata/suricata_logs_browser.php +++ b/config/suricata/suricata_logs_browser.php @@ -39,7 +39,7 @@ if (!is_array($config['installedpackages']['suricata']['rule'])) $config['installedpackages']['suricata']['rule'] = array(); $a_instance = $config['installedpackages']['suricata']['rule']; $suricata_uuid = $a_instance[$instanceid]['uuid']; -$if_real = suricata_get_real_interface($a_instance[$instanceid]['interface']); +$if_real = get_real_interface($a_instance[$instanceid]['interface']); // Construct a pointer to the instance's logging subdirectory $suricatalogdir = SURICATALOGDIR . "suricata_{$if_real}{$suricata_uuid}"; @@ -148,7 +148,7 @@ if ($input_errors) { $selected = ""; if ($id == $instanceid) $selected = "selected"; - echo "\n"; + echo "\n"; } ?>    diff --git a/config/suricata/suricata_os_policy_engine.php b/config/suricata/suricata_os_policy_engine.php index ed673006..61918e65 100644 --- a/config/suricata/suricata_os_policy_engine.php +++ b/config/suricata/suricata_os_policy_engine.php @@ -141,7 +141,7 @@ if ($_POST['Submit']) { } } -$if_friendly = suricata_get_friendly_interface($config['installedpackages']['suricata']['rule'][$id]['interface']); +$if_friendly = convert_friendly_interface_to_friendly_descr($config['installedpackages']['suricata']['rule'][$id]['interface']); $pgtitle = gettext("Suricata: Interface {$if_friendly} Operating System Policy Engine"); include_once("head.inc"); diff --git a/config/suricata/suricata_rules.php b/config/suricata/suricata_rules.php index f979d8b2..b848b4e8 100644 --- a/config/suricata/suricata_rules.php +++ b/config/suricata/suricata_rules.php @@ -102,7 +102,7 @@ function add_title_attribute($tag, $title) { } /* convert fake interfaces to real */ -$if_real = suricata_get_real_interface($pconfig['interface']); +$if_real = get_real_interface($pconfig['interface']); $suricata_uuid = $a_rule[$id]['uuid']; $suricatacfgdir = "{$suricatadir}suricata_{$suricata_uuid}_{$if_real}"; $snortdownload = $config['installedpackages']['suricata']['config'][0]['enable_vrt_rules']; @@ -409,7 +409,7 @@ else if ($_POST['cancel']) { require_once("guiconfig.inc"); include_once("head.inc"); -$if_friendly = suricata_get_friendly_interface($pconfig['interface']); +$if_friendly = convert_friendly_interface_to_friendly_descr($pconfig['interface']); $pgtitle = gettext("Suricata: Interface {$if_friendly} - Rules: {$currentruleset}"); ?> diff --git a/config/suricata/suricata_rulesets.php b/config/suricata/suricata_rulesets.php index 7ea34786..a1609d6c 100644 --- a/config/suricata/suricata_rulesets.php +++ b/config/suricata/suricata_rulesets.php @@ -57,7 +57,7 @@ if (isset($id) && $a_nat[$id]) { $pconfig['ips_policy'] = $a_nat[$id]['ips_policy']; } -$if_real = suricata_get_real_interface($pconfig['interface']); +$if_real = get_real_interface($pconfig['interface']); $suricata_uuid = $a_nat[$id]['uuid']; $snortdownload = $config['installedpackages']['suricata']['config'][0]['enable_vrt_rules'] == 'on' ? 'on' : 'off'; $emergingdownload = $config['installedpackages']['suricata']['config'][0]['enable_etopen_rules'] == 'on' ? 'on' : 'off'; @@ -225,7 +225,7 @@ if ($_POST['selectall']) { $enabled_rulesets_array = explode("||", $a_nat[$id]['rulesets']); -$if_friendly = suricata_get_friendly_interface($pconfig['interface']); +$if_friendly = convert_friendly_interface_to_friendly_descr($pconfig['interface']); $pgtitle = gettext("Suricata IDS: Interface {$if_friendly} - Categories"); include_once("head.inc"); ?> -- cgit v1.2.3