Admin Admin
Posts : 44 Join date : 2010-09-20 Age : 34 Location : mumbai
| Subject: how to create a simple mig33 id logger Sat Sep 25, 2010 3:02 pm | |
| hello friends, here am sharing the code and logic to make an id login to mig33 server... as we know the mig33 server IP = gateway.mig33.com and PORT = 9119...so lets start with our simple project.... ============================================================================================= firstly you have to take some controls like few text boxes and command buttons.. as shown in following figure.. ====================================== textbox :- txtip txtport txtuname txtpwd datahex dataasci hashcoder command button :- cmdconnect cmddisconnect cmdlogin
winsock control :- winsock1 ====================================== then after adding controls...you need to add a module as shown in following figure.. ====================================== ====================================== after adding modules you have to add all modules and functions in the module section...we will need few modules and functions in this project such as... modules : hextoascii() asciitohex() so just copy this modules codes in your module section..the code is as follows :-
================================================================================= module code of hextoascii() is
Public Function HextoAscii(inputstr As String) As String Dim spilter As Variant Dim i As Integer Dim finnal As String If InStr(1, inputstr, " ") <> 0 Then spilter = Split(inputstr, " ") For i = 0 To UBound(spilter) finnal = finnal & Chr(Val("&H" & spilter(i))) Next i HextoAscii = finnal ElseIf Len(inputstr) = 2 Then finnal = Chr(Val("&H" & inputstr)) HextoAscii = finnal End If End Function ================================================================================= module code of asccitohex() is
Public Function Asciitohex(inputstr As String) As String On Error Resume Next Dim spilter As Variant Dim i As Integer Dim finnal As String For i = 1 To Len(inputstr) finnal = finnal & Hex(Asc(Mid(inputstr, i, 1))) & " " Next i Asciitohex = Mid(finnal, 1, Len(finnal) - 1) End Function ================================================================================== module code of dectohexstr() is
Public Function DecToHexStr(ByVal inVal As Integer) As String On Error Resume Next Dim s As String s = Trim(Hex(inVal)) If Len(s) < 2 Then s = "0" & s End If DecToHexStr = s End Function ==================================================================================
now here your module works ends........
lets concentrate on vb form now...as we know we creating a project related to internet connection...we must include a 'microsoft winsock control'.. so our winsock
control name will be 'winsock1'...now firstly we have to write all the winsock events codes..means wat happens wehn winsock is connected or disconnected or wat happens
when winsock accepts packets... like winsock1_connect winsock1_close winsock1.dataarrival..etc
here are the particular winsock events codes just copy paste this codes in your project.... ================================================================================= codes are as follows :-
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim strData As String, theString As String, midString As String, hasege As String Dim Hash As String Dim haus As Long Dim hashcrot As String Dim hashcret As String Dim awal As String Dim awalana As String Winsock1.GetData strData, vbString datahex.Text = Asciitohex(strData) & vbCrLf theString = datahex.Text midString = Mid$(theString, 69, Len(datahex.Text)) hasege = HextoAscii(midString) dataasci.Text = strData & vbCrLf Hash = hasege & txtpwd.Text haus = GetHash(Hash) hashcrot = (Hex(haus)) hashcret = Left(hashcrot, 2) & " " & Mid(hashcrot, 3, 2) & " " & Mid(hashcrot, 5, 2) & " " & Right(hashcrot, 2) hashcoder.Text = "02 00 CA 00 02 00 00 00 0A 00 01 00 00 00 04 " & hashcret awal = Asciitohex(Left((strData), 4)) awalana = Asciitohex(Left((strData), 5))
If awal = "2 0 C9 0" Then Winsock1.SendData HextoAscii(hashcoder.Text) End If End Sub ================================================================================== Private Sub Winsock1_Close() Winsock1.Close End Sub ================================================================================== Private Sub Winsock1_Connect() cmdlogin.Enabled = True End Sub ================================================================================== Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) Winsock1_Close End Sub ============================================================================================= here we complete the for the winsock control which makes our project connect to internet... now lets turn to connect and actual login process...
first write the declaration at the top of the coding page :-
Private Declare Function GetHash Lib "hashGen.dll" (ByVal tEncode As String) As Long
to connect to mig33 server you need to write the following code in the connect button control (cmdconnect) code is as follows :-
Private Sub cmdconnect_Click() On Error GoTo t Winsock1.RemoteHost = txtip.Text Winsock1.RemotePort = txtport.Text Winsock1.Connect Exit Sub t: MsgBox "Error : " & Err.Description, vbCritical End Sub =======================================
to make login your id to mig33 server write the following code in the 'cmdlogin' command button... code is as follows :-
Private Sub cmdlogin_Click() Dim leni As String Dim assi As String leni = Len(txtuname.Text) assi = Asciitohex(txtuname.Text) Winsock1.SendData HextoAscii("2 0 C8 0 1 0 0 0 " & DecToHexStr(leni + 64) & " 0 9 0 0 0 4 0 0 0 1 0 8 0 0 0 4 6A 32 6D 65 0 7 0 0 0 9 4A 32 4D 45 76 33 2E 30 32 0 5 0 0 0 " & DecToHexStr(leni) & " " & assi & " 0 3 0 0 0 2 1 2E 0 2 0 0 0 1 2 0 1 0 0 0 2 0 1") End Sub ======================================= to make id disconnect or logout from mig write this following code in the 'cmddisconnect' command control button... code is as follows :-
private sub cmddisconnect_click() Winsock1.Close hashcoder.Text = "" datahex.Text = "" dataasci.Text = "" cmdlogin.Enabled = False end sub ======================================================================================================
=============================================WORKING OF PROJECT =========================================
WORKING :- Its working is very simple..firsly when we click on 'LOGIN' button our appliation sends a tcp packet to the mig33 server aslike client sending a request to mig33 server for connection....this tcp packets contains the username or 'you mig33 id'...when this packets reaches to the server...server checks whether the username or 'your mig33 id' exist in its database or not...if its exist then server will send a code on ur client..then ur client will catch the code... now here ur client will concatenate the password and the code...suppose passwod is 'india123' and code is '912cab13' then it wil concatenate as '912cab13india123' after concatenating we have to take the last four bytes of it...this process is called 'hashing code'...isnt its a tedious job... the guy who made first mig pc tool made one '.dll' file for us developers in which he put this logic...so we just need to call that file in our application so it will do hashing process now our client willl send the result of hashing to mig33 server..hence now server will check whethe the username and password matches..if they matched then id gets logged in succesfully in mig33 with 'online status....
phew it took more time to write this post than creating a application
i am uploading a simple mig33 logging application for u all...so u can get idea about it... its download link is :- http://uploading.com/files/331e5662/simple_login_project.rar/ file password is :- www.evilsofts.tk
well try this one ENJOY
EVILSOFTS RULZZZ... | |
|