Changeset 100
- Timestamp:
- 08/15/07 08:28:37 (16 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hexls.in
r98 r100 40 40 '''list directory, convert hexadecimal to dotted decimal''' 41 41 42 regexp = re.compile('[' + string.hexdigits + ']{8}' ) 43 for f in os.listdir(path): 42 regexp = re.compile('[' + string.hexdigits + ']+$' ) 43 files = os.listdir(path) 44 files.sort() 45 for f in files: 46 47 hostname = hostname_resolve = False 48 44 49 fullpath = os.path.join(path, f) 45 50 if os.path.islink(fullpath): … … 47 52 else: 48 53 symlink_dest = None 54 55 if regexp.match(f) and symlink_dest: 56 size = len(f) 57 digit2 = digit3 = digit4 = 'X' 49 58 50 if regexp.match(f) and len(f) == 8: 51 digit1 = string.atoi(f[:2], 16) 52 digit2 = string.atoi(f[2:4], 16) 53 digit3 = string.atoi(f[4:6], 16) 54 digit4 = string.atoi(f[6:], 16) 59 if size >= 2: 60 digit1 = str(string.atoi(f[:2], 16)) 61 if size >= 4: 62 digit2 = str(string.atoi(f[2:4], 16)) 63 if size >= 6: 64 digit3 = str(string.atoi(f[4:6], 16)) 65 if size >= 8: 66 hostname_resolve = True 67 digit4 = str(string.atoi(f[6:], 16)) 55 68 56 ipaddr = '%d.%d.%d.%d' % (digit1, digit2, digit3, digit4) 57 try: 58 hostname = socket.gethostbyaddr(ipaddr) 59 except socket.herror, detail: 60 hostname = ( detail[1], 'dummy' ) 69 ipaddr = '%s.%s.%s.%s' % (digit1, digit2, digit3, digit4) 70 71 if hostname_resolve: 72 try: 73 hostname = socket.gethostbyaddr(ipaddr) 74 except socket.herror, detail: 75 hostname = ( detail[1], 'dummy' ) 61 76 62 77 if hostname: … … 65 80 output = '%s => %s' % (f, ipaddr) 66 81 67 if symlink_dest: 68 output = '%s -> %s' % (output, symlink_dest) 82 output = '%s -> %s' % (output, symlink_dest) 69 83 70 84 print output -
trunk/pxeconfig.in
r99 r100 77 77 START='start' 78 78 END='end' 79 VERSION='0.7.1'80 79 REMOVE='remove' 81 80 INTERACTIVE='interactive' 81 VERSION=0.7.1 82 82 83 83 SHORTOPT_LIST='hVn:s:e:f:ri' -
trunk/pxeconfigd.in
r98 r100 60 60 61 61 PXE_CONF_DIR = '/tftpboot/pxelinux.cfg' 62 VERSION = '0. 4.4'62 VERSION = '0.7.1' 63 63 64 64 # Give the current time
Note: See TracChangeset
for help on using the changeset viewer.