|
|
|
|
|
|
|
|
// snfCFGmgr.cpp |
|
|
// 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. |
|
|
// See www.armresearch.com for the copyright terms. |
|
|
// |
|
|
// |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "snfCFGmgr.hpp" |
|
|
#include "snfCFGmgr.hpp" |
|
|
#include <iostream> |
|
|
#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 ////////////////////////////////////////////////////////////// |
|
|
//// RangeHandler ////////////////////////////////////////////////////////////// |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; // there is no map so there is |
|
|
return false; // there is no map so there is |
|
|
} // no side to be on. |
|
|
} // no side to be on. |
|
|
// If there are points we will need |
|
|
// 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. |
|
|
iRangePoint = EdgeMap.begin(); // What is the first point. |
|
|
|
|
|
|
|
|
if(x < (*iRangePoint)) { // If x is below that then |
|
|
if(x < (*iRangePoint)) { // If x is below that then |
|
|
|
|
|
|
|
|
return false; // there is no map so there is |
|
|
return false; // there is no map so there is |
|
|
} // no side to be on. |
|
|
} // no side to be on. |
|
|
// If ther are points then we |
|
|
// 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. |
|
|
iRangePoint = EdgeMap.begin(); // What is the first point. |
|
|
|
|
|
|
|
|
if(x < (*iRangePoint)) { // If x is below that then |
|
|
if(x < (*iRangePoint)) { // If x is below that then |
|
|
|
|
|
|
|
|
.End("snf"); |
|
|
.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. |
|
|
if(0 == s.length()) return; // If the string is empty we do nothing. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// see what separator has already been used. |
|
|
// see what separator has already been used. |
|
|
|
|
|
|
|
|
char Terminator; // This will be our terminator. |
|
|
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. |
|
|
Terminator = '/'; // we will use the forward slash. |
|
|
} else { // If we are using the backslash then |
|
|
} else { // If we are using the backslash then |
|
|
Terminator = '\\'; // we will remain consistent and terminate |
|
|
Terminator = '\\'; // we will remain consistent and terminate |
|
|
|
|
|
|
|
|
//// that way an attacker can't trick the application into disclosing the true |
|
|
//// that way an attacker can't trick the application into disclosing the true |
|
|
//// authentication string -- they will only get out what they put in. |
|
|
//// 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 |
|
|
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 |
|
|
ConfigLogSecurityKey = D.node_licenseid + D.node_authentication; // build up the key from that data so it |
|
|
} // can be displayed in the config log. |
|
|
} // can be displayed in the config log. |
|
|
|
|
|
|
|
|
void logCFGData(snfCFGData& D) { // Log interpreted cfg data (debug aid). |
|
|
void logCFGData(snfCFGData& D) { // Log interpreted cfg data (debug aid). |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
string CFGLogPath; // Build the snf_cfg log path. |
|
|
|
|
|
|
|
|
std::string CFGLogPath; // Build the snf_cfg log path. |
|
|
CFGLogPath = D.paths_log_path + |
|
|
CFGLogPath = D.paths_log_path + |
|
|
D.node_licenseid + "_snf_engine_cfg.log"; |
|
|
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. |
|
|
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: " |
|
|
<< " PerSecond: " |
|
|
<< ((D.Status_SecondReport_Log_OnOff)? "yes, " : "no, ") |
|
|
<< ((D.Status_SecondReport_Log_OnOff)? "yes, " : "no, ") |
|
|
<< "Append: " |
|
|
<< "Append: " |
|
|
<< ((D.Status_SecondReport_Append_OnOff)? "yes" : "no") |
|
|
<< ((D.Status_SecondReport_Append_OnOff)? "yes" : "no") |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " PerMinute: " |
|
|
<< " PerMinute: " |
|
|
<< ((D.Status_MinuteReport_Log_OnOff)? "yes, " : "no, ") |
|
|
<< ((D.Status_MinuteReport_Log_OnOff)? "yes, " : "no, ") |
|
|
<< "Append: " |
|
|
<< "Append: " |
|
|
<< ((D.Status_MinuteReport_Append_OnOff)? "yes" : "no") |
|
|
<< ((D.Status_MinuteReport_Append_OnOff)? "yes" : "no") |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " PerHour: " |
|
|
<< " PerHour: " |
|
|
<< ((D.Status_HourReport_Log_OnOff)? "yes, " : "no, ") |
|
|
<< ((D.Status_HourReport_Log_OnOff)? "yes, " : "no, ") |
|
|
<< "Append: " |
|
|
<< "Append: " |
|
|
<< ((D.Status_HourReport_Append_OnOff)? "yes" : "no") |
|
|
<< ((D.Status_HourReport_Append_OnOff)? "yes" : "no") |
|
|
<< endl |
|
|
|
|
|
<< " ____" << endl |
|
|
|
|
|
<< " Scan" << endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
|
|
|
<< " ____" << std::endl |
|
|
|
|
|
<< " Scan" << std::endl |
|
|
<< " Identifier: " |
|
|
<< " Identifier: " |
|
|
<< ((D.Scan_Identifier_Force_Message_Id)? "Force RFC822 Message-ID" : "Use Provided Identifier") |
|
|
<< ((D.Scan_Identifier_Force_Message_Id)? "Force RFC822 Message-ID" : "Use Provided Identifier") |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " Classic: Output-" |
|
|
<< " Classic: Output-" |
|
|
<< ((LogOutputMode_None == D.Scan_Classic_Mode)? "None, " : |
|
|
<< ((LogOutputMode_None == D.Scan_Classic_Mode)? "None, " : |
|
|
((LogOutputMode_API == D.Scan_Classic_Mode)? "API, " : |
|
|
((LogOutputMode_API == D.Scan_Classic_Mode)? "API, " : |
|
|
|
|
|
|
|
|
<< ((D.Scan_Classic_Matches == ScanLogMatches_None) ? "No Mathes": |
|
|
<< ((D.Scan_Classic_Matches == ScanLogMatches_None) ? "No Mathes": |
|
|
((D.Scan_Classic_Matches == ScanLogMatches_Unique) ? "Unique Matches": |
|
|
((D.Scan_Classic_Matches == ScanLogMatches_Unique) ? "Unique Matches": |
|
|
((D.Scan_Classic_Matches == ScanLogMatches_All) ? "All Matches" : "Error!"))) |
|
|
((D.Scan_Classic_Matches == ScanLogMatches_All) ? "All Matches" : "Error!"))) |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " XML: Output-" |
|
|
<< " XML: Output-" |
|
|
<< ((LogOutputMode_None == D.Scan_XML_Mode)? "None, " : |
|
|
<< ((LogOutputMode_None == D.Scan_XML_Mode)? "None, " : |
|
|
((LogOutputMode_API == D.Scan_XML_Mode)? "API, " : |
|
|
((LogOutputMode_API == D.Scan_XML_Mode)? "API, " : |
|
|
|
|
|
|
|
|
((D.Scan_XML_Matches == ScanLogMatches_All) ? "All Matches, " : "Match Error! "))) |
|
|
((D.Scan_XML_Matches == ScanLogMatches_All) ? "All Matches, " : "Match Error! "))) |
|
|
<< ((D.Scan_XML_Performance)? "Performance Metrics, " : "No Performance Metrics, ") |
|
|
<< ((D.Scan_XML_Performance)? "Performance Metrics, " : "No Performance Metrics, ") |
|
|
<< ((D.Scan_XML_GBUdb)? "GBUdb Data" : "No GBUdb Data") |
|
|
<< ((D.Scan_XML_GBUdb)? "GBUdb Data" : "No GBUdb Data") |
|
|
<< endl |
|
|
|
|
|
<< " XHeaders:" << endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
|
|
|
<< " XHeaders:" << std::endl |
|
|
<< " Output: " |
|
|
<< " Output: " |
|
|
<< ((LogOutputMode_None == D.XHDROutput_Mode) ? "None" : |
|
|
<< ((LogOutputMode_None == D.XHDROutput_Mode) ? "None" : |
|
|
((LogOutputMode_API == D.XHDROutput_Mode) ? "API" : |
|
|
((LogOutputMode_API == D.XHDROutput_Mode) ? "API" : |
|
|
((LogOutputMode_File == D.XHDROutput_Mode) ? "File" : |
|
|
((LogOutputMode_File == D.XHDROutput_Mode) ? "File" : |
|
|
((LogOutputMode_Inject == D.XHDROutput_Mode)? "Inject" : "Error!")))) |
|
|
((LogOutputMode_Inject == D.XHDROutput_Mode)? "Inject" : "Error!")))) |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " Version: " |
|
|
<< " Version: " |
|
|
<< ((D.XHDRVersion_OnOff)? "On, " : "Off, ") |
|
|
<< ((D.XHDRVersion_OnOff)? "On, " : "Off, ") |
|
|
<< D.XHDRVersion_Header |
|
|
<< D.XHDRVersion_Header |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " License: " |
|
|
<< " License: " |
|
|
<< ((D.XHDRLicense_OnOff)? "On, " : "Off, ") |
|
|
<< ((D.XHDRLicense_OnOff)? "On, " : "Off, ") |
|
|
<< D.XHDRLicense_Header |
|
|
<< D.XHDRLicense_Header |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " Rulebase: " |
|
|
<< " Rulebase: " |
|
|
<< ((D.XHDRRulebase_OnOff)? "On, " : "Off, ") |
|
|
<< ((D.XHDRRulebase_OnOff)? "On, " : "Off, ") |
|
|
<< D.XHDRRulebase_Header |
|
|
<< D.XHDRRulebase_Header |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " Identifier: " |
|
|
<< " Identifier: " |
|
|
<< ((D.XHDRIdentifier_OnOff)? "On, " : "Off, ") |
|
|
<< ((D.XHDRIdentifier_OnOff)? "On, " : "Off, ") |
|
|
<< D.XHDRIdentifier_Header |
|
|
<< D.XHDRIdentifier_Header |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " GBUdb: " |
|
|
<< " GBUdb: " |
|
|
<< ((D.XHDRGBUdb_OnOff)? "On, " : "Off, ") |
|
|
<< ((D.XHDRGBUdb_OnOff)? "On, " : "Off, ") |
|
|
<< D.XHDRGBUdb_Header |
|
|
<< D.XHDRGBUdb_Header |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " Result: " |
|
|
<< " Result: " |
|
|
<< ((D.XHDRResult_OnOff)? "On, " : "Off, ") |
|
|
<< ((D.XHDRResult_OnOff)? "On, " : "Off, ") |
|
|
<< D.XHDRResult_Header |
|
|
<< D.XHDRResult_Header |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " Matches: " |
|
|
<< " Matches: " |
|
|
<< ((D.XHDRMatches_OnOff)? "On, " : "Off, ") |
|
|
<< ((D.XHDRMatches_OnOff)? "On, " : "Off, ") |
|
|
<< D.XHDRMatches_Header |
|
|
<< D.XHDRMatches_Header |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " Black: " |
|
|
<< " Black: " |
|
|
<< ((D.XHDRBlack_OnOff)? "On, " : "Off, ") |
|
|
<< ((D.XHDRBlack_OnOff)? "On, " : "Off, ") |
|
|
<< D.XHDRBlack_Header |
|
|
<< D.XHDRBlack_Header |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " White: " |
|
|
<< " White: " |
|
|
<< ((D.XHDRWhite_OnOff)? "On, " : "Off, ") |
|
|
<< ((D.XHDRWhite_OnOff)? "On, " : "Off, ") |
|
|
<< D.XHDRWhite_Header |
|
|
<< D.XHDRWhite_Header |
|
|
<< endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
<< " Clean: " |
|
|
<< " Clean: " |
|
|
<< ((D.XHDRClean_OnOff)? "On, " : "Off, ") |
|
|
<< ((D.XHDRClean_OnOff)? "On, " : "Off, ") |
|
|
<< D.XHDRClean_Header |
|
|
<< D.XHDRClean_Header |
|
|
<< endl; |
|
|
|
|
|
|
|
|
<< std::endl; |
|
|
|
|
|
|
|
|
for( |
|
|
for( |
|
|
set<XHDRSymbol>::iterator iH = D.XHDRSymbolHeaders.SymbolHeaders.begin(); |
|
|
|
|
|
|
|
|
std::set<XHDRSymbol>::iterator iH = D.XHDRSymbolHeaders.SymbolHeaders.begin(); |
|
|
iH != D.XHDRSymbolHeaders.SymbolHeaders.end(); iH++ |
|
|
iH != D.XHDRSymbolHeaders.SymbolHeaders.end(); iH++ |
|
|
) { |
|
|
) { |
|
|
cfgl |
|
|
cfgl |
|
|
<< " Symbol: " |
|
|
<< " Symbol: " |
|
|
<< (*iH).Symbol << ", " |
|
|
<< (*iH).Symbol << ", " |
|
|
<< (*iH).Header |
|
|
<< (*iH).Header |
|
|
<< endl; |
|
|
|
|
|
|
|
|
<< std::endl; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
cfgl |
|
|
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: " |
|
|
<< " Time-Trigger: " |
|
|
<< ((D.gbudb_database_condense_time_trigger_on_off)? "on, " : "off, ") |
|
|
<< ((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: " |
|
|
<< " Posts-Trigger: " |
|
|
<< ((D.gbudb_database_condense_posts_trigger_on_off)? "on, " : "off, ") |
|
|
<< ((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: " |
|
|
<< " Records-Trigger: " |
|
|
<< ((D.gbudb_database_condense_records_trigger_on_off) ? "on, " : "off, ") |
|
|
<< ((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: " |
|
|
<< " Size-Trigger: " |
|
|
<< ((D.gbudb_database_condense_size_trigger_on_off) ? "on, " : "off, ") |
|
|
<< ((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: " |
|
|
<< " Checkpoint: " |
|
|
<< ((D.gbudb_database_checkpoint_on_off) ? "on, " : "off, ") |
|
|
<< ((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: " |
|
|
<< " White: " |
|
|
<< ((D.WhiteRangeHandler.On_Off) ? "on, " : "off, ") |
|
|
<< ((D.WhiteRangeHandler.On_Off) ? "on, " : "off, ") |
|
|
<< "Symbol " << D.WhiteRangeHandler.Symbol << endl |
|
|
|
|
|
|
|
|
<< "Symbol " << D.WhiteRangeHandler.Symbol << std::endl |
|
|
<< " Auto-Panic: " |
|
|
<< " Auto-Panic: " |
|
|
<< ((D.gbudb_regions_white_panic_on_off) ? "on, " : "off, ") |
|
|
<< ((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: " |
|
|
<< " Caution: " |
|
|
<< ((D.CautionRangeHandler.On_Off) ? "on, " : "off, ") |
|
|
<< ((D.CautionRangeHandler.On_Off) ? "on, " : "off, ") |
|
|
<< "Symbol " << D.CautionRangeHandler.Symbol << endl |
|
|
|
|
|
<< endl |
|
|
|
|
|
|
|
|
<< "Symbol " << D.CautionRangeHandler.Symbol << std::endl |
|
|
|
|
|
<< std::endl |
|
|
<< " Black: " |
|
|
<< " Black: " |
|
|
<< ((D.BlackRangeHandler.On_Off) ? "on, " : "off, ") |
|
|
<< ((D.BlackRangeHandler.On_Off) ? "on, " : "off, ") |
|
|
<< "Symbol " << D.BlackRangeHandler.Symbol << endl |
|
|
|
|
|
|
|
|
<< "Symbol " << D.BlackRangeHandler.Symbol << std::endl |
|
|
<< " Truncate: " |
|
|
<< " Truncate: " |
|
|
<< ((D.gbudb_regions_black_truncate_on_off) ? "on, " : "off, ") |
|
|
<< ((D.gbudb_regions_black_truncate_on_off) ? "on, " : "off, ") |
|
|
<< "Probability " << D.gbudb_regions_black_truncate_probability << ", " |
|
|
<< "Probability " << D.gbudb_regions_black_truncate_probability << ", " |
|
|
<< "Peek-One-In " << D.gbudb_regions_black_truncate_peek_one_in << ", " |
|
|
<< "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: " |
|
|
<< " Sample: " |
|
|
<< ((D.gbudb_regions_black_sample_on_off) ? "on, " : "off, ") |
|
|
<< ((D.gbudb_regions_black_sample_on_off) ? "on, " : "off, ") |
|
|
<< "Probability: " << D.gbudb_regions_black_sample_probability << ", " |
|
|
<< "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: " |
|
|
<< " Passthrough: " |
|
|
<< ((D.gbudb_regions_black_sample_passthrough) ? "yes, " : "no, ") |
|
|
<< ((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 |
|
|
// Output GBUdb Range Map |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cfgl << " "; // Otherwise put in a space. |
|
|
cfgl << " "; // Otherwise put in a space. |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
cfgl << "|" << c << endl; |
|
|
|
|
|
|
|
|
cfgl << "|" << c << std::endl; |
|
|
} |
|
|
} |
|
|
cfgl << " |---------------------|" << endl; |
|
|
|
|
|
|
|
|
cfgl << " |---------------------|" << std::endl; |
|
|
|
|
|
|
|
|
cfgl |
|
|
cfgl |
|
|
<< endl |
|
|
|
|
|
<< " ________" << endl |
|
|
|
|
|
<< " Training" << endl |
|
|
|
|
|
|
|
|
<< std::endl |
|
|
|
|
|
<< " ________" << std::endl |
|
|
|
|
|
<< " Training" << std::endl |
|
|
<< " GBUdb Updates: " |
|
|
<< " GBUdb Updates: " |
|
|
<< ((D.GBUdbTrainingOn_Off)? "Enabled" : "Disabled") << endl |
|
|
|
|
|
<< endl; |
|
|
|
|
|
|
|
|
<< ((D.GBUdbTrainingOn_Off)? "Enabled" : "Disabled") << std::endl |
|
|
|
|
|
<< std::endl; |
|
|
|
|
|
|
|
|
cfgl |
|
|
cfgl |
|
|
<< " Source Header Directives: " << endl; |
|
|
|
|
|
|
|
|
<< " Source Header Directives: " << std::endl; |
|
|
for( |
|
|
for( |
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
|
|
|
|
|
|
<< "Context " << Dx.Context << " is a " |
|
|
<< "Context " << Dx.Context << " is a " |
|
|
<< Dx.Header << " header at" |
|
|
<< Dx.Header << " header at" |
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
<< " that Contains " << Dx.Contains << endl; |
|
|
|
|
|
|
|
|
<< " that Contains " << Dx.Contains << std::endl; |
|
|
} else |
|
|
} else |
|
|
if(HeaderDirectiveSource == Dx.Directive) { |
|
|
if(HeaderDirectiveSource == Dx.Directive) { |
|
|
cfgl |
|
|
cfgl |
|
|
<< " " |
|
|
<< " " |
|
|
<< "Context " << Dx.Context << " Source ip is in " |
|
|
<< "Context " << Dx.Context << " Source ip is in " |
|
|
<< Dx.Header << " header at" |
|
|
<< Dx.Header << " header at" |
|
|
<< " Ordinal " << Dx.Ordinal << endl; |
|
|
|
|
|
|
|
|
<< " Ordinal " << Dx.Ordinal << std::endl; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
cfgl << endl; |
|
|
|
|
|
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
|
cfgl |
|
|
cfgl |
|
|
<< " Drilldown Header Directives: " << endl; |
|
|
|
|
|
|
|
|
<< " Drilldown Header Directives: " << std::endl; |
|
|
for( |
|
|
for( |
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
|
|
|
|
|
|
<< " " |
|
|
<< " " |
|
|
<< Dx.Header << " header at" |
|
|
<< Dx.Header << " header at" |
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
<< " Contains " << Dx.Contains << endl; |
|
|
|
|
|
|
|
|
<< " Contains " << Dx.Contains << std::endl; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
cfgl << endl; |
|
|
|
|
|
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
|
cfgl |
|
|
cfgl |
|
|
<< " Bypass Header Directives: " << endl; |
|
|
|
|
|
|
|
|
<< " Bypass Header Directives: " << std::endl; |
|
|
for( |
|
|
for( |
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
|
|
|
|
|
|
<< " " |
|
|
<< " " |
|
|
<< Dx.Header << " header at" |
|
|
<< Dx.Header << " header at" |
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
<< " Contains " << Dx.Contains << endl; |
|
|
|
|
|
|
|
|
<< " Contains " << Dx.Contains << std::endl; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
cfgl << endl; |
|
|
|
|
|
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
|
cfgl |
|
|
cfgl |
|
|
<< " White Rule Header Directives: " << endl; |
|
|
|
|
|
|
|
|
<< " White Rule Header Directives: " << std::endl; |
|
|
for( |
|
|
for( |
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin(); |
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++ |
|
|
|
|
|
|
|
|
<< " " |
|
|
<< " " |
|
|
<< Dx.Header << " header at" |
|
|
<< Dx.Header << " header at" |
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
<< " Ordinal " << Dx.Ordinal |
|
|
<< " Contains " << Dx.Contains << endl; |
|
|
|
|
|
|
|
|
<< " Contains " << Dx.Contains << std::endl; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
cfgl << endl; |
|
|
|
|
|
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
|
cfgl |
|
|
cfgl |
|
|
<< " White Rule Symbols: "; |
|
|
<< " White Rule Symbols: "; |
|
|
|
|
|
|
|
|
// Output white rule symbols |
|
|
// Output white rule symbols |
|
|
|
|
|
|
|
|
for( |
|
|
for( |
|
|
set<int>::iterator ix = D.TrainingWhiteRuleHandler.IntegerSet.begin(); |
|
|
|
|
|
|
|
|
std::set<int>::iterator ix = D.TrainingWhiteRuleHandler.IntegerSet.begin(); |
|
|
ix != D.TrainingWhiteRuleHandler.IntegerSet.end(); |
|
|
ix != D.TrainingWhiteRuleHandler.IntegerSet.end(); |
|
|
ix ++) { |
|
|
ix ++) { |
|
|
if(D.TrainingWhiteRuleHandler.IntegerSet.begin() != ix) { |
|
|
if(D.TrainingWhiteRuleHandler.IntegerSet.begin() != ix) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
cfgl << (*ix); |
|
|
cfgl << (*ix); |
|
|
} |
|
|
} |
|
|
cfgl << endl; |
|
|
|
|
|
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
|
// Rule Panics |
|
|
// Rule Panics |
|
|
|
|
|
|
|
|
cfgl |
|
|
cfgl |
|
|
<< "___________" << endl |
|
|
|
|
|
<< "Rule-Panics" << endl; |
|
|
|
|
|
|
|
|
<< "___________" << std::endl |
|
|
|
|
|
<< "Rule-Panics" << std::endl; |
|
|
|
|
|
|
|
|
for( |
|
|
for( |
|
|
set<int>::iterator ix = D.RulePanicHandler.IntegerSet.begin(); |
|
|
|
|
|
|
|
|
std::set<int>::iterator ix = D.RulePanicHandler.IntegerSet.begin(); |
|
|
ix != D.RulePanicHandler.IntegerSet.end(); |
|
|
ix != D.RulePanicHandler.IntegerSet.end(); |
|
|
ix ++) { |
|
|
ix ++) { |
|
|
cfgl << " Rule ID: " << (*ix) << endl; |
|
|
|
|
|
|
|
|
cfgl << " Rule ID: " << (*ix) << std::endl; |
|
|
} |
|
|
} |
|
|
cfgl << endl; |
|
|
|
|
|
|
|
|
cfgl << std::endl; |
|
|
|
|
|
|
|
|
cfgl |
|
|
cfgl |
|
|
<< "___________" << endl |
|
|
|
|
|
<< "Integration" << endl |
|
|
|
|
|
<< endl |
|
|
|
|
|
|
|
|
<< "___________" << std::endl |
|
|
|
|
|
<< "Integration" << std::endl |
|
|
|
|
|
<< std::endl |
|
|
<< " Message Format: " |
|
|
<< " Message Format: " |
|
|
<< ((D.MessageFileTypeCGP_on_off)? "CGP" : "RFC822") |
|
|
<< ((D.MessageFileTypeCGP_on_off)? "CGP" : "RFC822") |
|
|
<< endl; |
|
|
|
|
|
|
|
|
<< std::endl; |
|
|
|
|
|
|
|
|
#ifdef __BIG_ENDIAN__ |
|
|
#ifdef __BIG_ENDIAN__ |
|
|
|
|
|
|
|
|
cfgl << " Rulebase Conversion: BIG ENDIAN" << endl; |
|
|
|
|
|
|
|
|
cfgl << " Rulebase Conversion: BIG ENDIAN" << std::endl; |
|
|
|
|
|
|
|
|
#else |
|
|
#else |
|
|
|
|
|
|
|
|
cfgl << " Rulebase Conversion: LITTLE ENDIAN" << endl; |
|
|
|
|
|
|
|
|
cfgl << " Rulebase Conversion: LITTLE ENDIAN" << std::endl; |
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
cfgl |
|
|
cfgl |
|
|
<< "________" << endl |
|
|
|
|
|
<< "Platform" << endl |
|
|
|
|
|
|
|
|
<< "________" << std::endl |
|
|
|
|
|
<< "Platform" << std::endl |
|
|
<< D.PlatformElementContents |
|
|
<< 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. |
|
|
cfgl.close(); // Close the cfg log file. |
|
|
} catch (...) {} // Ignore any errors. |
|
|
} catch (...) {} // Ignore any errors. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int PathLength = InitFileName.length(); // How long is the path? |
|
|
int PathLength = InitFileName.length(); // How long is the path? |
|
|
const int MinimumPathLength = 12; // Must be at least licensid.snf long. |
|
|
const int MinimumPathLength = 12; // Must be at least licensid.snf long. |
|
|
if(MinimumPathLength > PathLength) throw LoadFailure(); // Path length is impossible? throw! |
|
|
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. |
|
|
const int SNFExtLength = SNFExt.length(); // The length of the extension. |
|
|
int SNFExtPosition = InitFileName.rfind(SNFExt,PathLength); // Find the extension at the end. |
|
|
int SNFExtPosition = InitFileName.rfind(SNFExt,PathLength); // Find the extension at the end. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CFGData.SecurityKey = CFGData.node_licenseid; // the LicenseID from our config file. |
|
|
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 |
|
|
if(InitAuthenticationIsProvided) { // If the Authentication has been provided then |
|
|
CFGData.SecurityKey += InitAuthentication; // we use it for the second part of our |
|
|
CFGData.SecurityKey += InitAuthentication; // we use it for the second part of our |