#! /usr/bin/perl
#
# translate_homepage.HTML.pl (translated from homepage.HTML.vbs
# [VBScript] to Perl by Avi Green <avi-cfengine@sputnik7.com>
#
# Usage example: ./translate_homepage.HTML.pl < coded_worm.dat > worm.vbs
#
# This program requires the binary worm code to be present (e.g. as the
# "coded_worm.dat" file).  If you don't have that file, you can copy it
# from the "Execute DeCode" statement in the worm email attachment,
# "homepage.HTML.VBS".

sub DeCode {
    $Coded = $_[0];
    for($I=1; $I <= length($Coded); $I++) {
	$CurChar= substr($Coded, $I, 1);
	if (ord($CurChar) == 15) {
	    $CurChar = chr(10);
	} elsif (ord($CurChar) == 16) {
	    $CurChar = chr(13);
	} elsif (ord($CurChar) == 17) {
	    $CurChar = chr(32);
	} elsif (ord($CurChar) == 18) {
	    $CurChar = chr(9);
	} else {
	    $CurChar = chr(ord($CurChar) - 2);
	}
	print $CurChar;
    }
}

&DeCode(`cat`);

print "\n";
