Jump to content

Search the Community

Showing results for tags 'sre geo ip ip2location'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Here are a couple of examples to find the geographical location of an IP address using various databases located around the Internet. IpToCountry.csv: #include <Array.au3> #include <Constants.au3> #cs Initial discussion: http://www.autoitscript.com/forum/topic/147550-sre-guru-challenge/ #ce Example() Func Example() Local $sIP = '74.125.224.72' ; 'Google IP' Local $sString = _IPv4ToInt($sIP) Local $sRead = FileRead(@ScriptDir & '\IpToCountry.csv') ; http://software77.net/geo-ip/ Local $hTimer = TimerInit() Local $aArray = StringRegExp($sRead, '"(' & StringLeft($sString, 2) & '\d{6,8})","(\d{8,10})","([a-z]+)","(\d{8,10})","([A-Z]{2})","([A-Z]{2,3})","([a-zA-Z ]+)"\n', 3) If @error = 0 Then Local $aReturn[7] For $i = 0 To UBound($aArray) - 1 Step 7 If $sString >= $aArray[$i] And $sString <= $aArray[$i + 1] Then $aReturn[0] = $aArray[$i] $aReturn[1] = $aArray[$i + 1] $aReturn[2] = $aArray[$i + 2] $aReturn[3] = $aArray[$i + 3] $aReturn[4] = $aArray[$i + 4] $aReturn[5] = $aArray[$i + 5] $aReturn[6] = $aArray[$i + 6] ExitLoop EndIf Next ConsoleWrite(TimerDiff($hTimer) & @CRLF) _ArrayDisplay($aReturn) Else MsgBox($MB_SYSTEMMODAL, '', 'Well an error occurred. Sorry.') EndIf EndFunc ;==>Example Func _IPv4ToInt($sString) ; By JohnOne Local $aStringSplit = StringSplit($sString, '.', 3) Local $iOct1 = Int($aStringSplit[0]) * (256 ^ 3) Local $iOct2 = Int($aStringSplit[1]) * (256 ^ 2) Local $iOct3 = Int($aStringSplit[2]) * (256) Local $iOct4 = Int($aStringSplit[3]) Return $iOct1 + $iOct2 + $iOct3 + $iOct4 EndFunc ;==>_IPv4ToInt
×
×
  • Create New...