[Esapi-php] Pretty print functions
jah
jah at jahboite.co.uk
Thu Jan 21 21:16:25 EST 2010
OK, attached is CodecDebug.php which is an initial attempt at the
functions for outputting codec debugging info - hopefully as you
envisaged , Mike. Also attached is codec_debugging.patch which shows
the functions in use in Codec decode and encode, and in PercentCodec,
pretty much as you said it would be, I think.
I'm sure you'll let me know if it needs work - consider it a rough draft
and fire away.
Here's an example output:
DEBUG - [ -> ] DefaultEncoder->encodeForURL, Codec->encode,
PercentCodec->encodeCharacter:
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . '<']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 's']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 'c']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 'r']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 'i']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 'p']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 't']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . '>']
Encoded: [%3Cscript%3E]
DEBUG - [ -> ] DefaultEncoder->canonicalize, Codec->decode,
PercentCodec->decodeCharacter:
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . '%']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . '3']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 'C']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 's']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 'c']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 'r']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 'i']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 'p']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 't']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . '%']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . '3']
Normalized codec input: 4 bytes ['' . "\0" . '' . "\0" . '' . "\0" . 'E']
Decoded: [<script>]
Regards,
jah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.owasp.org/pipermail/esapi-php/attachments/20100122/899b1195/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: codec_debugging.patch
Type: text/x-patch
Size: 3696 bytes
Desc: not available
Url : https://lists.owasp.org/pipermail/esapi-php/attachments/20100122/899b1195/attachment-0001.bin
More information about the Esapi-php
mailing list