loblab / noip-renew

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

[Docker] Can't launch docker run #61

Open RomyxBaps opened 3 years ago

RomyxBaps commented 3 years ago

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 ?

michaeleekk commented 3 years ago

@RomyxBaps I got the same problem. You need to convert your password to base64 by yourselves. You can edit the crontab with crontab -e and replace your password parameter with a base64 string.

geepy123456790123 commented 3 years ago

@RomyxBaps @michaeleekk Could one of you show me what your crontab looks like?

What's wrong with mine?

12 3 1,3,5 docker run --network host loblab/selenium:debian ${dXXXXXX} ${GXXXXXX} ${1} ${2}

michaeleekk commented 3 years ago

@geepy123456790123 you shouldn’t have the ${} in your crontab, unless you set the username and password in the environment variable. So if your username is “abcde” and password is “hello”, your docker command is,

docker run --network host loblab/selenium:debian abcde Gaiendk= 2

and you might want to run the docker command manually in the shell once first, to make sure that the command works, and then paste the command back to crontab.

For the password, you need to encode with base64 first,

echo hello | base64