+ Responder ao Tópico



  1. #1

    Padrão Script Dydns

    Boa noite alguem ai tem o script do Dydns paguei ele por um ano para colocar alguns clientes de dvr ai queria um script pra aproveitar e deixar no meu servidor mikrotik sem problema

  2. #2

    Padrão Re: Script Dydns

    Citação Postado originalmente por tec.marinho Ver Post
    Boa noite alguem ai tem o script do Dydns paguei ele por um ano para colocar alguns clientes de dvr ai queria um script pra aproveitar e deixar no meu servidor mikrotik sem problema
    Código :
    add name=DDNSD policy=\
        ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
        source="# Set needed variables\r\
        \n:local username \"USER\"\r\
        \n:local password \"SENHA\"\r\
        \n:local hostname \"DOMÍNIO.dyndns.org\"\r\
        \n\r\
        \n:global dyndnsForce\r\
        \n:global previousIP \r\
        \n\r\
        \n# print some debug info\r\
        \n#:log info (\"UpdateDynDNS: username = \$username\")\r\
        \n#:log info (\"UpdateDynDNS: password = \$password\")\r\
        \n#:log info (\"UpdateDynDNS: hostname = \$hostname\")\r\
        \n#:log info (\"UpdateDynDNS: previousIP = \$previousIP\")\r\
        \n\r\
        \n# get the current IP address from the internet (in case of double-nat)\r\
        \n/tool fetch mode=http address=\"checkip.dyndns.org\" src-path=\"/\" dst-\
        path=\"/dyndns.checkip.html\"\r\
        \n:delay 1\r\
        \n:local result [/file get dyndns.checkip.html contents]\r\
        \n\r\
        \n# parse the current IP result\r\
        \n:local resultLen [:len \$result]\r\
        \n:local startLoc [:find \$result \": \" -1]\r\
        \n:set startLoc (\$startLoc + 2)\r\
        \n:local endLoc [:find \$result \"</body>\" -1]\r\
        \n:local currentIP [:pick \$result \$startLoc \$endLoc]\r\
        \n:log info \"UpdateDynDNS: currentIP = \$currentIP\"\r\
        \n\r\
        \n# Remove the # on next line to force an update every single time - usefu\
        l for debugging,\r\
        \n# but you could end up getting blacklisted by DynDNS!\r\
        \n\r\
        \n#:set dyndnsForce true\r\
        \n\r\
        \n# Determine if dyndns update is needed\r\
        \n# more dyndns updater request details http://www.dyndns.com/developers/s\
        pecs/syntax.html\r\
        \n\r\
        \n:if ((\$currentIP != \$previousIP) || (\$dyndnsForce = true)) do={\r\
        \n   :set dyndnsForce false\r\
        \n   :set previousIP \$currentIP\r\
        \n   :log info \"\$currentIP or \$previousIP\"\r\
        \n   /tool fetch user=\$username password=\$password mode=http address=\"m\
        embers.dyndns.org\" \\\r\
        \n      src-path=\"nic/update\?system=dyndns&hostname=\$hostname&myip=\$cu\
        rrentIP&wildcard=no\" \\\r\
        \n      dst-path=\"/dyndns.txt\"\r\
        \n   :delay 1\r\
        \n   :local result [/file get dyndns.txt contents]\r\
        \n   :log info (\"UpdateDynDNS: Dyndns update needed\")\r\
        \n   :log info (\"UpdateDynDNS: Dyndns Update Result: \".\$result)\r\
        \n   :put (\"Dyndns Update Result: \".\$result)\r\
        \n} else={\r\
        \n   :log info (\"UpdateDynDNS: No dyndns update needed\")\r\
        \n}"