@conf.commands.register
def linehexdump(x, onlyasc=0, onlyhex=0, dump=False):
 s = ''
 x = str(x)
 l = len(x)
 if (not onlyasc):
  for i in xrange(l):
   s += ('%02X' % ord(x[i]))
  if (not onlyhex):
   s += ' '
 if (not onlyhex):
  s += sane_color(x)
 if dump:
  return s
 else:
  print s

@ conf . commands . register def linehexdump ( x , onlyasc = 0 , onlyhex = 0 , dump = False ) : s = '' x = str ( x ) l = len ( x ) if ( not onlyasc ) : for i in xrange ( l ) : s += ( '%02X' % ord ( x [ i ] ) ) if ( not onlyhex ) : s += ' ' if ( not onlyhex ) : s += sane_color ( x ) if dump : return s else : print s
build an equivalent view of hexdump() on a single line note that setting both onlyasc and onlyhex to 1 results in a empty output .