[jcifs] nbtscan and mac addresses

Eric Glass eric.glass at gmail.com
Thu Aug 5 09:06:42 GMT 2004


> 
> BTW the jcifs.util.Hexdump class is good for formatting hex values. E.g.:
> 

Yes, I use it for some of the logging in Davenport.  This particular
function is a bit unwieldy, though; the size parameter is actually the
size of the intended output string (rather than the number of bytes
you want to process).  Doing:

    byte[] b = new byte[8];
    for (int i = 0; i < 8; i++) b[i] = (byte) i;
    System.out.println("0x" + Hexdump.toHexString(b, 0, 8));

gives "0x00010203".  To get "0x0001020304050607", you need to do
"toHexString(b, 0, 16)", which is a little funky (IMHO).

> 
> Also, note that a notation like 0x123456789abc not common for byte
> sequences. In fact the only other place I've seen it is in your NTLM
> documentation. I would have much rather seen hexdump notation in that
> documentation like:
> 

I've always used the "0x" notation for some reason; not really sure why.

> 
> What are example outputs of "unclean" names?
> 

Scratch that; I was just thrown off by the MSBROWSE name.  Doing:

    System.out.println(addr.getHostName());

on the "MSBROWSE" entry prints a couple of "smiley face" characters in
a DOS window.  Whereas addr.toString() converts the nonprintables to
".".


Eric


More information about the jcifs mailing list