ddrgen dynamically generates forward and reverse DNS zone files based on information obtained from SMB (Windows File and Printer Sharing) servers. It additionally creates a web based index of all active shares on the network, and also some game servers. This is the first Python script I ever wrote, so the code is a bit ugly.
A huge issue I find at such events is that most of the time I’m not running Windows, and someone gives me a server name to play Quake 3 (or something else), and I cannot connect. Many LAN Party administrators are under the false impression that this is a “real” DNS setup - when infact this is because of Windows’ broken DNS resolver, that allows one to substitute NetBIOS names as if they were real DNS records. If you’ve ever had a Mac or Linux user at a LAN whinge that they can’t access your game server by hostname, or have the problem yourself, then this script is for you.
Unlike using a dynamic DNS system over DHCP, it does not require that all users have an IP address given by a DHCP server. This is desirable particularly where some users are running network servers, and don’t want to loose their IP address after a reboot, or between parties.
It also provides a stable alternative to the “Network Neighbourhood” (aka “My Network Places”) in Windows, showing you every share on the network in one location, without having to worry about workgroup names or broken master browsers. It will also try to “guess” the operating system version installed, which maybe useful for statistical purposes. For example, you can use it to find out how many people are running Windows Vista, so that you know wether you should play some Vista-specific game next LAN, and the chance of people running that operating system.
The script presently runs on Linux, however should also run on Mac OS X, if the appropriate requirements are met. It doesn’t run on Windows yet (without trying to install samba in cygwin) - however a portable SMB client is in the works, so that there is no longer a dependancy on Samba, thus allowing the code to easily run on Windows. However this isn’t a great priority for me.
What this will generate (1.2.0 Development Version):
- A forward zone file, ie: so you can resolve “laptop” to “192.168.0.43”.
- A reverse zone file, ie: so you can look up “192.168.0.43” and get “laptop”.
- An optional report, formatted in XML, which is fed to a PHP script to generate HTML stats. This PHP script is included for your convienience, and works with PHP4 (and possibly PHP5).
What this won’t work with:
- Machines without a running SMB server. All Windows boxes using Microsoft Networking will work, as well as other boxes using Samba or something similar. This was chosen as it is a fairly standard way to give out names and get names, and not all DHCP clients give out the machine’s hostname.
- Giving you a free laptop with the IP “192.168.0.43” ;)
There’s an example use of the stats available.
- Samba, Version 3. Version 2 doesn’t work due to differences in the smbclient.
- nmap. I have version 3.75. It’s formatting dependant again, however I’m pretty sure you can use older versions as the formatting is close enough.
- Python 2.3 or later
- The BIND DNS server, djbdns, or something similar that supports the same type of zone files.
- The Python “twisted” Network Libraries.
- As of version 1.1.3, iplib is required.
- Despite the name, it doesn’t require a DHCP server.
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 of the License, 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.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
The current “stable” version of ddrgen is 1.0. You can download it as a bzip2’d tarball (11 kb). It was released on 2005-04-30. Please note this version is very old, and doesn’t support as much as the development versions (the 1.1.x series).
It has a new XML stats output format, and support for scanning Unreal Tournament 2004 (and 2003) games, and also Quake III Arena (and thus Call of Duty and other q3a-based games) games. There’s also some support for djbdns.
- Development version
- Support for using Avahi as a nameserver, and outputting records to Avahi’s host file. This means you can act as a MDNS server for computers that don’t have it available - and being a name server for the local network no longer requires configuration on MDNS capable systems.
- New multi-threaded scanning module, which dramatically reduces scan times on large networks (at the cost of CPU/RAM use on the scanning host). It will now spawn a scanning process for every computer found, rather than processing them sequentially.
- A couple of more versions of Samba recognised.
Old Development versions
- Development version
- An all new configuration file system
- Automatic network detection on Linux
- DNS record generation is now optional
- ddrgen fixes permissions on zone and stats files automatically.
- Fixed BIND record generation
- Improved detection of Ubuntu Linux (includes many pre-release Samba versions)
- Updated generic Samba detection for versions 3.0.0 to 3.0.23
- A new XSL stylesheet for the XML stats
- Fixed a bug that caused XML parse errors while the page was updating
- Temporary files are now handled dynamically by ddrgen (and ddrgen.tmp isn’t used anymore)
- Development version 2006-07-07. It adds support for DDRHelper scanning. You can download it here.
- Development version 2006-06-10. You can download it here. Please note that generating “BIND” DNS entries doesn’t work, you’ll need to use it the djbdns way for now.
Please note: scanning game servers when you have >10 hosts isn’t recommended if a firewall is running that drops packets sent to closed/restricted ports. It can take Twisted to take a very long time to time out. Use the “nogames” option to disable game scanning.
DDRHelper is a Windows application written in C# that runs ontop of the .NET 2.0 Framework. It allows someone to advertise services by running a small webserver (on port 6565/tcp) on their computer, which ddrgen can scan and download a configuration from. You can read more about it on the DDRHelper page.
Where I want this to go some day
- Not rely on external software in order to do the work. Have it all in the script itself. This should also help make it more cross platform. I hear there is a Python Samba interface, but the documentation isn’t that great. There’s info on how to find printers, but not much else...
- Maybe a separate database for the OS and Server information, that’s all fancy and indexed.
- Zeroconf (aka Apple Rendezvous, Bonjour) support for service advertising.
- Thread some of the scanning process to improve speed