Python script to log dhcp leases

Thought I would share this. It is called from DNSMasq in the dnsmasq.conf file: dhcp-script=/home/nate/logdhcp.py enjoy #!/usr/bin/env python import sys, string, array appendLine=1 if sys.argv[4]: f=open(‘/home/nate/dhcplog’, ‘r’) lineArray=f.readlines() for line in f: lineArray.append(line) for line in lineArray: if line == (string.join(sys.argv[1:])+”\n”): appendLine=0 f.close() if appendLine==1: f=open(‘/home/nate/dhcplog’, ‘a’) f.write(string.join(sys.argv[1:])+”\n”) f.close()

IPv6 howto

As Promised, a simple IPv6 howto. So far it is only for windows systems, as that is what I have been using to test on at polytech, but I will add one for Linux as soon as I work out how to get it running on Ubuntu (it hasn’t been working atm, any help would … Continue Reading

Basic Apache Virtual Host Config File

NameVirtualHost example.com <VirtualHost *:80> ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/www.example.com <Directory /var/www/www.example.com> Options FollowSymLinks AllowOverride None </Directory> DirectoryIndex index.php </VirtualHost>