diff options
Diffstat (limited to 'mitmproxy/contentviews/hex.py')
-rw-r--r-- | mitmproxy/contentviews/hex.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mitmproxy/contentviews/hex.py b/mitmproxy/contentviews/hex.py new file mode 100644 index 00000000..116ed600 --- /dev/null +++ b/mitmproxy/contentviews/hex.py @@ -0,0 +1,20 @@ +from mitmproxy.utils import strutils +from . import base + + +class ViewHex(base.View): + name = "Hex" + prompt = ("hex", "e") + content_types = [] + + @staticmethod + def _format(data): + for offset, hexa, s in strutils.hexdump(data): + yield [ + ("offset", offset + " "), + ("text", hexa + " "), + ("text", s) + ] + + def __call__(self, data, **metadata): + return "Hex", self._format(data) |