Dim mCurReqId
Dim YesConnect As Boolean 'The server name. In this exmp, it is MS Chat server Const gServerIp = "mschat1.msn.com" 'The Port of Server..This port for Ms chat server Const gServerPort = 6667 'The Port of Client..MSChat client requests this port 'So it is the listening port Const gListenPort = 6667 Private Sub Command1_Click() 'Overrides server to send data to the client On Error Resume Next wsAccept.SendData txtMessage.Text + vbCrLf End Sub Private Sub Command2_Click() 'Overrides client to send data to the server On Error Resume Next wsConnect.SendData txtMessage.Text + vbCrLf End Sub Private Sub Form_Load() 'wsListen is the listening socket (for client) 'wsAccept is the socket connected to client 'wsConnect is the scoket connected to server 'Set The variable YesConnect = False 'For telling you your localip Debug.Print wsListen.LocalIP Me.Caption = "Internet Detective - [" & wsListen.LocalIP & "]" End Sub Private Sub tbMain_ButtonClick(ByVal Button As MSComctlLib.Button) 'Set enabling/disabling stuff urself..u too need some job..lol Select Case Button.Key Case "Start" Err.Clear On Error Resume Next wsListen.LocalPort = gListenPort wsListen.Listen If Err Then MsgBox "Error: " & Err.Description, vbCritical + vbOKOnly End If Case "Disc" Err.Clear On Error Resume Next ret = MsgBox("Disconnect between server and client?", _ vbYesNo + vbQuestion, "Disconnect") If ret = vbNo Then Exit Sub wsAccept.Close wsConnect.Close wsListen.Close If Err Then MsgBox "Error: " & Err.Description, vbCritical + vbOKOnly End If Case "Save" 'Record Data We Need Open App.Path & "\chatClient.txt" For Output As #1 For i = 0 To lstChat.ListCount - 1 Write #1, lstChat.List(i) Next i Close #1 Open App.Path & "chatServer.txt" For Output As #1 For i = 0 To lstServer.ListCount - 1 Write #1, lstServer.List(i) Next i Close #1 Case "About" mStr = "INTERNET DETECTIVE" mStr = mStr + vbCrLf + vbCrLf + "Developed by Anoop.M.Nedumkunnam,anoopj13@yahoo.com" mStr = mStr + vbCrLf + "Visit http://profiles.guru.com/anoopm" MsgBox mStr, vbInformation, "About.." End Select End Sub Private Sub wsAccept_Close() wsConnect.Close End Sub Private Sub wsAccept_DataArrival(ByVal bytesTotal As Long) wsAccept.GetData todat, vbString lstChat.AddItem todat On Error Resume Next wsConnect.SendData todat End Sub Private Sub wsConnect_Close() wsAccept.Close YesConnect = True End Sub Private Sub wsConnect_Connect() YesConnect = True End Sub Private Sub wsConnect_DataArrival(ByVal bytesTotal As Long) wsConnect.GetData todat, vbString lstServer.AddItem todat On Error Resume Next wsAccept.SendData todat End Sub Private Sub wsListen_ConnectionRequest(ByVal requestID As Long) 'Connects to the server wsConnect.Connect gServerIp, gServerPort On Error Resume Next Do 'Just a looping task dummy = DoEvents() 'We will make YesConnect true in the 'Connect event of wsConnect If YesConnect = True Then wsAccept.Accept requestID If YesConnect = True Then GoTo NoLoop 'b'coz i hate while statements..i don't know why. :) Loop NoLoop: End Sub '================================================ 'INTERNET DETECTIVE - For Spying Data '================================================ ' 'By ANOOP.M, Web Strategist & Developer 'Visit http://profiles.guru.com/anoopm ' 'Send Personal Mail to anoopj13@yahoo.com 'if you need a (quicker) reply ' '================================================ 'Category: '================================================ 'Internet/Sockets ' '================================================ 'Purpose: '================================================ 'For extracting the data transmission between 'two sockets. ' '================================================ 'Help: '================================================ 'Our purpose is to spy the data transmission 'between two sockets. That is, our spy should 'act between the server and client. ' ' Server <-----> Spy <-----> Client ' | ' | ' V ' Record Data ' 'For example, if you are spying the data trans 'mission between Microsoft Chat Server/Client, 'here is the procedure. ' '1) After going online, run the App. '2) If you do not have a permenant IP, ' get ur current IP from the debug window. '3) If you are using MS Chat 2.5, goto ' View->Options->Servers and setup a ' server with the current IP ' (For earlier versions of MSChat, I think ' you can paste it directly in the initial ' 'Chat Connection' box) '4) Then click 'connect' to connect the Microsoft ' Chat to your IP(not the IP of MS Chat ' Server) '5) Just examine the listbox (better replace with ' a text box) to see the 'real' data. '6) Goto your nearby shop and buy a little ' glucose (for getting energy to understand ' what you see.. ' ' ' Hope this may help..Download my other apps ' including a little famous Icon Hunter ' from the Planet..regards. ' ' ' Once the client establishes a connection ' our prog will automatically contact the ' server.. ' '================================================ 'Details: '================================================ 'Well, This is a simple program. If the name 'is doesn't indicate anything, here is a short 'story: ' 'I usually use Microsoft Chat for chatting. '(Usually my nick name is Nice-Guy, in case 'u need to find me..) Just for understanding 'the communication between the Microsoft chat 'client and the server, I wrote this app.. ' 'But you can use it as a router,multi 'chat enabler etc, if 'you need to use it that way.. '================================================ |