unit sl3loc; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, Gauges, IniFiles, HexUtils; type TForm1 = class(TForm) Log: TMemo; Pr: TGauge; LoadL: TBitBtn; Stb: TBitBtn; GroupBox2: TGroupBox; Label2: TLabel; Speed: TEdit; SaltB: TComboBox; Label3: TLabel; Label4: TLabel; Elap: TEdit; Label1: TLabel; ImeiE: TEdit; OpenDialog: TOpenDialog; Rsalt: TCheckBox; procedure LoadLClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure StbClick(Sender: TObject); private { Private declarations } public procedure Rndmc; function Rndc(I: Integer): word; { Public declarations } end; var Form1: TForm1; StartDir: string; OldX : integer; term:boolean; implementation {$R *.dfm} procedure TForm1.LoadLClick(Sender: TObject); label fr; var ifi:TIniFile; s,hash:string; i,j:integer; begin with OpenDialog do begin FilterIndex:=1; InitialDir := ExtractFilePath(FileName); FileName := ExtractFileName(FileName); if not DirectoryExists(InitialDir) then InitialDir := StartDir+'Local_calc\'; DefaultExt := '.bcl'; Filter := 'NCK code calc file (*.bcl)|*.bcl|All files (*.*)|*.*'; Options:=Options+[ofFileMustExist]-[ofHideReadOnly] +[ofNoChangeDir]-[ofNoLongNames]-[ofNoNetworkButton]-[ofHideReadOnly] -[ofOldStyleDialog]-[ofOverwritePrompt]+[ofPathMustExist] -[ofReadOnly]-[ofShareAware]-[ofShowHelp]; Title:='Choose a NCK code calc file '; end;//with OpenDialog if OpenDialog.execute then begin Log.Lines.Add('Open file '+OpenDialog.FileName+' - Ok'); ifi:=TIniFile.Create(OpenDialog.FileName); ImeiE.Text:=ifi.ReadString('Log','imei','123456789012345'); hash:=Copy(ifi.ReadString('Log','hash',''),1,40); if hash ='' then begin Log.Lines.Add('Hash error... '); Log.Lines.Add(''); exit; end; if ImeiE.Text ='123456789012345' then begin Log.Lines.Add('Invalid imei... '); Log.Lines.Add(''); exit; end; SaltB.Clear; if FileExists (ChangeFileExt(OpenDialog.FileName,'.salt')) then begin SaltB.Items.LoadFromFile(ChangeFileExt(OpenDialog.FileName,'.salt')); Log.Lines.Add('Salt file found, loading... - Ok '); end else begin Log.Lines.Add('Generate Salt... '); Pr.MaxValue:=9999; Pr.Progress:=0; if RSalt.Checked then begin Log.Lines.Add('Use random method... '); for i:=0 to 9999 do SaltB.Items.Add(' '); for i:=0 to 9950 do begin s:=IntToStr(hex2dec(IntToHex(i,4))); if Length(s)<4 then while Length(s)< 4 do s:='0'+s; fr: j:=Random(9999); if SaltB.Items.Strings[j]<>' ' then goto fr; SaltB.Items.Strings[j]:=s; Pr.Progress:=i; end; for i:=9951 to 9999 do begin s:=IntToStr(hex2dec(IntToHex(i,4))); if Length(s)<4 then while Length(s)< 4 do s:='0'+s; j:=0; while SaltB.Items.Strings[j]<>' ' do j:=j+1; SaltB.Items.Strings[j]:=s; Pr.Progress:=i; end; end else begin for i:=0 to 9999 do begin s:=IntToStr(hex2dec(IntToHex(i,4))); if Length(s)<4 then while Length(s)< 4 do s:='0'+s; SaltB.Items.Add(s); Pr.Progress:=i; end; end; SaltB.Items.SaveToFile(ChangeFileExt(OpenDialog.FileName,'.salt')); Log.Lines.Add('Curent salt file saved to '+ChangeFileExt(OpenDialog.FileName,'.salt')+' - Ok'); end; end; Pr.Progress:=0; SaltB.ItemIndex:=0; Log.Lines.Add(''); Stb.Enabled:=true; end; procedure TForm1.Rndmc; begin OldX := GetTickCount; end; function TForm1.Rndc(I: Integer): word; var X: Integer; begin X := (35789 * OldX + 13849) mod 65536; OldX := X; X := X mod I; Result:=X and $FFFF; end; procedure TForm1.FormCreate(Sender: TObject); begin Randomize; StartDir:=GetCurrentDir+'\'; Rndmc; Stb.Enabled:=false; term:=false; end; procedure TForm1.StbClick(Sender: TObject); label trm; var all:integer; begin if Stb.Caption='Stop' then begin term:=true; exit; end; LoadL.Enabled:=false; Stb.Caption:='Stop'; Pr.MaxValue:=SaltB.Items.Count; while SaltB.Items.Count<>0 do begin Application.ProcessMessages; if term then goto trm; end; trm: if SaltB.Items.Count<>0 then begin SaltB.Items.SaveToFile(ChangeFileExt(OpenDialog.FileName,'.salt')); Log.Lines.Add('Curent salt file saved... - Ok'); end else begin Log.Lines.Add('Key not found... :('); Stb.Enabled:=false; end; Stb.Caption:='Start'; term:=false; LoadL.Enabled:=true; Log.Lines.Add(''); end; end.