<% ' ' Written by Stefan Olsson on behalf of Damalini AB ' Creation 2012-05-18 ' Dim fileprotocolversion, protocolversion, language , version, licensenumber, applicationserial As String Dim useragent, remoteIP, path, hostname Dim d, i, s, a Dim prog() As String Dim targetfile Dim resultstring Dim o Dim rightNow as DateTime = DateTime.Now Dim Organization, Country, City, Latitude, Longitude As String Dim page As String Dim str As String Dim myWebClient As New System.Net.WebClient() Dim url As String Dim OSSystem As String Organization = "" Country = "" City = "" Latitude = "" Longitude = "" hostname = "" protocolversion = "" language = "" version = "" licensenumber = "" applicationserial = "" useragent = "" OSSystem = "" ' ' The protocol version used to save data in the file ' fileprotocolversion = "2" protocolversion = Request.QueryString("pv") ' Protocol version comming from easylink language = Request.QueryString("l") ' Language setting in Easylink version = Request.QueryString("v") ' Easylink version licensenumber = Request.QueryString("ln") ' Easylink license number applicationserial = Request.QueryString("asid") ' Easylink serial number useragent = Request.ServerVariables("HTTP_USER_AGENT") ' Which client is the user using If InStr(useragent, "Windows NT 6.1") Then OSSystem = "Windows 7" ElseIf InStr(useragent, "Windows NT 6.0") Then OSSystem = "Windows Vista" ElseIf InStr(useragent, "Windows NT 5.2") Then OSSystem = "Windows Server 2003" ElseIf InStr(useragent, "Windows NT 5.1") Then OSSystem = "Windows XP" ElseIf InStr(useragent, "Windows NT 5.0") Then OSSystem = "Windows 2000" ElseIf InStr(useragent, "Windows 98") Then OSSystem = "Windows 98" ElseIf InStr(useragent, "Windows 95") Then OSSystem = "Windows 95" ElseIf InStr(useragent, "Mac OS X") Then OSSystem = "Mac OS X" ElseIf InStr(useragent, "Linux") Then OSSystem = "Linux" Else OSSystem = "Unknown" End If path = Request.ServerVariables("PATH_TRANSLATED") ' The Path to this script ' ' Get the remote (calling) IP address ' ' with Proxy detection ' remoteIP = Request.ServerVariables("REMOTE_ADDR") If remoteIP = "" Then remoteIP = Request.UserHostAddress End If ' ' without Proxy detection ' If remoteIP = "" Then remoteIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR") End If If remoteIP.Length > 0 Then Try ' ' Translate the ip address into a DNS name ' 'Response.Write("remoteIP = " & remoteIP & "
") hostname = System.Net.Dns.GetHostEntry(remoteIP.ToString ).HostName if (hostname = String.Empty) Then hostname = "Can not resolve" End If ' ' Use http://whatismyipaddress.com to extract more information ' url = "http://whatismyipaddress.com/ip/" & remoteIP 'Response.Write("url = " & url & "
") ' ' Simulate an ordinary web access, that is, ' access the page and save the entire response (html page) into a string ' myWebClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)") page = myWebClient.DownloadString(url) ' ' Parse the downloaded string for specific parameters ' This will stopp work if whatismyipaddress changes their layout ' but for now rely on whatismyipaddress ' ' Get Organization ' i = InStr(1, page, "Organization:", vbTextCompare) + 22 str = Mid(page, i, 100) ' i = InStr(1, str, "", vbTextCompare) Organization = Mid(str, 1, i - 1) ' ' Get Country ' i = InStr(1, page, "Country:", vbTextCompare) + 17 str = Mid(page, i, 100) ' i = InStr(1, str, " ", vbTextCompare) Country = Mid(str, 1, i - 1) ' ' Get City ' i = InStr(1, page, "City:", vbTextCompare) + 14 str = Mid(page, i, 100) ' i = InStr(1, str, "", vbTextCompare) City = Mid(str, 1, i - 1) ' ' Get Latitude ' i = InStr(1, page, "Latitude:", vbTextCompare) + 18 str = Mid(page, i, 100) ' i = InStr(1, str, "", vbTextCompare) Latitude = Mid(str, 1, i - 1) ' ' Get Longitude ' i = InStr(1, page, "Longitude:", vbTextCompare) + 19 str = Mid(page, i, 100) ' i = InStr(1, str, "", vbTextCompare) Longitude = Mid(str, 1, i - 1) Catch ex As Exception End Try End If Try ' ' Create the string to be saved in the data file, ' "save" each information seperated with a tab character ' resultstring = "" resultstring = resultstring & fileprotocolversion & vbTab resultstring = resultstring & protocolversion & vbTab resultstring = resultstring & rightNow.ToString("yyyy-MM-dd") & vbTab resultstring = resultstring & rightNow.ToString("HH:mm:ss") & vbTab resultstring = resultstring & remoteIP & vbTab resultstring = resultstring & hostname & vbTab resultstring = resultstring & OSSystem & vbTab resultstring = resultstring & Organization & vbTab resultstring = resultstring & Country & vbTab resultstring = resultstring & City & vbTab resultstring = resultstring & Latitude & vbTab resultstring = resultstring & Longitude & vbTab resultstring = resultstring & vbTab resultstring = resultstring & vbTab resultstring = resultstring & vbTab resultstring = resultstring & useragent & vbTab resultstring = resultstring & language & vbTab resultstring = resultstring & version & vbTab resultstring = resultstring & licensenumber & vbTab resultstring = resultstring & applicationserial & vbTab REM Response.Write("protocolversion = " & protocolversion & "
") REM Response.Write("resultstring = " & resultstring & "
") REM Response.Write("
") REM Response.Write("Request.QueryString = ") REM Response.Write(Request.QueryString) REM Response.Write("
") REM Response.Write("Request.QueryString(2) = " & Request.QueryString(2) & "
") REM Response.Write("Request.QueryString(7) = " & Request.QueryString(7) & "
") REM Response.Write("Request.QueryString(ProgramStart5) = " & Request.QueryString("ProgramStart5") & "
") REM o=Request.QueryString.Keys REM Response.Write("o(2) = " & o(2) & "
") REM Response.Write("o(7) = " & o(7) & "
") REM Response.Write("Request.QueryString.Keys(2) = " & Request.QueryString.Keys(2) & "
") REM Response.Write("Request.QueryString.Keys(7) = " & Request.QueryString.Keys(7) & "
") REM Response.Write("Request.QueryString.Count = " & Request.QueryString.Count & "
") ' ' Extract the program paramters ' If Request.QueryString.Count > 5 Then For i = 5 To Request.QueryString.Count -1 s = Request.QueryString(i) If strComp(s , "ProgramStart") = 0 Then s = "0" End if resultstring = resultstring & Request.QueryString.Keys(i) & ":" & s & vbTab next End if 'Response.Write("resultstring = " & resultstring & "
") ' ' Only save if a path exist to the directory where this script is placed ' If path.Length > 0 Then Dim ts, fs, f Dim split As String() = path.Split(New [Char]() {"\"c}) ' ' Get the path to the same directory where this script is placed ' and add the data filename ' fs=Server.CreateObject("Scripting.FileSystemObject") targetfile = fs.BuildPath(fs.GetParentFolderName(path),"easylink_3") targetfile = fs.BuildPath(targetfile,"userdata.txt") 'Response.Write("targetfile = " & targetfile & "
") If (fs.FileExists(targetfile)) = true Then ts = fs.GetFile(targetfile) f = ts.OpenAsTextStream(8) ' Append to the file, ASCII mode Else f = fs.CreateTextFile(targetfile) ' Create file, ASCII mode End if f.Write(resultstring) f.Write(vbCrLf) f.close End If Catch ex As Exception End Try ' ' Redirect the user to the download link ' Response.BufferOutput = False If (Response.IsClientConnected) Then Response.Redirect("/easylink/easylink_3/EasyLink.msi", false) Else Response.End() End If %>