-
Notifications
You must be signed in to change notification settings - Fork 189
/
WinBruteLogon.dpr
147 lines (117 loc) · 3.71 KB
/
WinBruteLogon.dpr
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
(*******************************************************************************
Jean-Pierre LESUEUR (@DarkCoderSc)
https://www.phrozen.io/
License : MIT
*******************************************************************************)
program WinBruteLogon;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
Windows,
UntWorker in 'Units\UntWorker.pas',
UntFunctions in 'Units\UntFunctions.pas',
UntStringDefs in 'Units\UntStringDefs.pas',
UntGlobalDefs in 'Units\UntGlobalDefs.pas',
UntTypeDefs in 'Units\UntTypeDefs.pas';
{-------------------------------------------------------------------------------
Help Banner
-------------------------------------------------------------------------------}
procedure DisplayHelpBanner(AErrorMsg : String = ''; AFull : Boolean = False);
begin
if AFull then begin
WriteLn;
WriteColoredWord('WinBruteLogon', FOREGROUND_GREEN);
WriteLn(' PoC');
WriteLn('Jean-Pierre LESUEUR (@DarkCoderSc)');
WriteLn('https://github.com/darkcodersc');
WriteLn('https://www.phrozen.io/');
WriteLn;
end;
if (AErrorMsg <> '') then begin
Debug(AErrorMsg, dlError);
WriteLn;
end;
///
Write('Usage: ');
WriteColoredWord('winbrutelogon');
WriteLn('.exe -u <username> -w <wordlist_file>');
Write(StringOfChar(' ', 7));
WriteColoredWord('winbrutelogon');
WriteLn('.exe -h : Show help.');
if AFull then begin
WriteLn;
WriteLn('-h : Display this menu.');
WriteLn('-u : Username to crack.');
WriteLn('-d : Optional domain name.');
WriteLn('-w : Wordlist file.');
WriteLn(' - : Read wordlist from Stdin.');
WriteLn('-v : Verbose mode.');
WriteLn;
end;
end;
{-------------------------------------------------------------------------------
Program Entry
-------------------------------------------------------------------------------}
var AWorkers : TWorkers = nil;
AUserName : String = '';
ADomainName : String = '';
AWordlist : String = '';
AWordlistMode : TWordlistMode = wmUndefined;
begin
IsMultiThread := True;
///
try
{
Parse Parameters
}
if CommandLineOptionExists('h') then begin
DisplayHelpBanner('', True);
Exit();
end;
// --
if NOT GetCommandLineOption('u', AUserName) then
raise EOptionException.Create('You need to specify a target username with option `-u`.\nYou can run `net user` command to enumerate available users.');
if GetCommandLineOption('w', AWordlist) then begin
AWordlistMode := wmFile;
if NOT FileExists(AWordlist) then
raise Exception.Create(Format(SD_FILE_NOT_FOUND, [AWordlist]));
end else if CommandLineOptionExists('-') then
AWordlistMode := wmStdin;
///
if (AWordlistMode = wmUndefined) then
raise EOptionException.Create('You need to specify a wordlist file with option `-w` or via stdin with option `-`.');
GetCommandLineOption('d', ADomainName);
G_DEBUG := CommandLineOptionExists('v');
{
Configure and start cracking process
}
AWorkers := TWorkers.Create(AUserName, AWordlistMode, ADomainName);
case AWordlistMode of
wmFile : begin
AWorkers.WordlistFile := AWordlist;
end;
{
... : begin
end;
}
end;
{
Build wordlist in memory with chosen mode
}
if not AWorkers.Build() then
raise Exception.Create('Could not build wordlist in memory.');
{
Start cracking process
}
AWorkers.Start();
except
on E : EOptionException do
DisplayHelpBanner(E.Message);
on E : Exception do begin
if (E.Message <> '') then
Debug(Format('message=[%s]', [E.Message]), dlError);
end;
end;
end.