From c0f7e96117af1b92b2e7f60017adc2e6d4844b55 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 16 Jul 2018 13:10:10 -0600 Subject: [PATCH] More glyph changes ugh --- netarch/__init__.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/netarch/__init__.py b/netarch/__init__.py index 2cf3cd6..b34ae90 100644 --- a/netarch/__init__.py +++ b/netarch/__init__.py @@ -1,5 +1,6 @@ #! /usr/bin/python3 +import binascii import sys import struct @@ -60,6 +61,25 @@ cgach = ( '≡±≥≤⌠⌡÷≈°∙·√ⁿ²■¤' ) +fluffych = ( + '·☺☻♥♦♣♠•◘○◙♂♀♪♫☼' + '►◄↕‼¶§▬↨↑↓→←∟↔▲▼' + ' !"#$%&\'()*+,-./' + '0123456789:;<=>?' + '@ABCDEFGHIJKLMNO' + 'PQRSTUVWXYZ[\]^_' + '`abcdefghijklmno' + 'pqrstuvwxyz{|}~⌂' + 'ÇüéâäàåçêëèïîìÄÅ' + 'ÉæÆôöòûùÿÖÜ¢£¥₧ƒ' + 'áíóúñѪº¿⌐¬½¼¡«»' + '░▒▓│┤╡╢╖╕╣║╗╝╜╛┐' + '└┴┬├─┼╞╟╚╔╩╦╠═╬╧' + '╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀' + 'αßΓπΣσµτΦΘΩδ∞φε∩' + '≡±≥≤⌠⌡÷≈°∀∃√ⁿ²■¤' +) + def unpack(fmt, buf): """Unpack buf based on fmt, return the remainder.""" @@ -70,7 +90,7 @@ def unpack(fmt, buf): class HexDumper: - def __init__(self, output, charset=stdch): + def __init__(self, output, charset=fluffych): self.offset = 0 self.last = None self.elided = False @@ -124,7 +144,7 @@ class HexDumper: self.output.write('{:08x}\n'.format(self.offset)) -def hexdump(buf, f=sys.stdout, charset=cgach): +def hexdump(buf, f=sys.stdout, charset=fluffych): "Print a hex dump of buf" h = HexDumper(output=f, charset=charset) @@ -246,7 +266,7 @@ def bin(i, bits=None): def unhex(s): """Decode a string as hex, stripping whitespace first""" - return [ord(i) for i in s.replace(' ', '').decode('hex')] + return binascii.unhexlify(s.replace(' ', '')) def pp(value, bits=16):