Results 1 to 12 of 12

Thread: distinguish hits from various domains

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537

    distinguish hits from various domains

    is there a way to tell where our viewers are coming from?
    i know we can trap IP's and stuff but how do i determine if they are coming from say .edu or .com or .net?

    if that doesn't make sense, please tell me and i'll try and re-word it.

    thank you
    pnj

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Code:
    <html>
    
    <head>
    <title>Resolve IP</title>
    </head>
    
    <body>
    
    <p>Hello freak of nature, connected from <%
    set bh = Server.CreateObject("cyScape.browserObj")
    hostname = bh.ResolveIP
    if  hostname <> "" then
          response.write hostname
    else
          response.write "Unknown Dumbass"
    end if
    %> </p>
    
    <p>%&gt;</p>
    </body>
    </html>

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537

    Talking

    that's great.

    is there a way to do it w/ out browserhawk?


    Thanks!
    pnj

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by pnj
    that's great.

    is there a way to do it w/ out browserhawk?


    Thanks!
    OK... I'm going to sound like an idiot here.
    Browserhawk???
    Did I miss something?

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537
    if me.retarted=true then
    kick me in the shins
    end if
    msgbox "My shins hurt!"

    well, were did you get the object cyScape?

    i have used a component called browserhawk before and it is made by a company called cyScape.

    when i tried to run your code i got a Server.CreateObject Failed

    message.

    (rubbing my shins....in pain...)
    pnj

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    WHOOPS!! yup my fault actually. You can kick me

    Yes... As such, I don't think it's possible to simply get the domain name by looking at an IP address.

    You'll have to get a component or tool for this.

    see here:
    http://www.aspobjects.com/ASP_Components/network/dns/

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537
    I suppose one could write a component that calls nslookup.

    you could pass the component the IP and it would call nslookup, get the domain and pass it back.

    i have no idea how to call nslookup from a component though.

    but in theory it sounds easy eh?
    pnj

  8. #8
    Hyperactive Member
    Join Date
    Feb 2001
    Posts
    280
    hi,

    this is a terrible suggestion..

    whenever I need to do something quick (and dirty) - rather than dig out the relvent object/api, i often resort to just shelling a prompt (call shell.....).
    As nslookup takes a set of commands and an exit to end, I guess that when you want to do a lookup (you could) use the FSO to create parms.txt containing 2 lines (ip address on the first, EXIT on the second) - shell "type pass.txt | nslookup > info.dat" - then again use the FSO to read info.dat - then stringslice out the "name: remotename" line..... - all on the server

    very dirty - very bad - use it often for ftp/sending message and adding user accounts to the localadmin group......

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537
    jpritchard

    that sounds cool to me. what makes it so dirty and bad?
    would using the API be more effeciant?
    pnj

  10. #10
    Hyperactive Member
    Join Date
    Feb 2001
    Posts
    280
    hi

    yeah you are right the api is by far the better way to go..
    shelling command is just duff.... but very useful particularly when you have a command based 3rd party product which has some functionality you would like to incoporate into a vb app. If they provide NO object/api then this type of thing would work but dunno what the server impact would be, (threading etc etc......)
    <%
    option explicit


    Dim strIP, objWsh, objRtc, objfso, objFile, strCommand, strContent, strupdpath

    '----the one you want
    strIP = "127.0.0.1"

    '---some path on the server where iuser etc can update!!
    strupdpath = "c:\inetpub\wwwroot\upddir\"

    Set objfso = Server.CreateObject("Scripting.FileSystemObject")
    Set objFile = objfso.CreateTextFile(strupdpath & "nslookup.txt", True)
    objFile.WriteLine(strip)
    objFile.WriteLine("exit")
    objFile.Close
    Set objFile = nothing

    strCommand = "cmd /c type " & strupdpath & "nslookup.txt | nslookup > " & strupdpath & "nslookup.dat"
    Set objWsh = Server.CreateObject("WScript.Shell")
    objRtc = objWsh.Run (strCommand , 0, True)
    Set objWsh = Nothing


    Set objFile = objfso.OpenTextFile( strupdpath & "nslookup.dat", 1)
    strContent = objFile.ReadAll
    Set objFile = nothing
    Set objfso = nothing

    '---ling out the whole response..
    Response.Write strContent
    Response.Write "<br>done!"


    %>

  11. #11
    Hyperactive Member
    Join Date
    Feb 2001
    Posts
    280

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537

    :)

    nice!

    Thanks for both the code and the link!
    pnj

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