Did I find the right examples for you? yes no

All Samples(5)  |  Call(2)  |  Derive(0)  |  Import(3)
Dump the buffer in wireshark style

        def hex_dump(buff, size=16):
    """
    Dump the buffer in wireshark style
    """
    out = []
    half = int(size / 2)
    if buff:
        for i in range(0, len(buff), size):
            hexed, plain = zip(*[(hex_value(c), printable(c)) for c in buff[i:i + size]])
            hexed = "{:04x}  {}  {}".format(i,
                                            " ".join(hexed[:half]),
                                            " ".join(hexed[half:size]))
            plain = "{} {}".format("".join(plain[: half]),
                                   "".join(plain[half:size]))
            out.append("{0}   {1:>{2}}".format(hexed,
                                               plain,
                                               55 - (len(hexed) - len(plain))))
    return "\n".join(out)
        


src/w/s/wstunnel-0.0.3/wstunnel/filters.py   wstunnel(Download)
import yaml
 
from wstunnel.toolbox import hex_dump
 
__author__ = 'fabio'
    def ws_to_socket(self, data, **kwargs):
        self.logger.info("[-->] From WebSocket endpoint\n{}".format(hex_dump(data)))
        return data
 
    def socket_to_ws(self, data, **kwargs):
        self.logger.info("[<--] To WebSocket endpoint\n{}".format(hex_dump(data)))

src/w/s/wstunnel-0.0.3/wstunnel/test/test_wstunnel.py   wstunnel(Download)
from wstunnel.client import WSTunnelClient, WebSocketProxy
from wstunnel.server import WSTunnelServer
from wstunnel.toolbox import hex_dump, random_free_port
 
 

src/w/s/wstunnel-0.0.3/wstunnel/test/test_toolbox.py   wstunnel(Download)
from wstunnel.factory import load_filter
from wstunnel.filters import DumpFilter
from wstunnel.toolbox import address_to_tuple, tuple_to_address, hex_dump, random_free_port
 
__author__ = 'fabio'