Giter Site home page Giter Site logo

neothematrix / noip-renew Goto Github PK

View Code? Open in Web Editor NEW

This project forked from loblab/noip-renew

53.0 53.0 19.0 429 KB

Auto renew (confirm) noip.com free hosts

Home Page: https://hub.docker.com/r/moebiuss/noip-renew

License: Apache License 2.0

Python 58.51% Dockerfile 3.62% Shell 37.87%
ddns

noip-renew's People

Contributors

angel0ffdeath avatar benyjr avatar cactooz avatar idemixi avatar ikerurle avatar loblab avatar lorenzoracca avatar neothematrix avatar ray1025 avatar ridgarou avatar snakuzzo avatar tomoli75 avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

noip-renew's Issues

Feedback from the script

The most important thing, which script doesn't do, is feedback.

Example Renew date is coming. The script executes at the right time to renew the host, but due to some reasons (change of web site, temporary no internet access during execution of the script) the host(s) was not confirmed.

In the example above, everybody would like to know the script has failed in order to reschedule for a little bit later script execution (if using home automation system) or to manually start the script. In case of using conjob an there is failure the script can be reschedule automatically for 1 hour later.

No one would like to be surprised the host has expired and deleted due to script failure....

Currently the only way to understand if everything is ok is to manually check noip web site or to manually check png files - something which is far from my understanding for automation....

Probably possible solution will be to use exit codes ( sys.exit(x) ) - x > 0 - remaining number of days (if there are more than 1 host - min value), x = 0 - everything is ok, x < 0 - script failed (and here different reasons could be assigned for no internet (-1 for instance), could not find element on the page, i.e. page changed (-2 for instance) - in this case manual intervention will be needed, but at least everybody will know that, etc....

ModuleNotFoundError: No module named 'pyotp'

Hi guys, i've updated script to v2.0.0 OS Debian 11
I've this issue when i start the script :
File "/usr/local/bin/noip-renew.py", line 24, in
from pyotp import *
ModuleNotFoundError: No module named 'pyotp'

Module pyotp is already satisfied :
Requirement already satisfied: pyotp in /usr/local/lib/python3.11/site-packages (2.9.0)

Did you have any ideas ?
Thanks.

Help running script option 4 please

hi
running on bookwork debian raspbian
ran bash setup.sh, and set up account info
im stuck on the last bit,(after installing script and entering username and password(also didn't get option 3 about the crontab))
4.Run noip-renew-USERNAME command.
tried as user and root and with sudo commands to run above but i get:
theskid@raspberrypi:~$ cd /usr/local/bin theskid@raspberrypi:/usr/local/bin $ bash noip-renew-theskid.sh noip-renew-theskid.sh: line 10: ./noip-renew.py: Permission denied theskid@raspberrypi:/usr/local/bin $ sudo bash noip-renew-theskid.sh noip-renew-theskid.sh: line 10: ./noip-renew.py: Permission denied theskid@raspberrypi:/usr/local/bin $ su Password: root@raspberrypi:/usr/local/bin# bash noip-renew-theskid.sh noip-renew-theskid.sh: line 10: ./noip-renew.py: Permission denied root@raspberrypi:/usr/local/bin#

Finding Hosts

@neothematrix Please add tag help/assistance required

Im saving the page my.noip.com/dynamic-dns as *.mhtml

After that I open saved file with Notepad++
There is only one place where you can find your hostname:

class=3D"link-info cursor-pointer" (or withoth 3D)

can you please check the same is for you. Will appreciate if users with more hosts share the results.

If the above is same by you - will be easy to find the hosts without xpath - by.class, ""link-info cursor-pointer"

replace sleeps with proper wait events

there are a few sleeps placed in the code that allows for screenshot to be properly taken on debug level 2, this also allows some slower connection to properly run the script.
As a workaround #9 enables debug by default, but the correct solution would be to add some wait events to make sure the page is fully loaded.

Randomize the crontab mm:hh entry?

Hello,

I wonder if randomizing the time when the next job should run is of interest. I decided to try it:

sudo cp /usr/local/bin/noip-renew-skd.sh /usr/local/bin/noip-renew-skd.sh.orig
sudo nano /usr/local/bin/noip-renew-skd.sh

Then add the following:

Min=$(/usr/bin/shuf -i 0-60 -n 1)
Hr=$(/usr/bin/shuf -i 9-15 -n 1)

Finally, I altered:

CRONJOB="$Min $Hr * * * $INSTEXE $LOGDIR"
NEWCJOB="$Min $Hr $1 $2 * $INSTEXE $LOGDIR"

Let me know if it is a good or bad idea. Thanks!
JMB

webdriver dep

This is not good. The chrome version (webdriver) is updated more often than no-ip. There is more work with it than one saves.

timeout???

After months, if not years, of honorable service on my RPi, I suddenly find this in the log:

[2024/01/11 12:29:06] - Debug level: 2
[2024/01/11 12:29:06] - Opening https://www.noip.com/login...
[2024/01/11 12:30:37] - Message: timeout: Timed out receiving message from renderer: 82.338
  (Session info: chrome-headless-shell=120.0.6099.102)
Stacktrace:
#0 0x000000ba9454 <unknown>
#1 0x00000087b1c8 <unknown>
#2 0x0000008614f0 <unknown>
#3 0x00000086135c <unknown>
#4 0x00000085f8ec <unknown>
#5 0x000000860244 <unknown>
#6 0x00000087011c <unknown>
#7 0x0000008880e8 <unknown>
#8 0x00000088d868 <unknown>
#9 0x000000860930 <unknown>
#10 0x000000887ee0 <unknown>
#11 0x000000914264 <unknown>
#12 0x0000008f5f64 <unknown>
#13 0x0000008ba73c <unknown>
#14 0x0000008bbdd0 <unknown>
#15 0x000000b732d4 <unknown>
#16 0x000000b77794 <unknown>
#17 0x000000b771c0 <unknown>
#18 0x000000b77bd4 <unknown>
#19 0x000000b603c0 <unknown>
#20 0x000000b77fe8 <unknown>
#21 0x000000b4951c <unknown>
#22 0x000000b97ff8 <unknown>
#23 0x000000b98144 <unknown>
#24 0x000000ba861c <unknown>
#25 0x000076f1f310 start_thread
#26 0x000000000000 <unknown>

The related exception.png image is a correct login page:
image

Anyone have an idea what's going on?

Page could not load

Got the following message when running noiprenew-{USER}

[2022/08/16 23:22:10] - Debug level: 2
[2022/08/16 23:22:10] - Opening https://www.noip.com/login...
[2022/08/16 23:22:14] - Logging in...
[2022/08/16 23:22:25] - my.noip.com page could not load

Problem installing in Ubuntu 20.04 / 22.04

Hello neothematrix,

Firstly, I commend and thank you for forking the original and making it work again. Wonderful work by loblab & you !

I ran into a minor issue running ./setup, which I was able to circumvent and thereafter I was able to successfully install & make it auto-renew the NOIP website record.

The problem:

./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 22.04.1 LTS
    ./setup.sh.orig: line 34: install_debian: command not found

So in a nutshell here's what I did:
a) I saved your setup.sh as setup.sh.orig
b) Commented out the entire function install_debian()
c) Installed the google repo & keys using

echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -

d) Used 'sudo apt -y install ...' for the various packages install_debian() would have performed.
e) Then I ran the modified ./setup.sh

There may have been a better way to handle the problem I ran into, but this is what worked for me. Running the setup.sh as 'sudo' or 'root' was not an option I wanted to pursue.
I wonder if you could:

  1. modify your setup.sh to circumvent the problem I ran into? OR
  2. split the setup.sh into two parts where the first part is run under superuser privileges & the latter as normal user?

Your advice & comment(s) would be appreciated. Thank you again for resurrecting & maintaining this code.

JMB

NOTE: Incidentally, the version I used is the latest, as I did a 'git clone ...' today.

Manual intervention required. Upgrade text detected.

Hi,

I've got this message when i run manually noip-renew script :
root@shuttle-plex:/usr/bin# sh /usr/local/bin/noip-renew.sh
[2022/11/20 18:18:06] - Debug level: 2
[2022/11/20 18:18:06] - Opening https://www.noip.com/login...
[2022/11/20 18:18:13] - Logging in...
[2022/11/20 18:18:18] - Opening https://my.noip.com/dynamic-dns...
[2022/11/20 18:18:20] - Updating xxx.xxx.org
[2022/11/20 18:18:22] - Manual intervention required. Upgrade text detected.

Change in confirmation page

@neothematrix It looks like there is minor change in confirmation page. Today I received this error:

[2024/01/18 10:34:53] - Debug level: 2
[2024/01/18 10:34:53] - Opening https://www.noip.com/login...
[2024/01/18 10:35:03] - Logging in...
[2024/01/18 10:35:37] - Opening https://my.noip.com/dynamic-dns...
[2024/01/18 10:36:01] - Message: no such element: Unable to locate element: {"method":"xpath","selector":".//following-sibling::td[4]/button[contains(@Class, 'btn')]"}

This is button Confirm.
Line 183 in noip-renew.py (current):
return host.find_element(By.XPATH, ".//following-sibling::td[4]/button[contains(@Class, 'btn')]")

Changing this line to:
return host.find_element(By.XPATH, "//td[6]/button[contains(@Class, 'btn-success')]")

Fixes the issue.
EDIT: atclass should be with small letter, but obviously github interprets it as username.... Please update the code.

Cant connect to noip.com

hi guys i found this nice script and searched for the newest version that work. Now im here and thought 12 days last update it would work. But i get no connection to noip.com.
pi@raspberrypi:/usr/local/bin $ ./noip-renew-pi.sh
[2022/02/19 23:04:11] - Debug level: 2
[2022/02/19 23:04:11] - Opening https://www.noip.com/login...
[2022/02/19 23:04:15] - Logging in...
[2022/02/19 23:04:25] - my.noip.com page could not load

Maybe you can help to fix it again. by the way great job!

No-IP implemented ReCaptcha

As the tittle says, it's just to bring out that they implemented ReCaptcha so the script might not work as expected. For now they are using ReCaptcha v2 that "could be bypassed" with Selenium but if they implement ReCaptcha v3 it could bring issues. I don't know if it is worth the effort (having Duck DNS available...). Maybe just of we want to keep it with compatible routers.

Concerns about Merging

@neothematrix Thank you for merging everything and issuing a new version. However I have some concerns which I cannot test right now:

  1. You moved this line according to my recommendations:
    host_button = self.get_host_button(host, iteration) # This is the button to confirm our free host

  2. Meanwhile you keep line 183 as:
    return host.find_element(By.XPATH, ".//following-sibling::td[4]/button[contains(@class, 'btn')]")

My recommendation about item 2 above in case you fulfil item 1 was:
return host.find_element(By.XPATH, "//td[6]/button[contains(@class, 'btn-success')]")

If you don't move button search (item 1 above) then you should keep my other proposal:
return host.find_element(By.XPATH, "//following-sibling::td[6]/button[contains(@Class, 'btn')]")

I don't think keeping
".//following-sibling::td[4]/button[contains(@class, 'btn')]"
is correct since exactly that was the error I received.
Are you sure current code works correct in both cases - with confirmed host (should work because we don't search for confirm button) and without confirmed host (according to me should not work since we are searching with old xpath pattern). Can't test the last...

Please check again.

random timeout

after updating to the latest chromedriver it looks like sometimes the script is timing out for no reason with this message:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created from timeout: Timed out receiving message from renderer: 600.000

Neo The Best

Hi all,

This time it is not a new issue, but I would like to say to @neothematrix and to all of you - good job. In the last few days the team presented here have done a lot of work (don't want to compare with other branches/forks).
Let's go further together. Personally I hope, all people here will continue to support @neothematrix

Error installing on rpi

Wen y try to run the setup.sh i get this error.

The following packages were automatically installed and are no longer required:
chromium-common libevent-2.1-7 libjsoncpp25 libminizip1 libopenh264-7
libopenjp2-7 libsnappy1v5 libwebpdemux2 libwebpmux3 libwoff1 libxnvctrl0
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Update readme and selenium 4.11.0 suggestion

@neothematrix I updated readme.md with chrome and selenium working versions. Please merge this.

Also, if you want you can make a new branch of the code which will work with selenium 4.11.0 and above. Python script should be reworked for the new commands, but I dont want to mess the old code, since most of the people here are using it as it is. This one is not urgent. Im still reading documentation.... For now it looks like only 'options' are changed, but I dont know what will come next...
The other option is setup.sh to detect which selenium version is installed and to aleter python script - something like my implementation of running the script of python 3.5
However this will take some time, since not so much free time for me right now. Help will be appreciated :)

Auto reschedule script after update

If you run the script as cronjob - the script runs at specified time on calculated date which is correct, confirms the host(s), but doesn't create correct new cronjob for the next run.

Edit: Looking into the code:
nr = min(next_renewal) - 6
today = date.today() + timedelta(days=nr)
We always run the script 6 days before expiration date.
And if you run the script 6 days before expiration the above will result in same day. Which leads to a new cronjob after 1 year.

Possible Fix - expiration days should be reread after host is confirmed:

Existing code:
expiration_days = self.get_host_expiration_days(host, iteration)
next_renewal.append(expiration_days)
self.logger.log(f"{host_name} expires in {str(expiration_days)} days")
if expiration_days <= 7:
self.update_host(host_button, host_name)
count += 1

Change to:
expiration_days = self.get_host_expiration_days(host, iteration)
if expiration_days <= 7:
self.update_host(host_button, host_name)
expiration_days = self.get_host_expiration_days(host, iteration)
next_renewal.append(expiration_days)
self.logger.log(f"{host_name} expires in {str(expiration_days)} days") count += 1
else:
next_renewal.append(expiration_days)
self.logger.log(f"{host_name} expires in {str(expiration_days)} days")

This fix should create directly new cronjob for the correct date.

@neothematrix @benyjr @peteakalad Unfortunately will be able to test this after 1 month. If someone can test it sooner will be good...

Asking to verify email

Not sure if this is happening for anyone else, but recently they started asking a verification code to sign in. This is separate from 2FA because my 2FA is turned off. It seems that I need to enter a 6 digit code every 30 days? Any ideas on how to get around this?

noip

is the docker container working as expected?

docker run --rm --network host moebiuss/noip-renew "[email protected]" "secret" "2"
[2023/04/19 16:47:35] - Debug level: 2
[2023/04/19 16:47:35] - Opening https://www.noip.com/login...
[2023/04/19 16:47:37] - Logging in...
[2023/04/19 16:47:37] - 'utf-8' codec can't decode byte 0xa2 in position 0: invalid start byte
[2023/04/19 16:47:37] - noip-renew-skd.sh missing or not executable, skipping crontab configuration

Running the script on Python 3.5

@neothematrix It is not exactly an issue. I managed to run the script on python 3.5
The only problem in the script are f-strings which are available from python 3.6 further
So, all packages from setup.sh can be installed in python 3.5. I installed them manually
For the f-strings is necessary to additionally install:
pip3 install future-fstrings

in noip-renew.py after first row should be added:
# -*- coding: future_fstrings -*-

The above should be written exactly as it is!!!

Then in setup.sh I commented install, i.e:
function installer() {
config
#install
deploy
}

We skip function install. WARNING: All packages from function install should be pre-installed manually.

Then run setup.sh and noip-renew-user.sh.... and amazing the script runs perfectly :)

This allows users with old systems, for instance RPi 3 with debian 9 (stretch) which is with python 3.5.3, to run the script. Installing python 3.7 on my such system didn't gave expected result and script doesnt work....

I hope this will help somebody.
@neothematrix If you want you can make a fork for python 3.5 with the above changes. Of course setup.sh can install packages automatically, just check for python 3.6 should be changed and added installation of future-fstrings

Docker version for raspberry

Thank you for your project.

I would like to use it in a docker environment on a raspberry pi with buster debian.

Could you add this on docker hub ?

Cleanup and Login Button - 419 page expired

@neothematrix I saw you made a cleanup and added search for login button, so:

  1. You removed sending Enter key. In this case you don't need this row as well - from selenium.webdriver.common.keys import Keys
  2. Login button is inside section "content" which we already extracted so it will be more elegant if you use the following to find login button - elem.find_element(By.ID, "clogs-captcha-button").click(). You can find the button also with self.browser.find_element(By.ID, "clogs-captcha-button").click(), but this will search the whole document. ID's are unique. I really don't know why you prefer to write complex XPATH expressions instead simple one...

broken redirect after login

just to report that the script is currently broken due to some changes to noip.com website, I'm working on a fix.
basically, a redirect has been added between the login page and the dynamic hosts page that requires some more code to be added to the script.
I'll try to fix it asap.

Versioning

I do believe, finally, it is good idea to add version number and repo in python script and this info to be printed on screen and in log (regardless which debuglevel is used). This will prevent further misunderstandings and/or requests

unclear instructions

hi, I'm a little bit unclear on how to use this on Debian.
it seems the script doesn't finish successfully?
two packages cannot be installed:
E: Package 'chromium-browser' has no installation candidate
E: Unable to locate package chromium-chromedriver
not sure how to move on from here?

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.