Six Demon Bag
Some stuff I have worked on, which may (hopefully) be helpful to others.
Auditing Windows File ACLs
From time to time I run into a situation where I need to get an overview of the permissions on a directory tree. Despite some online research I didn't manage to find a tool that would present me with an overview that I consider readable, so I wrote a script for this task: AuditACLs.
ParseIni() for Reading INI Files
I wanted to be able to use INI files as configuration files for my VBScripts, so I wrote ParseIni() to parse the contents of an INI file into a dictionary of dictionaries. Comments are allowed and must begin with a semicolon. As of yet, any semicolon is treated as the beginning of a comment, so neither section titles nor key/value pairs can contain semicolons. I'll probably add a more sophisticated comment handling at some point, but right now this works well enough for me.
As usual the function can be used by either copy/pasting the code or by importing the file.
CArray - A Wrapper Class for VBScript Arrays
Although VBScript does support arrays, their handling leaves a lot to be desired. To deal with the shortcomings of the built-in arrays (or rather, to avoid having to deal with them) I wrote CArray, a wrapper class that provides operations like inserting, appending and removing elements, getting slices (sub-arrays), sorting, etc.
Of course there's already stuff like System.Collections.ArrayList. However, I was aiming for something that a) would not require .NET and b) could easily be used as a queue or stack as well as a "regular" array. See API documentation for details.
If you want to use this wrapper class, either copy/paste the code to your script or import the class file.
Thanks to Alex for his feedback on the class interface.
DumpData() for Inspecting (not only) Dictionary-based Data Structures
Dictionary-based data structures are quite handy in various situations. However, when the structures grow, they tend to become messy pretty fast. To deal with this issue I wrote a DumpData() function to inspect a given variable and return a string representation of its data. It can be used either by copy/pasting the code or by importing the script.
DumpData() was inspired by Perl's Data::Dumper module, although my little function is far less sophisticated. Just in case you were wondering.
VBSdoc - A VBScript API Documentation Generator
API documentation is nice, and being able to generate it from the code is even nicer. However, unlike Perl, Python, Java, or several other languages, VBScript doesn't have a feature or tool that supports this. Which kinda sucks.
I tried VBDOX, but didn't find usability or results too convincing. I also tried doxygen by adapting Basti Grembowietz' Visual Basic doxygen filter. However, doxygen does a lot of things I don't actually need, and I didn't manage to make it do some of the things I do need. Thus I ended up writing my own VBScript documentation generator: VBSdoc. Enjoy.
Active Directory Documentation
When you inherit an existing (usually home-grown) Active Directory, it can be a real pain to figure out how the thing was actually configured by the previous admin(s). In a situation like that it's kinda nice to have a tool at hand that'll do the dirty work for you.
Of course there's pay-ware like ADscribe, but personally I find $99 kinda expensive for something you're going to use every other decade (or so). Microsoft's own Active Directory Topology Diagrammer is freeware (well, sort of, since it requires Visio), but it needs to be installed, and the results weren't that convincing when I tried to run it from outside the target domain.
That is where Nils Kaczenski's José comes in handy. José is a VBScript that can be run either from the command-line or with an HTML Application as a GUI frontend. It doesn't require installation, just unpack the archive wherever you like and run the tool from there.
Not invented here, but since I contributed to the project, I'm borrowing the plumes. ;-)
A Logger Class for VBScript
I got tired of having to re-implement logging routines for my VBScripts on a regular basis, so I wrote a logger class that serves as an abstraction layer for logging to interactive console/desktop, files or eventlog. Now I just instantiate a new logger, define the logging facilities (default is console/desktop for interactive, eventlog for non-interactive execution), and can log away with the same set of methods, regardless of log target. See API documentation for details.
If you want to use the Logger class, either copy/paste the code to your script or import the class file with this neat procedure.
Thanks to Alex and Rico for their valuable input on the class interface.
Update: Version 1.1 released (now including API documentation).
Update: Version 1.2 fixes a bug in error logging to eventlog and adds a global method for standard error message formatting (for convenience).
Update: Version 2.0 changes the class name from LoggerClass to CLogger and adds another global method for error message formatting (with decimal instead of hexadecimal error number format). The global constants were removed to avoid potential conflicts with other imported code.
Interactive VBScript Shell
Python's interactive mode is very convenient, because you can try simple stuff without having to write it to a script first. Since I have to do a lot of VBScript lately, I wanted to have something like that for VBScript, too.
I found this blog post that has almost exactly what I wanted, except for line continuation. Which is what I added (for my own convenience). You can download the modified script here.
Update: Added an Import() procedure for loading/executing additional code from other VBScript files.
Update: vbsh can now be customized via an optional init script "%USERPROFILE%\init.vbs".
Patch for kh2reg.py
On Linux you can simply store a server's public key in your known_hosts file to avoid being prompted for host key verification. However, PuTTY stores server public keys in a different format, so you can't simply import a public key into the Windows registry and be done with it. You can convert known_hosts files to .reg file format with this script from the PuTTY homepage, but unfortunately the script doesn't account for entries that use a non-default port:
[a.b.c.d]:2222 ssh-rsa AAAA...
This patch fixes the issue. You can also download an already patched version of the script.
Update: The official version of kh2reg.py has been updated.
Backscatter Protection
Backscatter (particularly spam-induced backscatter) is one of the major annoyances of the Internet. To get rid of this crap once and for all I wrote a backscatter filter for Postfix.
Mail Encryption Proxy
A quick & dirty Perl script written by Alexander Bernauer and myself, because we needed our ticketing system to be able to send encrypted mail.
Wormhole
Sometimes administrators need to access the computer of a remote user, but depending on the location (e.g. hotels or foreign company networks) NAT or firewalls may get in the way. One method of getting around this problem is to establish an outbound SSH tunnel on the remote user's computer, and then connect back to the computer through that tunnel. However, setting up an SSH tunnel isn't something Joe Average usually is too comfortable with. That's why I wrote wormhole, a little application (actually a shell script encapsulated in an application bundle via Platypus) to make establishing a tunnel as simple as possible for remote Macintosh users.
Personal Firewalls
In 2004 Alexander Bernauer and I evaluated various personal firewalls. Our disillusioning findings have been published in issue #086 of the Datenschleuder, a quarterly journal issued by the Chaos Computer Club.
ntsvcfg
ntsvcfg is a Windows CMD script to automatically deactivate unneeded Windows services for either a standalone computer with its own internet connection or a computer that is part of a local network. I co-authored this script with Torsten Mann, who is hosting and maintaining it.
3D Simulation
Back in college, one of my software engineering classes was a project to develop a simple 3D engine without resorting to existing 3D routines. The implementation of my group was done in Java, because that way it was rather easy to implement the GUI, and the requirements were simple enough to be met by contemporary hardware. It's probably not really helpful to anyone, but it was fun to do, so I'm posting it anyway.
Run simulation
Project report (
, 307 kB, in German language)
Source code (
, 293 kB)
How to Beat Windows Software into Submission
A lot of Windows software requires elevated privileges for no good reason. Usually the problem is simply that the program tries to write someplace where normal users don't have write access, in which case you can mitigate the problem by granting the users write permissions to the respective files, folders or registry keys. Here's a mini-HOWTO on how to identify (and fix) those missing permissions.
Multiboot Linux and Windows
There are some recommended ways in which order to install operating systems in order to get a working dual- or multiboot setup (e.g. install Windows 9x first, then Windows 2000; or install Windows first, then Linux). However, although these are the easiest ways to achieve the goal, they're not the only ones, and may even have considerable disadvantages. Here's how to do it the hard way.


