|
|
@@ -21,7 +21,7 @@ HeaderFinder::HeaderFinder( |
|
|
|
HeaderDirectives(Patterns), // Grab the Directives and |
|
|
|
Bfr(MessageBuffer), // the message buffer. |
|
|
|
Len(MessageLength), |
|
|
|
ImpossibleBytes(NumberOfByteValues, false), // Clear the impossible bytes cache. |
|
|
|
ImpossibleBytes(NumberOfByteValues, false), // Clear the impossible bytes cache.
|
|
|
|
Directives(0) { // Zero the composite result. |
|
|
|
UnfoldHeaders(); // Unfold the headers. |
|
|
|
} |
|
|
@@ -56,10 +56,11 @@ void HeaderFinder::CheckContent(string& Header, const HeaderFinderPattern& P) { |
|
|
|
// Extract the IP from the header. |
|
|
|
|
|
|
|
const string digits = "0123456789"; // These are valid digits. |
|
|
|
int IPStart = Header.find_first_of(digits, P.Header.length()); // Find the first digit in the header. |
|
|
|
unsigned int IPStart =
|
|
|
|
Header.find_first_of(digits, P.Header.length()); // Find the first digit in the header. |
|
|
|
if(string::npos == IPStart) return; // If we don't find it we're done. |
|
|
|
const string ipchars = ".0123456789"; // These are valid IP characters. |
|
|
|
int IPEnd = Header.find_first_not_of(ipchars, IPStart); // Find the end of the IP. |
|
|
|
unsigned int IPEnd = Header.find_first_not_of(ipchars, IPStart); // Find the end of the IP. |
|
|
|
if(string::npos == IPEnd) IPEnd = Header.length(); // Correct for end of string cases. |
|
|
|
ScanData->HeaderDirectiveSourceIP( // Extract the IP from the header and |
|
|
|
Header.substr(IPStart, (IPEnd - IPStart)) // expose it to the calling scanner. |