-
Notifications
You must be signed in to change notification settings - Fork 0
/
UMain.pas
261 lines (227 loc) · 7.53 KB
/
UMain.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
{******************************************************************************}
{ }
{ RainLohmus }
{ }
{ Copyright(c) 2024 Pieter Valentijn }
{ Github Repository <https://github.com/PieterValentijn/rainlohmus.git> }
{ }
{ Distributed under GNU AGPL v3.0 with Commons Clause }
{ }
{ This program is free software: you can redistribute it and/or modify }
{ it under the terms of the GNU Affero General Public License as published }
{ by the Free Software Foundation, either version 3 of the License, or }
{ (at your option) any later version. }
{ }
{ This program is distributed in the hope that it will be useful, }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the }
{ GNU Affero General Public License for more details. }
{ }
{ You should have received a copy of the GNU Affero General Public License }
{ along with this program. If not, see <https://www.gnu.org/licenses/> }
{ }
{******************************************************************************}
unit UMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls,
Vcl.Samples.Spin, SyncObjs,
shellapi, System.Threading;
type
TfmMain = class(TForm)
bGo: TButton;
bStop: TButton;
bShowAccount: TButton;
pcMain: TPageControl;
tsLog: TTabSheet;
tsAbout: TTabSheet;
mabout: TMemo;
mlog: TMemo;
tsSettings: TTabSheet;
spSleep: TSpinEdit;
Label1: TLabel;
Label2: TLabel;
spThreads: TSpinEdit;
Label3: TLabel;
cbAlgo: TComboBox;
procedure bGoClick(Sender: TObject);
procedure bStopClick(Sender: TObject);
procedure bShowAccountClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
DoStop: Boolean;
TotalLogTimes: int64;
aTask: ITask;
procedure RunThread;
procedure AddLine(aString: String);
end;
var
fmMain: TfmMain;
implementation
{$R *.dfm}
uses
web3.eth.types, web3, web3.crypto, web3.utils, web3.eth.crypto;
const
pubkey1 = '0x2B6eD29A95753C3Ad948348e3e7b1A251080Ffb9';
type
TPrivateKeyHack = record
public
Inner: TBytes32;
function ToString: string;
class function Generate: TPrivateKeyHack; static;
function GetAddress: IResult<TAddress>;
end;
procedure TfmMain.AddLine(aString: String);
begin
if mlog.Lines.Count > 1000 then
mlog.Lines.Clear;
mlog.Lines.add(aString);
end;
procedure TfmMain.bGoClick(Sender: TObject);
begin
if fileexists(ChangeFileExt(Application.ExeName, '.YOU_WON_ETH')) then
begin
mlog.Lines.LoadFromFile(ChangeFileExt(Application.ExeName, '.YOU_WON_ETH'));
Exit;
end;
tsSettings.Enabled := False;
TotalLogTimes := 0;
for var i := 1 to spThreads.Value do
RunThread;
end;
procedure TfmMain.bStopClick(Sender: TObject);
begin
DoStop := True;
sleep(spSleep.Value);
end;
procedure TfmMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
DoStop := True;
end;
procedure TfmMain.FormCreate(Sender: TObject);
begin
pcMain.ActivePageIndex := 0;
end;
procedure TfmMain.RunThread;
begin
if spSleep.Value < 0 then
spSleep.Value := 0;
if spSleep.Value <> 0 then
self.WindowState := TWindowState.wsMinimized;
var
sleepvalue := spSleep.Value;
var
Algo := cbAlgo.ItemIndex;
pcMain.ActivePageIndex := 0;
mlog.Clear;
bGo.Enabled := False;
bStop.Enabled := True;
Application.ProcessMessages;
DoStop := False;
aTask := TTask.Create(
procedure
begin
var
totaltry := 0;
var
aMessage := '';
var
pr: TPrivateKeyHack;
pr := TPrivateKeyHack.Generate;
while True do
begin
aMessage := '';
if not DoStop then
sleep(sleepvalue);
if Algo = 0 then
begin
pr := TPrivateKeyHack.Generate;
end
else if Algo = 1 then
begin
var
rnd := random(32);
pr.Inner[rnd] := (pr.Inner[rnd] + 1) mod 256;
end;
inc(totaltry);
if pr.GetAddress.Value.SameAs(pubkey1) then
begin
var
thelist := TStringList.Create();
thelist.Text := pr.ToString;
thelist.add('If you dont know what to do next contact me [email protected]');
thelist.SaveToFile(ChangeFileExt(Application.ExeName, '.YOU_WON_ETH'));
thelist.free;
aMessage := ('You won a lot of ETH use the Private key to access the ETH');
aMessage := aMessage + #13#10 + pr.ToString + #13#10 +
'If you dont know what to do next contact me [email protected]';
DoStop := True;
end
else
begin
var
LogTimes := 1000;
if sleepvalue > 10 then
LogTimes := 100;
if sleepvalue > 200 then
LogTimes := 10;
if (totaltry mod LogTimes) = 0 then
begin
TotalLogTimes := TotalLogTimes + totaltry;
totaltry := 0;
aMessage := ('Tryed ' + TotalLogTimes.ToString + ' times');
end;
end;
TThread.Synchronize(TThread.Current,
procedure
begin
if DoStop then
begin
self.WindowState := TWindowState.wsMaximized;
TotalLogTimes := TotalLogTimes + totaltry;
aMessage := ('Stopped trying ' + TotalLogTimes.ToString + ' times');
bGo.Enabled := True;
bStop.Enabled := False;
tsSettings.Enabled := True;
end;
if aMessage <> '' then
AddLine(aMessage);
end);
if DoStop then
break;
end;
end);
aTask.Start;
end;
procedure TfmMain.bShowAccountClick(Sender: TObject);
begin
var
aString := 'https://etherscan.io/address/0x2b6ed29a95753c3ad948348e3e7b1a251080ffb9';
ShellExecute(self.Handle, 'OPEN', pchar(aString), '', '', 1);
end;
{ TPrivateKeyHack }
class function TPrivateKeyHack.Generate: TPrivateKeyHack;
begin
const
key = TPrivateKey(web3.crypto.generatePrivateKey('ECDSA', SECP256K1));
const
bytes = web3.utils.fromHex(key.ToString);
Result.Inner := byteArrayToBytes32(bytes);
end;
function TPrivateKeyHack.GetAddress: IResult<TAddress>;
begin
try
const
key = TPrivateKey(web3.utils.toHex('', bytes32ToByteArray(self.Inner)));
Result := TResult<TAddress>.Ok(web3.eth.crypto.publicKeyToAddress(web3.crypto.publicKeyFromPrivateKey(key)));
except
Result := TResult<TAddress>.Err(TAddress.Zero, 'Private key is invalid');
end;
end;
function TPrivateKeyHack.ToString: string;
begin
Result := web3.utils.toHex('', bytes32ToByteArray(self.Inner));
end;
end.