Build an equivalent view of hexdump() on a single line Note that setting both onlyasc and onlyhex to 1 results in a empty output :param p: a Packet :param onlyasc: 1 to display only the ascii view :param onlyhex: 1 to display only the hexadecimal view :param dump: print the vie
(p, onlyasc=0, onlyhex=0, dump=False)
| 336 | |
| 337 | @conf.commands.register |
| 338 | def linehexdump(p, onlyasc=0, onlyhex=0, dump=False): |
| 339 | # type: (Union[Packet, AnyStr], int, int, bool) -> Optional[str] |
| 340 | """Build an equivalent view of hexdump() on a single line |
| 341 | |
| 342 | Note that setting both onlyasc and onlyhex to 1 results in a empty output |
| 343 | |
| 344 | :param p: a Packet |
| 345 | :param onlyasc: 1 to display only the ascii view |
| 346 | :param onlyhex: 1 to display only the hexadecimal view |
| 347 | :param dump: print the view if False |
| 348 | :return: a String only when dump=True |
| 349 | """ |
| 350 | s = "" |
| 351 | s = hexstr(p, onlyasc=onlyasc, onlyhex=onlyhex, color=not dump) |
| 352 | if dump: |
| 353 | return s |
| 354 | else: |
| 355 | print(s) |
| 356 | return None |
| 357 | |
| 358 | |
| 359 | @conf.commands.register |