home *** CD-ROM | disk | FTP | other *** search
- ////////////////////////////////////////////////////////////////////////////////////////////
- //
- // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
- //
- // NAME: Ruletxt.js
- //
- // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
- //
- ////////////////////////////////////////////////////////////////////////////////////////////
-
- function getComputerListStr(rule)
- {
-
- var returnstring = StrID("computer_any");
-
- var remoteaddresses = rule.RemoteIPs;
-
- if(null != remoteaddresses)
- {
- if(0 != remoteaddresses.ItemCount)
- returnstring = StrID("computer_specific");
- }
-
- return returnstring;
- }
-
- function getAdapterText(rule)
- {
-
- var returnstring = StrID("adapter_any");
-
- var adapters = rule.LocalIPs;
-
- if(null != adapters)
- {
- if(0 != adapters.ItemCount)
- returnstring = StrID("adapter_specific");
- }
-
- return returnstring;
- }
-
- function getLoggingStr(rule)
- {
- returnstring = "";
-
- val = rule.Logging;
-
- if(val & 32)
- returnstring += StrID("logging_atracker");
- if(val & 1)
- {
- if ("" != returnstring)
- returnstring += ", ";
- returnstring += StrID("logging_log");
- }
- if(val & 18)
- {
- if ("" != returnstring)
- returnstring += ", ";
- returnstring += StrID("logging_alert");
- }
-
- if("" != returnstring)
- returnstring = StrID("tracking") + returnstring;
- return returnstring;
- }
-
- function getProtocolString(protocol)
- {
- var strProt = "";
-
- switch(protocol)
- {
- case 0:
- strProt = StrID("TCPANDUDP_Protocol");
- break;
-
- case 1:
- strProt = StrID("ICMP_Protocol");
- break;
-
- case 6:
- strProt = StrID("TCP_Protocol");
- break;
-
- case 17:
- strProt = StrID("UDP_Protocol");
- break;
- }
-
- return strProt;
- }
-
- function getLocationsText(arrayLocations)
- {
- var strLocations = StrID("LocationsColon");
- var nLocations = arrayLocations.length;
- for (var i=0; i<nLocations; i++)
- {
- if (i > 0) strLocations += ", ";
- strLocations += arrayLocations[i];
- }
- return strLocations;
- }
-
- function developRuleString(rule, arrayLocations)
- {
- var sep = StrID("string_separation");
-
- return ruleString(rule, arrayLocations, sep);
- }
-
- function ruleString(rule, arrayLocations, sep)
- {
-
- var Action = "";
- var Direction = "";
- var Services = "";
- var ComputerType = "";
- var Adapter = "";
- var returnstring= "";
- var sLocations = "";
-
- switch (rule.Action)
- {
- case 2: // Permit
- Action = "<span class=nisPermitTx>"+StrID("permit")+"</span>";
- break;
- case 1: // Block
- Action = "<span class=nisBlockTx>"+StrID("block")+"</span>";
- break;
- case 4: // Monitor
- Action = "<span class=nisMonitorTx>"+StrID("monitor")+"</span>";
- break;
- default:
- Action = "";
- break;
- }
-
- switch (rule.Direction)
- {
- case 2: // In
- Direction = StrID("direction_inbound_localhost_any");
- break;
- case 1: // Out
- Direction = StrID("direction_outbound_localhost_any");
- break;
- case 3: // In-Out
- Direction = StrID("direction_either_localhost_any");
- break;
- default:
- Direction = "";
- break;
- }
-
- Services = getGenericServicesStr(rule);
- ComputerType = getComputerListStr(rule);
- Adapter = getAdapterText(rule);
-
- var Protocol = StrID("protocol") + getProtocolString(rule.Protocol);
- var logging = getLoggingStr(rule);
- if (logging != "")
- logging = sep + logging;
-
- if (typeof(arrayLocations) != "undefined")
- {
- sLocations = getLocationsText(arrayLocations);
- if (sLocations != "")
- sLocations = sep + sLocations;
- }
-
- returnstring = Action + sep +
- Direction + sep +
- ComputerType + sep +
- Adapter + sep +
- Services + sep +
- Protocol + // no sep becuase logging can be empty
- logging + // no sep becuase sLocations can be empty
- sLocations;
-
- return returnstring;
-
- }
-