|
|
@@ -1,5 +1,5 @@ |
|
|
|
// snfCFGmgr.cpp |
|
|
|
// Copyright (C) 2006 - 2009 Arm Research Labs, LLC |
|
|
|
// Copyright (C) 2006 - 2020 Arm Research Labs, LLC |
|
|
|
// See www.armresearch.com for the copyright terms. |
|
|
|
// |
|
|
|
|
|
|
@@ -8,6 +8,48 @@ |
|
|
|
#include "snfCFGmgr.hpp" |
|
|
|
#include <iostream> |
|
|
|
|
|
|
|
namespace cd = codedweller; |
|
|
|
|
|
|
|
//// IntegerSetHandler ///////////////////////////////////////////////////////// |
|
|
|
|
|
|
|
bool IntegerSetHandler::isListed(int x) { // How to check if an int is listed. |
|
|
|
return (IntegerSet.end() != IntegerSet.find(x)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//// snfCFGmgr ///////////////////////////////////////////////////////////////// |
|
|
|
|
|
|
|
snfCFGmgr::snfCFGmgr() : // We construct a CFGmgr this way... |
|
|
|
AisActive(false), // So that A is active after 1st load() |
|
|
|
InitFileName(""), // and all of the Init strings are |
|
|
|
InitLicenseId(""), // empty. |
|
|
|
InitAuthentication(""), |
|
|
|
ConfigurationPath("") { |
|
|
|
} |
|
|
|
|
|
|
|
void snfCFGmgr::swapCFGData() { // This swaps the active dataset. |
|
|
|
AisActive = (AisActive)?false:true; |
|
|
|
} |
|
|
|
|
|
|
|
snfCFGData& snfCFGmgr::ActiveData() { // This returns the active dataset. |
|
|
|
return (AisActive) ? A : B; |
|
|
|
} |
|
|
|
|
|
|
|
snfCFGData& snfCFGmgr::InactiveData() { // This returns the inactive dataset. |
|
|
|
return (AisActive) ? B : A; |
|
|
|
} |
|
|
|
|
|
|
|
std::string snfCFGmgr::RuleFilePath() { // Rulebase file path |
|
|
|
return ActiveData().RuleFilePath; |
|
|
|
} |
|
|
|
|
|
|
|
std::string snfCFGmgr::SecurityKey() { // Security key for rulebase |
|
|
|
return ActiveData().SecurityKey; |
|
|
|
} |
|
|
|
|
|
|
|
snfCFGData* snfCFGmgr::ActiveConfiguration() { // Pointer to active configuration |
|
|
|
return &(ActiveData()); |
|
|
|
} |
|
|
|
|
|
|
|
//// RangeHandler ////////////////////////////////////////////////////////////// |
|
|
|
|
|
|
@@ -16,7 +58,7 @@ bool RangeHandler::isInBlack(RangePoint& x) { |
|
|
|
return false; // there is no map so there is |
|
|
|
} // no side to be on. |
|
|
|
// If there are points we will need |
|
|
|
set<RangePoint>::iterator iRangePoint; // to examine them. |
|
|
|
std::set<RangePoint>::iterator iRangePoint; // to examine them. |
|
|
|
iRangePoint = EdgeMap.begin(); // What is the first point. |
|
|
|
|
|
|
|
if(x < (*iRangePoint)) { // If x is below that then |
|
|
@@ -67,7 +109,7 @@ bool RangeHandler::isInWhite(RangePoint& x) { |
|
|
|
return false; // there is no map so there is |
|
|
|
} // no side to be on. |
|
|
|
// If ther are points then we |
|
|
|
set<RangePoint>::iterator iRangePoint; // need to examine them. |
|
|
|
std::set<RangePoint>::iterator iRangePoint; // need to examine them. |
|
|
|
iRangePoint = EdgeMap.begin(); // What is the first point. |
|
|
|
|
|
|
|
if(x < (*iRangePoint)) { // If x is below that then |
|
|
@@ -466,7 +508,7 @@ snfCFGData::snfCFGData() : |
|
|
|
.End("snf"); |
|
|
|
} |
|
|
|
|
|
|
|
void fixPathTermination(string& s) { // Ensure s ends in a / or a \ as needed. |
|
|
|
void fixPathTermination(std::string& s) { // Ensure s ends in a / or a \ as needed. |
|
|
|
|
|
|
|
if(0 == s.length()) return; // If the string is empty we do nothing. |
|
|
|
|
|
|
@@ -474,7 +516,7 @@ void fixPathTermination(string& s) { |
|
|
|
// see what separator has already been used. |
|
|
|
|
|
|
|
char Terminator; // This will be our terminator. |
|
|
|
if(string::npos == s.find('\\')) { // If we're not using a backslash then |
|
|
|
if(std::string::npos == s.find('\\')) { // If we're not using a backslash then |
|
|
|
Terminator = '/'; // we will use the forward slash. |
|
|
|
} else { // If we are using the backslash then |
|
|
|
Terminator = '\\'; // we will remain consistent and terminate |
|
|
@@ -573,8 +615,8 @@ void snfCFGmgr::initialize( |
|
|
|
//// that way an attacker can't trick the application into disclosing the true |
|
|
|
//// authentication string -- they will only get out what they put in. |
|
|
|
|
|
|
|
string SecurityKeyDisplayString(snfCFGData& D) { // Returns appropriate SecurityKey: data |
|
|
|
string ConfigLogSecurityKey = "************************"; // Start with a masked display. |
|
|
|
std::string SecurityKeyDisplayString(snfCFGData& D) { // Returns appropriate SecurityKey: data |
|
|
|
std::string ConfigLogSecurityKey = "************************"; // Start with a masked display. |
|
|
|
if(0 < D.node_authentication.length()) { // If auth info is in the config files then |
|
|
|
ConfigLogSecurityKey = D.node_licenseid + D.node_authentication; // build up the key from that data so it |
|
|
|
} // can be displayed in the config log. |
|
|
@@ -584,51 +626,51 @@ string SecurityKeyDisplayString(snfCFGData& D) { |
|
|
|
void logCFGData(snfCFGData& D) { // Log interpreted cfg data (debug aid). |
|
|
|
|
|
|
|
try { |
|
|
|
string CFGLogPath; // Build the snf_cfg log path. |
|
|
|
std::string CFGLogPath; // Build the snf_cfg log path. |
|
|
|
CFGLogPath = D.paths_log_path + |
|
|
|
D.node_licenseid + "_snf_engine_cfg.log"; |
|
|
|
|
|
|
|
ofstream cfgl(CFGLogPath.c_str(), ios::trunc); // Open and truncate the cfg log file. |
|
|
|
std::ofstream cfgl(CFGLogPath.c_str(), std::ios::trunc); // Open and truncate the cfg log file. |
|
|
|
cfgl // Report important cfg information. |
|
|
|
<< "SNF Engine Configuration" << endl |
|
|
|
<< "____________" << endl |
|
|
|
<< "Fundamentals" << endl |
|
|
|
<< " License: " << D.node_licenseid << endl |
|
|
|
<< " ConfigFilePath: " << D.ConfigFilePath << endl |
|
|
|
<< " IdentityFilePath: " << D.node_identity << endl |
|
|
|
<< " SecurityKey: " << SecurityKeyDisplayString(D) << endl |
|
|
|
<< "_____" << endl |
|
|
|
<< "Paths" << endl |
|
|
|
<< " Log Path: " << D.paths_log_path << endl |
|
|
|
<< " Rulebase Path: " << D.paths_rulebase_path << endl |
|
|
|
<< " Workspace Path: " << D.paths_workspace_path << endl |
|
|
|
<< " RuleFilePath: " << D.RuleFilePath << endl |
|
|
|
<< "____" << endl |
|
|
|
<< "Logs" << endl |
|
|
|
<< endl |
|
|
|
<< " Rotation-Midnight: " << ((D.Logs_Rotation_LocalTime_OnOff)? "Local" : "UTC") << endl |
|
|
|
<< " ______" << endl |
|
|
|
<< " Status" << endl |
|
|
|
<< "SNF Engine Configuration" << std::endl |
|
|
|
<< "____________" << std::endl |
|
|
|
<< "Fundamentals" << std::endl |
|
|
|
<< " License: " << D.node_licenseid << std::endl |
|
|
|
<< " ConfigFilePath: " << D.ConfigFilePath << std::endl |
|
|
|
<< " IdentityFilePath: " << D.node_identity << std::endl |
|
|
|
<< " SecurityKey: " << SecurityKeyDisplayString(D) << std::endl |
|
|
|
<< "_____" << std::endl |
|
|
|
<< "Paths" << std::endl |
|
|
|
<< " Log Path: " << D.paths_log_path << std::endl |
|
|
|
<< " Rulebase Path: " << D.paths_rulebase_path << std::endl |
|
|
|
<< " Workspace Path: " << D.paths_workspace_path << std::endl |
|
|
|
<< " RuleFilePath: " << D.RuleFilePath << std::endl |
|
|
|
<< "____" << std::endl |
|
|
|
<< "Logs" << std::endl |
|
|
|
<< std::endl |
|
|
|
<< " Rotation-Midnight: " << ((D.Logs_Rotation_LocalTime_OnOff)? "Local" : "UTC") << std::endl |
|
|
|
<< " ______" << std::endl |
|
|
|
<< " Status" << std::endl |
|
|
|
<< " PerSecond: " |
|
|
|
<< ((D.Status_SecondReport_Log_OnOff)? "yes, " : "no, ") |
|
|
|
<< "Append: " |
|
|
|
<< ((D.Status_SecondReport_Append_OnOff)? "yes" : "no") |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " PerMinute: " |
|
|
|
<< ((D.Status_MinuteReport_Log_OnOff)? "yes, " : "no, ") |
|
|
|
<< "Append: " |
|
|
|
<< ((D.Status_MinuteReport_Append_OnOff)? "yes" : "no") |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " PerHour: " |
|
|
|
<< ((D.Status_HourReport_Log_OnOff)? "yes, " : "no, ") |
|
|
|
<< "Append: " |
|
|
|
<< ((D.Status_HourReport_Append_OnOff)? "yes" : "no") |
|
|
|
<< endl |
|
|
|
<< " ____" << endl |
|
|
|
<< " Scan" << endl |
|
|
|
<< std::endl |
|
|
|
<< " ____" << std::endl |
|
|
|
<< " Scan" << std::endl |
|
|
|
<< " Identifier: " |
|
|
|
<< ((D.Scan_Identifier_Force_Message_Id)? "Force RFC822 Message-ID" : "Use Provided Identifier") |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " Classic: Output-" |
|
|
|
<< ((LogOutputMode_None == D.Scan_Classic_Mode)? "None, " : |
|
|
|
((LogOutputMode_API == D.Scan_Classic_Mode)? "API, " : |
|
|
@@ -637,7 +679,7 @@ void logCFGData(snfCFGData& D) { |
|
|
|
<< ((D.Scan_Classic_Matches == ScanLogMatches_None) ? "No Mathes": |
|
|
|
((D.Scan_Classic_Matches == ScanLogMatches_Unique) ? "Unique Matches": |
|
|
|
((D.Scan_Classic_Matches == ScanLogMatches_All) ? "All Matches" : "Error!"))) |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " XML: Output-" |
|
|
|
<< ((LogOutputMode_None == D.Scan_XML_Mode)? "None, " : |
|
|
|
((LogOutputMode_API == D.Scan_XML_Mode)? "API, " : |
|
|
@@ -648,134 +690,134 @@ void logCFGData(snfCFGData& D) { |
|
|
|
((D.Scan_XML_Matches == ScanLogMatches_All) ? "All Matches, " : "Match Error! "))) |
|
|
|
<< ((D.Scan_XML_Performance)? "Performance Metrics, " : "No Performance Metrics, ") |
|
|
|
<< ((D.Scan_XML_GBUdb)? "GBUdb Data" : "No GBUdb Data") |
|
|
|
<< endl |
|
|
|
<< " XHeaders:" << endl |
|
|
|
<< std::endl |
|
|
|
<< " XHeaders:" << std::endl |
|
|
|
<< " Output: " |
|
|
|
<< ((LogOutputMode_None == D.XHDROutput_Mode) ? "None" : |
|
|
|
((LogOutputMode_API == D.XHDROutput_Mode) ? "API" : |
|
|
|
((LogOutputMode_File == D.XHDROutput_Mode) ? "File" : |
|
|
|
((LogOutputMode_Inject == D.XHDROutput_Mode)? "Inject" : "Error!")))) |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " Version: " |
|
|
|
<< ((D.XHDRVersion_OnOff)? "On, " : "Off, ") |
|
|
|
<< D.XHDRVersion_Header |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " License: " |
|
|
|
<< ((D.XHDRLicense_OnOff)? "On, " : "Off, ") |
|
|
|
<< D.XHDRLicense_Header |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " Rulebase: " |
|
|
|
<< ((D.XHDRRulebase_OnOff)? "On, " : "Off, ") |
|
|
|
<< D.XHDRRulebase_Header |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " Identifier: " |
|
|
|
<< ((D.XHDRIdentifier_OnOff)? "On, " : "Off, ") |
|
|
|
<< D.XHDRIdentifier_Header |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " GBUdb: " |
|
|
|
<< ((D.XHDRGBUdb_OnOff)? "On, " : "Off, ") |
|
|
|
<< D.XHDRGBUdb_Header |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " Result: " |
|
|
|
<< ((D.XHDRResult_OnOff)? "On, " : "Off, ") |
|
|
|
<< D.XHDRResult_Header |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " Matches: " |
|
|
|
<< ((D.XHDRMatches_OnOff)? "On, " : "Off, ") |
|
|
|
<< D.XHDRMatches_Header |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " Black: " |
|
|
|
<< ((D.XHDRBlack_OnOff)? "On, " : "Off, ") |
|
|
|
<< D.XHDRBlack_Header |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " White: " |
|
|
|
<< ((D.XHDRWhite_OnOff)? "On, " : "Off, ") |
|
|
|
<< D.XHDRWhite_Header |
|
|
|
<< endl |
|
|
|
<< std::endl |
|
|
|
<< " Clean: " |
|
|
|
<< ((D.XHDRClean_OnOff)? "On, " : "Off, ") |
|
|
|
<< D.XHDRClean_Header |
|
|
|
<< endl; |
|
|
|
<< std::endl; |
|
|
|
|
|
|
|
for( |
|
|
|
set<XHDRSymbol>::iterator iH = D.XHDRSymbolHeaders.SymbolHeaders.begin(); |
|
|
|
std::set<XHDRSymbol>::iterator iH = D.XHDRSymbolHeaders.SymbolHeaders.begin(); |
|
|
|
iH != D.XHDRSymbolHeaders.SymbolHeaders.end(); iH++ |
|
|
|
) { |
|
|
|
cfgl |
|
|
|
<< " Symbol: " |
|
|
|
<< (*iH).Symbol << ", " |
|
|
|
<< (*iH).Header |
|
|
|
<< endl; |
|
|
|
<< std::endl; |
|
|
|
} |
|
|
|
|
|
|
|
cfgl |
|
|
|
<< "_______" << endl |
|
|
|
<< "Network" << endl |
|
|
|
<< " Sync Host: " << D.network_sync_host << endl |
|
|
|
<< " Sync Port: " << D.network_sync_port << endl |
|
|
|
<< " Sync Secs: " << D.network_sync_secs << endl |
|
|
|
<< " _____________" << endl |
|
|
|
<< " Update-Script" << endl |
|
|
|
<< " On-Off: " << ((D.update_script_on_off) ? "On" : "Off") << endl |
|
|
|
<< " Script: " << D.update_script_call << endl |
|
|
|
<< " Guard-Time: " << D.update_script_guard_time << " seconds" << endl |
|
|
|
<< "___" << endl |
|
|
|
<< "XCI" << endl |
|
|
|
<< " " << ((D.XCI_OnOff)? "Enabled" : "Disabled") << endl |
|
|
|
<< " Port: " << D.XCI_Port << endl |
|
|
|
<< "_____" << endl |
|
|
|
<< "GBUdb" << endl |
|
|
|
<< " ____________" << endl |
|
|
|
<< " Condensation" << endl |
|
|
|
<< " Minimum-Seconds-Between = " << D.gbudb_database_condense_minimum_seconds_between << endl |
|
|
|
<< "_______" << std::endl |
|
|
|
<< "Network" << std::endl |
|
|
|
<< " Sync Host: " << D.network_sync_host << std::endl |
|
|
|
<< " Sync Port: " << D.network_sync_port << std::endl |
|
|
|
<< " Sync Secs: " << D.network_sync_secs << std::endl |
|
|
|
<< " _____________" << std::endl |
|
|
|
<< " Update-Script" << std::endl |
|
|
|
<< " On-Off: " << ((D.update_script_on_off) ? "On" : "Off") << std::endl |
|
|
|
<< " Script: " << D.update_script_call << std::endl |
|
|
|
<< " Guard-Time: " << D.update_script_guard_time << " seconds" << std::endl |
|
|
|
<< "___" << std::endl |
|
|
|
<< "XCI" << std::endl |
|
|
|
<< " " << ((D.XCI_OnOff)? "Enabled" : "Disabled") << std::endl |
|
|
|
<< " Port: " << D.XCI_Port << std::endl |
|
|
|
<< "_____" << std::endl |
|
|
|
<< "GBUdb" << std::endl |
|
|
|
<< " ____________" << std::endl |
|
|
|
<< " Condensation" << std::endl |
|
|
|
<< " Minimum-Seconds-Between = " << D.gbudb_database_condense_minimum_seconds_between << std::endl |
|
|
|
<< " Time-Trigger: " |
|
|
|
<< ((D.gbudb_database_condense_time_trigger_on_off)? "on, " : "off, ") |
|
|
|
<< D.gbudb_database_condense_time_trigger_seconds << " seconds" << endl |
|
|
|
<< D.gbudb_database_condense_time_trigger_seconds << " seconds" << std::endl |
|
|
|
<< " Posts-Trigger: " |
|
|
|
<< ((D.gbudb_database_condense_posts_trigger_on_off)? "on, " : "off, ") |
|
|
|
<< D.gbudb_database_condense_posts_trigger_posts << " posts" << endl |
|
|
|
<< D.gbudb_database_condense_posts_trigger_posts << " posts" << std::endl |
|
|
|
<< " Records-Trigger: " |
|
|
|
<< ((D.gbudb_database_condense_records_trigger_on_off) ? "on, " : "off, ") |
|
|
|
<< D.gbudb_database_condense_records_trigger_records << " records" << endl |
|
|
|
<< D.gbudb_database_condense_records_trigger_records << " records" << std::endl |
|
|
|
<< " Size-Trigger: " |
|
|
|
<< ((D.gbudb_database_condense_size_trigger_on_off) ? "on, " : "off, ") |
|
|
|
<< D.gbudb_database_condense_size_trigger_megabytes << " megabytes" << endl |
|
|
|
<< " __________" << endl |
|
|
|
<< " Checkpoint" << endl |
|
|
|
<< D.gbudb_database_condense_size_trigger_megabytes << " megabytes" << std::endl |
|
|
|
<< " __________" << std::endl |
|
|
|
<< " Checkpoint" << std::endl |
|
|
|
<< " Checkpoint: " |
|
|
|
<< ((D.gbudb_database_checkpoint_on_off) ? "on, " : "off, ") |
|
|
|
<< D.gbudb_database_checkpoint_secs << " seconds" << endl |
|
|
|
<< " ______" << endl |
|
|
|
<< " Ranges" << endl |
|
|
|
<< D.gbudb_database_checkpoint_secs << " seconds" << std::endl |
|
|
|
<< " ______" << std::endl |
|
|
|
<< " Ranges" << std::endl |
|
|
|
<< " White: " |
|
|
|
<< ((D.WhiteRangeHandler.On_Off) ? "on, " : "off, ") |
|
|
|
<< "Symbol " << D.WhiteRangeHandler.Symbol << endl |
|
|
|
<< "Symbol " << D.WhiteRangeHandler.Symbol << std::endl |
|
|
|
<< " Auto-Panic: " |
|
|
|
<< ((D.gbudb_regions_white_panic_on_off) ? "on, " : "off, ") |
|
|
|
<< "Range " << D.gbudb_regions_white_panic_rule_range << endl |
|
|
|
<< endl |
|
|
|
<< "Range " << D.gbudb_regions_white_panic_rule_range << std::endl |
|
|
|
<< std::endl |
|
|
|
<< " Caution: " |
|
|
|
<< ((D.CautionRangeHandler.On_Off) ? "on, " : "off, ") |
|
|
|
<< "Symbol " << D.CautionRangeHandler.Symbol << endl |
|
|
|
<< endl |
|
|
|
<< "Symbol " << D.CautionRangeHandler.Symbol << std::endl |
|
|
|
<< std::endl |
|
|
|
<< " Black: " |
|
|
|
<< ((D.BlackRangeHandler.On_Off) ? "on, " : "off, ") |
|
|
|
<< "Symbol " << D.BlackRangeHandler.Symbol << endl |
|
|
|
<< "Symbol " << D.BlackRangeHandler.Symbol << std::endl |
|
|
|
<< " Truncate: " |
|
|
|
<< ((D.gbudb_regions_black_truncate_on_off) ? "on, " : "off, ") |
|
|
|
<< "Probability " << D.gbudb_regions_black_truncate_probability << ", " |
|
|
|
<< "Peek-One-In " << D.gbudb_regions_black_truncate_peek_one_in << ", " |
|
|
|
<< "Symbol " << D.gbudb_regions_black_truncate_symbol << endl |
|
|
|
<< "Symbol " << D.gbudb_regions_black_truncate_symbol << std::endl |
|
|
|
<< " Sample: " |
|
|
|
<< ((D.gbudb_regions_black_sample_on_off) ? "on, " : "off, ") |
|
|
|
<< "Probability: " << D.gbudb_regions_black_sample_probability << ", " |
|
|
|
<< "Grab-One-In: " << D.gbudb_regions_black_sample_grab_one_in << ", " << endl |
|
|
|
<< "Grab-One-In: " << D.gbudb_regions_black_sample_grab_one_in << ", " << std::endl |
|
|
|
<< " Passthrough: " |
|
|
|
<< ((D.gbudb_regions_black_sample_passthrough) ? "yes, " : "no, ") |
|
|
|
<< "Passthrough Symbol " << D.gbudb_regions_black_sample_passthrough_symbol << endl |
|
|
|
<< endl |
|
|
|
<< " Range Map - [W]hite [B]lack [C]aution [ ]undefined" << endl << endl |
|
|
|
<< " |-9876543210123456789+|" << endl; |
|
|
|
<< "Passthrough Symbol " << D.gbudb_regions_black_sample_passthrough_symbol << std::endl |
|
|
|
<< std::endl |
|
|
|
<< " Range Map - [W]hite [B]lack [C]aution [ ]undefined" << std::endl << std::endl |
|
|
|
<< " |-9876543210123456789+|" << std::endl; |
|
|
|
|
|
|
|
// Output GBUdb Range Map |
|
|
|
|
|
|
@@ -795,20 +837,20 @@ void logCFGData(snfCFGData& D) { |
|
|
|
cfgl << " "; // Otherwise put in a space. |
|
|
|
} |
|
|
|
} |
|
|
|
cfgl << "|" << c << endl; |
|
|
|
cfgl << "|" << c << std::endl; |
|
|
|
} |
|
|
|
cfgl << " |---------------------|" << endl; |
|
|
|
cfgl << " |---------------------|" << std::endl; |
|
|
|
|
|
|
|
cfgl |
|
|
|
<< endl |
|
|
|
<< " ________" << endl |
|
|
|
<< " Training" << endl |
|
|
|
<< std::endl |
|
|
|
<< " ________" << std::endl |
|
|
|
<< " Training" << std::endl |
|
|
|
<< " GBUdb Updates: " |
|
|
|
<< ((D.GBUdbTrainingOn_Off)? "Enabled" : "Disabled") << endl |
|
|
|
<< endl; |
|
|
|
<< ((D.GBUdbTrainingOn_Off)? "Enabled" : "Disabled") << std::endl |
|
|
|
<< std::endl; |
|
|
|
|
|
|
|
cfgl |
|
|
|
<< " Source Header Directives: " << endl; |
|
|
|
<< " Source Header Directives: " << std::endl; |
|
|
|
for( |
|
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
@@ -820,20 +862,20 @@ void logCFGData(snfCFGData& D) { |
|
|
|
<< "Context " << Dx.Context << " is a " |
|
|
|
<< Dx.Header << " header at" |
|
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
|
<< " that Contains " << Dx.Contains << endl; |
|
|
|
<< " that Contains " << Dx.Contains << std::endl; |
|
|
|
} else |
|
|
|
if(HeaderDirectiveSource == Dx.Directive) { |
|
|
|
cfgl |
|
|
|
<< " " |
|
|
|
<< "Context " << Dx.Context << " Source ip is in " |
|
|
|
<< Dx.Header << " header at" |
|
|
|
<< " Ordinal " << Dx.Ordinal << endl; |
|
|
|
<< " Ordinal " << Dx.Ordinal << std::endl; |
|
|
|
} |
|
|
|
} |
|
|
|
cfgl << endl; |
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
cfgl |
|
|
|
<< " Drilldown Header Directives: " << endl; |
|
|
|
<< " Drilldown Header Directives: " << std::endl; |
|
|
|
for( |
|
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
@@ -844,13 +886,13 @@ void logCFGData(snfCFGData& D) { |
|
|
|
<< " " |
|
|
|
<< Dx.Header << " header at" |
|
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
|
<< " Contains " << Dx.Contains << endl; |
|
|
|
<< " Contains " << Dx.Contains << std::endl; |
|
|
|
} |
|
|
|
} |
|
|
|
cfgl << endl; |
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
cfgl |
|
|
|
<< " Bypass Header Directives: " << endl; |
|
|
|
<< " Bypass Header Directives: " << std::endl; |
|
|
|
for( |
|
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
@@ -861,13 +903,13 @@ void logCFGData(snfCFGData& D) { |
|
|
|
<< " " |
|
|
|
<< Dx.Header << " header at" |
|
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
|
<< " Contains " << Dx.Contains << endl; |
|
|
|
<< " Contains " << Dx.Contains << std::endl; |
|
|
|
} |
|
|
|
} |
|
|
|
cfgl << endl; |
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
cfgl |
|
|
|
<< " White Rule Header Directives: " << endl; |
|
|
|
<< " White Rule Header Directives: " << std::endl; |
|
|
|
for( |
|
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
@@ -878,10 +920,10 @@ void logCFGData(snfCFGData& D) { |
|
|
|
<< " " |
|
|
|
<< Dx.Header << " header at" |
|
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
|
<< " Contains " << Dx.Contains << endl; |
|
|
|
<< " Contains " << Dx.Contains << std::endl; |
|
|
|
} |
|
|
|
} |
|
|
|
cfgl << endl; |
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
cfgl |
|
|
|
<< " White Rule Symbols: "; |
|
|
@@ -889,7 +931,7 @@ void logCFGData(snfCFGData& D) { |
|
|
|
// Output white rule symbols |
|
|
|
|
|
|
|
for( |
|
|
|
set<int>::iterator ix = D.TrainingWhiteRuleHandler.IntegerSet.begin(); |
|
|
|
std::set<int>::iterator ix = D.TrainingWhiteRuleHandler.IntegerSet.begin(); |
|
|
|
ix != D.TrainingWhiteRuleHandler.IntegerSet.end(); |
|
|
|
ix ++) { |
|
|
|
if(D.TrainingWhiteRuleHandler.IntegerSet.begin() != ix) { |
|
|
@@ -897,47 +939,47 @@ void logCFGData(snfCFGData& D) { |
|
|
|
} |
|
|
|
cfgl << (*ix); |
|
|
|
} |
|
|
|
cfgl << endl; |
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
// Rule Panics |
|
|
|
|
|
|
|
cfgl |
|
|
|
<< "___________" << endl |
|
|
|
<< "Rule-Panics" << endl; |
|
|
|
<< "___________" << std::endl |
|
|
|
<< "Rule-Panics" << std::endl; |
|
|
|
|
|
|
|
for( |
|
|
|
set<int>::iterator ix = D.RulePanicHandler.IntegerSet.begin(); |
|
|
|
std::set<int>::iterator ix = D.RulePanicHandler.IntegerSet.begin(); |
|
|
|
ix != D.RulePanicHandler.IntegerSet.end(); |
|
|
|
ix ++) { |
|
|
|
cfgl << " Rule ID: " << (*ix) << endl; |
|
|
|
cfgl << " Rule ID: " << (*ix) << std::endl; |
|
|
|
} |
|
|
|
cfgl << endl; |
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
cfgl |
|
|
|
<< "___________" << endl |
|
|
|
<< "Integration" << endl |
|
|
|
<< endl |
|
|
|
<< "___________" << std::endl |
|
|
|
<< "Integration" << std::endl |
|
|
|
<< std::endl |
|
|
|
<< " Message Format: " |
|
|
|
<< ((D.MessageFileTypeCGP_on_off)? "CGP" : "RFC822") |
|
|
|
<< endl; |
|
|
|
<< std::endl; |
|
|
|
|
|
|
|
#ifdef __BIG_ENDIAN__ |
|
|
|
|
|
|
|
cfgl << " Rulebase Conversion: BIG ENDIAN" << endl; |
|
|
|
cfgl << " Rulebase Conversion: BIG ENDIAN" << std::endl; |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
cfgl << " Rulebase Conversion: LITTLE ENDIAN" << endl; |
|
|
|
cfgl << " Rulebase Conversion: LITTLE ENDIAN" << std::endl; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
cfgl |
|
|
|
<< "________" << endl |
|
|
|
<< "Platform" << endl |
|
|
|
<< "________" << std::endl |
|
|
|
<< "Platform" << std::endl |
|
|
|
<< D.PlatformElementContents |
|
|
|
<< endl; |
|
|
|
<< std::endl; |
|
|
|
|
|
|
|
cfgl << endl; // End with a new line. |
|
|
|
cfgl << std::endl; // End with a new line. |
|
|
|
cfgl.close(); // Close the cfg log file. |
|
|
|
} catch (...) {} // Ignore any errors. |
|
|
|
} |
|
|
@@ -955,8 +997,8 @@ void snfCFGmgr::load() { |
|
|
|
int PathLength = InitFileName.length(); // How long is the path? |
|
|
|
const int MinimumPathLength = 12; // Must be at least licensid.snf long. |
|
|
|
if(MinimumPathLength > PathLength) throw LoadFailure(); // Path length is impossible? throw! |
|
|
|
const string SNFExt = ".snf"; // The extension we are looking for. |
|
|
|
const string CFGExt = ".xml"; // The default cfg extension. |
|
|
|
const std::string SNFExt = ".snf"; // The extension we are looking for. |
|
|
|
const std::string CFGExt = ".xml"; // The default cfg extension. |
|
|
|
const int SNFExtLength = SNFExt.length(); // The length of the extension. |
|
|
|
int SNFExtPosition = InitFileName.rfind(SNFExt,PathLength); // Find the extension at the end. |
|
|
|
|
|
|
@@ -1006,7 +1048,7 @@ void snfCFGmgr::load() { |
|
|
|
CFGData.SecurityKey = CFGData.node_licenseid; // the LicenseID from our config file. |
|
|
|
} |
|
|
|
|
|
|
|
string LicenseIDToUse = CFGData.SecurityKey; // Grab the License ID we want to use. |
|
|
|
std::string LicenseIDToUse = CFGData.SecurityKey; // Grab the License ID we want to use. |
|
|
|
|
|
|
|
if(InitAuthenticationIsProvided) { // If the Authentication has been provided then |
|
|
|
CFGData.SecurityKey += InitAuthentication; // we use it for the second part of our |