Solved

Winsock: Networking and Internet

Posted on 2000-02-19
9
250 Views
Last Modified: 2013-11-13
I'm looking for codes that will enable a PC to extract another PC's internet activity online. What i want is the ablility to obtain the IE and Netscape Navigator's internet site address and the topic as well, if available.
I've established a connection using the winsock control within 2 PCs. I just need the codes to add in to obtain the infomation on the PC that I'm monitoring. I'm looking for an easy-to-use protocol; i.e. just click and display type, a click will display a list of internet addresses that the monitored PC is currently browsing on.
And can someone teach me how to do multiple connection with that winsock control? I've tried many times but still fail. What are the things that I should do?
Points awarded could be up if necessary...
Thanx.
0
Comment
Question by:pennyroyal
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 2

Expert Comment

by:orbitaltech
ID: 2538973
Well, to create multiple instances of a winsock control is not too hard. Just like any other windows control, you want to set the Index property of the Winsock control to 0. This will allow you to reference multiple instances of the control. For example:

Winsock1(0)
Winsock1(1)
Winsock1(2)  etc...

This should solve some of your problems..
0
 

Expert Comment

by:FAQ
ID: 2539123
why don't you use the API?
0
 
LVL 2

Expert Comment

by:orbitaltech
ID: 2539243
Either or would work
0
 

Author Comment

by:pennyroyal
ID: 2539686
What I really wanted is my first question. How to retrieve the site address and the topic from another PC who is browsing using Netscape and IE?
I appreciate the answers to my second question, but I really need the monitoring internet part before I go into the multiple connection part...
Thanx.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 13

Expert Comment

by:crazyman
ID: 2542269
Place a text box called DDELink on a form and a command button (command1)

Option Explicit

Private Sub Command1_Click()
    MsgBox GetCurrentIEURL
    MsgBox GetCurrentNetscapeURL
End Sub
Function GetCurrentNetscapeURL()
Dim commapos As Integer
Dim urltitle As String
With DDELink
    .LinkMode = 0
    .LinkTopic = "Netscape|WWW_GetWindowInfo"
    .LinkItem = &HFFFFFFFF
    .LinkMode = 2
    .LinkRequest
    .LinkMode = 0
    Debug.Print .Text
    Debug.Print Left(.Text, 20)
    commapos = InStr(.Text, ",")
    Debug.Print
    GetCurrentNetscapeURL = Mid(.Text, 2, commapos - 3)
    urltitle = Mid(.Text, commapos + 2, Len(.Text) - (commapos + 2))
  End With
End Function
Function GetCurrentIEURL()
Dim commapos As Integer
Dim urltitle As String
With DDELink
    .LinkMode = 0
    .LinkTopic = "Iexplore|WWW_GetWindowInfo"
    .LinkItem = &HFFFFFFFF
    .LinkMode = 2
    .LinkRequest
    .LinkMode = 0
    Debug.Print .Text
    Debug.Print Left(.Text, 20)
    commapos = InStr(.Text, ",")
    Debug.Print
    GetCurrentIEURL = Mid(.Text, 2, commapos - 3)
    urltitle = Mid(.Text, commapos + 2, Len(.Text) - (commapos + 2))
  End With
End Function

this is easily modified to send the data over the network
0
 
LVL 13

Accepted Solution

by:
crazyman earned 100 total points
ID: 2542289
Use EnumWindows to search for all IE windows.  Here is an example: (Taken from a PAQ)

                           '~~~~~Form Code~~~~~

                           Option Explicit

                           Private Sub Command1_Click()
                               Call fEnumWindows 'Look for IE
                           End Sub


                           '~~~~~Module Code~~~~~

                           Option Explicit

                           Public Const MAX_PATH = 260
                           Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
                           Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
                           Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

                           Public Function EnumFunc(ByVal hwnd As Long, ByVal lpData As Long) As Long
                               Dim lResult    As Long
                               Dim sWndName   As String
                               Dim szClassName As String
                           '
                           ' This callback function is called by Windows (from the EnumWindows
                           ' API call) for EVERY window that exists.  It populates the aWindowList
                           ' array with a list of windows that we are interested in.
                           '
                               EnumFunc = 1
                               szClassName = Space$(MAX_PATH)
                               sWndName = Space$(MAX_PATH)

                               lResult = GetClassName(hwnd, szClassName, MAX_PATH)
                               szClassName = Left$(szClassName, lResult)

                               If UCase(szClassName) = "IEFRAME" Then
                                   lResult = GetWindowText(hwnd, sWndName, MAX_PATH)
                                   sWndName = Left$(sWndName, lResult)
                                   'Found an IE window
                                   'Do something with the window text here
                                   Debug.Print sWndName
                               End If
                           End Function

                           Public Function fEnumWindows() As Boolean
                               Dim hwnd As Long
                           '
                           ' The EnumWindows function enumerates all top-level windows
                           ' on the screen by passing the handle of each window, in turn,
                           ' to an application-defined callback function. EnumWindows
                           ' continues until the last top-level window is enumerated or
                           ' the callback function returns FALSE.
                           '
                               Call EnumWindows(AddressOf EnumFunc, hwnd)
                           End Function
0
 
LVL 13

Expert Comment

by:crazyman
ID: 2542321
If you use any of mine please reject the current answer and accept my comment as an answer.
Cheers
0
 

Author Comment

by:pennyroyal
ID: 2551629
thanx a lot...
simply fabulous...
exactly what i need... :)
0
 

Expert Comment

by:newmembername
ID: 5042631
use winsock?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now