Skip to content
Permalink
Browse files

Locale-independence support & packet send/recv code & SOCKS proxies

Things done:
* Locale-independent clsDataBuffer
  (the other receive buffers have been deleted - the DataBuffer now
  fully handles the checking and taking packets loop)
* Locale-independent DLL calls (warden.dll, bncsutil.dll)
* Cleaned up packet send code and most of packet receive code;
  packet code all uses Byte() and the receive code
  holds onto a single clsDataBuffer instead of
  creating a new one at each level
* Re-implemented and enhanced proxy code
  - Now supports SOCKS5 username/password auth
  - Now keeps track of more information regarding the proxy
  - Now supports BNCS, BNLS, and MCP separately
  - Now allows you to ask the proxy to resolve the hostname
    if the local network is unable to or by override
  - Proxy handshake packets are now shown in packet dumps
  - Additional config options:
    [Client]
    ; already existing
    UseProxy=True|False
    ProxyType=SOCKS4|SOCKS5
    ProxyIP=
    ProxyPort=
    ; new for username/password
    ProxyUsername=
    ProxyPassword=
    ; new for server resolve
    ProxyServerResolve=True|False [default False]
    ; new for additional streams
    ProxyMCP=True|False [default True: MCP needs to be on the same local IP]
    ProxyBNLS=True|False [default False]

  - Fixed a crash when inputting a proxy port > 32767 in the Settings form
  - Will now verify the server's 128-byte signature even when connected
    via proxy, if the remote IP of the Battle.net server is known
  • Loading branch information...
nmbook committed Feb 17, 2017
1 parent 480b515 commit 17481363e0b2829266d4d721977af02e190797f8
Showing with 1,791 additions and 1,496 deletions.
  1. +1 −3 trunk/Bot.vbp
  2. +1 −1 trunk/clsBNCSQueue.cls
  3. +0 −169 trunk/clsBNCSRecvBuffer.cls
  4. +0 −72 trunk/clsBNLSRecvBuffer.cls
  5. +22 −27 trunk/clsBotVars.cls
  6. +8 −8 trunk/clsCRC32.cls
  7. +3 −10 trunk/clsClanPacketHandler.cls
  8. +11 −11 trunk/clsCommandDocObj.cls
  9. +1 −1 trunk/clsCommandDocObjStatic.cls
  10. +9 −9 trunk/clsCommandObj.cls
  11. +3 −3 trunk/clsCommandObjStatic.cls
  12. +5 −5 trunk/clsCommandParamsObj.cls
  13. +65 −5 trunk/clsConfig.cls
  14. +224 −66 trunk/clsDataBuffer.cls
  15. +15 −15 trunk/clsDataStorage.cls
  16. +48 −38 trunk/clsErrorHandler.cls
  17. +3 −6 trunk/clsFriendlistHandler.cls
  18. +17 −9 trunk/clsKeyDecoder.cls
  19. +21 −21 trunk/clsLogger.cls
  20. +21 −26 trunk/clsMCPHandler.cls
  21. +84 −37 trunk/clsNLS.cls
  22. +29 −29 trunk/clsQueue.cls
  23. +1 −1 trunk/clsQueueObj.cls
  24. +6 −6 trunk/clsQuotesObj.cls
  25. +35 −2 trunk/clsScriptSupportClass.cls
  26. +1 −1 trunk/clsUserObj.cls
  27. +222 −180 trunk/frmChat.frm
  28. BIN trunk/frmChat.frx
  29. +11 −11 trunk/frmCommands.frm
  30. +3 −3 trunk/frmDBManager.frm
  31. +2 −2 trunk/frmRealm.frm
  32. +4 −3 trunk/frmScript.frm
  33. +4 −4 trunk/frmSettings.frm
  34. +3 −7 trunk/modAPI.bas
  35. +123 −61 trunk/modBNCS.bas
  36. +10 −10 trunk/modBNCSutil.bas
  37. +19 −21 trunk/modBNLS.bas
  38. +32 −32 trunk/modCommands.bas
  39. +41 −7 trunk/modCommandsInfo.bas
  40. +1 −1 trunk/modCommandsMisc.bas
  41. +26 −11 trunk/modEnum.bas
  42. +1 −1 trunk/modEvents.bas
  43. +2 −3 trunk/modGlobals.bas
  44. +1 −1 trunk/modMail.bas
  45. +3 −3 trunk/modMenuObj.bas
  46. +26 −19 trunk/modOtherCode.bas
  47. +107 −43 trunk/modPacketBuffer.bas
  48. +0 −96 trunk/modParsing.bas
  49. +346 −184 trunk/modProxySupport.bas
  50. +18 −18 trunk/modScripting.bas
  51. +1 −1 trunk/modTimerProcs.bas
  52. +0 −45 trunk/modWar3Clan.bas
  53. +148 −145 trunk/modWarden.bas
  54. +3 −3 trunk/modWindow.bas
@@ -14,7 +14,6 @@ Object={CA5A8E1E-C861-4345-8FF8-EF0A27CD4236}#1.1#0; vbalTreeView6.ocx
Object={3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0; RICHTX32.OCX
Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX
Form=frmAbout.frm
Class=clsBNLSRecvBuffer; clsBNLSRecvBuffer.cls
Class=clsClanPacketHandler; clsClanPacketHandler.cls
Class=clsMCPHandler; clsMCPHandler.cls
Class=clsDataStorage; clsDataStorage.cls
@@ -54,7 +53,7 @@ Module=modScripting; modScripting.bas
Module=modSystray; modSystray.bas
Module=modGlobals; modGlobals.bas
Class=clsBotVars; clsBotVars.cls
Class=clsQueueOBj; clsQueueObj.cls
Class=clsQueueObj; clsQueueObj.cls
Module=modQuickChannels; modQuickChannels.bas
Module=modTimerProcs; modTimerProcs.bas
Module=modChatQueue; modChatQueue.bas
@@ -91,7 +90,6 @@ Class=clsOSVersion; clsOSVersion.cls
Module=modWarden; modWarden.bas
Class=clsCRC32; clsCRC32.cls
Module=modUnsignedConversions; modUnsignedConversions.bas
Class=clsBNCSRecvBuffer; clsBNCSRecvBuffer.cls
Form=frmScript.frm
Class=clsSLongTimer; clsSLongTimer.cls
Class=clsMenuObj; clsMenuObj.cls
@@ -187,7 +187,7 @@ Public Function BanDelay() As Long
' default error handler
ERROR_HANDLER:
' display error message
Call frmChat.AddChat(vbRed, "Error: " & Err.description & " in BanDelay().")
Call frmChat.AddChat(vbRed, "Error: " & Err.Description & " in BanDelay().")

' exit procedure
Exit Function

This file was deleted.

This file was deleted.

@@ -38,11 +38,6 @@ Private m_bySpoof As Byte
Private m_bDisableMP3Commands As Boolean
Private m_bUseUDP As Boolean
Private m_byFlashOnEvents As Byte
Private m_bUseProxy As Boolean
Private m_sProxyIP As String
Private m_lProxyPort As Long
Private m_eProxyStatus As enuProxyStatus
Private m_bProxyIsSocks5 As Boolean
Private m_lMaxBacklogSize As Long
Private m_lMaxLogfileSize As Long
Private m_bUseGreet As Boolean
@@ -261,44 +256,44 @@ Public Property Let FlashOnEvents(ByVal byFlashOnEvents As Byte)
m_byFlashOnEvents = byFlashOnEvents
End Property

Public Property Get UseProxy() As Boolean
UseProxy = m_bUseProxy
Public Property Get UseProxy(Optional ByVal st As enuPL_ServerTypes = stBNCS) As Boolean
UseProxy = ProxyConnInfo(st).UseProxy
End Property

Public Property Let UseProxy(ByVal bUseProxy As Boolean)
m_bUseProxy = bUseProxy
Public Property Let UseProxy(Optional ByVal st As enuPL_ServerTypes = stBNCS, ByVal bUseProxy As Boolean)
ProxyConnInfo(st).UseProxy = bUseProxy
End Property

Public Property Get ProxyPort() As Long
ProxyPort = m_lProxyPort
Public Property Get ProxyStatus(Optional ByVal st As enuPL_ServerTypes = stBNCS) As enuProxyStatus
ProxyStatus = ProxyConnInfo(st).Status
End Property

Public Property Let ProxyPort(ByVal lProxyPort As Long)
m_lProxyPort = lProxyPort
Public Property Get ProxyPort(Optional ByVal st As enuPL_ServerTypes = stBNCS) As Long
ProxyPort = ProxyConnInfo(st).ProxyPort
End Property

Public Property Get ProxyStatus() As enuProxyStatus
ProxyStatus = m_eProxyStatus
Public Property Let ProxyPort(Optional ByVal st As enuPL_ServerTypes = stBNCS, ByVal lPort As Long)
ProxyConnInfo(st).ProxyPort = lPort
End Property

Public Property Let ProxyStatus(ByVal eProxyStatus As enuProxyStatus)
m_eProxyStatus = eProxyStatus
Public Property Get ProxyIP(Optional ByVal st As enuPL_ServerTypes = stBNCS) As String
ProxyIP = ProxyConnInfo(st).ProxyIP
End Property

Public Property Get ProxyIP() As String
ProxyIP = m_sProxyIP
Public Property Let ProxyIP(Optional ByVal st As enuPL_ServerTypes = stBNCS, ByVal sIP As String)
ProxyConnInfo(st).ProxyIP = sIP
End Property

Public Property Let ProxyIP(ByVal sProxyIP As String)
m_sProxyIP = sProxyIP
Public Property Get ProxyIsSocks5(Optional ByVal st As enuPL_ServerTypes = stBNCS) As Boolean
ProxyIsSocks5 = CBool(ProxyConnInfo(st).Version = 5)
End Property

Public Property Get ProxyIsSocks5() As Boolean
ProxyIsSocks5 = m_bProxyIsSocks5
End Property

Public Property Let ProxyIsSocks5(ByVal bProxyIsSocks5 As Boolean)
m_bProxyIsSocks5 = bProxyIsSocks5
Public Property Let ProxyIsSocks5(Optional ByVal st As enuPL_ServerTypes = stBNCS, ByVal bIsSocks5 As Boolean)
If bIsSocks5 Then
ProxyConnInfo(st).Version = 5
Else
ProxyConnInfo(st).Version = 4
End If
End Property

Public Property Get MaxBacklogSize() As Long
@@ -42,7 +42,7 @@ Private Sub InitCRC32()
Next

CRC32Table(i) = K
Next
Next
End Sub

Public Function CRC32(ByVal Data As String) As Long
@@ -68,14 +68,14 @@ Public Function CRC32(ByVal Data As String) As Long
CRC32 = (Not (CRC32))
End Function

Public Function GetFileCRC32(ByVal filePath As String) As Long
Dim str As String
Dim tmp As String
Dim f As Integer
Public Function GetFileCRC32(ByVal FilePath As String) As Long
Dim str As String
Dim tmp As String
Dim f As Integer

f = FreeFile

Open filePath For Input As #f
Open FilePath For Input As #f
Do While (EOF(f) = False)
Line Input #f, tmp

@@ -137,8 +137,8 @@ ValidateExecutable_Exit:
ValidateExecutable_Error:
ValidateExecutable = True

Debug.Print "Error " & Err.Number & " (" & Err.description & ") in procedure " & _
Debug.Print "Error " & Err.Number & " (" & Err.Description & ") in procedure " & _
"ValidateExecutable of Module modCRC32Checksum"

Resume ValidateExecutable_Exit
Resume ValidateExecutable_Exit
End Function

0 comments on commit 1748136

Please sign in to comment.
You can’t perform that action at this time.