|
|
|
|
|
|
|
|
HeaderDirectives(Patterns), // Grab the Directives and |
|
|
HeaderDirectives(Patterns), // Grab the Directives and |
|
|
Bfr(MessageBuffer), // the message buffer. |
|
|
Bfr(MessageBuffer), // the message buffer. |
|
|
Len(MessageLength), |
|
|
Len(MessageLength), |
|
|
ImpossibleBytes(NumberOfByteValues, false), // Clear the impossible bytes cache. |
|
|
|
|
|
|
|
|
ImpossibleBytes(NumberOfByteValues, false), // Clear the impossible bytes cache.
|
|
|
Directives(0) { // Zero the composite result. |
|
|
Directives(0) { // Zero the composite result. |
|
|
UnfoldHeaders(); // Unfold the headers. |
|
|
UnfoldHeaders(); // Unfold the headers. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Extract the IP from the header. |
|
|
// Extract the IP from the header. |
|
|
|
|
|
|
|
|
const string digits = "0123456789"; // These are valid digits. |
|
|
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. |
|
|
if(string::npos == IPStart) return; // If we don't find it we're done. |
|
|
const string ipchars = ".0123456789"; // These are valid IP characters. |
|
|
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. |
|
|
if(string::npos == IPEnd) IPEnd = Header.length(); // Correct for end of string cases. |
|
|
ScanData->HeaderDirectiveSourceIP( // Extract the IP from the header and |
|
|
ScanData->HeaderDirectiveSourceIP( // Extract the IP from the header and |
|
|
Header.substr(IPStart, (IPEnd - IPStart)) // expose it to the calling scanner. |
|
|
Header.substr(IPStart, (IPEnd - IPStart)) // expose it to the calling scanner. |