Tootoot222
2009-04-14 09:07:40
This little script downloads the .key files required to use Kaspersky's AV products (Kaspersky Internet Security [KIS] or Kaspersky Anti Virus [KAV]). i made this because i was trying to avoid doing my schoolwork =P
Anyways, fill out the constants, and let it fly! (probably want to leave MKey to True, as i doubt you're using the Chinese version of kaspersky… also, kis 7 keys work even if you have kis 8, so if there isn't any working kis8's, grab a 7)
Anyways, fill out the constants, and let it fly! (probably want to leave MKey to True, as i doubt you're using the Chinese version of kaspersky… also, kis 7 keys work even if you have kis 8, so if there isn't any working kis8's, grab a 7)
program KavKisKeyDownloader;
const
Kis = True; //True if you want Kis keys
Ver = '8';
MKey = True; //False if you want the Chinese keys...
SaveDir = 'C:\KavKisKeys\';
var
Prod, CMN: String;
function GetAllKeys(Skip: TStringArray; Data: String): TStringArray;
var
P, L: Integer;
SP, K: String;
begin
SP:= Prod + Ver + '-' + CMN;
P:= Pos(SP, Data);
while(P > 0) do
begin
K:= Copy(Data, P, PosEx(''' target=lu>', Data, P) - P) + '.KEY';
if(Length(K) = 29) then
begin
SetLength(Result, L + 1);
Result[L]:= K;
L:= L + 1;
end;
P:= PosEx(SP, Data, P + Length(SP));
end;
end;
var
I, L, X: Integer;
S, K, SavePath: String;
FoundKeys: TStringArray;
begin
ClearDebug;
Prod:= 'KAV';
if(Kis) then
Prod:= 'KIS';
CMN:= 'CN';
if(MKey) then
CMN:= 'CM';
S:= GetPage('http://www.kavkiskey.com/');
I:= Pos('Last updated', S);
Writeln(Copy(S, I, PosEx('</span>', S, I) - I));
L:= High(Explode(Prod + Ver + '-' + CMN, S));
if(not(L < 1)) then
Writeln('There are ' + IntToStr(L) + ' ' + Prod + Ver + '-' + CMN + ' keys available.')
else
if(not(Length(Explode(Prod + Ver + '-' + CMN, S)) = 0)) then
Writeln('There is 1 ' + Prod + Ver + '-' + CMN + ' key available.')
else
begin
Writeln('There are no ' + Prod + Ver + '-' + CMN + ' keys available.');
TerminateScript;
end;
SavePath:= SaveDir;
if(not(EndsWith('\', SavePath))) then
SavePath:= SavePath + '\';
if(not(DirectoryExists(SavePath))) then
CloseFile(RewriteFile(SavePath, False));
FoundKeys:= GetAllKeys([], S);
for I:= High(FoundKeys) downto 0 do
begin
Writeln(FoundKeys[I]);
if(FoundKeys[I] = '') then
Continue;
K:= GetPage('http://www.kavkiskey.com/upfile/' + FoundKeys[I]);
if(K = '') then
Continue;
X:= RewriteFile(SavePath + FoundKeys[I], False);
WriteFileString(X, K);
CloseFile(X);
end;
end.