minor fix

This commit is contained in:
lgandx 2013-12-26 10:28:45 -05:00
commit 938f9bd533

View file

@ -240,13 +240,16 @@ def Validate_NBT_NS(data,Wredirect):
def Decode_Name(nbname): def Decode_Name(nbname):
#From http://code.google.com/p/dpkt/ with author's permission. #From http://code.google.com/p/dpkt/ with author's permission.
if len(nbname) != 32: try:
return nbname if len(nbname) != 32:
l = [] return nbname
for i in range(0, 32, 2): l = []
l.append(chr(((ord(nbname[i]) - 0x41) << 4) | for i in range(0, 32, 2):
l.append(chr(((ord(nbname[i]) - 0x41) << 4) |
((ord(nbname[i+1]) - 0x41) & 0xf))) ((ord(nbname[i+1]) - 0x41) & 0xf)))
return ''.join(l).split('\x00', 1)[0].strip() return ''.join(l).split('\x00', 1)[0].strip()
except:
return "Illegal NetBIOS name"
# NBT_NS Server class. # NBT_NS Server class.
class NB(BaseRequestHandler): class NB(BaseRequestHandler):
@ -1611,3 +1614,4 @@ if __name__ == '__main__':
raise raise
raw_input() raw_input()