Цитата: Как генерировать типа пароля или просто набор букв цифр.
типа кейген на Inno?
простенький пример:
[more=n1]
; крякми не поддерживает символы и цифры в имени, если вставить через Ctrl + A или Shift + Ins, киген генерит, но обработка такого имени в крякми не предусмотрен
[Setup]
AppName=Keygen for CrackMe v1.0 by Cruehead
AppVerName=Keygen for CrackMe v1.0 by Cruehead
DefaultDirName={tmp}
VersionInfoDescription=Keygen for CrackMe v1.0 by Cruehead
OutputBaseFilename=CM.1.0.CRU.KG
[Messages]
SetupAppTitle=CM.1.0.CRU.KG
[LangOptions]
DialogFontName=Tahoma
DialogFontSize=8
[Code]
const
maxChar = 10;
var
h: Longint;
pass,sn: String;
Form: TSetupForm;
Pwd,PwdNew: TMemo;
str: string;
opStr,snStr:TNewStaticText;
ExitButton,GenerateButton: TButton;
procedure CheckDigits(Sender: TObject; var Key: Char);
begin
if ( (Key = '1') or (Key = '2') or (Key = '3') or (Key = '4')
or (Key = '5') or (Key = '6') or (Key = '7') or (Key = '8')
or (Key = '9') or (Key = '0') or (Key = ' ') or (Key = '~')
or (Key = '`') or (Key = '!') or (Key = '@') or (Key = '"')
or (Key = '#') or (Key = '№') or (Key = '^') or (Key = ':')
or (Key = ';') or (Key = '.') or (Key = '/') or (Key = '*')
or (Key = '$') or (Key = '%') or (Key = '&') or (Key = '(')
or (Key = ')') or (Key = '-') or (Key = '_') or (Key = '=')
or (Key = '|') or (Key = '\') or (Key = '<') or (Key = '>')
or (Key = ',') or (Key = '{') or (Key = '}') or (Key = '[')
or (Key = ']') or (Key = '+') or (Key = '?') or (Key = '''')) then
begin
Key:=#0;
Beep;
PwdNew.Text:='Error! Only letters are allowed!';
Pwd.Text:='';
end;
end;
procedure Generate;
var
s,str: string;
byt: byte;
i,i2: integer;
begin
if Pwd.Text = '' then
begin
PwdNew.Text := 'Enter your name...';
end else
begin
str := Pwd.Text;
str := Uppercase(str);
i := 0;
repeat // запускаем цикл, в котором посимвольно конвертим имя в hex
i := i + 1; // inc ecx
if i <= 10 then // выполняем калькуляцию байтов при условии, что имя содержит до 10 символов
begin
byt := Ord(str[i]); // переводим каждый полученый байт в hex
i2 := i2 + byt; // складываем значения каждого полученного байта
if not ((StrGet(str, i)>='A') and (StrGet(str, i)<='Z')) then // если засекаем алфавит, отличный от английского, делаем побайтный sub 20
i2 := i2 - $20;
end;
until i >= Length(str); // цикл завершается, когда количество символов в имени равно или больше его длины
i2 := i2 xor $5678 xor $1234; // получаем серийник, супер нехитрые вычисления
PwdNew.Text := IntToStr(i2);
end;
end;
procedure GenerateSerial (Sender: TObject);
begin
Generate;
end;
function ShowKeygenForm(): Boolean;
begin
Result := True;
Form := CreateCustomForm();
try
Form.ClientWidth := ScaleX(210);
Form.ClientHeight := ScaleY(112);
Form.Caption := 'Keygen for CrackMe v1.0 by Cruehead';
Form.BorderIcons := [biMinimize];
Form.BorderStyle := bsToolWindow;
Form.Center;
opStr := TNewStaticText.Create(Form);
opStr.Parent := Form;
opStr.Width:= 38;
opStr.Top := 6;
opStr.Left := 8;
opStr.Caption := 'Super name:';
snStr := TNewStaticText.Create(Form);
snStr.Parent := Form;
snStr.Width:= 38;
snStr.Top := 46;
snStr.Left := 8;
snStr.Caption := 'Super serial:';
Pwd := TMemo.Create(Form);
Pwd.Parent := Form;
Pwd.Width := ScaleX(195);
Pwd.Height := ScaleY(18);
Pwd.Left := ScaleX(7);
Pwd.Top := ScaleY(24);
Pwd.Text := '';//ExpandConstant('{username}');
Pwd.WantReturns :=false;
Pwd.WordWrap:=false;
// Pwd.MaxLength:=maxChar;
// Pwd.Alignment:=taCenter;
Pwd.OnKeyPress:=@CheckDigits;
PwdNew := TMemo.Create(Form);
PwdNew.Parent := Form;
PwdNew.Width := ScaleX(195);
PwdNew.Height := ScaleY(18);
PwdNew.Left := ScaleX(7);
PwdNew.Top := ScaleY(64);
PwdNew.WantReturns :=false;
PwdNew.WordWrap:=false;
// PwdNew.Alignment:=taCenter;
GenerateButton := TButton.Create(Form);
GenerateButton.Parent := Form;
GenerateButton.Width := ScaleX(93);
GenerateButton.Height := ScaleY(20);
GenerateButton.Left := ScaleX(8);
GenerateButton.Top := ScaleY(92);
GenerateButton.Caption := 'Generate';
GenerateButton.OnClick := @GenerateSerial;
GenerateButton.Default := true;
ExitButton := TButton.Create(Form);
ExitButton.Parent := Form;
ExitButton.Width := ScaleX(93);
ExitButton.Height := ScaleY(20);
ExitButton.Left := ScaleX(109);
ExitButton.Top := ScaleY(92);
ExitButton.Caption := 'Exit';
ExitButton.ModalResult := mrOk;
ExitButton.Default := true;
Form.ActiveControl := ExitButton;
if Form.ShowModal() = mrOk then
begin
Result := True;
end;
finally
Form.Free();
end;
end;
function InitializeSetup(): Boolean;
begin
Result:=True;
h:=FindWindowByWindowName('Keygen for CrackMe v1.0 by Cruehead');
if h<>0 then
begin
Result:=False;
end else
begin
ShowKeygenForm;
Result:=False;
end;
end;
[/more]
[more=n2][Setup]
AppName=Keygen for Splish CrackMe
AppVerName=Keygen for Splish CrackMe
DefaultDirName={tmp}
VersionInfoDescription=Keygen for Splish CrackMe
OutputBaseFilename=SPLISH.KG
[Messages]
SetupAppTitle=SPLISH.KG
[LangOptions]
DialogFontName=Tahoma
DialogFontSize=8
[Code]
const
maxChar = 10;
var
h: Longint;
pass,sn: String;
Form: TSetupForm;
Pwd,PwdNew: TMemo;
str: string;
opStr,snStr:TNewStaticText;
ExitButton,GenerateButton: TButton;
function NumToHex(b: BYTE): string;
begin
Result := Format('%.2x', [b]);
end;
procedure CheckDigits(Sender: TObject; var Key: Char);
begin
if ( (Key = '1') or (Key = '2') or (Key = '3') or (Key = '4')
or (Key = '5') or (Key = '6') or (Key = '7') or (Key = '8')
or (Key = '9') or (Key = '0') or (Key = ' ') or (Key = '~')
or (Key = '`') or (Key = '!') or (Key = '@') or (Key = '"')
or (Key = '#') or (Key = '№') or (Key = '^') or (Key = ':')
or (Key = ';') or (Key = '.') or (Key = '/') or (Key = '*')
or (Key = '$') or (Key = '%') or (Key = '&') or (Key = '(')
or (Key = ')') or (Key = '-') or (Key = '_') or (Key = '=')
or (Key = '|') or (Key = '\') or (Key = '<') or (Key = '>')
or (Key = ',') or (Key = '{') or (Key = '}') or (Key = '[')
or (Key = ']') or (Key = '+') or (Key = '?') or (Key = '''')) then
begin
Key:=#0;
Beep;
PwdNew.Text:='Error! Only letters are allowed!';
Pwd.Text:='';
end;
end;
procedure Generate;
var
s,str: string;
byt: byte;
i,i2,idiv,i3: integer;
begin
if Pwd.Text = '' then
begin
PwdNew.Text := 'Enter your name...';
end else
begin
str := Pwd.Text;
PwdNew.Text := ''; //
i := 0;
repeat
i := i + 1;
byt := Ord(str[i]);
i2 := byt div $A;
i3 := i2 * $A;
idiv := byt - i3;
i2 := idiv xor (i - 1);
i2 := i2 + 2;
if (i2 >= $A) then
begin
i2 := i2 - $A
end;
i2 := i2 + 2;
begin
s := IntToStr(i2);
i3 := StrToInt('2');
if i3 = Length(s) then
Delete(s,1,1);
end;
PwdNew.Text := PwdNew.Text + s;
until i >= Length(str); // цикл завершается, когда количество символов в имени равно или больше его длины
end;
end;
procedure GenerateSerial (Sender: TObject);
begin
Generate;
end;
function ShowKeygenForm(): Boolean;
begin
Result := True;
Form := CreateCustomForm();
try
Form.ClientWidth := ScaleX(210);
Form.ClientHeight := ScaleY(112);
Form.Caption := 'Keygen for Splish CrackMe';
Form.BorderIcons := [biMinimize];
Form.BorderStyle := bsToolWindow;
Form.Center;
opStr := TNewStaticText.Create(Form);
opStr.Parent := Form;
opStr.Width:= 38;
opStr.Top := 6;
opStr.Left := 8;
opStr.Caption := 'Super name:';
snStr := TNewStaticText.Create(Form);
snStr.Parent := Form;
snStr.Width:= 38;
snStr.Top := 46;
snStr.Left := 8;
snStr.Caption := 'Super serial:';
Pwd := TMemo.Create(Form);
Pwd.Parent := Form;
Pwd.Width := ScaleX(195);
Pwd.Height := ScaleY(18);
Pwd.Left := ScaleX(7);
Pwd.Top := ScaleY(24);
Pwd.Text := ExpandConstant('{username}');
Pwd.WantReturns :=false;
Pwd.WordWrap:=false;
// Pwd.MaxLength:=maxChar;
// Pwd.Alignment:=taCenter;
// Pwd.OnKeyPress:=@CheckDigits;
PwdNew := TMemo.Create(Form);
PwdNew.Parent := Form;
PwdNew.Width := ScaleX(195);
PwdNew.Height := ScaleY(18);
PwdNew.Left := ScaleX(7);
PwdNew.Top := ScaleY(64);
PwdNew.WantReturns :=false;
PwdNew.WordWrap:=false;
// PwdNew.Alignment:=taCenter;
PwdNew.ReadOnly:=True;
GenerateButton := TButton.Create(Form);
GenerateButton.Parent := Form;
GenerateButton.Width := ScaleX(93);
GenerateButton.Height := ScaleY(20);
GenerateButton.Left := ScaleX(8);
GenerateButton.Top := ScaleY(92);
GenerateButton.Caption := 'Generate';
GenerateButton.OnClick := @GenerateSerial;
GenerateButton.Default := true;
ExitButton := TButton.Create(Form);
ExitButton.Parent := Form;
ExitButton.Width := ScaleX(93);
ExitButton.Height := ScaleY(20);
ExitButton.Left := ScaleX(109);
ExitButton.Top := ScaleY(92);
ExitButton.Caption := 'Exit';
ExitButton.ModalResult := mrOk;
ExitButton.Default := true;
Generate;
Form.ActiveControl := ExitButton;
if Form.ShowModal() = mrOk then
begin
Result := True;
end;
finally
Form.Free();
end;
end;
function InitializeSetup(): Boolean;
begin
Result:=True;
h:=FindWindowByWindowName('Keygen for Splish CrackMe');
if h<>0 then
begin
Result:=False;
end else
begin
ShowKeygenForm;
Result:=False;
end;
end;
[/more]