/usr/lib/python2.7/dist-packages/ltsp/dhcpconf.py is in python-ltsp 0.2-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ##
## /etc/ltsp/dhcpd,conf parser
##
## Copyright (C) 2007 Canonical Ltd.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
def read():
list = []
try:
file = open('/etc/ltsp/dhcpd.conf', 'r')
except:
print 'can\'t open dhcp config'
return False
for line in file.read().split('\n'):
line = line.strip().lstrip('option ')
items = ['range','domain-name','domain-name-servers','broadcast-address','routers','subnet-mask','filename','root-path']
for item in items:
if line.startswith(item+' '):
if item == 'range':
range_from = line.strip('range').strip(';').split()[0]
range_to = line.strip('range').strip(';').split()[1]
list.append(('range_from', range_from))
list.append(('range_to',range_to))
else:
list.append((item, line.strip(item).strip(';').split()[0].strip('"')))
return list
|