-
Notifications
You must be signed in to change notification settings - Fork 2
/
pvpgn.txt
247 lines (214 loc) · 7.74 KB
/
pvpgn.txt
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
Script("Name") = "PvPGN Enabler"
Script("Author") = "Hdx"
Script("Major") = 0
Script("Minor") = 3
Script("Revision") = 0
Script("Description") = "Forces SB to use XSHA1 hashed passwords when logging into Battle.net, " & _
"because PvPGN servers use outdated ones like that. " & _
"Also forces SB to send your password in plain text when creating a WC3 account, " & _
"because PvPGNs are insecure like that."
'=====================================================
'Change Log:
'=====================================================
' v0.3.0:
' Will now translate the Online Status field in WC3
' clan member list, and clan update to something SB
' can handle. Therefore fixing Error #35600.
' Note: This error has been fixed in StealthBot as of
' build #449
'
' v0.2.0:
' Can now create Accounts on PvPGN servers
'
' v0.1.0:
' Initial Creation, Can login to PvPGN servers using
' XSHA1 passwords.
'=====================================================
Const SID_AUTH_ACCOUNTCREATE = &H52
Const SID_AUTH_ACCOUNTLOGONPROOF = &H54
Const SID_CLANMEMBERLIST = &H7D
Const SID_CLANMEMBERSTATUSCHANGE = &H7F
Dim SwitchPackets
Sub Event_Load()
SwitchPackets = True
End Sub
Sub Event_PacketSent(Protocol, ID, Length, Data)
If UCase(Protocol) = "BNCS" Then
Data = Mid(Data, 5) ' Strip The Header
Select Case ID
Case SID_AUTH_ACCOUNTCREATE: Call SEND_SID_AUTH_ACCOUNTCREATE (Data)
Case SID_AUTH_ACCOUNTLOGONPROOF: Call SEND_SID_AUTH_ACCOUNTLOGONPROOF(Data)
End Select
End If
End Sub
Sub Event_PacketReceived(Protocol, ID, Length, Data)
If UCase(Protocol) = "BNCS" Then
Data = Mid(Data, 5) ' Strip The Header
Select Case ID
Case SID_CLANMEMBERLIST: Call RECV_SID_CLANMEMBERLIST (Data)
Case SID_CLANMEMBERSTATUSCHANGE: Call RECV_SID_CLANMEMBERSTATUSCHANGE(Data)
End Select
End If
End Sub
'=======================================
'SID_AUTH_ACCOUNTCREATE (0x52) C->S
'=======================================
' For Normal Battle.Net:
' (BYTE[32]) Salt (s)
' (BYTE[32]) Verifier (v)
' (STRING) Username
'
' For PvPGN:
' (BYTE[32]) Salt (s)
' (BYTE[32]) Plain Text Password
' (STRING) Username
'=======================================
Sub SEND_SID_AUTH_ACCOUNTCREATE(Data)
If (SwitchPackets = True) Then
Dim pBuff
Dim Salt
Dim Username
Set pBuff = SSC.DataBufferEx()
With pBuff
.Data = Data
Salt = .GetRaw(32)
.GetRaw(32)
Username = .GetString()
.Clear
.InsertNonNTString Salt
.InsertNonNTString Left(BotVars.Password & String(32, Chr(0)), 32) 'Note: This does not modify the password's casing,
'I do not know if PvPGN does that. I need someone
'to confirm/deny that it does.
.InsertNTString CStr(Username)
VetoThisMessage 'Don't Send Verifier
SwitchPackets = False
AddChat vbYellow, "[PPGN] Switching password verifier to plain text password"
.SendPacket SID_AUTH_ACCOUNTCREATE
SwitchPackets = True
End With
Set pBuff = Nothing
End If
End Sub
'=======================================
'SID_AUTH_ACCOUNTLOGONPROOF (0x54) C->S
'=======================================
' For Normal Battle.Net:
' (BYTE[20]) Client Password Proof (M1)
'
' For PvPGN:
' (BYTE[20]) XSHA1 Password Hash
'=======================================
Sub SEND_SID_AUTH_ACCOUNTLOGONPROOF(Data)
If (SwitchPackets = True) Then
Dim pBuff
Dim passHash
passHash = SSC.XSHA1(BotVars.Password) 'Note: This does not modify the password's casing,
'I do not know if PvPGN does that. I need someone
'to confirm/deny that it does.
If Len(passHash) = 20 Then
VetoThisMessage 'Don't Send M1
SwitchPackets = False
AddChat vbYellow, "[PPGN] Switching password proof to XSHA1 Hash"
Set pBuff = SSC.DataBufferEx()
pBuff.InsertNonNTString CStr(passHash)
pBuff.SendPacket SID_AUTH_ACCOUNTLOGONPROOF
Set pBuff = Nothing
SwitchPackets = True
Else
AddChat vbYellow, "[PPGN] Could not XSHA1 Hash your password, proceeding with SRP login"
End If
End If
End Sub
'============================================
'SID_CLANMEMBERLIST (0x7D) S->C
'============================================
' (DWORD) Cookie
' (BYTE) Number of Members
' For each member:
' (STRING) Username
' (BYTE) Rank
' (BYTE) Online Status
' (STRING) Location
'============================================
' On normal Battle.net the 'Online Status'
'byte is always either 1 or 0, yes/no.
'SB does some bad math with this. which beaks
'if that field is anything but 1/0.
'This bug has been fixed in the latest SVN
'Build 449+, but for now I can script the fix.
'============================================
Sub RECV_SID_CLANMEMBERLIST(Data)
If (SwitchPackets = True) Then
Dim inBuff
Dim outBuff
Dim count
Dim x
Dim status
Set inBuff = SSC.DataBufferEx()
Set outBuff = SSC.DataBufferEx()
inBuff.Data = Data
VetoThisMessage
With outBuff
'Insert Dummy BNCS Header
.InsertByte &HFF
.InsertBYTE SID_CLANMEMBERLIST
.InsertWord 0
.InsertDWORD inBuff.GetDWORD
count = inBuff.GetByte
.InsertByte count
For x = 1 to Count
.InsertNTString inBuff.GetString
.InsertByte inBuff.GetByte
status = inBuff.GetByte
If (status = 0) Then
.InsertByte 0
Else
.InsertByte 1
End If
.InsertNTString inBuff.GetString
Next
SwitchPackets = False
SSC.ForceBNCSPacketParse .Data
SwitchPackets = True
End With
End If
End Sub
'============================================
'SID_CLANMEMBERLIST (0x7D) S->C
'============================================
' (STRING) Username
' (BYTE) Rank
' (BYTE) Status
' (STRING) Location
'============================================
' SB does some bad math with the 'Status' field
'This bug has been fixed in the latest SVN
'Build 449+, but for now I can script the fix.
'============================================
Sub RECV_SID_CLANMEMBERSTATUSCHANGE(Data)
If (SwitchPackets = True) Then
Dim inBuff
Dim outBuff
Set inBuff = SSC.DataBufferEx()
Set outBuff = SSC.DataBufferEx()
inBuff.Data = Data
VetoThisMessage
With outBuff
'Insert Dummy BNCS Header
.InsertByte &HFF
.InsertBYTE SID_CLANMEMBERSTATUSCHANGE
.InsertWord 0
.InsertNTString inBuff.GetString
.InsertByte inBuff.GetByte
If (inBuff.GetByte = 0) Then
.InsertByte 0
Else
.InsertByte 1
End If
.InsertNTString inBuff.GetString
SwitchPackets = False
SSC.ForceBNCSPacketParse .Data
SwitchPackets = True
End With
End If
End Sub