#!/usr/bin/env python # ICQ Update File Creator by Daniel Seither (post@tiwoc.de) # # Parameter: # filename of .exe that should be delivered as an update for ICQ.exe # # Overwrites ICQ.zip and updates.xml in the current directory # without a warning! import sys, os from hashlib import md5 from zipfile import ZipFile, ZIP_DEFLATED if len(sys.argv) < 2: print "argument missing" sys.exit(1) f = open(sys.argv[1]) payload = f.read() f.close() payload_checksum = md5(payload).hexdigest() payload_size = len(payload) f = ZipFile('ICQ.zip', 'w') f.write(sys.argv[1], 'ICQ.exe', ZIP_DEFLATED) f.close() payload_compressed = os.path.getsize('ICQ.zip') updatesfile = ('' + '' + '' + '' + '' ) % (payload_checksum, payload_size, payload_compressed) updatesfile_checksum = md5(updatesfile).hexdigest() updatesfile = '\r\n%s' % (updatesfile_checksum, updatesfile) f = open('updates.xml', 'w') f.write(updatesfile) f.close