Code Monkey home page Code Monkey logo

noip-renew's Introduction

Script to auto renew/confirm noip.com free hosts

noip.com free hosts expire every month. This script auto clicks web pages to renew the hosts, using Python/Selenium with Chrome headless mode.

noip.com hosts

Usage

  1. Clone this repository to the device you will be running it from. (git clone https://github.com/loblab/noip-renew.git)
  2. Run setup.sh and set your noip.com account information,
  3. Run noip-renew-USERNAME command.

Check confirmed records from multiple log files:

grep -h Confirmed *.log | grep -v ": 0" | sort

Usage with Docker

For docker users, run the following:

my_username='add username here'
my_password='add password here'
my_host_num='add number of hosts here'
debug_lvl=2
docker build -t loblab/selenium:debian .
echo -e "$(crontab -l)"$'\n'"12  3  *  *  1,3,5  docker run --network host loblab/selenium:debian ${my_username} ${my_password} ${my_host_num} ${debug_lvl}" | crontab -

Remarks

The script is not designed to renew/update the dynamic DNS records, though the latest version does have this ability if requested. Check noip.com documentation for that purpose. Most wireless routers support noip.com. For more information, check here. You can also check DNS-O-Matic to update multiple noip.com DNS records.

If you need notification functionality, please try IDemixI's branch.

History

  • 1.2 (01/02/2021): Merged all pull requests in latest months: make it work for updated noip.com site.
  • 1.1 (06/05/2020): Fixed error when attempting to update an expired host.
  • 1.0 (05/18/2020): Minor fixes to an xpath & a try catch pass to avoid an exception. Also fixed versioning.
  • 1.0 (04/16/2020): Catches "Would you like to upgrade?" page & stops script accordingly. Manual intervention still required.
  • 0.9 (04/13/2020): Complete refactor of code, more stability & automatic crontab scheduling.
  • 0.8 (03/23/2020): Added menu to repair/install/remove script along with ability to update noip.com details.
  • 0.7 (03/21/2020): Code tidyup and improved efficiency (Removed number of hosts and automatically get this)
  • 0.6 (03/15/2020): Improved support for Raspberry Pi (Raspbian Buster) & Changes to setup script.
  • 0.5 (01/05/2020): Support raspberry pi, try different "chromedriver" packages in setup script.
  • 0.4 (01/14/2019): Add num_hosts argument, change for button renaming; support user agent.
  • 0.3 (05/19/2018): Support Docker, ignore timeout, support proxy, tested on python3.
  • 0.2 (11/12/2017): Deploy the script as normal user only. root user with 'no-sandbox' option is not safe for Chrome.
  • 0.1 (11/05/2017): Support Debian with Chrome headless.

noip-renew's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

noip-renew's Issues

useradd: invalid user ID 'pi'

When I try to running with docker, got this error.

pi@raspberrypi:~/Project/noip-renew $ docker-compose up
Building selenium
Step 1/16 : FROM debian
 ---> 756aa643c9cd
Step 2/16 : MAINTAINER loblab
 ---> Using cache
 ---> 7381898d26af
Step 3/16 : ARG USER=loblab
 ---> Using cache
 ---> ca78fdc41038
Step 4/16 : ARG UID=1000
 ---> Using cache
 ---> d88caef2dc81
Step 5/16 : ARG HOME=/noip-renew
 ---> Using cache
 ---> 1c07ec2921b3
Step 6/16 : ARG DEBIAN_FRONTED=noninteractive
 ---> Using cache
 ---> f016d280d84e
Step 7/16 : ARG PYTHON=python3
 ---> Using cache
 ---> c5d708450ccd
Step 8/16 : RUN apt-get update && apt-get -y upgrade
 ---> Using cache
 ---> 8515044e6267
Step 9/16 : RUN apt-get -y install chromium-chromedriver ||     apt-get -y install chromium-driver ||     apt-get -y install chromedriver
 ---> Using cache
 ---> 97fdad943338
Step 10/16 : RUN apt-get -y install ${PYTHON}-pip
 ---> Using cache
 ---> 88a396587817
Step 11/16 : RUN $PYTHON -m pip install selenium
 ---> Using cache
 ---> 65c569707967
Step 12/16 : RUN apt-get -y install curl wget
 ---> Using cache
 ---> 286983192a50
Step 13/16 : RUN useradd -d $HOME -u $UID $USER
 ---> Running in 4377b1a632f2
useradd: invalid user ID 'pi'
ERROR: Service 'selenium' failed to build: The command '/bin/sh -c useradd -d $HOME -u $UID $USER' returned a non-zero code: 3

this script don't work anymore

i used this script for a lot of months and now it doesn't work anymore

[2020/11/10 13:00:09] - Debug level: 2
[2020/11/10 13:00:09] - Opening https://www.noip.com/login...
[2020/11/10 13:00:14] - Logging in...
[2020/11/10 13:00:20] - Opening https://my.noip.com/#!/dynamic-dns...
[2020/11/10 13:00:22] - No hosts or host table rows not found

OR

[2020/11/10 12:46:20] - Debug level: 2
[2020/11/10 12:46:20] - Opening https://www.noip.com/login...
[2020/11/10 12:46:23] - Logging in...
[2020/11/10 12:46:24] - 'utf-8' codec can't decode byte 0xa5 in position 0: invalid start byte

installing on pi?

hi loblab,
thanks for your great script. could you give a short tutorial on how to install this on a pi?
that would be awesome!

Cron job schedule

Can you help me understand the logic in lines 104-108 of the noip-renew.py file?

        nr = min(next_renewal) - 6
        today = date.today() + timedelta(days=nr)
        day = str(today.day)
        month = str(today.month)
        subprocess.call(['/usr/local/bin/noip-renew-skd.sh', day, month, "True"])

It is true that the next renewal (nr) variable is always going to be a negative number?!?
Ex: If next_renewal = 5; then nr = 5 - 6 = -1

It looks like your code is trying to schedule the next noip check for a day prior to today's date.
Ex: If nr = 5 and today's date is 3/27, then noip-renew will schedule the next check for 3/26. (Which is a big problem.)

I think it makes more sense to schedule the next check nr days from today's date. In other words:
nr = min(next_renewal) + 6

Let me know what you think!

Unable to install chromium-chromedriver and chromium-browser

Hi,

I'm on Debian Buster AMD64 and i can't install the setup.sh script.
Unable to locate chromium-chromedriver package and no version chromium-browser package is available.
The script stop after that.

Here my sources.list >

deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main

deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main

buster-updates, previously known as 'volatile'

deb http://deb.debian.org/debian/ buster-updates main
deb-src http://deb.debian.org/debian/ buster-updates main

Can you help me please ?

Can't get the script working: /usr/local/bin/noip-renew-skd.sh: 10: [[: not found

 [I]  /u/l/bin  ls noip-renew.py ^C
[I]  /u/l/bin  ./noip-renew-arooni.sh
[2021/01/05 20:06:34] - Debug level: 2
[2021/01/05 20:06:34] - Opening https://www.noip.com/login...
[2021/01/05 20:06:37] - Logging in...
[2021/01/05 20:06:44] - Opening https://my.noip.com/#!/dynamic-dns...
[2021/01/05 20:06:45] - fooooooooooo.ddns.net expires in 28 days
[2021/01/05 20:06:46] - Confirmed hosts: 0
/usr/local/bin/noip-renew-skd.sh: 10: [[: not found

[I]  ~/s/noip-renew   master   ./setup.sh
No-IP Auto Renewal Script Setup.
1) Install/Repair Script            3) Uninstall Script
2) Update noip.com account details  4) Exit setup.sh
Select an option: 3
[sudo] password for arooni:
Do you want to remove all log files? (y/n): y
Script successfully uninstalled.
[I]  ~/s/noip-renew   master   ./setup.sh
No-IP Auto Renewal Script Setup.
1) Install/Repair Script            3) Uninstall Script
2) Update noip.com account details  4) Exit setup.sh
Select an option: 1
  Operating System: Ubuntu 20.04.1 LTS
Installing necessary packages...
Perform apt-get update? (y/n): n
Reading package lists... Done
Building dependency tree
Reading state information... Done
chromium-chromedriver is already the newest version (1:85.0.4183.83-0ubuntu0.20.04.2).
0 upgraded, 0 newly installed, 0 to remove and 25 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
cron is already the newest version (3.0pl1-136ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 25 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
chromium-browser is already the newest version (1:85.0.4183.83-0ubuntu0.20.04.2).
0 upgraded, 0 newly installed, 0 to remove and 25 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (20.0.2-5ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 25 not upgraded.
Requirement already satisfied: selenium in /usr/local/lib/python3.8/dist-packages (3.141.0)
Requirement already satisfied: urllib3 in /usr/lib/python3/dist-packages (from selenium) (1.25.8)
Deploying the script...
Enter your No-IP Account details...
Username: *******
Password:
Installation Complete.
To change noip.com account details, please run setup.sh again.
Logs can be found in '/var/log/noip-renew/arooni'
[I]  ~/s/noip-renew   master  


DeprecationWarning: use options instead of chrome_options...

I have this error:

pi@RaspGarden:~/rpi-noip-renew $ ./noip-renew.sh
./noip-renew.py:39: DeprecationWarning: use options instead of chrome_options
self.browser = webdriver.Chrome(chrome_options=options)
2020/06/03 23:07:36 [[email protected]] - Debug level: 2
2020/06/03 23:07:36 [[email protected]] - Open https://www.noip.com/login...
2020/06/03 23:09:32 [[email protected]] - Message: timeout: Timed out receiving message from renderer: 1,075
(Session info: headless chrome=78.0.3904.108)

Traceback (most recent call last):
File "./noip-renew.py", line 109, in run
self.login(username, password)
File "./noip-renew.py", line 53, in login
self.browser.save_screenshot("debug1.png")
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 1055, in save_screenshot
return self.get_screenshot_as_file(filename)
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 1032, in get_screenshot_as_file
png = self.get_screenshot_as_png()
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 1064, in get_screenshot_as_png
return base64.b64decode(self.get_screenshot_as_base64().encode('ascii'))
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 1074, in get_screenshot_as_base64
return self.execute(Command.SCREENSHOT)['value']
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: 1,075
(Session info: headless chrome=78.0.3904.108)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./noip-renew.py", line 138, in
sys.exit(main())
File "./noip-renew.py", line 135, in main
return robot.run(username, password, num_hosts)
File "./noip-renew.py", line 114, in run
self.browser.save_screenshot("exception.png")
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 1055, in save_screenshot
return self.get_screenshot_as_file(filename)
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 1032, in get_screenshot_as_file
png = self.get_screenshot_as_png()
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 1064, in get_screenshot_as_png
return base64.b64decode(self.get_screenshot_as_base64().encode('ascii'))
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 1074, in get_screenshot_as_base64
return self.execute(Command.SCREENSHOT)['value']
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: 6,173
(Session info: headless chrome=78.0.3904.108)

I have a Raspberry 2, Raspbian 10 lite (Buster).

Can you help me???

Service chromedriver unexpectedly exited

i run script /usr/local/bin/noip-renew-abdelilah.sh
the the error is
Traceback (most recent call last): File "./noip-renew.py", line 200, in <module> sys.exit(main()) File "./noip-renew.py", line 181, in main return (Robot(noip_username, noip_password, debug)).run() File "./noip-renew.py", line 48, in __init__ self.browser = self.init_browser() File "./noip-renew.py", line 62, in init_browser browser = webdriver.Chrome(options=options) File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__ self.service.start() File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py", line 98, in start self.assert_process_still_running() File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running % (self.path, return_code) selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: -4

i use debian
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster

i use pyhon 3.7
/usr/local/bin/python -> /usr/bin/python3.7

i use pip3
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

i installed selenium 3 with pip3
selenium 3.141.0

i installed chromium
chromium-common/stable,now 88.0.4324.182-1
chromium-driver/stable,now 88.0.4324.182-1
chromium-sandbox/stable,now 88.0.4324.182-1
chromium/stable,now 88.0.4324.182-1
libchromaprint1/stable,now 1.4.3-3

no hosts or host table rows not found

hi all.

i have installed this, and tried it a few times. but i keep getting this error. i have triple checked that i have the username and password entered correctly. and thats all fine.

this is the output from the ssh session.

jason@ubuntu-production:~/no_ip_auto_renew$ ls | Dockerfile README.md debug1.png docker-compose.yml noip-renew-master noip-renew.py screenshot.png | LICENSE crontab-docker-host debug2.png exception.png noip-renew-skd.sh noip-renew.sh setup.sh | jason@ubuntu-production:~/no_ip_auto_renew$ ./noip-renew.sh | [2020/05/16 03:24:25] - Debug level: 2 | [2020/05/16 03:24:25] - Opening https://www.noip.com/login... | [2020/05/16 03:24:28] - Logging in... | [2020/05/16 03:24:32] - Opening https://my.noip.com/#!/dynamic-dns... | [2020/05/16 03:24:34] - No hosts or host table rows not found | 30 0 * * * jason /usr/local/bin/noip-renew-jason /var/log/noip-renew/jason | jason@ubuntu-production:~/no_ip_auto_renew$

Minor issues

First of all, great program, I really like it!
To make it work I had to fix two issues:

  • I had an Exception "IndexError" here. To fix it, I encapsulated the condition with try - except - pass.
  • I had to put in a dot the beginning of the xpath here. In my case I had three hosts, the first one was ok, the other two needed to be confirmed. This did not work without the dot.

Thanks.

Running script on pi

I getting the following message:

Package chromedriver is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'chromedriver' has no installation candidate

Error when running setup.sh

I'm getting this message when I run setup.sh:

Hit:1 http://us.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Ign:4 http://ppa.launchpad.net/certbot/certbot/ubuntu focal InRelease
Hit:5 http://security.ubuntu.com/ubuntu focal-security InRelease
Err:6 http://ppa.launchpad.net/certbot/certbot/ubuntu focal Release
404 Not Found [IP: 91.189.95.83 80]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/certbot/certbot/ubuntu focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

What do I need to do to install this script?

Windows support?

Windows server 2016 standard
python 3.8.2
update:
ok, I made it work
first write a batchfile like

@echo off
taskkill /F /IM chromedriver.exe
taskkill /F /IM chrome.exe
chcp 65001
cd C:\path to noip-renew
start py "noip-renew.py" "username" "password encoded in base64" 2
exit /b

comment all the subprocess.call(['/usr/local/bin/noip-renew-skd.sh' lines,
because we use Task Scheduler instead of cron job under windows.

add the batch to the Task Scheduler, done!

error log:

DevTools listening on ws://127.0.0.1:53942/devtools/browser/b4ad2ef3-b166-4c3a-b96b-07f18308600a
[2020/08/26 16:14:41] - Debug level: 2
[2020/08/26 16:14:41] - Opening https://www.noip.com/login...
[0826/161443.832:INFO:CONSOLE(61)] "Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.", source: https://www.googleadservices.com/pagead/conversion.js (61)
[2020/08/26 16:14:44] - Logging in...
[2020/08/26 16:14:44] - Incorrect padding
Traceback (most recent call last):
  File "noip-renew.py", line 166, in run
    self.login()
  File "noip-renew.py", line 76, in login
    ele_pwd.send_keys(base64.b64decode(self.password).decode('utf-8'))
  File "C:\Users\username\AppData\Local\Programs\Python\Python38-32\lib\base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "noip-renew.py", line 200, in <module>
    sys.exit(main())
  File "noip-renew.py", line 181, in main
    return (Robot(noip_username, noip_password, debug)).run()
  File "noip-renew.py", line 172, in run
    subprocess.call(['/usr/local/bin/noip-renew-skd.sh', "0", "0", "False"])
  File "C:\Users\username\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Users\username\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\username\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable


Current directory:
C:\Install\noip-renew

Command to be executed:
"C:\Windows\py.exe"  "noip-renew.py" "username" "password" 2

exception.png
image

"Chrome version must be between 70 and 73" error

Hi. I get the following errors when running manually.

The script has been running flawless until 21 juni 2019, where it stopped working according to my log.
I did check noip.com..and i believe I had a CAPTCHA test, but I don't have that anymore on the web interface. Must have been on VPN or something to trigger the CAPTCHA.

I'm doing the update manually now, and its really annoying. I love the noip-renew script.

root@xxxxxx:/usr/local/bin# ./noip-renew-debian Traceback (most recent call last): File "./noip-renew.py", line 138, in <module> sys.exit(main()) File "./noip-renew.py", line 134, in main robot = Robot(debug) File "./noip-renew.py", line 39, in __init__ self.browser = webdriver.Chrome(chrome_options=options) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__ desired_capabilities=desired_capabilities) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73 (Driver info: chromedriver=73.0.3683.75,platform=Linux 4.9.0-3-amd64 x86_64)

The renew script has stopped working as you can see, and it ends issuing a error message, that "Chrome version must be between 70 and 73"

I have verified my chormedriver ...as pasted below.

root@xxxxxxxx:/usr/local/bin# chromedriver -v ChromeDriver 73.0.3683.75 root@xxxxxxxxx:/usr/local/bin# apt-get install chromedriver Reading package lists... Done Building dependency tree Reading state information... Done chromedriver is already the newest version (73.0.3683.75-1~deb9u1). 0 upgraded, 0 newly installed, 0 to remove and 23 not upgraded. root@xxxxxxxxx:/usr/local/bin#

What is wrong?
requa3r0

Recent problem

Only recently the script gives me this error, until recently it always worked correctly:

[2020/08/09 09:17:40] - Opening https://my.noip.com/#!/dynamic-dns...
[2020/08/09 09:17:42] - Message: no such element: Unable to locate element: {"method":"xpath","selector":".//a[@Class='no-link-style']"}
(Session info: headless chrome=72.0.3626.121)
(Driver info: chromedriver=72.0.3626.121,platform=Linux 4.19.66-v7+ armv7l)

Message: no such element (".//a[@class='text-info cursor-pointer']")

Hello!

I burnt my RPI few days ago, and after installing/updating the complete previous version, I am now having this error in noip-renew script:

Message: no such element: Unable to locate element: {"method":"xpath","selector":".//a[@class='text-info cursor-pointer']"} (Session info: headless chrome=86.0.4240.197)

I have just gitcloned the project few minutes ago (I saw a PR has been submitted to fix this, but it is not working here).
EDIT: Ohh no my bad, I did not gitcloned because it was saying that the folder was already there

Thanks for your help!

Docker : No hosts or host table rows not found

What am i doing wrong here guys???
This is the output:

sudo docker run --network host loblab/selenium:debian XXXXXXX ZZZZZZZZZZZZZZ(base64) 2
[2021/03/27 17:00:40] - Debug level: 2
[2021/03/27 17:00:40] - Opening https://www.noip.com/login...
[2021/03/27 17:00:44] - Logging in...
[2021/03/27 17:00:48] - Opening https://my.noip.com/#!/dynamic-dns...
[2021/03/27 17:00:51] - No hosts or host table rows not found
Traceback (most recent call last):
File "/home/loblab/noip-renew.py", line 167, in run
if not self.update_hosts():
File "/home/loblab/noip-renew.py", line 90, in update_hosts
hosts = self.get_hosts()
File "/home/loblab/noip-renew.py", line 159, in get_hosts
raise Exception("No hosts or host table rows not found")
Exception: No hosts or host table rows not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/loblab/noip-renew.py", line 200, in
sys.exit(main())
File "/home/loblab/noip-renew.py", line 181, in main
return (Robot(noip_username, noip_password, debug)).run()
File "/home/loblab/noip-renew.py", line 172, in run
subprocess.call(['/usr/local/bin/noip-renew-skd.sh', "", "", "False"])
File "/usr/lib/python3.7/subprocess.py", line 323, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.7/subprocess.py", line 775, in init
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/noip-renew-skd.sh': '/usr/local/bin/noip-renew-skd.sh'

centos 7, git 后进入目录执行./setup.sh

选择2(update noip.com account details)输入用户名和密码后提示sed: can't read /usr/local/bin/noip-renew-XXXX(我的用户名): No such file or directory
求解答

Fail to set password with setup.sh

Hello,

I am trying to run your script on FreeBSD..
Everything going well, till i try to set my NOIP password by using setup.sh, here the error i get :
error

Problem with 0.9

I've very old version 0.4 and work fine on RPI3.
With 0.9 i've this error:

File "/usr/local/bin/noip-renew.py", line 35
print(f"[{self.time_string_formatter}] - {msg}")
^
SyntaxError: invalid syntax

[Docker] No hosts or host table rows not found

Hi,
if I run noip-renew from shell everything works fine.
Running on docker I got "No hosts or host table rows not found"

I followed these steps:

export my_username='myusername'
export my_password='mypassword'
export my_host_num='1'
export debug_lvl=2
docker build -t loblab/selenium:debian .

and then (not considering error about No such file or directory: '/usr/local/bin/noip-renew-skd.sh' at the end of run) I've got this...

$  docker run --network host loblab/selenium:debian ${my_username} ${my_password} ${my_host_num} ${debug_lvl}
[2021/02/17 22:57:10] - Debug level: 1
[2021/02/17 22:57:10] - Opening https://www.noip.com/login...
[2021/02/17 22:57:12] - Logging in...
[2021/02/17 22:57:15] - Opening https://my.noip.com/#!/dynamic-dns...
[2021/02/17 22:57:18] - No hosts or host table rows not found
Traceback (most recent call last):
  File "/home/loblab/noip-renew.py", line 167, in run
    if not self.update_hosts():
  File "/home/loblab/noip-renew.py", line 90, in update_hosts
    hosts = self.get_hosts()
  File "/home/loblab/noip-renew.py", line 159, in get_hosts
    raise Exception("No hosts or host table rows not found")
Exception: No hosts or host table rows not found
  • my_host_num variable was taken as debug level
  • No hosts or host table rows not found

[Docker] silent the `missing noip-renew-skd.sh` error

Similar to #61 where there is a missing file /usr/local/bin/noip-renew-skd.sherror even though the script ran successfully. Maybe adding a dummy file inside the Dockerfile would be better ? Like,

RUN touch /usr/local/bin/noip-renew-skd.sh

right after all the apt-get installation.

something seems broken - script is not working any more.

Hi
Something is not working right anymore!
The script has not been working for quite a while.

The user in image debug1-2 and exeption.png looks fine.
The script is logging in correctly and loads the correct pages.

Software:
I have cloned latest code on my debian 9 sever - user: debian

The additional Software has been a bit of a nightmare to figure out, since last update.
Mainly because i run Debian 9...so all repos are not running latest versions.
I have sideloaded all software...and this means that running setup.sh...BREALS EVERTHING!
Please change the script to ASK before installing / updating software in an installation script!
IF anwser is no...just list the software installed...and show if its ok or not!
Otherwise the installer will undo all the sideloaded software and downgrade to repo versions!!!

Anyway I have made sure all software are the newest version, and I have no code breaks due to incompatibility!

Im Running
Chromium 73.0.3683.75 built on Debian 9.8, running on Debian 9.13
ChromeDriver 87.0.4280.20
Python 3.6.4

sudo python3.6 -m pip install selenium
Requirement already satisfied: selenium in /usr/local/lib/python3.6/site-packages (3.141.0)
Requirement already satisfied: urllib3 in /usr/local/lib/python3.6/site-packages (from selenium) (1.26.2)

Runing as user
[2020/12/28 14:36:20] - Debug level: 2
[2020/12/28 14:36:20] - Opening https://www.noip.com/login...
[2020/12/28 14:36:23] - Logging in...
[2020/12/28 14:36:23] - Incorrect padding
[sudo] password for debian:
30 0 * * * debian /usr/local/bin/noip-renew-debian /var/log/noip-renew/debian

run with sudo

sudo ./noip-renew-debian
[2020/12/28 14:55:40] - Debug level: 2
[2020/12/28 14:55:40] - Opening https://www.noip.com/login...
[2020/12/28 14:55:43] - Logging in...
[2020/12/28 14:55:53] - Opening https://my.noip.com/#!/dynamic-dns...
[2020/12/28 14:55:55] - Message: no such element: Unable to locate element: {"method":"xpath","selector":".//a[@Class='text-info cursor-pointer']"}
(Session info: headless chrome=87.0.4280.66)

30 0 * * * debian /usr/local/bin/noip-renew-debian /var/log/noip-renew/debian

See image of Debug2 and exeption.png

debug2
exeption

Why has the crontab been moved out of the docker container?

Hi everyone,

I just pulled the latest version and realized, that for Docker usage, the docker-compose and Dockerfile have changed. As far as i understand it, it is intended that the crontab is run on the Dockerhost, which executes a docker exec to run the update script inside the container. Why has this implementation been choose?

This goes completely against the docker concept. When I run docker-compose up I want everything that is related and neccessary for that container to be in there as well as all of it removed when I run docker-compose down

Cheers
Fabian

issue with noip-renew.sh

Hi,

After configuring the package on my RPI, I am facing this error message:

File "./noip-renew.py", line 35
print(f"[{self.time_string_formatter}] - {msg}")
^
SyntaxError: invalid syntax

All dependancies with Python have been installed before the configuration of the no-ip account.
Thanks for you help!
Regards

Edit: I made the test with the noip-renew.py, and had exactly the same error message

Better feedback with pushover notifications - not an issue more a feature reuquest

Hi lollab.

I have added this python function to my code

The function is insearted as the first function in
class Robot:

def pushover(self, msg):
    conn = httplib.HTTPSConnection("api.pushover.net:443")
    conn.request("POST", "/1/messages.json",
    urllib.urlencode({
    "token": "mypushovertoken",
    "user": "mypushoveruserkey",
    "message": msg,
    "device": "SOMEDEVICENAME",    #OPTIONAL switch.....but i like to have this messate send only to a specific device
    }), { "Content-type": "application/x-www-form-urlencoded" })
    conn.getresponse()

Its activated here.

    for button in buttons_todo:
        button.click()
        time.sleep(1)
    self.browser.save_screenshot("result.png")
    self.log_msg("Confirmed hosts: %d" % count, 2)

    #pushover
    if count > 0:
            self.pushover("Confirmed hosts: %d" % count)
    return True

The user will receive a pushover notification on his smartphone with the pushover app, with info about number of host confirmed.

Very handy im my opionion.

You could add the pushover info and activation switch in the .sh script with other credientials.

Keep up the good work

Requaero.

Selenium/webdriver/chrome seems to be broken, possibly DNS or certificate-related

I have been using this software for about a year, and it has worked fine. Until recently. I cloned the latest master and ran the setup script (including the "apt get" parts), so I know I have the latest version.
First I got this error message:
Message: unknown error: net::ERR_NAME_NOT_RESOLVED (Session info: headless chrome=88.0.4324.150)

Thinking it was DNS-related, I substituted LOGIN_URL = "https://www.noip.com/login" with LOGIN_URL = "https://8.23.224.107/login" in the python file, but even though there was no raised exception this time, it did not work:
print(self.browser.page_source) (added for debugging reasons) resulted in <html><head></head><body></body></html>

I can't determine if it is the selenium package that is broken, if the selenium package has changed its syntax or default values and the noip-renew scripts have not been updated to match, or if the noip.com webpage has changed its coding. Or if it is DNS- and/or certificate-related. Something that could be the cause is if the headless browser could not verify the certificate of www.noip.com, but I don't know how to troubleshoot this. (The IP address URL gave me a certificate warning in a desktop Firefox session, since the certificate is only valid for the noip.com domain, and that could be the reason. So perhaps the root cause is DNS-related after all.)

Do others have the same problems? Any ideas?

(I have tried this on Ubuntu 20.04 and Ubuntu 20.10, both up-to-date to within a week or so, both running a local dnsmasq instance which works for all other DNS lookups. Python version 3.8.6 (20.10) or 3.8.5 (20.04). Selenium version (according to pip3 list) is 3.141.0 in both cases.)

New simple approch with puppeteer and js - put in readme.md

See in attachment sample.js (easy invoke with node sample.js after install nodejs)
Sample.zip

The script work fine, but need some improvement.
I have also I working version build with Azure Function (linux consumption plan), so low cost solution.
(a timertrigger every 15 days for example and a httptrigger to test it. save to blob storage the screenshot)
Same code as sample.js

Please put in readme.md so also other can be benefit or adopt and start a new project, I no have time to manage it.

Syntax error whenever I try to run the script.

pi@pihole:/usr/local/bin $ ./noip-renew-pi.sh File "./noip-renew.py", line 35 print(f"[{self.time_string_formatter}] - {msg}") ^ SyntaxError: invalid syntax pi@pihole:/usr/local/bin $

It doesn't look like I'm good with pasting the output to my phone very well. Anyway, the ^ is pointing to the " after {msg}.
Running on Raspberry pi 3. All dependencies updated.

ISSUE -- 'utf-8' codec can't decode byte 0xe9 in position 1 ISSUE

hello Bros,
I got the issue after i ran as below ? Could you please assist the issue related 'utf-8' . Any assist will be very well appreciated.

./noip-renew.py xxxxxxxxx djfjkgsbsfb (xxxxx : my noip account ; djfjkgsbsfb : my password)
[2021/03/06 16:32:18] - Debug level: 1
[2021/03/06 16:32:18] - Opening https://www.noip.com/login...
[2021/03/06 16:32:24] - Logging in...
[2021/03/06 16:32:25] - 'utf-8' codec can't decode byte 0xe9 in position 1: invalid continuation byte
PS: Python version : 3.6 , I did it with my Raspberry Pi 3B.

"No hosts or host table rows not found"

[2021/02/17 Debug level: 2
[2021/02/17 Opening https://www.noip.com/login...
[2021/02/17 Logging in...
[2021/02/17 Opening https://my.noip.com/#!/dynamic-dns...
[2021/02/17 No hosts or host table rows not found

Any idea? I do have a hostname, which is waiting to get confirmed when logging in.

no hosts or host table rows not found

Hi again!
I keep moving forward and once again thanks for your help!

I am now facing this issue (the script does not connect) and after checking the files, I am almost sure that is because my pwd contains special characters ($, !, /, etc...).

Regards

edit: In fact does not seem to linked to special char... I changed the pwd and faced the same issue (debug1 showing login page, debug 2 showing user/pwd combination is incorrect). The script reports asuccessful connection btw:

pi@octopi:~/noip-renew $ ./noip-renew.sh
[2020/06/27 15:38:04] - Debug level: 2
[2020/06/27 15:38:04] - Opening https://www.noip.com/login...
[2020/06/27 15:38:08] - Logging in...
[2020/06/27 15:38:15] - Opening https://my.noip.com/#!/dynamic-dns...
[2020/06/27 15:38:18] - No hosts or host table rows not found
30 0 * * * pi /usr/local/bin/noip-renew-pi /var/log/noip-renew/pi

Invalid syntax error

Ran install on rabspberrypi followed all steps added my no-ip acct info and received the following error

root@retropie:~/noip-renew# ./noip-renew.sh
  File "./noip-renew.py", line 35
    print(f"[{self.time_string_formatter}] - {msg}")
                                                  ^
SyntaxError: invalid syntax

Install on Raspberry Pi

In order to install the script on Raspberry Pi, in addition to the original, follow these steps:

  1. Install Selenium since the script does not do so automatically with
    sudo pip install selenium

  2. Edit the noip-renew.sh file by changing all occurrences of chromedriver into chromium-chromedriver

  3. As of the moment, chromium on Raspbian Buster+ versions does not work without adding the code options.add_argument('--disable-features=VizDisplayCompositor') to noip-renew.py among all the other options under __init__ . Check https://www.raspberrypi.org/forums/viewtopic.php?t=258019 for reference.
    Running the script without doing step 3 will throw a "Chrome not reachable" error.

[Docker] Can't launch docker run

Hello,

here is my problem, I can't launch docker run with my credentials variable. I have an error on 'utf-8' and no file for /usr/local/bin/noip-renew-skd.sh :

docker run --network host loblab/selenium:debian ${my_username} ${my_password} ${my_host_num} ${debug_lvl}
[2021/03/01 17:22:55] - Debug level: 1
[2021/03/01 17:22:55] - Opening https://www.noip.com/login...
[2021/03/01 17:22:58] - Logging in...
[2021/03/01 17:22:58] - 'utf-8' codec can't decode byte 0xff in position 1: invalid start byte
Traceback (most recent call last):
  File "/home/loblab/noip-renew.py", line 166, in run
    self.login()
  File "/home/loblab/noip-renew.py", line 76, in login
    ele_pwd.send_keys(base64.b64decode(self.password).decode('utf-8'))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 1: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/loblab/noip-renew.py", line 200, in <module>
    sys.exit(main())
  File "/home/loblab/noip-renew.py", line 181, in main
    return (Robot(noip_username, noip_password, debug)).run()
  File "/home/loblab/noip-renew.py", line 172, in run
    subprocess.call(['/usr/local/bin/noip-renew-skd.sh', "*", "*", "False"])
  File "/usr/lib/python3.7/subprocess.py", line 323, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/noip-renew-skd.sh': '/usr/local/bin/noip-renew-skd.sh'

What's the solution ?

page with the offer to upgrade to enhanced

Good afternoon. Thank you for a great script, very useful indeed! However, I encountered a problem - when performing the button click procedure, the process stops on the page with the offer to upgrade to enhanced. I attach a screenshot.

result

MacOS version?

Would you consider making a version of your noip-renew scripts that works on MacOS?

Necessary changes to noip-renew-skd.sh

The following file creates the cron job that allows noip-renew to run once every 4 days:
noip-renew-skd.sh

However, this file contains 1 error and 1 suggested improvement.

The Error

The INSTEXE variable points to a file that does not exist. The variable must include the .sh file extension.
Wrong: INSTEXE=$INSTDIR/noip-renew-$USER
Correct: INSTEXE=$INSTDIR/noip-renew-$USER.sh

Suggested Improvement

I was unable to get the cron job working, until I omitted the $USER parameter from the cron job. I use a raspberry pi. Here are the values that I assigned to the CRONJOB and NEWCJOB variables.

CRONJOB="30 0 * * * $INSTEXE $LOGDIR"
NEWCJOB="30 0 $1 $2 * $INSTEXE $LOGDIR"

Issue with chromedriver?

Hi! I've been trying to use your awesome script to save myself some time and I couldn't get it to work.
Upon running noip-renew.sh this comes up:

Traceback (most recent call last):
File "./noip-renew.py", line 200, in
sys.exit(main())
File "./noip-renew.py", line 181, in main
return (Robot(noip_username, noip_password, debug)).run()
File "./noip-renew.py", line 48, in init
self.browser = self.init_browser()
File "./noip-renew.py", line 62, in init_browser
browser = webdriver.Chrome(options=options)
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/chrome/webdriver.py", line 73, in init
self.service.start()
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1

I have tried troubleshooting the problem myself but I am kind of inexperienced. I tried changing my chromedriver version to match chrome but that didn't seem to fix it, can you give me a hand?
Thanks!

no such element error

Has been good for months
but a fews day ago got error like:
[2020/10/14 14:44:13] - Debug level: 2
[2020/10/14 14:44:13] - Opening https://www.noip.com/login...
[2020/10/14 14:44:17] - Logging in...
[2020/10/14 14:44:23] - Opening https://my.noip.com/#!/dynamic-dns...
[2020/10/14 14:44:24] - Message: no such element: Unable to locate element: {"method":"xpath","selector":".//a[@Class='text-info cursor-pointer']"}
(Session info: headless chrome=84.0.4147.105)

Is there a ready-to-go Docker image?

Hi, I was wondering if there is a ready-to-go Docker image that I can install on my Synology nas. Using Docker on the Synology nas goes to a GUI, so I really don’t know how to install your container without using the GUI.

TIA

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.