
Code: Select all
Sub Include(sInstFile)
Dim f, s, oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
If oFSO.FileExists(sInstFile) Then
Set f = oFSO.OpenTextFile(sInstFile)
s = f.ReadAll
f.Close
ExecuteGlobal s
End If
On Error Goto 0
Set f = Nothing
Set oFSO = Nothing
End Sub
Include("C:\hMailServer\Events\VbsJson.vbs")
Sub OnClientConnect(oClient)
' ip (Visitor IP address, or IP address specified as parameter)
' country_code (Two-letter ISO 3166-1 alpha-2 country code)
' country_code3 (Three-letter ISO 3166-1 alpha-3 country code)
' country (Name of the country)
' region_code (Two-letter ISO-3166-2 state / region code)
' region (Name of the region)
' city (Name of the city)
' postal_code (Postal code / Zip code)
' continent_code (Two-letter continent code)
' latitude (Latitude)
' longitude (Longitude)
' dma_code (DMA Code)
' area_code (Area Code)
' asn (Autonomous System Number)
' isp (Internet service provider)
' timezone (Time Zone)
' Skip if client is local LAN
If InStr(oClient.IPAddress,"192.168.0") Then
Result.Value = 0
Else
Dim oXML, json, oGeoip
Set json = New VbsJson
Set oXML = CreateObject ("Msxml2.XMLHTTP.3.0")
oXML.Open "GET","http://www.telize.com/geoip/"+oClient.IPAddress,False
oXML.Send
If (oXML.status = 200 ) Then
Set oGeoip = json.Decode(oXML.responseText)
Select Case oGeoip("country_code")
Case "CN"
Result.Value = 1
Case "RO"
Result.Value = 1
Case "RU"
Result.Value = 1
Case "US"
If (oGeoip("isp") = "Google Inc.") Then
Result.Value = 0
ElseIf (oGeoip("isp") = "Microsoft Corp") Then
Result.Value = 0
Else
Result.Value = 1
End If
Case "VN"
Result.Value = 1
Case else
Result.Value = 0
End Select
If Result.Value = 1 Then
EventLog.Write("OnClientConnect Denied :"+Chr(34)+vbTab+oClient.IPAddress+vbTab+Chr(34)+oGeoip("country_code")+" - "+oGeoip("country")+" - "+oGeoip("isp"))
Else
EventLog.Write("OnClientConnect :"+Chr(34)+vbTab+oClient.IPAddress+vbTab+Chr(34)+oGeoip("country_code")+" - "+oGeoip("country")+" - "+oGeoip("isp"))
End If
Else
Result.Value = 0
EventLog.Write("www.telize.com/geoip error ->"+Chr(34)+vbTab+oXML.status+vbTab+Chr(34)+oClient.IPAddress)
End If
End If
End Sub
Code: Select all
3780 "2014-06-27 08:45:04.824" "OnClientConnect Denied :" 216.*.*.222 "US - United States - ViaWest"
3780 "2014-06-27 08:45:06.543" "OnClientConnect :" 80.*.*.115 "DK - Denmark - TDC Data Networks"
3780 "2014-06-27 08:45:12.089" "OnClientConnect :" 209.*.*.66 "US - United States - Google Inc."
3780 "2014-06-27 08:51:56.030" "OnClientConnect :" 95.*.*.103 "NL - Netherlands - LeaseWeb B.V."
3780 "2014-06-27 08:51:57.686" "OnClientConnect :" 80.*.*.115 "DK - Denmark - TDC Data Networks"
3780 "2014-06-27 08:55:47.015" "OnClientConnect :" 94.*.*.151 "PT - Portugal - NFSi Telecom, Lda."