loblab / noip-renew

Auto renew (confirm) noip.com free hosts
Apache License 2.0
434 stars 138 forks source link

no hosts or host table rows not found #20

Closed jbates58 closed 3 years ago

jbates58 commented 4 years ago

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$

IDemixI commented 4 years ago

Hi @jbates58,

Would it be possible to upload your debug1.png & debug2.png here? Feel free to censor any host info, etc. Will give us a better idea of where the script got to before failing.

Are you allowing the script to run via crontab or are you trying to run it from the installation folder (~/no_ip_auto_renew)?

If you're trying to run it "live" I recommend the following:

cd /usr/local/bin
. noip-renew-pi

If you run it from the installation folder, the file "noip-renew.sh" file which is supposed to contain your noip user details will be empty as they're only copied into the working file. I hope this helps!

Thanks Ryan

jbates58 commented 4 years ago

sure. here you go, i just re-ran a fresh copy of it aswell.

i am running it from the installation folder

/home/jason/no_ip_auto_renew

and i run it by entering

./noip-renew.sh

below are the png files

its the login screen and thats it. it mentions that the password is wrong, but i have tripple checked that i have entered it correctly

debug2t just ge exception

debug1

jbates58 commented 4 years ago

just a quick addition to that.

i just looked at the file noip-renew-jason

and the password in that was incorrect. i dont know why, as i did it 3 times. but i have changed the password in that file to mine (unless the password in that faile was some sort of hash of mine??) Turns out it is base 64 encoded, so i have changed this back. and i get the below error

image

IDemixI commented 4 years ago

Hi @jbates58,

It looks like it's not being called correctly. So, the way this script works is:

When setup.sh is run and you configure your no-ip account settings, etc, a copy of the script is moved to /usr/local/bin/ A total of 3 files are copied here:

When noip-renew-jason is copied into /usr/local/bin/ it is also updated to contain your noip username and password (in base64 as I see you've mentioned) This is just a feature so that your password isn't sitting in plain text. This script can be ran interactively by simply typing: noip-renew-jason into your ssh session. This calls the correct version with the username and password filled in as opposed to the empty template in /home/jason/no_ip_auto_renew/noip-renew.sh.

Here is what I recommend:

Completely remove the script (run install and then select the "uninstall" option. Remove your local copy and grab a fresh one.

Run setup.sh and fill in your noip details.

type noip-renew-jason which should kick the script off!

Let me know if you have any problems!

jbates58 commented 4 years ago

ok, i will do this now. and report back in 10 or so min.

jbates58 commented 4 years ago

ok, here is the results.

i have 3 hosts, and the middle one in the list is the one that has currently expired. it seems to pnly be picking up the 1st one in the list. (im assuming they are sorted alphabetically in the list, as the middle one was the fisrt host i created, and the 3rd was the lasy, and its down the bottom of the list)

image

IDemixI commented 4 years ago

Progress! It appears I've missed something in the script. I believe it's because it's looking for "x days remaining" and if that host has already expired that explains it. Looks like I need to make a change to fix this! Could you do me a favour and pop across the debug1 and 2 images (again feel free to censor host info!) just so I can see where you're at now. I may need to wait for one of my hosts to expire in order for me to get the correct xpath of an expired host. Sorry for the inconvenience!

Another Edit: If you're able to, could you open your hosts page via the noip website and inspect element on whatever you have here (see below)? Will allow me to fix it now rather than in 14 days when my next host expires :P

image

Edit: What I mean is that on a usual host there is an element <a class="no-link-style" _v-78c9c52b="">Expires in 14 days</a> which is being read by our script to determine if it needs an update or not. I'm assuming your middle host which is expired has a different element. One I didn't account for. The script then does a regex match over the element to see how many days etc, which it can't get to if 0 days are there. The good news is... I can and will fix it!

jbates58 commented 4 years ago

for some reason, it is not creating the debug images. below is the hosts table i screen capped from noip page

image i hope this is what your after.

i have tried to seperate it into what i think the hosts are. but i am unsure. tbh, this is out of my paygrade. haha

image

IDemixI commented 4 years ago

Hi @jbates58,

I think I have a bit of a botch fix for the moment which will get you up and running. You're going to have to add the following two lines of code:

        if len(host_remaining_days) == 0:
            host_remaining_days = "Expires in 0 days"

This needs to go https://github.com/loblab/noip-renew/blob/5e8e160dedb2fcb7780f55a766dfa8db85d791d0/noip-renew.py#L129 below this line.

So it currently reads:

@staticmethod
    def get_host_expiration_days(host, iteration):
        host_remaining_days = host.find_element_by_xpath(".//a[@class='no-link-style']").text
        regex_match = re.search("\\d+", host_remaining_days)
        if regex_match is None:
            raise Exception("Expiration days label does not match the expected pattern in iteration: {iteration}")
        expiration_days = int(regex_match.group(0))
        return expiration_days

We want it to be:

@staticmethod
    def get_host_expiration_days(host, iteration):
        host_remaining_days = host.find_element_by_xpath(".//a[@class='no-link-style']").text
        if len(host_remaining_days) == 0:
            host_remaining_days = "Expires in 0 days"
        regex_match = re.search("\\d+", host_remaining_days)
        if regex_match is None:
            raise Exception("Expiration days label does not match the expected pattern in iteration: {iteration}")
        expiration_days = int(regex_match.group(0))
        return expiration_days

The best way to do this is to change it in /usr/local/bin/noip-renew.py - If you don't want to change it here, I would recommend uninstalling, then changing the line in the installation folder /home/jason/no_ip_auto_renew/noip-renew.py

And then install again. This should fix it I hope! I will do some additional testing myself when one of my hosts expires.

jbates58 commented 4 years ago

thats a negative. same error as in

image

IDemixI commented 4 years ago

Hmm, this is an odd one.

Unfortunately, without an expired host it's difficult for me to try and debug. I need to find out where the code is falling over. I have another idea. self.logger.log(f"DEBUG HOST DAYS: {regex_match}")

If you could remove the two new lines I asked you to add and instead pop that right under the line: regex_match = re.search("\\d+", host_remaining_days)

This should give us the value of regex_match in the logs. I'm hoping that will explain things.

Unfortunately, it's going to be at least 14 days until I can debug this myself. I've uninstalled my local copy of the script so I don't accidentally renew the hosts prior to the first one expiring. I apologise for the issues. I may recommend manually renewing that one host for the time being if we can't get anywhere yet, but I'm definitely going to look at resolving it as soon as I can replicate it myself.

Edit: What I really need to do for future versions is add a script with test cases to run some rudimentary checks to make sure it can find all the elements on the page required. Definitely something I will add if I get some time.

jbates58 commented 4 years ago

no that also didnt work for me.

i have just renewed it manually for now. but i noticed that there is a captcha aswell, how do you navigate past that?

IDemixI commented 4 years ago

@jbates58 The captcha only appears once in a while, and unfortunately this script can't bypass it. Luckily, once you've had it, it will be quite some time until it returns. This is mentioned in Issue #14

I actually have a developmental branch of this script at the moment that will alert the user if manual intervention is required via a bunch of different methods. Currently I have support for Pushover, Telegram & Slack, but I won't be commiting this as it's not really in line with the purpose of the script. I may release it as an alternative branch at some point and add additional methods of notification if anyone shows any interest.

As soon as I've fixed this issue regarding expired hosts I shall let you know :) but hopefully the script should work as expected now. You can check logs via /var/log/noip-renew/jason and I would imagine the crontab has now set itself up to run when your next renewal will be available (> 6 before expiry).

Cheers Ryan

IDemixI commented 4 years ago

Hi @jbates58,

So, I almost forgot and lost my host, haha.. however...

image

I found the issue. It appears that for an expired host the element is not within an "a" tag. It's just dumped into the div. That's why it can't find the xpath ".//a[@class='no-link-style']".

This is exactly what your image shows but apparently I was being blind and completely missed it. I'm implementing a fix for this now. Will test it and push a merge request out later. Thanks for finding this bug and helping to resolve it!

IDemixI commented 4 years ago

Just a quick update. I've managed to fix the issue. *It also appears that letting a host expire will always trigger the "Upgrade Now" dialogue which is troublesome***. Not a big deal once this script is up and running though as it will never let a host get to "Expired".

So the below is the current expected output when trying to renew a host that's expired:

image

This means if a host expires prior to you setting up and using this script then it will require manually renewing it the first time. There is actually an experimental git repo I've been looking at which actually solves reCAPTCHA's but it's extremely complex when hopefully this is something that won't crop up very often anyway.

I will commit these changes either later today or over the weekend. This will hopefully make the script more stable and at least provide users with what the actual issue is when that happens.

** It actually doesn't always trigger the "upgrade now" dialogue, which is better news. This isn't really a problem, nonethless.

IDemixI commented 4 years ago

@loblab - I just wanted to mention that I've created a new branch in my repo which contains notifications. I know you closed #10 as it was off-scope for the script, but I took a look at all of the forks of your script and various use-cases and came up with a few options. My Notifications Branch allows users to receive notifications from:

It includes instructions on how to get set up in the readme. This is my last change/contribution to the script as I'm quite busy on other projects, but I hope you find this useful. I made it as a separate branch as I wasn't sure if you would want to include such functionality, but the option is there.

Wishing you all the best!

Kind regards Ryan

loblab commented 4 years ago

@IDemixI Ryan,

I appreciate all of your contributions. Your notifications branch is a great option. For the people who need this functionality, I will introduce it, while I will keep this repo simple. I also add your branch link in the remarks section of README.

Hope everything goes well with you!

Thanks. loblab

IDemixI commented 4 years ago

@loblab,

I was happy to help 😄 I will still keep an eye on the repo and help with any issues that may come up :) also if any bugs are discovered I will do my best to fix them.

Good luck and I’m sure I will check in from time to time.

Thanks Ryan

Singtah commented 4 years ago

Hello, Thank you for the script. I currently have the same issue whe nrunning noip-renew.sh No hosts or host table rows not found

Heres the status of the dns :

image

the scripts generates a results.png image though Any idea ?

snakuzzo commented 4 years ago

Same problem here...

pi@raspberry:~/noip-renew $ ./noip-renew.sh 
[2020/08/02 01:49:47] - Debug level: 2
[2020/08/02 01:49:47] - Opening https://www.noip.com/login...
[2020/08/02 01:49:56] - Logging in...
[2020/08/02 01:50:05] - Opening https://my.noip.com/#!/dynamic-dns...
[2020/08/02 01:50:08] - No hosts or host table rows not found
30 0    * * *   pi    /usr/local/bin/noip-renew-pi /var/log/noip-renew/pi

Debug1 image

Debug2 image

Exception image

C-o-l-l-i-n commented 4 years ago

I too have the username/password is incorrect error as well, even though I know I have entered the credentials correctly and multiple times. I have also reinstalled multiple times.

Edit: Manually put username & base64 pass in the right file and the issue has been fixed.

IDemixI commented 4 years ago

Hey there,

I’m glad to hear you’ve fixed it by manually adding username and pass in base64 to the right file. How were you calling the script to run it? That’s one thing I feel is a tad unclear.

Essentially after installation, the original folder you’ve downloaded isn’t needed. To call the script you can type noip-renew-username (pi for example) and it then calls the script from the correct folder, using the correct details used during “installation”.

C-o-l-l-i-n commented 4 years ago

The command you sent works even outside the initial directory. Check the file stored in /usr/local/bin if you are having trouble.

On Sat, Aug 8, 2020, 3:36 AM Ryan Saunders notifications@github.com wrote:

Hey there,

I’m glad to hear you’ve fixed it by manually adding username and pass in base64 to the right file. How were you falling the script to run it? That’s one thing I feel is a tad unclear.

Essentially after installation, the original folder you’ve downloaded isn’t needed. To call the script you can type noip-renew-username (pi for example) and it then calls the script from the correct folder, using the correct details used during “installation”.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/loblab/noip-renew/issues/20#issuecomment-670845366, or unsubscribe https://github.com/notifications/unsubscribe-auth/AICGWNFBQKUPTPYE3WBJ5ODR7UFADANCNFSM4NCXIWCA .

loblab commented 3 years ago

fixed already?