-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathLicense.vb
785 lines (628 loc) · 24.3 KB
/
License.vb
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
Imports System
Imports System.Net
Imports System.Text
Imports System.IO
Imports System.IO.Compression
Imports System.Diagnostics
Imports System.Reflection
Imports System.Windows.Forms
Imports System.ComponentModel
Imports System.Security.Cryptography
Imports System.Collections.Generic
Imports System.Runtime.InteropServices
Imports System.Net.Security
Imports System.Security
Imports System.Security.Cryptography.X509Certificates
''' <summary>
''' License Loader, Version: 2.0.0.7, Changed: 09/05/2013
''' </summary>
Friend NotInheritable Class License
#Region " ReadOnly Properties "
ReadOnly Property Username As String
Get
Dim Data As Object = Instance.GetMethod("GetUsername").Invoke(Nothing, Nothing)
Return DirectCast(Data, String)
End Get
End Property
Private _ProductVersion As Version
ReadOnly Property ProductVersion As Version
Get
If _ProductVersion Is Nothing Then
_ProductVersion = New Version(Application.ProductVersion)
End If
Return _ProductVersion
End Get
End Property
ReadOnly Property ExecutablePath As String
Get
Dim Data As Object = Instance.GetMethod("GetExecutablePath").Invoke(Nothing, Nothing)
Return DirectCast(Data, String)
End Get
End Property
ReadOnly Property GlobalMessage As String
Get
Dim Data As Object = Instance.GetMethod("GetMessage").Invoke(Nothing, Nothing)
Return DirectCast(Data, String)
End Get
End Property
ReadOnly Property IPAddress As IPAddress
Get
Dim Data As Object = Instance.GetMethod("GetIPAddress").Invoke(Nothing, Nothing)
Return DirectCast(Data, IPAddress)
End Get
End Property
ReadOnly Property ExpirationDate As Date
Get
Dim Data As Object = Instance.GetMethod("GetExpiration").Invoke(Nothing, Nothing)
Return DirectCast(Data, Date)
End Get
End Property
ReadOnly Property TimeRemaining As TimeSpan
Get
Dim Data As Object = Instance.GetMethod("GetRemaining").Invoke(Nothing, Nothing)
Return DirectCast(Data, TimeSpan)
End Get
End Property
ReadOnly Property LicenseType As LicenseType
Get
Dim Data As Object = Instance.GetMethod("GetLicenseType").Invoke(Nothing, Nothing)
Return DirectCast(Data, LicenseType)
End Get
End Property
ReadOnly Property Points As Integer
Get
Dim Data As Object = Instance.GetMethod("GetPoints").Invoke(Nothing, Nothing)
Return DirectCast(Data, Integer)
End Get
End Property
ReadOnly Property UnlimitedTime As Boolean
Get
Dim Data As Object = Instance.GetMethod("GetUnlimitedTime").Invoke(Nothing, Nothing)
Return DirectCast(Data, Boolean)
End Get
End Property
ReadOnly Property UpdateAvailable As Boolean
Get
Dim Data As Object = Instance.GetMethod("GetUpdateAvailable").Invoke(Nothing, Nothing)
Return DirectCast(Data, Boolean)
End Get
End Property
ReadOnly Property UsersCount As Integer
Get
Dim Data As Object = Instance.GetMethod("GetUsersCount").Invoke(Nothing, Nothing)
Return DirectCast(Data, Integer)
End Get
End Property
ReadOnly Property UsersOnline As Integer
Get
Dim Data As Object = Instance.GetMethod("GetUsersOnline").Invoke(Nothing, Nothing)
Return DirectCast(Data, Integer)
End Get
End Property
ReadOnly Property GUID As String
Get
Dim Data As Object = Instance.GetMethod("GetGUID").Invoke(Nothing, Nothing)
Return DirectCast(Data, String)
End Get
End Property
ReadOnly Property PublicToken As String
Get
Dim Data As Object = Instance.GetMethod("GetPublicToken").Invoke(Nothing, Nothing)
Return DirectCast(Data, String)
End Get
End Property
ReadOnly Property PrivateKey As Byte()
Get
Dim Data As Object = Instance.GetMethod("GetPrivateKey").Invoke(Nothing, Nothing)
Return DirectCast(Data, Byte())
End Get
End Property
ReadOnly Property Client As WebClient
Get
Dim Data As Object = Instance.GetMethod("GetClient").Invoke(Nothing, Nothing)
Return DirectCast(Data, WebClient)
End Get
End Property
ReadOnly Property News As NewsPost()
Get
Dim Data As Object = Instance.GetMethod("GetNews").Invoke(Nothing, Nothing)
Dim Values As Object() = DirectCast(Data, Object())
Dim Section As Integer
Dim T As New List(Of NewsPost)
For I As Integer = 0 To Values.Length - 1 Step 3
Section = I * 3
T.Add(New NewsPost(Values(I), Values(I + 1), Values(I + 2)))
Next
Return T.ToArray()
End Get
End Property
#End Region
#Region " Initialize Properties "
Private _ID As String
Property ID() As String
Get
Return _ID
End Get
Set(ByVal value As String)
_ID = value
End Set
End Property
Private _Catch As Boolean = True
Property [Catch]() As Boolean
Get
Return _Catch
End Get
Set(ByVal value As Boolean)
_Catch = value
End Set
End Property
Private _DisableUpdates As Boolean
Property DisableUpdates() As Boolean
Get
Return _DisableUpdates
End Get
Set(ByVal value As Boolean)
_DisableUpdates = value
End Set
End Property
Private _RunHook As GenericDelegate
Property RunHook() As GenericDelegate
Get
Return _RunHook
End Get
Set(ByVal value As GenericDelegate)
_RunHook = value
End Set
End Property
Private _BanHook As GenericDelegate
Property BanHook() As GenericDelegate
Get
Return _BanHook
End Get
Set(ByVal value As GenericDelegate)
_BanHook = value
End Set
End Property
Private _RenewHook As GenericDelegate
Property RenewHook() As GenericDelegate
Get
Return _RenewHook
End Get
Set(ByVal value As GenericDelegate)
_RenewHook = value
End Set
End Property
Private _Protection As RuntimeProtection
Property Protection() As RuntimeProtection
Get
Return _Protection
End Get
Set(ByVal value As RuntimeProtection)
_Protection = value
End Set
End Property
Private _ValidateCore As Boolean = True
Property ValidateCore As Boolean
Get
Return _ValidateCore
End Get
Set(ByVal value As Boolean)
_ValidateCore = value
End Set
End Property
#End Region
#Region " Public Methods "
Sub Initialize(ByVal programID As String)
ID = programID
Initialize()
End Sub
Sub Initialize()
If LicenseGlobal.LicenseInitialize Then Return
LicenseGlobal.LicenseInitialize = True
If String.IsNullOrEmpty(ID) Then
ErrorKill("Unable to initialize due to missing Net Seal ID.")
Return
End If
ServicePointManager.Expect100Continue = False
ServicePointManager.DefaultConnectionLimit = 5
Try
WC = New CookieClient()
Dim Common As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
LocationPath = Path.Combine(Common, "Nimoru")
LicenseLocation = Path.Combine(LocationPath, "LicenseSE")
GizmoDllLocation = Path.Combine(LocationPath, "GizmoDll")
GizmoLocation = Path.Combine(LocationPath, "GizmoSE")
OverrideSSL() '--BEGIN OVERRIDE--
DownloadChecksums()
DownloadComponents()
RestoreSSL() '--END OVERRIDE--
Endpoint = Checksums(5)
ValidateSignature()
Instance.GetMethod("SetID").Invoke(Nothing, New Object() {ID})
Instance.GetMethod("SetCatch").Invoke(Nothing, New Object() {[Catch]})
Instance.GetMethod("SetDisableUpdates").Invoke(Nothing, New Object() {DisableUpdates})
Instance.GetMethod("SetRunHook").Invoke(Nothing, New Object() {RunHook})
Instance.GetMethod("SetBanHook").Invoke(Nothing, New Object() {BanHook})
Instance.GetMethod("SetRenewHook").Invoke(Nothing, New Object() {RenewHook})
Instance.GetMethod("SetScan").Invoke(Nothing, New Object() {DirectCast(Protection, Byte)})
Catch ex As Exception
Dim T As New StringBuilder
T.AppendLine(Date.UtcNow.ToString)
T.AppendLine()
T.AppendLine(ex.Message)
T.AppendLine(ex.StackTrace)
File.WriteAllText("loader.log", T.ToString)
ErrorKill("Unable to continue due to an error. Exception written to 'loader.log' file.")
Return
End Try
Try
Instance.GetMethod("RunWE").Invoke(Nothing, New Object() {Version, ProductVersion, Endpoint})
Catch
ErrorKill("Unable to initialize license file.")
End Try
End Sub
Sub ShowAccount()
Instance.GetMethod("ShowAccount").Invoke(Nothing, Nothing)
End Sub
Function Encrypt(ByVal data As String) As String
InitializeRm()
Dim R As Byte() = Encoding.UTF8.GetBytes(data)
Dim O As Byte() = Encryptor.TransformFinalBlock(R, 0, R.Length)
Dim U(O.Length + 3) As Byte
Buffer.BlockCopy(BitConverter.GetBytes(data.Length), 0, U, 0, 4)
Buffer.BlockCopy(O, 0, U, 4, O.Length)
Return Convert.ToBase64String(U)
End Function
Function Decrypt(ByVal data As Byte()) As Byte()
InitializeRm()
Dim Size As Integer = BitConverter.ToInt32(data, 0)
Dim O As Byte() = Decryptor.TransformFinalBlock(data, 4, data.Length - 4)
Dim U(Size - 1) As Byte
Buffer.BlockCopy(O, 0, U, 0, Size)
Return U
End Function
'NOTE: If String.IsNullOrEmpty() get new posts from License.News.
Function GetPostMessage(ByVal postID As Integer) As String
Dim Data As Object = Instance.GetMethod("GetPostMessage").Invoke(Nothing, New Object() {postID})
Return DirectCast(Data, String)
End Function
Function GetVariable(ByVal name As String) As String
Dim Data As Object = Instance.GetMethod("GetVariable").Invoke(Nothing, New Object() {name})
Return DirectCast(Data, String)
End Function
Function SpendPoints(ByVal count As Integer) As Boolean
Dim Data As Object = Instance.GetMethod("SpendPoints").Invoke(Nothing, New Object() {count})
Return DirectCast(Data, Boolean)
End Function
Sub InstallUpdates()
Instance.GetMethod("InstallUpdates").Invoke(Nothing, Nothing)
End Sub
Sub BanCurrentUser(ByVal reason As String)
Instance.GetMethod("BanCurrentUser").Invoke(Nothing, New Object() {reason})
End Sub
#End Region
#Region " System Declarations "
'IMPORTANT: DO NOT CHANGE THIS!
Private Version As New Version("2.0.0.6")
Private Instance As Type
Private WC As CookieClient
Private LocationPath As String
Private LicenseLocation As String
Private GizmoDllLocation As String
Private GizmoLocation As String
Private Checksums As String()
Private Endpoint As String
Private Const Domain1 As String = "http://seal.nimoru.com/Base/"
Private Const Domain2 As String = "https://s3.amazonaws.com/nimoru/"
Private Const PublicKey As String = "BgIAAAAiAABEU1MxAAQAAKVlurdZMaHymNk04yRy3VGj0Bhf6gGIBsGr1zk42LrdnwYLfvn7MBAiYoCH2cD07M/HuM6NW1WqJQVF2omwH5S211wfvBCutU92RxXldmfvd06l8eQqmppztYIrXdxmW0BRlosBKPM5ms6YXZnoMKseAoqZ6Ajza8U9QCJMkSHSR+O23EoGj9V+7xwkCoYHklFtLJzERB6y/DW1BCCHhLblzpFz+mht1CD6xAi2QBNY7vZcWdbqo+ZLT4y7sw8jU61liYBuZLA/t+6KHhoIwZ+NIErsCHW5RD9ln5VpMC66wBCcY594ZTIManIuvmpw4eQaUXZPoMogf29gJgJSolaDg5iP1XDqzOTPu9RdsHe3R1ZaNglrL05zoTM94Zkl5KT+bPAUC99kGrEDmNipe6tj8FwoOTNNaTaOvWZlXTtAfaxqGV47nxKfabgxEl08n0c3PBJEjUZzJ4chwQ2Ex2A5uYBgRukcmKmRmdwIphHq0IwdoxS1+6HSwXxg1d3EEAoxJ75R1eSXF+cXOeC7d/U2UY0tqwAAAMvTiz5uMzpBQIYdNcbYnrJwHObk"
Private ReadOnly Property UID As String
Get
Return "?uid=" & BitConverter.ToString(BitConverter.GetBytes(Environment.TickCount)).Replace("-", "")
End Get
End Property
Private Encryptor As ICryptoTransform
Private Decryptor As ICryptoTransform
Private RmInitialize As Boolean
<EditorBrowsable(EditorBrowsableState.Advanced)> _
Delegate Sub GenericDelegate()
<DllImport("kernel32.dll", EntryPoint:="ExitProcess")> _
Private Shared Sub ExitProcess(ByVal code As UInteger)
End Sub
<DllImport("mscoree.dll", EntryPoint:="StrongNameSignatureVerificationEx", CharSet:=CharSet.Unicode)> _
Private Shared Function StrongNameSignatureVerificationEx( _
ByVal fileName As String, _
ByVal force As Boolean, _
ByRef genuine As Boolean) As Boolean
End Function
<DllImport("mscoree.dll", PreserveSig:=False, EntryPoint:="CLRCreateInstance")> _
Private Shared Function CreateInstance( _
<MarshalAs(UnmanagedType.LPStruct)> ByVal cid As Guid, _
<MarshalAs(UnmanagedType.LPStruct)> ByVal iid As Guid) As <MarshalAs(UnmanagedType.Interface)> Object
End Function
#End Region
#Region " System Methods "
Private Sub DownloadChecksums()
Try
Checksums = WC.DownloadString(Domain1 & "checksumSE.php" & UID).Split(Char.MinValue)
Catch ex As Exception
Threading.Thread.Sleep(500)
Checksums = WC.DownloadString(Domain2 & "checksumSE.txt" & UID).Split(Convert.ToChar(124))
End Try
End Sub
Private Sub DownloadComponents()
Dim Hash As String
If Not Directory.Exists(LocationPath) Then
Directory.CreateDirectory(LocationPath)
End If
If Not File.Exists(GizmoDllLocation) Then
DownloadGizmoDll()
End If
Hash = MD5File(GizmoDllLocation)
If Not Hash = Checksums(1) Then
DownloadGizmoDll()
End If
If Not File.Exists(GizmoLocation) Then
DownloadGizmo()
End If
Hash = MD5File(GizmoLocation)
If Not Hash = Checksums(2) Then
DownloadGizmo()
End If
If Not File.Exists(LicenseLocation) Then
DownloadLicense()
End If
Hash = MD5File(LicenseLocation)
If Not Hash = Checksums(3) Then
DownloadLicense()
End If
End Sub
Private Sub ValidateSignature()
If ValidateCore AndAlso Not CheckCore() Then
Throw New InvalidDataException("Core framework files are not trusted.")
Return
End If
Dim M As FileStream = File.OpenRead(LicenseLocation)
Dim R As New BinaryReader(M)
Dim FullData As Byte() = R.ReadBytes(CInt(M.Length))
M.Position = 2
Dim Sign As Byte() = R.ReadBytes(40)
Dim Data As Byte() = R.ReadBytes(CInt(M.Length - Sign.Length - 2))
R.Close()
Dim DSA As New DSACryptoServiceProvider
DSA.ImportCspBlob(Convert.FromBase64String(PublicKey))
If DSA.VerifyData(Data, Sign) Then
Instance = Assembly.Load(FullData).GetType("Share")
Else
Throw New InvalidDataException("Unable to validate signature.")
End If
End Sub
Private Sub DownloadGizmoDll()
Dim Data As Byte() = WC.DownloadData(Checksums(0) & Checksums(1) & ".co")
Data = Decompress(Data)
Dim Hash As String = MD5(Data)
If Not Checksums(1) = Hash Then
Fail(GizmoDllLocation)
Return
End If
File.WriteAllBytes(GizmoDllLocation, Data)
End Sub
Private Sub DownloadGizmo()
Dim Data As Byte() = WC.DownloadData(Checksums(0) & Checksums(2) & ".co")
Data = GizmoDecompress(Data)
Dim Hash As String = MD5(Data)
If Not Checksums(2) = Hash Then
Fail(GizmoLocation)
Return
End If
File.WriteAllBytes(GizmoLocation, Data)
End Sub
Private Sub DownloadLicense()
Dim PI As New ProcessStartInfo
PI.Arguments = String.Format("""{0}"" ""{1}"" {2} -s", Checksums(0) & Checksums(3) & ".co", LicenseLocation, Checksums(3))
PI.FileName = GizmoLocation
PI.UseShellExecute = False
Dim P As Process = Process.Start(PI)
If Not P.WaitForExit(20000) Then
Environment.Exit(0)
End If
If Not P.ExitCode = 7788 Then
Environment.Exit(0)
End If
End Sub
Private Sub Fail(ByVal path As String)
File.Delete(path)
ErrorKill("Failed to initialize all the required components.")
End Sub
Private Sub ErrorKill(ByVal message As String)
MessageBox.Show(message, "Loader Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Environment.Exit(0)
ExitProcess(0)
End Sub
Private Function Decompress(ByVal data As Byte()) As Byte()
Dim Size As Integer = BitConverter.ToInt32(data, 0)
Dim U(Size - 1) As Byte
Dim M As New MemoryStream(data, 4, data.Length - 4)
Dim D As New DeflateStream(M, CompressionMode.Decompress, False)
D.Read(U, 0, U.Length)
D.Close()
M.Close()
Return U
End Function
Private Function GizmoDecompress(ByVal data As Byte()) As Byte()
Dim GizmoDll As Byte() = File.ReadAllBytes(GizmoDllLocation)
Dim G As MethodInfo = Assembly.Load(GizmoDll).GetType("H").GetMethod("Decompress")
Return DirectCast(G.Invoke(Nothing, New Object() {data}), Byte())
End Function
Private Function MD5(ByVal data As Byte()) As String
Dim H As New MD5CryptoServiceProvider
Return HashToString(H.ComputeHash(data))
End Function
Private Function MD5File(ByVal path As String) As String
Dim F As New FileStream(path, FileMode.Open, FileAccess.Read)
Dim H As New MD5CryptoServiceProvider
Dim Hash As String = HashToString(H.ComputeHash(F))
F.Close()
Return Hash
End Function
Private Function HashToString(ByVal data As Byte()) As String
Return BitConverter.ToString(data).ToLower().Replace("-", String.Empty)
End Function
Private Sub InitializeRm()
If RmInitialize Then Return
RmInitialize = True
Dim Rm As New RijndaelManaged
Rm.Padding = PaddingMode.Zeros
Rm.Mode = CipherMode.CBC
Rm.Key = PrivateKey
Rm.IV = PrivateKey
Encryptor = Rm.CreateEncryptor()
Decryptor = Rm.CreateDecryptor()
End Sub
Private SN As IStrongName
Private Function CheckCore() As Boolean
Dim Base As String = RuntimeEnvironment.GetRuntimeDirectory()
Dim Build As String = RuntimeEnvironment.GetSystemVersion()
Dim HostCLR As Boolean = Int32.Parse(Build(1).ToString()) >= 4
If HostCLR Then
Dim CID_META_HOST As New Guid("9280188D-0E8E-4867-B30C-7FA83884E8DE")
Dim CID_STRONG_NAME As New Guid("B79B0ACD-F5CD-409B-B5A5-A16244610B92")
Dim Meta As IMeta = DirectCast(CreateInstance(CID_META_HOST, GetType(IMeta).GUID), IMeta)
Dim Runtime As IRuntime = DirectCast(Meta.GetRuntime(Build, GetType(IRuntime).GUID), IRuntime)
SN = DirectCast(Runtime.GetInterface(CID_STRONG_NAME, GetType(IStrongName).GUID), IStrongName)
End If
Dim File1 As String = Path.ChangeExtension(Path.Combine(Base, "mscorlib"), "dll")
Dim File2 As String = Path.ChangeExtension(Path.Combine(Base, "system"), "dll")
Dim Token As Byte() = New Byte() {183, 122, 92, 86, 25, 52, 224, 137}
If Not IsTrusted(File1, Token, HostCLR) Then Return False
If Not IsTrusted(File2, Token, HostCLR) Then Return False
Return True
End Function
Private Function IsTrusted(ByVal path As String, ByVal token As Byte(), ByVal hostCLR As Boolean) As Boolean
Dim Genuine As Boolean
If hostCLR Then
If Not (SN.StrongNameSignatureVerificationEx(path, True, Genuine) = 0 AndAlso Genuine) Then Return False
Else
If Not (StrongNameSignatureVerificationEx(path, True, Genuine) AndAlso Genuine) Then Return False
End If
Dim PublicToken As Byte() = Assembly.LoadFile(path).GetName().GetPublicKeyToken()
If PublicToken Is Nothing OrElse Not PublicToken.Length = 8 Then Return False
For I As Integer = 0 To 7
If Not PublicToken(I) = token(I) Then Return False
Next
Return True
End Function
Private SSLCallback As RemoteCertificateValidationCallback
Private Function ValidateSSL(ByVal sender As Object, ByVal cert As X509Certificate, ByVal chain As X509Chain, ByVal errors As SslPolicyErrors) As Boolean
Return True
End Function
Private Sub OverrideSSL()
SSLCallback = ServicePointManager.ServerCertificateValidationCallback
ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateSSL)
End Sub
Private Sub RestoreSSL()
ServicePointManager.ServerCertificateValidationCallback = SSLCallback
End Sub
#End Region
<InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("D332DB9E-B9B3-4125-8207-A14884F53216")> _
Private Interface IMeta
Function GetRuntime(ByVal version As String, <MarshalAs(UnmanagedType.LPStruct)> ByVal iid As Guid) As <MarshalAs(UnmanagedType.Interface)> Object
End Interface
<InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("BD39D1D2-BA2F-486A-89B0-B4B0CB466891")> _
Private Interface IRuntime
Sub M1()
Sub M2()
Sub M3()
Sub M4()
Sub M5()
Sub M6()
Function GetInterface(<MarshalAs(UnmanagedType.LPStruct)> cid As Guid, <MarshalAs(UnmanagedType.LPStruct)> iid As Guid) As <MarshalAs(UnmanagedType.Interface)> Object
End Interface
<InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("9FD93CCF-3280-4391-B3A9-96E1CDE77C8D")> _
Private Interface IStrongName
Sub M1()
Sub M2()
Sub M3()
Sub M4()
Sub M5()
Sub M6()
Sub M7()
Sub M8()
Sub M9()
Sub M10()
Sub M11()
Sub M12()
Sub M13()
Sub M14()
Sub M15()
Sub M16()
Sub M17()
Sub M18()
Sub M19()
Sub M20()
Function StrongNameSignatureVerificationEx(ByVal filePath As String, ByVal force As Boolean, ByRef genuine As Boolean) As Integer
End Interface
End Class
Friend Module LicenseGlobal
Friend Seal As New License
Friend LicenseInitialize As Boolean
End Module
Friend Enum LicenseType As Byte
Free = 0
Bronze = 1
Silver = 2
Gold = 3
Platinum = 4
Diamond = 5
End Enum
<Flags()> _
Friend Enum RuntimeProtection As Byte
None = 0
Debuggers = 1
DebuggersEx = 2
Timing = 4
Parent = 8
FullScan = 15
VirtualMachine = 16
End Enum
Friend Structure NewsPost
Private ReadOnly _ID As Integer
ReadOnly Property ID() As Integer
Get
Return _ID
End Get
End Property
Private ReadOnly _Name As String
ReadOnly Property Name() As String
Get
Return _Name
End Get
End Property
Private ReadOnly _Time As Date
ReadOnly Property Time() As Date
Get
Return _Time
End Get
End Property
Sub New(ByVal id As Object, ByVal name As Object, ByVal time As Object)
_ID = DirectCast(id, Integer)
_Name = DirectCast(name, String)
_Time = DirectCast(time, Date)
End Sub
End Structure
Friend NotInheritable Class CookieClient
Inherits WebClient
Private Request As HttpWebRequest
Public Cookies As New CookieContainer
Protected Overrides Function GetWebRequest(ByVal address As Uri) As WebRequest
Request = DirectCast(MyBase.GetWebRequest(address), HttpWebRequest)
Request.Timeout = 8000
Request.ReadWriteTimeout = 30000
Request.KeepAlive = False
Request.CookieContainer = Cookies
Request.Proxy = Nothing
Return Request
End Function
Sub ClearCookies()
Cookies = New CookieContainer
End Sub
End Class