|
|
|
|
|
|
|
|
return GetInternal(); // and return the next byte. |
|
|
return GetInternal(); // and return the next byte. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
unsigned char FilterChainDefunker::DefunkRoot() { // While in DefunkRoot state |
|
|
|
|
|
unsigned char x = GetStore(); // grab the next byte. |
|
|
|
|
|
if(x == '<') { // If it matches < then |
|
|
|
|
|
Internal = &FilterChainDefunker::OpenTag; // go to OpenTag state and |
|
|
|
|
|
return GetInternal(); // return the next byte. |
|
|
|
|
|
} else |
|
|
|
|
|
if(x == '&') { // If it matches & then |
|
|
|
|
|
Internal = &FilterChainDefunker::OpenAmp; // go to OpenAnd state and |
|
|
|
|
|
EnQueue(x); // push in the amphersand. |
|
|
|
|
|
return GetInternal(); // return the next byte. |
|
|
|
|
|
|
|
|
|
|
|
} // If we did not match then |
|
|
|
|
|
return x; // return what we grabbed. |
|
|
|
|
|
|
|
|
unsigned char FilterChainDefunker::DefunkRoot() { // While in DefunkRoot state...
|
|
|
|
|
|
unsigned char x = 0; // One byte at a time via x.
|
|
|
|
|
|
|
|
|
|
|
|
do { // Loop through any emptiness.
|
|
|
|
|
|
ReturnNothing = false; // Be ready to return a byte.
|
|
|
|
|
|
x = GetStore(); // Grab the next byte to process.
|
|
|
|
|
|
|
|
|
|
|
|
if(x == '<') { // If it matches < then |
|
|
|
|
|
Internal = &FilterChainDefunker::OpenTag; // go to OpenTag state and |
|
|
|
|
|
x = GetInternal(); // return the converted byte. |
|
|
|
|
|
} else |
|
|
|
|
|
|
|
|
|
|
|
if(x == '&') { // If it matches & then |
|
|
|
|
|
Internal = &FilterChainDefunker::OpenAmp; // go to OpenAnd state and |
|
|
|
|
|
EnQueue(x); // push in the amphersand. |
|
|
|
|
|
x = GetInternal(); // return the converted byte. |
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If x is none of the above then x is just x.
|
|
|
|
|
|
|
|
|
|
|
|
} while (true == ReturnNothing); // Returning nothing? Go again!
|
|
|
|
|
|
return x; // otherwise return a funkless x. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
unsigned char FilterChainDefunker::OpenTag() { // While in OpenTag state |
|
|
unsigned char FilterChainDefunker::OpenTag() { // While in OpenTag state |
|
|
|
|
|
|
|
|
unsigned char FilterChainDefunker::EatTag() { // If our mode is EatTag |
|
|
unsigned char FilterChainDefunker::EatTag() { // If our mode is EatTag |
|
|
if(LastGetStore != '>') { // and our last byte was not |
|
|
if(LastGetStore != '>') { // and our last byte was not |
|
|
while(GetStore()!='>')continue; // endtag then eat through |
|
|
while(GetStore()!='>')continue; // endtag then eat through |
|
|
} // the end tag. Then set our |
|
|
|
|
|
|
|
|
} // the end tag. Then set our
|
|
|
|
|
|
ReturnNothing = true; // ReturnNothing flag, set our |
|
|
Internal = &FilterChainDefunker::DefunkRoot; // mode to DefunkRoot and |
|
|
Internal = &FilterChainDefunker::DefunkRoot; // mode to DefunkRoot and |
|
|
return GetInternal(); // return the next byte. |
|
|
|
|
|
|
|
|
return 0; // return 0 (nothing, really). |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
unsigned char FilterChainDefunker::DecodeNum() { // If our mode is DecodeNum |
|
|
unsigned char FilterChainDefunker::DecodeNum() { // If our mode is DecodeNum |