Nessie Posted May 17, 2013 Share Posted May 17, 2013 (edited) Hi, yesterday i saw the post of a user who had problems with no-ip.com and I remembered that i had created an udf for no-ip time ago. With this UDF you can simply update your no-ip hostname(s) and retrive the ip address of an no-ip address. Read carrefully: If an error occurred during the request you must not continue sending updates to no-ip.com server. You should instead notify the user of the problem have them attempt to correct it before trying again. If the error return code requires No-IP intervention your client should tell the user to contact our support team. If you continue on this behaviour you can blocked due to abuse.expandcollapse popup#include-once #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ; #INDEX# ======================================================================================================================= ; Title .........: NoIP UDF v.1.0.0 ; AutoIt Version : v3.3.8.1 ; Description ...: NoIP API UDF ; Author(s) .....: Nessie ; =============================================================================================================================== ; #INCLUDES# ========================================================================================================= ; None ; #GLOBAL VARIABLES# ================================================================================================= ; None ; #CURRENT# ===================================================================================================================== ; _NOIP_DNSUpdate ; _NOIP_HostnameResolve ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ; __NOIP_GetIpAddress ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _NOIP_DNSUpdate ; Description ...: Update multiple no-ip hostnames ; Syntax ........: _NOIP_DNSUpdate($sUser, $sPass, $sHostname[, $sIP = ""[, $bOffline = False[, $bSecure = True]]]) ; Parameters ....: $sUser - Your no-ip username ; $sPass - Your no-ip password ; $sHostname - Your no-ip hostname. ; - If updating multiple hostnames use a comma separated list. Ex: test1.no-ip.biz,test2.no-ip.biz ; $sIP - The IP address to which the host(s) will be set. Default is the current IP address. ; $bOffline - Sets the current host(s) to offline status. Offline settings are an Enhanced / No-IP Plus feature. ; $bSecure - The protocol to use. If True the https protocol will be used, otherwise http. Default is True. ; Return values .: On Success - True ; On Failure - ; @error = 1 Empty Username ; @error = 2 Empty Password ; @error = 3 Empty Hostname(s) ; @error = 4 Invalid $bOffline parameter ; @error = 5 Invalid $bSecure parameter ; @error = 6 Unable to retrive the current IP address ; @error = 7 Invalid IP address ; @error = 8 Unable to contact the no-ip website ; @error = 9 Unable to retrive the no-ip source ; @error = 10 "nohost" ; @error = 11 "badauth" ; @error = 12 "badagent" ; @error = 13 "!donator" ; @error = 14 "abuse" ; @error = 15 "911" ; @error = 16 Unknown error ; Author ........: Nessie ; Example .......: _NOIP_DNSUpdate("Test", "Test", "TestME.zapto.org", "") ; =============================================================================================================================== Func _NOIP_DNSUpdate($sUser, $sPass, $sHostname, $sIP = "", $bOffline = False, $bSecure = True) Local $iMatch, $sOffline, $sProtocol If $sUser = "" Then Return SetError(1, 0, "") If $sPass = "" Then Return SetError(2, 0, "") If $sHostname = "" Then Return SetError(3, 0, "") If Not IsBool($bOffline) Then Return SetError(4, 0, "") If Not IsBool($bSecure) Then Return SetError(5, 0, "") If $sIP = "" Then $sIP = __NOIP_GetIpAddress() If @error Then Return SetError(6, 0, "") EndIf ;Thanks to http://tools.netshiftmedia.com/regexlibrary/# for this regex $iMatch = StringRegExp($sIP, "^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$", 0) If Not $iMatch Then Return SetError(7, 0, "") If $bOffline Then $sOffline = "YES" Else $sOffline = "NO" EndIf If $bSecure Then $sProtocol = "https" Else $sProtocol = "http" EndIf Local $bRead = InetRead($sProtocol & "://" & $sUser & ":" & $sPass & "@dynupdate.no-ip.com/nic/update?hostname=" & $sHostname & "&myip=" & $sIP & "&offline=" & $sOffline) If @error Then Return SetError(8, 0, "") Local $sRead = BinaryToString($bRead) If @error Then Return SetError(9, 0, "") Switch $sRead Case StringInStr($sRead, "good ") Or StringInStr($sRead, "nochg ") Return True Case "nohost" Return SetError(10, 0, "") Case "badauth" Return SetError(11, 0, "") Case "badagent" Return SetError(12, 0, "") Case "!donator" Return SetError(13, 0, "") Case "abuse" Return SetError(14, 0, "") Case "911" Return SetError(15, 0, "") Case Else Return SetError(16, 0, "") EndSwitch EndFunc ;==>_NOIP_DNSUpdate ; #FUNCTION# ==================================================================================================================== ; Name ..........: _NOIP_HostnameResolve ; Description ...: Converts a no-ip address to IP address. ; Syntax ........: _NOIP_HostnameResolve($sAddress) ; Parameters ....: $sAddress - The no-ip hostname address ;Return values .: On Success - Returns string containing IP address corresponding to the name. ; On Failure - ; @error = 1 Unable to retrive the IP address ; Author ........: Nessie ; Example .......: _NOIP_HostnameResolve("TestME.zapto.org") ; =============================================================================================================================== Func _NOIP_HostnameResolve($sAddress) TCPStartup() Local $aResult = TCPNameToIP($sAddress) If @error Then Return SetError(1, 0, "") TCPShutdown() Return $aResult EndFunc ;==>_NOIP_HostnameResolve ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __NOIP_GetIpAddress ; Description ...: Retrive the current IP address ; Syntax ........: __NOIP_GetIpAddress() ;Return values .: On Success - Returns string containing IP address corresponding to the name. ; On Failure - ; @error = 1 Unable to contact the server ; @error = 2 Unable to retrive the IP address ; Author ........: Nessie ; Example .......: __NOIP_GetIpAddress() ; =============================================================================================================================== Func __NOIP_GetIpAddress() Local $bRead, $sRead, $aResult $bRead = InetRead("http://checkip.dyndns.org") If @error Then Return SetError(1, 0, "") $sRead = BinaryToString($bRead) If @error Then Return SetError(2, 0, "") $aResult = StringRegExp($sRead, "(?s)(?i)<body>Current IP Address: (.*?)</body>", 3) If Not @error Then Return $aResult[0] $bRead = InetRead("http://api.exip.org/?call=ip") If @error Then Return SetError(1, 0, "") $sRead = BinaryToString($bRead) If @error Then Return SetError(2, 0, "") Return $bRead EndFunc ;==>__NOIP_GetIpAddressHere is a simple example:#include "NoIP.au3" _NOIP_DNSUpdate("MyUSER", "MyPASS", "test1.no-ip.biz,test2.no-ip.biz", "127.0.0.1") If @error Then MsgBox(16, "Error", "Unable to update the No-IP hostname(s)." & @CRLF & "Error: " & @error) Else MsgBox(0, "Done", "Hostaname(s) seccesfully updated") EndIf $sHostIP = _NOIP_HostnameResolve("test1.no-ip.biz") If @error Then MsgBox(16, "Error", "Unable to resolve the address.") Else MsgBox(0, "Done", "The hostname ip is: " & $sHostIP) EndIfNoIP v.1.0.0.rar Edited May 17, 2013 by Nessie My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file Link to comment Share on other sites More sharing options...
guinness Posted May 17, 2013 Share Posted May 17, 2013 Interesting. Will test this later on. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
autoitxp Posted May 18, 2013 Share Posted May 18, 2013 (edited) well host-name resolve will not work for NOIP if you use port redirect service only method which i am using is to GET location headers Thanks ! Edited May 18, 2013 by autoitxp Link to comment Share on other sites More sharing options...
Nessie Posted May 18, 2013 Author Share Posted May 18, 2013 @autoitxpI will certainly take a look to your suggestion when i come back to home Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file Link to comment Share on other sites More sharing options...
guinness Posted May 29, 2013 Share Posted May 29, 2013 This is better version of __NOIP_GetIpAddress, which I created for the current beta of AutoIt. ; #FUNCTION# ==================================================================================================================== ; Name...........: _GetIP ; Description ...: Retrieves the Public IP Address of a Network/Computer. ; Syntax.........: _GetIP ( ) ; Parameters ....: None ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns Public IP Address. ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ; =============================================================================================================================== Func _GetIP() Local $aGetIPURL[4] = [3, "http://checkip.dyndns.org/", "http://api.exip.org/?call=ip", "http://www.myexternalip.com/raw"], $aReturn = 0, $sReturn = "" For $i = 1 To $aGetIPURL[0] $sReturn = InetRead($aGetIPURL[$i]) If @error Or $sReturn == "" Then ContinueLoop $aReturn = StringRegExp(BinaryToString($sReturn), "[\d\.]{7,15}", 3) If @error = 0 Then $sReturn = $aReturn[0] ExitLoop EndIf $sReturn = "" Next If $sReturn == "" Then Return SetError(1, 0, -1) Return $sReturn EndFunc ;==>_GetIP UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now