Build a fancy tcpdump like hex from bytes.
(p, onlyasc=0, onlyhex=0, color=False)
| 380 | |
| 381 | @conf.commands.register |
| 382 | def hexstr(p, onlyasc=0, onlyhex=0, color=False): |
| 383 | # type: (Union[Packet, AnyStr], int, int, bool) -> str |
| 384 | """Build a fancy tcpdump like hex from bytes.""" |
| 385 | x = bytes_encode(p) |
| 386 | s = [] |
| 387 | if not onlyasc: |
| 388 | s.append(" ".join("%02X" % orb(b) for b in x)) |
| 389 | if not onlyhex: |
| 390 | s.append(sane(x, color=color)) |
| 391 | return " ".join(s) |
| 392 | |
| 393 | |
| 394 | def repr_hex(s): |
no test coverage detected