Skip to content

Commit

Permalink
Account Manager
Browse files Browse the repository at this point in the history
* Support for changing your password and sending the request for
  email change and password reset during login.

* Account Manager form will appear when an account logon or other
  account entry error occurs, allowing the user to fix the issue
  or perform another account action, just like a real Battle.net
  client. The bot no longer disconnects from Battle.net on all account
  errors, unless told to.

  - This Account Manager can be accessed from Bot -> Account Manager.

  - It supports (re)connecting to return to the account entry state
    in order to fulfill requests.

  - If the window is closed when in the account entry state,
    the bot will disconnect.

  - [CLIENT]
    ManageOnAccountError=True|False
    =True [defualt]: is this behavior, and
    =False: causes the bot to disconnect on account errors, as before.

  - [CLIENT]
    AutoAccountAction=True|False
    =True [default]: The bot will try to log in automatically.
    This state is set when you save the Settings
    (implies you want to use the Settings U & P automatically).
    =False: The bot will bring up the Account Manager when it enters
    or re-enters account logon state (i.e. on "account exists" error).
    This state is set when you do an action from the Account Manager.

  - [CLIENT]
    AccountMode=Logon|Create|ChangePass|ResetPass|ChangeEmail
    =Logon [default]: The bot will attempt to log on
    using Username and Password.
    On fail, the bot will switch to Create mode (and "do action").

    =Create: The bot will attempt to create an account
    using Username and Password.
    On success, the bot will switch to Logon mode (and "do action").

    =ChangePass: The bot will attempt to change the password of
    Username from Password to NewPassword.
    On success, the bot will save Password=NewPassword and clear NewPassword.
    On success, the bot will switch to Logon mode (and "do action").

    =ResetPass: The bot will request a reset password email
    using Username and RegisterEmailDefault.
    On successful send, the bot will switch to Logon mode, but will "await action".

    =ChangeEmail: The bot will request to change the account email
    using Username and RegisterEmailDefault to RegisterEmailChange.
    On successful send, the bot will save
    RegisterEmailDefault=RegisterEmailChange and clear RegisterEmailChange.
    On successful send, the bot will switch to Logon mode, but will "await action".

    On all other failures, the bot will "await action" and not change mode.

    When the bot "awaits action" above, it will either show the Account Manager or disconnect,
    depending on ManageOnAccountError.

    When the bot is to "do action" above, it will either do the action
    if the settings are set, or open the Account Manager to that page,
    depending on AutoAccountAction.

  - [CLIENT]
    NewPassword=
    RegisterEmailChange=

    These two settings are used to save the "change to" of the values in the new modes.

* Account lock timeouts apply to password change requests and are
  handled by the Account Manager system.

* Account success and error messages are all handled through Event_LogonEvent().
  As such, SID_AUTH_* logon responses are all interpreted together.
  Legacy response codes are re-distributed to the SID_AUTH_* values for
  that event only.

* clsNLS (scripting: CreateNLS(U, P)) has been improved and recieved
  many fixes so that change requests actually work correctly.
  Many function and property names have been changed, and calling
  properties without initializing Username and Password now result
  in failure/empty values instead of attempting to initialize.
  • Loading branch information
nmbook committed Mar 1, 2017
1 parent 1748136 commit f591a7a
Show file tree
Hide file tree
Showing 16 changed files with 1,581 additions and 382 deletions.
3 changes: 2 additions & 1 deletion trunk/Bot.vbp
Expand Up @@ -115,13 +115,14 @@ Module=modBNLS; modBNLS.bas
Class=clsKeyDecoder; clsKeyDecoder.cls
Module=modConstants; modConstants.bas
Class=clsConfig; clsConfig.cls
Form=frmAccountManager.frm
IconForm="frmChat"
Startup="frmChat"
HelpFile=""
Title="StealthBot"
ExeName32="StealthBot v2.7.exe"
Path32="..\..\Compile"
Command32=""
Command32="-addpath "C:\Program Files (x86)\StealthBot\" -ppath "C:\Users\Nate\AppData\Roaming\StealthBot\RiboseDEV\""
Name="StealthBot"
HelpContextID="0"
Description="StealthBot"
Expand Down
4 changes: 2 additions & 2 deletions trunk/clsCToolTip.cls
Expand Up @@ -19,7 +19,7 @@ Option Explicit
Private Declare Sub InitCommonControls Lib "comctl32.dll" ()

''Windows API Functions
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function DestroyWindow Lib "user32" (ByVal hWnd As Long) As Long
Expand Down Expand Up @@ -122,7 +122,7 @@ Public Property Get Centered() As Boolean
Centered = mvarCentered
End Property

Public Function Create(ByVal ParentHwnd As Long, X As Long, Y As Long) As Boolean
Public Function Create(ByVal ParentHwnd As Long, x As Long, y As Long) As Boolean
Dim lWinStyle As Long

If m_lTTHwnd <> 0 Then
Expand Down
60 changes: 60 additions & 0 deletions trunk/clsConfig.cls
Expand Up @@ -72,6 +72,10 @@ Private m_ProxyUsername As String
Private m_ProxyPassword As String
Private m_ProxyBNLS As Boolean
Private m_ProxyMCP As Boolean
Private m_AccountMode As String
Private m_AutoAccountAction As Boolean
Private m_ManageOnAccountError As Boolean
Private m_NewPassword As String

'[FEATURES]
Private m_UseBackupChannel As Boolean
Expand Down Expand Up @@ -214,6 +218,7 @@ Private m_MaxMessageLength As Integer
Private m_AutoCreateChannels As String
Private m_RegisterEmailAction As String
Private m_RegisterEmailDefault As String
Private m_RegisterEmailChange As String
Private m_RealmServerPassword As String
Private m_ProtocolID As Long
Private m_PlatformID As String
Expand Down Expand Up @@ -429,6 +434,38 @@ Public Property Let ProxyMCP(ByVal sValue As Boolean)
m_ProxyMCP = sValue
End Property

Public Property Get AccountMode() As String
AccountMode = m_AccountMode
End Property

Public Property Let AccountMode(ByVal sValue As String)
m_AccountMode = sValue
End Property

Public Property Get AutoAccountAction() As Boolean
AutoAccountAction = m_AutoAccountAction
End Property

Public Property Let AutoAccountAction(ByVal sValue As Boolean)
m_AutoAccountAction = sValue
End Property

Public Property Get ManageOnAccountError() As Boolean
ManageOnAccountError = m_ManageOnAccountError
End Property

Public Property Let ManageOnAccountError(ByVal sValue As Boolean)
m_ManageOnAccountError = sValue
End Property

Public Property Get NewPassword() As String
NewPassword = m_NewPassword
End Property

Public Property Let NewPassword(ByVal sValue As String)
m_NewPassword = sValue
End Property


'-------------------------
' SECTION: FEATURES
Expand Down Expand Up @@ -1476,6 +1513,14 @@ Public Property Let RegisterEmailDefault(ByVal sValue As String)
m_RegisterEmailDefault = sValue
End Property

Public Property Get RegisterEmailChange() As String
RegisterEmailChange = m_RegisterEmailChange
End Property

Public Property Let RegisterEmailChange(ByVal sValue As String)
m_RegisterEmailChange = sValue
End Property

Public Property Get RealmServerPassword() As String
RealmServerPassword = m_RealmServerPassword
End Property
Expand Down Expand Up @@ -1697,6 +1742,10 @@ Public Sub Save(Optional ByVal sFilePath As String = vbNullString)
WriteSetting SECTION_CLIENT, "ProxyPassword", m_ProxyPassword
WriteSetting SECTION_CLIENT, "ProxyBNLS", m_ProxyBNLS
WriteSetting SECTION_CLIENT, "ProxyMCP", m_ProxyMCP
WriteSetting SECTION_CLIENT, "AccountMode", m_AccountMode
WriteSetting SECTION_CLIENT, "AutoAccountAction", m_AutoAccountAction
WriteSetting SECTION_CLIENT, "ManageOnAccountError", m_ManageOnAccountError
WriteSetting SECTION_CLIENT, "NewPassword", m_NewPassword

WriteSetting SECTION_FEATURES, "UseBackupChannel", m_UseBackupChannel
WriteSetting SECTION_FEATURES, "BackupChannel", m_BackupChannel
Expand Down Expand Up @@ -1831,6 +1880,7 @@ Public Sub Save(Optional ByVal sFilePath As String = vbNullString)
WriteSetting SECTION_EMULATION, "AutoCreateChannels", m_AutoCreateChannels
WriteSetting SECTION_EMULATION, "RegisterEmailAction", m_RegisterEmailAction
WriteSetting SECTION_EMULATION, "RegisterEmailDefault", m_RegisterEmailDefault
WriteSetting SECTION_EMULATION, "RegisterEmailChange", m_RegisterEmailChange
WriteSetting SECTION_EMULATION, "RealmServerPassword", m_RealmServerPassword
WriteSetting SECTION_EMULATION, "ProtocolID", m_ProtocolID
WriteSetting SECTION_EMULATION, "PlatformID", m_PlatformID
Expand Down Expand Up @@ -1887,6 +1937,10 @@ Private Sub LoadDefaults()
m_ProxyPassword = vbNullString
m_ProxyBNLS = False
m_ProxyMCP = True
m_AccountMode = "LOGON"
m_AutoAccountAction = True
m_ManageOnAccountError = True
m_NewPassword = vbNullString

'[Features]
m_UseBackupChannel = False
Expand Down Expand Up @@ -2029,6 +2083,7 @@ Private Sub LoadDefaults()
m_AutoCreateChannels = "ALWAYS"
m_RegisterEmailAction = "PROMPT"
m_RegisterEmailDefault = vbNullString
m_RegisterEmailChange = vbNullString
m_RealmServerPassword = "password"
m_ProtocolID = 0
m_PlatformID = "IX86"
Expand Down Expand Up @@ -2233,6 +2288,10 @@ Private Sub LoadVersion6Config()
m_ProxyPassword = ReadSetting(SECTION_CLIENT, "ProxyPassword", m_ProxyPassword)
m_ProxyBNLS = ReadSetting(SECTION_CLIENT, "ProxyBNLS", m_ProxyBNLS)
m_ProxyMCP = ReadSetting(SECTION_CLIENT, "ProxyMCP", m_ProxyMCP)
m_AccountMode = ReadSetting(SECTION_CLIENT, "AccountMode", m_AccountMode)
m_AutoAccountAction = ReadSetting(SECTION_CLIENT, "AutoAccountAction", m_AutoAccountAction)
m_ManageOnAccountError = ReadSetting(SECTION_CLIENT, "ManageOnAccountError", m_ManageOnAccountError)
m_NewPassword = ReadSetting(SECTION_CLIENT, "NewPassword", m_NewPassword)

m_UseBackupChannel = ReadSettingB(SECTION_FEATURES, "UseBackupChannel", m_UseBackupChannel)
m_BackupChannel = ReadSetting(SECTION_FEATURES, "BackupChannel", m_BackupChannel)
Expand Down Expand Up @@ -2367,6 +2426,7 @@ Private Sub LoadVersion6Config()
m_AutoCreateChannels = ReadSetting(SECTION_EMULATION, "AutoCreateChannels", m_AutoCreateChannels)
m_RegisterEmailAction = ReadSetting(SECTION_EMULATION, "RegisterEmailAction", m_RegisterEmailAction)
m_RegisterEmailDefault = ReadSetting(SECTION_EMULATION, "RegisterEmailDefault", m_RegisterEmailDefault)
m_RegisterEmailChange = ReadSetting(SECTION_EMULATION, "RegisterEmailChange", m_RegisterEmailChange)
m_RealmServerPassword = ReadSetting(SECTION_EMULATION, "RealmServerPassword", m_RealmServerPassword)
m_ProtocolID = ReadSettingL(SECTION_EMULATION, "ProtocolID", m_ProtocolID)
m_PlatformID = ReadSetting(SECTION_EMULATION, "PlatformID", m_PlatformID)
Expand Down
39 changes: 24 additions & 15 deletions trunk/clsDataStorage.cls
Expand Up @@ -14,21 +14,22 @@ Attribute VB_Exposed = False
Option Explicit
Private m_lNLSHandle As Long

Private m_ServerToken As Long
Private m_ClientToken As Long
Private m_lLogonType As Long
Private m_UDPValue As Long
Private m_CRevFileTime As String
Private m_CRevFileName As String
Private m_CRevSeed As String
Private m_CRevVersion As Long
Private m_CRevChecksum As Long
Private m_CRevResult As String
Private m_ServerSig As String
Private m_EmailRegDelay As Boolean
Private m_NLS As clsNLS
Private m_MCPHandler As clsMCPHandler
Private m_FirstTimeChat As Boolean
Private m_ServerToken As Long
Private m_ClientToken As Long
Private m_lLogonType As Long
Private m_UDPValue As Long
Private m_CRevFileTime As String
Private m_CRevFileName As String
Private m_CRevSeed As String
Private m_CRevVersion As Long
Private m_CRevChecksum As Long
Private m_CRevResult As String
Private m_ServerSig As String
Private m_EmailRegDelay As Boolean
Private m_NLS As clsNLS
Private m_MCPHandler As clsMCPHandler
Private m_FirstTimeChat As Boolean
Private m_AccountEntry As Boolean

Public Sub List()
With frmChat
Expand Down Expand Up @@ -63,6 +64,7 @@ Public Sub Reset()
Set m_MCPHandler = Nothing
Set m_NLS = Nothing
m_FirstTimeChat = False
m_AccountEntry = False
End Sub

Public Property Get LogonType() As Long
Expand Down Expand Up @@ -184,6 +186,13 @@ Public Property Get EnteredChatFirstTime() As Boolean
EnteredChatFirstTime = m_FirstTimeChat
End Property

Public Property Let AccountEntry(bData As Boolean)
m_AccountEntry = bData
End Property
Public Property Get AccountEntry() As Boolean
AccountEntry = m_AccountEntry
End Property

Private Sub Class_Terminate()
Reset
End Sub

0 comments on commit f591a7a

Please sign in to comment.