本文整理汇总了PHP中convert_real_interface_to_friendly_descr函数的典型用法代码示例。如果您正苦于以下问题:PHP convert_real_interface_to_friendly_descr函数的具体用法?PHP convert_real_interface_to_friendly_descr怎么用?PHP convert_real_interface_to_friendly_descr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convert_real_interface_to_friendly_descr函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processQueues
function processQueues($altqstats, $level, $parent_name)
{
global $g;
global $if_queue_list;
$parent_name = $parent_name . " queuerow" . $altqstats['name'] . $altqstats['interface'];
$prev_if = $altqstats['interface'];
foreach ($altqstats['queue'] as $q) {
$if_name = "";
foreach ($if_queue_list as $oif => $real_name) {
if ($oif == $q['interface']) {
$if_name = $real_name;
break;
}
}
if ($prev_if != $q['interface']) {
echo "<tr><td colspan=\"8\"><b>Interface " . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>\n";
$prev_if = $q['interface'];
}
?>
<tr class="<?php
echo $parent_name;
?>
">
<td class="<?php
echo $row_class;
?>
" style="padding-left:<?php
echo $level * 20;
?>
px;">
<?php
if (is_array($q['queue'])) {
echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a>";
}
if (strstr($q['name'], "root_")) {
echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$if_name}&action=show\">Root queue</a>";
} else {
echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$q['name']}&action=show\">" . htmlspecialchars($q['name']) . "</a>";
}
?>
</td>
<?php
$cpuUsage = 0;
print '<td>';
print '<div class="progress" style="height: 7px;width: 170px;">';
print ' <div class="progress-bar" role="progressbar" id="queue' . $q['name'] . $q['interface'] . 'width" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width: ' . $cpuUsage * 100 . '%;\\"></div>';
print ' </div>';
print '</td>';
print '<td><input readonly style="border:0;width:70px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'pps" id="queue' . $q['name'] . $q['interface'] . 'pps" value="(' . gettext("Loading") . ')" /></td>';
print '<td><input readonly style="border:0;width:80px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'bps" id="queue' . $q['name'] . $q['interface'] . 'bps" value="" /></td>';
print '<td><input readonly style="border:0;width:70px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'borrows" id="queue' . $q['name'] . $q['interface'] . 'borrows" value="" /></td>';
print '<td><input readonly style="border:0;width:70px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'suspends" id="queue' . $q['name'] . $q['interface'] . 'suspends" value="" /></td>';
print '<td><input readonly style="border:0;width:70px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'drops" id="queue' . $q['name'] . $q['interface'] . 'drops" value="" /></td>';
print '<td><input readonly style="border:0;width:70px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'length" id="queue' . $q['name'] . $q['interface'] . 'length" value="" /></td>';
?>
</tr>
<?php
if (is_array($q['queue'])) {
processQueues($q, $level + 1, $parent_name);
}
}
}
示例2: processQueues
function processQueues($altqstats, $level, $parent_name)
{
global $g;
global $if_queue_list;
$gray_value = 190 + $level * 10;
if ($gray_value > 250) {
$gray_value = 255;
}
$row_background = str_repeat(dechex($gray_value), 3);
$parent_name = $parent_name . " queuerow" . $altqstats['name'] . $altqstats['interface'];
$prev_if = $altqstats['interface'];
foreach ($altqstats['queue'] as $q) {
$if_name = "";
foreach ($if_queue_list as $oif => $real_name) {
if ($oif == $q['interface']) {
$if_name = $real_name;
break;
}
}
if ($prev_if != $q['interface']) {
echo "<tr><td colspan=\"8\" style=\"padding: 2px;\"><b>Interface " . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>";
$prev_if = $q['interface'];
}
?>
<tr class="<?php
echo $parent_name;
?>
">
<td bgcolor="#<?php
echo $row_background;
?>
" style="padding-left: <?php
echo $level * 20;
?>
px;">
<font color="#000000">
<?php
if (strstr($q['name'], "root_")) {
echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$if_name}&action=show\">Root queue</a>";
} else {
echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$q['name']}&action=show\">" . htmlspecialchars($q['name']) . "</a>";
}
?>
</font>
</td>
<?php
$cpuUsage = 0;
echo "<td class=\"nowrap\" width=\"1%\" bgcolor=\"#{$row_background}\">";
echo "<img src='./themes/" . $g['theme'] . "/images/misc/bar_left.gif' height='10' width='4' border='0' align='middle' alt='' />";
echo "<img src='./themes/" . $g['theme'] . "/images/misc/bar_blue.gif' height='10' name='queue{$q['name']}{$q['interface']}widtha' id='queue{$q['name']}{$q['interface']}widtha' width='" . $cpuUsage . "' border='0' align='middle' alt='" . htmlspecialchars($q['name']) . "' />";
echo "<img src='./themes/" . $g['theme'] . "/images/misc/bar_gray.gif' height='10' name='queue{$q['name']}{$q['interface']}widthb' id='queue{$q['name']}{$q['interface']}widthb' width='" . (150 - $cpuUsage) . "' border='0' align='middle' alt='" . htmlspecialchars($q['name']) . "' />";
echo "<img src='./themes/" . $g['theme'] . "/images/misc/bar_right.gif' height='10' width='5' border='0' align='middle' alt='' /> ";
if (is_array($q['queue'])) {
echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a> ";
}
echo " </td>";
echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}pps' id='queue{$q['name']}{$q['interface']}pps' value='(" . gettext("Loading") . ")' align='left' /></td>";
echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}bps' id='queue{$q['name']}{$q['interface']}bps' value='' align='right' /></td>";
echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}borrows' id='queue{$q['name']}{$q['interface']}borrows' value='' align='right' /></td>";
echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}suspends' id='queue{$q['name']}{$q['interface']}suspends' value='' align='right' /></td>";
echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}drops' id='queue{$q['name']}{$q['interface']}drops' value='' align='right' /></td>";
echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}length' id='queue{$q['name']}{$q['interface']}length' value='' align='right' /></td>";
?>
</tr>
<?php
if (is_array($q['queue'])) {
processQueues($q, $level + 1, $parent_name);
}
}
}
示例3: isset
<?php
$row = 0;
/* get our states */
$grepline = isset($_POST['filter']) ? "| /usr/bin/egrep " . escapeshellarg(htmlspecialchars($_POST['filter'])) : "";
$fd = popen("/sbin/pfctl -s state {$grepline}", "r");
while ($line = chop(fgets($fd))) {
if ($row >= 10000) {
break;
}
$line_split = preg_split("/\\s+/", $line);
$iface = array_shift($line_split);
$proto = array_shift($line_split);
$state = array_pop($line_split);
$info = implode(" ", $line_split);
// We may want to make this optional, with a large state table, this could get to be expensive.
$iface = convert_real_interface_to_friendly_descr($iface);
/* break up info and extract $srcip and $dstip */
$ends = preg_split("/\\<?-\\>?/", $info);
$parts = explode(":", $ends[0]);
$srcip = trim($parts[0]);
$parts = explode(":", $ends[count($ends) - 1]);
$dstip = trim($parts[0]);
?>
<tr>
<td><?php
echo $iface;
?>
</td>
<td><?php
echo $proto;
?>
示例4: processQueues
function processQueues($altqstats, $level, $parent_name)
{
global $g;
global $if_queue_list;
$gray_value = 190 + $level * 10;
if ($gray_value > 250) {
$gray_value = 255;
}
$row_background = str_repeat(dechex($gray_value), 3);
$parent_name = $parent_name . " queuerow" . $altqstats['name'] . $altqstats['interface'];
$prev_if = $altqstats['interface'];
foreach ($altqstats['queue'] as $q) {
$if_name = "";
foreach ($if_queue_list as $oif => $real_name) {
if ($oif == $q['interface']) {
$if_name = $real_name;
break;
}
}
if ($prev_if != $q['interface']) {
echo "<tr><td><b>Interface " . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>";
$prev_if = $q['interface'];
}
?>
<tr class="<?php
echo $parent_name;
?>
">
<td bgcolor="#<?php
echo $row_background;
?>
" style="padding-left: <?php
echo $level * 20;
?>
px;">
<font color="#000000">
<?php
if (is_array($q['queue'])) {
echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a> ";
}
if (strstr($q['name'], "root_")) {
echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$if_name}&action=show\">Root queue</a>";
} else {
echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$q['name']}&action=show\">" . htmlspecialchars($q['name']) . "</a>";
}
?>
</font>
</td>
<?php
$cpuUsage = 0;
echo "<td bgcolor=\"#{$row_background}\">";
echo "<div class='progress' style='height: 7px;width: 170px;'>\n\t\t\t\t<div class='progress-bar' role='progressbar' name='queue{$q['name']}{$q['interface']}width' id='queue{$q['name']}{$q['interface']}width' aria-valuenow='70' aria-valuemin='0' aria-valuemax='100' style='width: " . $cpuUsage * 100 . "%;'></div>\n\t\t\t </div>";
echo " </td>";
echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}pps' id='queue{$q['name']}{$q['interface']}pps' value='(" . gettext("Loading") . ")' align='left' /></td>";
echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}bps' id='queue{$q['name']}{$q['interface']}bps' value='' align='right' /></td>";
echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}borrows' id='queue{$q['name']}{$q['interface']}borrows' value='' align='right' /></td>";
echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}suspends' id='queue{$q['name']}{$q['interface']}suspends' value='' align='right' /></td>";
echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}drops' id='queue{$q['name']}{$q['interface']}drops' value='' align='right' /></td>";
echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}length' id='queue{$q['name']}{$q['interface']}length' value='' align='right' /></td>";
?>
</tr>
<?php
if (is_array($q['queue'])) {
processQueues($q, $level + 1, $parent_name);
}
}
}
示例5: filter_generate_gateways
/* mutually exclusive settings - if user wants advanced NAT, we don't generate automatic rules */
if ($_POST['mode'] == "advanced" && ($mode == "automatic" || $mode == "hybrid")) {
/*
* user has enabled advanced outbound NAT and doesn't have rules
* lets automatically create entries
* for all of the interfaces to make life easier on the pip-o-chap
*/
if (empty($GatewaysList)) {
filter_generate_gateways();
}
$tonathosts = filter_nat_rules_automatic_tonathosts(true);
$automatic_rules = filter_nat_rules_outbound_automatic("");
foreach ($tonathosts as $tonathost) {
foreach ($automatic_rules as $natent) {
$natent['source']['network'] = $tonathost['subnet'];
$natent['descr'] .= sprintf(gettext(' - %1$s to %2$s'), $tonathost['descr'], convert_real_interface_to_friendly_descr($natent['interface']));
$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
/* Try to detect already auto created rules and avoid duplicate them */
$found = false;
foreach ($a_out as $rule) {
if ($rule['interface'] == $natent['interface'] && $rule['source']['network'] == $natent['source']['network'] && $rule['dstport'] == $natent['dstport'] && $rule['target'] == $natent['target'] && $rule['descr'] == $natent['descr']) {
$found = true;
break;
}
}
if ($found === false) {
$a_out[] = $natent;
}
}
}
$savemsg = gettext("Default rules for each interface have been created.");
示例6: processQueues
function processQueues($altqstats, $level, $parent_name)
{
global $g;
global $if_queue_list;
$gray_value = 190 + $level * 10;
if ($gray_value > 250) {
$gray_value = 255;
}
$row_background = str_repeat(dechex($gray_value), 3);
$parent_name = $parent_name . " queuerow" . $altqstats['name'] . $altqstats['interface'];
$prev_if = $altqstats['interface'];
foreach ($altqstats['queue'] as $q) {
$if_name = "";
foreach ($if_queue_list as $oif => $real_name) {
if ($oif == $q['interface']) {
$if_name = $real_name;
break;
}
}
if ($prev_if != $q['interface']) {
echo "<tr><td colspan=\"8\"><b>Interface " . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>\n";
$prev_if = $q['interface'];
}
?>
<tr class="<?php
echo $parent_name;
?>
">
<td style="background-color:#<?php
echo $row_background;
?>
;padding-left:<?php
echo $level * 20;
?>
px;">
<?php
if (is_array($q['queue'])) {
echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a>";
}
if (strstr($q['name'], "root_")) {
echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$if_name}&action=show\">Root queue</a>";
} else {
echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$q['name']}&action=show\">" . htmlspecialchars($q['name']) . "</a>";
}
?>
</td>
<?php
$cpuUsage = 0;
echo "<td style=\"background-color:#{$row_background}\" >";
echo "<div class=\"progress\" style=\"height: 7px;width: 170px;\">\n\t\t\t\t<div class=\"progress-bar\" role=\"progressbar\" id=\"queue{$q['name']}{$q['interface']}width\" aria-valuenow=\"70\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: " . $cpuUsage * 100 . "%;\"></div>\n\t\t\t </div>";
echo "</td>";
echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}pps\" id=\"queue{$q['name']}{$q['interface']}pps\" value=\"(" . gettext("Loading") . ")\" /></td>";
echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:80px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}bps\" id=\"queue{$q['name']}{$q['interface']}bps\" value=\"\" /></td>";
echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}borrows\" id=\"queue{$q['name']}{$q['interface']}borrows\" value=\"\" /></td>";
echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}suspends\" id=\"queue{$q['name']}{$q['interface']}suspends\" value=\"\" /></td>";
echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}drops\" id=\"queue{$q['name']}{$q['interface']}drops\" value=\"\" /></td>";
echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}length\" id=\"queue{$q['name']}{$q['interface']}length\" value=\"\" /></td>";
?>
</tr>
<?php
if (is_array($q['queue'])) {
processQueues($q, $level + 1, $parent_name);
}
}
}
示例7: convert_real_interface_to_friendly_descr
<?php
require_once "guiconfig.inc";
global $config;
include "head.inc";
include "fbegin.inc";
$aaaa = $config['installedpackages']['vnstat2']['config'][0]['vnstat_interface'];
$cccc = convert_real_interface_to_friendly_descr($aaaa);
$pgtitle = gettext("Vnstati info for {$cccc} ({$aaaa})");
echo "<a href={$myurl}/pkg_edit.php?xml=vnstati.xml&id=0>Go Back</a><br />";
echo "<center><p class=\"pgtitle\">{$pgtitle}</p>";
?>
<center><img src="vnstat2_img.php?image=newpicture1.png" style="border:1px solid black; center;"><br />
<center><img src="vnstat2_img.php?image=newpicture2.png" style="border:1px solid black; center;"><br />
<center><img src="vnstat2_img.php?image=newpicture3.png" style="border:1px solid black; center;"><br />
<center><img src="vnstat2_img.php?image=newpicture4.png" style="border:1px solid black; center;"><br />
<?php
include "fend.inc";
?>
示例8: conv_log_filter_lite
function conv_log_filter_lite($logfile, $nentries, $tail, $pfbdenycnt, $pfbpermitcnt, $pfbmatchcnt)
{
global $pfb, $rule_list, $filterfieldsarray;
$fields_array = array();
$logarr = "";
$denycnt = 0;
$permitcnt = 0;
$matchcnt = 0;
if (file_exists($logfile)) {
exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . " | grep -v \"CLOG\" | grep -v \"\" | /usr/bin/grep 'filterlog:' | /usr/bin/tail -r -n {$tail}", $logarr);
} else {
return;
}
if (!empty($logarr) && !empty($rule_list['id'])) {
foreach ($logarr as $logent) {
$pfbalert = array();
$log_split = "";
if (!preg_match("/(.*)\\s(.*)\\sfilterlog:\\s(.*)\$/", $logent, $log_split)) {
continue;
}
list($all, $pfbalert[99], $host, $rule) = $log_split;
$rule_data = explode(",", $rule);
$pfbalert[0] = $rule_data[0];
// Rulenum
// Skip Alert if Rule is not a pfBNG Alert
if (!in_array($pfbalert[0], $rule_list['id'])) {
continue;
}
$pfbalert[1] = $rule_data[4];
// Realint
$pfbalert[3] = $rule_data[6];
// Act
$pfbalert[4] = $rule_data[8];
// Version
if ($pfbalert[4] == "4") {
$pfbalert[5] = $rule_data[15];
// Protocol ID
$pfbalert[6] = $rule_data[16];
// Protocol
$pfbalert[7] = $rule_data[18];
// SRC IP
$pfbalert[8] = $rule_data[19];
// DST IP
$pfbalert[9] = $rule_data[20];
// SRC Port
$pfbalert[10] = $rule_data[21];
// DST Port
$pfbalert[11] = $rule_data[23];
// TCP Flags
} else {
$pfbalert[5] = $rule_data[13];
// Protocol ID
$pfbalert[6] = $rule_data[12];
// Protocol
$pfbalert[7] = $rule_data[15];
// SRC IP
$pfbalert[8] = $rule_data[16];
// DST IP
$pfbalert[9] = $rule_data[17];
// SRC Port
$pfbalert[10] = $rule_data[18];
// DST Port
$pfbalert[11] = $rule_data[20];
// TCP Flags
}
if ($pfbalert[5] == "6" || $pfbalert[5] == "17") {
// skip
} else {
$pfbalert[9] = "";
$pfbalert[10] = "";
$pfbalert[11] = "";
}
// Skip Repeated Alerts
if ($pfbalert[1] . $pfbalert[3] . $pfbalert[7] . $pfbalert[8] . $pfbalert[10] == $previous_alert) {
continue;
}
$pfbalert[2] = convert_real_interface_to_friendly_descr($rule_data[4]);
// Friendly Interface Name
$pfbalert[6] = str_replace("TCP", "TCP-", strtoupper($pfbalert[6]), $pfbalert[6]) . $pfbalert[11];
// Protocol Flags
// If Alerts Filtering is selected, process Filters as required.
if ($pfb['filterlogentries'] && !pfb_match_filter_field($pfbalert, $filterfieldsarray)) {
continue;
}
if ($pfbalert[3] == "block") {
if ($denycnt < $pfbdenycnt) {
$fields_array['Deny'][] = $pfbalert;
$denycnt++;
}
} elseif ($pfbalert[3] == "pass") {
if ($permitcnt < $pfbpermitcnt) {
$fields_array['Permit'][] = $pfbalert;
$permitcnt++;
}
} elseif ($pfbalert[3] == "unkn(%u)" || $pfbalert[3] == "unkn(11)") {
if ($matchcnt < $pfbmatchcnt) {
$fields_array['Match'][] = $pfbalert;
$matchcnt++;
}
}
//.........这里部分代码省略.........
示例9: get_ip
$dstip = get_ip($res[$i]['dst']);
if ($res[$i]['src-orig']) {
$info .= " (" . $res[$i]['src-orig'] . ")";
}
$info .= " -> ";
$info .= $res[$i]['dst'];
if ($res[$i]['dst-orig']) {
$info .= " (" . $res[$i]['dst-orig'] . ")";
$killdstip = get_ip($res[$i]['dst-orig']);
} else {
$killdstip = $dstip;
}
?>
<tr>
<td><?php
echo convert_real_interface_to_friendly_descr($res[$i]['if']);
?>
</td>
<td><?php
echo $res[$i]['proto'];
?>
</td>
<td><?php
echo $info;
?>
</td>
<td><?php
echo $res[$i]['state'];
?>
</td>
<td><?php
示例10: conv_log_filter_lite
function conv_log_filter_lite($logfile, $nentries, $tail, $pfbdenycnt, $pfbpermitcnt, $pfbmatchcnt)
{
global $pfb, $rule_list, $filterfieldsarray;
$fields_array = array();
$denycnt = $permitcnt = $matchcnt = 0;
$logarr = '';
if (file_exists($logfile)) {
// Collect filter.log entries
exec("/usr/local/sbin/clog {$logfile} | {$pfb['grep']} -v '\"CLOG\"\\|\"\"' | {$pfb['grep']} 'filterlog:' | /usr/bin/tail -r -n {$tail}", $logarr);
} else {
return;
}
if (!empty($logarr) && !empty($rule_list['id'])) {
foreach ($logarr as $logent) {
$pfbalert = array();
$flog = explode(' ', $logent);
// Remove 'extra space' from single date entry (days 1-9)
if (empty($flog[1])) {
array_splice($flog, 1, 1);
}
$rule_data = explode(',', $flog[5]);
// Skip alert if rule is not a pfBNG alert
if (!in_array($rule_data[3], $rule_list['id'])) {
continue;
}
$pfbalert[0] = $rule_data[3];
// Rulenum
$pfbalert[1] = $rule_data[4];
// Realint
$pfbalert[3] = $rule_data[6];
// Act
$pfbalert[4] = $rule_data[8];
// Version
if ($pfbalert[4] == 4) {
$pfbalert[5] = $rule_data[15];
// Protocol ID
$pfbalert[6] = $rule_data[16];
// Protocol
$pfbalert[7] = $rule_data[18];
// SRC IP
$pfbalert[8] = $rule_data[19];
// DST IP
$pfbalert[9] = $rule_data[20];
// SRC Port
$pfbalert[10] = $rule_data[21];
// DST Port
$pfbalert[11] = $rule_data[23];
// TCP Flags
} else {
$pfbalert[5] = $rule_data[13];
// Protocol ID
$pfbalert[6] = $rule_data[12];
// Protocol
$pfbalert[7] = $rule_data[15];
// SRC IP
$pfbalert[8] = $rule_data[16];
// DST IP
$pfbalert[9] = $rule_data[17];
// SRC Port
$pfbalert[10] = $rule_data[18];
// DST Port
$pfbalert[11] = $rule_data[20];
// TCP Flags
}
if ($pfbalert[5] == 6 || $pfbalert[5] == 17) {
// skip
} else {
$pfbalert[9] = $pfbalert[10] = $pfbalert[11] = '';
}
$pfbalert[99] = "{$flog[0]} {$flog[1]} {$flog[2]}";
// Date/Timestamp
// Skip repeated alerts
if ("{$pfbalert[1]}{$pfbalert[3]}{$pfbalert[7]}{$pfbalert[8]}{$pfbalert[10]}" == $previous_alert) {
continue;
}
$pfbalert[2] = convert_real_interface_to_friendly_descr($rule_data[4]);
// Friendly Interface Name
$pfbalert[6] = str_replace('TCP', 'TCP-', strtoupper($pfbalert[6]), $pfbalert[6]) . $pfbalert[11];
// Protocol Flags
// If alerts filtering is selected, process filters as required.
if ($pfb['filterlogentries'] && !pfb_match_filter_field($pfbalert, $filterfieldsarray)) {
continue;
}
if ($pfbalert[3] == 'block') {
if ($denycnt < $pfbdenycnt) {
$fields_array['Deny'][] = $pfbalert;
$denycnt++;
}
} elseif ($pfbalert[3] == 'pass') {
if ($permitcnt < $pfbpermitcnt) {
$fields_array['Permit'][] = $pfbalert;
$permitcnt++;
}
} elseif ($pfbalert[3] == 'unkn(%u)') {
if ($matchcnt < $pfbmatchcnt) {
$fields_array['Match'][] = $pfbalert;
$matchcnt++;
}
}
// Exit function if sufficinet matches found.
//.........这里部分代码省略.........
示例11: filter_generate_gateways
/*
* user has enabled advanced outbound NAT and doesn't have rules
* lets automatically create entries
* for all of the interfaces to make life easier on the pip-o-chap
*/
if (empty($GatewaysList)) {
filter_generate_gateways();
}
/* XXX cranky low-level call, please refactor */
$FilterIflist = filter_generate_optcfg_array();
$tonathosts = filter_nat_rules_automatic_tonathosts($FilterIflist, true);
$automatic_rules = filter_nat_rules_outbound_automatic($FilterIflist, '');
foreach ($tonathosts as $tonathost) {
foreach ($automatic_rules as $natent) {
$natent['source']['network'] = $tonathost['subnet'];
$natent['descr'] .= ' - ' . $tonathost['descr'] . ' -> ' . convert_real_interface_to_friendly_descr($natent['interface']);
$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
/* Try to detect already auto created rules and avoid duplicate them */
$found = false;
foreach ($a_out as $rule) {
// initialize optional values
if (!isset($rule['dstport'])) {
$rule['dstport'] = "";
}
if (!isset($natent['dstport'])) {
$natent['dstport'] = "";
}
//
if ($rule['interface'] == $natent['interface'] && $rule['source']['network'] == $natent['source']['network'] && $rule['dstport'] == $natent['dstport'] && $rule['target'] == $natent['target'] && $rule['descr'] == $natent['descr']) {
$found = true;
break;
示例12: gettext
</th>
<th><?php
echo gettext("Description");
?>
</th>
<th><?php
echo gettext("Actions");
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($a_gres as $i => $gre) {
if (substr($gre['if'], 0, 4) == "_vip") {
$if = convert_real_interface_to_friendly_descr(get_real_interface($gre['if']));
} else {
$if = $gre['if'];
}
?>
<tr>
<td>
<?php
echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($if));
?>
</td>
<td>
<?php
echo htmlspecialchars($gre['remote-addr']);
?>
</td>
示例13: gettext
<td class="listhdr" colspan="6"><?php
echo gettext("Statistics");
?>
</td>
</tr>
<?php
$i = 0;
foreach ($altqstats['queue'] as $q) {
if (strstr($q['name'], "root_")) {
continue;
}
?>
<tr><td bgcolor="#DDDDDD" colspan="7"> </td></tr>
<tr valign="top">
<td bgcolor="#DDDDDD">
<font color="#000000"> <?echo "<a href=\"firewall_shaper.php?id={$q['name']}\">" . htmlspecialchars($q['name'] . " on " . convert_real_interface_to_friendly_descr($q['interface'])) . "</a>";?> </td>
<td bgcolor="#DDDDDD">
<nobr>
<?php
$cpuUsage = 0;
echo "<img src='./themes/" . $g['theme'] . "/images/misc/bar_left.gif' height='10' width='4' border='0' align='absmiddle'>";
echo "<img src='./themes/" . $g['theme'] . "/images/misc/bar_blue.gif' height='10' name='queue{$q['name']}{$q['interface']}widtha' id='queue{$q['name']}{$q['interface']}widtha' width='" . $cpuUsage . "' border='0' align='absmiddle'>";
echo "<img src='./themes/" . $g['theme'] . "/images/misc/bar_gray.gif' height='10' name='queue{$q['name']}{$q['interface']}widthb' id='queue{$q['name']}{$q['interface']}widthb' width='" . (400 - $cpuUsage) . "' border='0' align='absmiddle'>";
echo "<nobr><img src='./themes/" . $g['theme'] . "/images/misc/bar_right.gif' height='10' width='5' border='0' align='absmiddle'> ";
echo "</nobr></td></tr>";
echo "<tr><td bgcolor=\"#DDDDDD\" colspan=\"7\">";
echo " ";
echo "<nobr>";
echo "<input style='border: 0px solid white; background-color:#DDDDDD; color:#000000;' size='10' name='queue{$q['name']}{$q['interface']}pps' id='queue{$q['name']}{$q['interface']}pps' value='(" . gettext("Loading") . ")' align='left'>";
echo "<input style='border: 0px solid white; background-color:#DDDDDD; color:#000000;' size='10' name='queue{$q['name']}{$q['interface']}bps' id='queue{$q['name']}{$q['interface']}bps' value='' align='right'>";
echo "<input style='border: 0px solid white; background-color:#DDDDDD; color:#000000;' size='10' name='queue{$q['name']}{$q['interface']}borrows' id='queue{$q['name']}{$q['interface']}borrows' value='' align='right'>";
示例14: get_ip
$dstip = get_ip($res[$i]['dst']);
if ($res[$i]['src-orig']) {
$info .= " (" . $res[$i]['src-orig'] . ")";
}
$info .= " -> ";
$info .= $res[$i]['dst'];
if ($res[$i]['dst-orig']) {
$info .= " (" . $res[$i]['dst-orig'] . ")";
$killdstip = get_ip($res[$i]['dst-orig']);
} else {
$killdstip = $dstip;
}
?>
<tr>
<td><?= convert_real_interface_to_friendly_descr($res[$i]['if']) ?></td>
<td><?= $res[$i]['proto'] ?></td>
<td><?= $info ?></td>
<td><?= $res[$i]['state'] ?></td>
<td><?= format_number($res[$i]['packets in']) ?> /
<?= format_number($res[$i]['packets out']) ?></td>
<td><?= format_bytes($res[$i]['bytes in']) ?> /
<?= format_bytes($res[$i]['bytes out']) ?></td>
<td>
<a class="btn fa fa-trash" data-entry="<?=$srcip?>|<?=$killdstip?>"
title="<?=sprintf(gettext('Remove all state entries from %1$s to %2$s'), $srcip, $killdstip);?>"></a>
</td>
</tr>
<?
}