Code: Select all
Public Function Login(ByVal user As String, ByVal pass As String) As Boolean
Send("/login", True)
Dim hash = Read()(0).Split(New String() {"ret="}, StringSplitOptions.None)(1)
Send("/login")
Send("=name=" + user)
Send("=response=00" + EncodePassword(pass, hash), True)
Dim res = Read()
If (res(0) = "!done") Then Return True Else Return False
End Function
SOURCE: https://wiki.mikrotik.com/wiki/API_in_VB_dot_NET
Login method post-v6.43:
/login
=name=admin
=password=
!done
Now client sends username and password in first message.
Password is sent in plain text.
in case of error, reply contains =message=error message.
In case of successful login client can start to issue commands.