Results 1 to 6 of 6

Thread: IP address logging

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    4

    IP address logging

    HI All,

    I am new to VB script. i want to log users IP addresses who accessing my system. is it possible to do in VB Script.

    Thanks,
    Prabhu Selvakumar

  2. #2
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: IP address logging

    Yes - Request.ServerVariables("REMOTE_ADDR") will contain the user's IP address. Then you can write it to a text file, insert it to database, etc.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    4

    Re: IP address logging

    Thanks SambaNeko, could you please share the script.... i have tried lot but i could not find it... please help me on this...

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    4

    Re: IP address logging

    i have tried below script to print the remote IP who accessing my system

    On Error Resume Next
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Do while(true)
    wscript.echo "******** " & Request.ServerVariables("REMOTE_ADDR")
    Loop


    the above code is not working... could you please help me on this.

  5. #5
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: IP address logging

    Ah, you're actually asking something different than what I thought you were. Not sure how to get the IP in your scenario. Is this of any use? The relevant part:
    Code:
    'Get IP address of the computer and display it in the window
    Set IPConfigSet = objWMIService.ExecQuery _
        ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
     
    For Each IPConfig in IPConfigSet
        If Not IsNull(IPConfig.IPAddress) Then
            For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
                objdocument.WriteLn "IP Address:        " & IPConfig.IPAddress(i) & "<br>"
            Next
        End If
    Next
    That may only be getting the IP of your own system though... I'm really not sure.

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    4

    Re: IP address logging

    Thanks for your reply SambaNeko, i hope the above code will print my system IP address.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width