Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login #92

Open
wants to merge 88 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
3436a01
merging updates
neothematrix Nov 5, 2021
4c2762b
restored files
neothematrix Nov 5, 2021
964dce0
adapting to another small change
neothematrix Nov 9, 2021
63a4996
merge
neothematrix Nov 21, 2021
60ff2b0
Merge branch 'loblab-master'
neothematrix Nov 21, 2021
ed0aa67
cleanup
neothematrix Nov 21, 2021
edc8557
fixed permissions
neothematrix Nov 21, 2021
4944433
Update noip-renew.py
benyjr Nov 22, 2021
6a9e9e4
Update noip-renew-skd.sh
benyjr Nov 22, 2021
1d6a855
Merge pull request #3 from benyjr/master
neothematrix Nov 22, 2021
705683c
Merge pull request #4 from benyjr/patch-1
neothematrix Nov 22, 2021
1c401c9
Restore password decoding
benyjr Nov 22, 2021
f00a314
restored crontab setup functionality with enable/disable flag
neothematrix Nov 22, 2021
5046362
Merge pull request #5 from benyjr/patch-2
neothematrix Nov 22, 2021
be7d285
Update README.md
neothematrix Nov 22, 2021
0aeaa73
Update README.md
neothematrix Nov 23, 2021
1679227
Update noip-renew.py
Angel0ffDeath Nov 23, 2021
0a486b4
removed comment
neothematrix Nov 24, 2021
a91ccbf
Merge pull request #6 from Angel0ffDeath/patch-1
neothematrix Nov 24, 2021
511fb68
more elegant way to disable crontab configuration
neothematrix Nov 24, 2021
729e4ee
Create docker-image.yml
neothematrix Nov 24, 2021
8d912a0
Update docker-image.yml
neothematrix Nov 24, 2021
87dd482
Update README.md
neothematrix Nov 24, 2021
a02d99d
Updated Login
Angel0ffDeath Nov 25, 2021
91bdb44
Update noip-renew.py
Angel0ffDeath Nov 26, 2021
bfbcc18
Merge pull request #14 from Angel0ffDeath/patch-2
neothematrix Dec 1, 2021
0ebc60f
Update docker-image.yml
neothematrix Dec 1, 2021
f9e9427
Update docker-image.yml
neothematrix Dec 1, 2021
59cf9bb
added disable-gpu option to chromedriver
neothematrix Dec 1, 2021
b879cc2
Update README.md
neothematrix Dec 1, 2021
a79a238
Remove redundant $USER input
benyjr Jan 2, 2022
ded5a9b
Fix auto reschedule after host update
Angel0ffDeath Jan 9, 2022
6f71849
Merge pull request #19 from benyjr/patch-1
neothematrix Jan 9, 2022
4e301d0
Merge pull request #20 from Angel0ffDeath/patch-4
neothematrix Jan 9, 2022
d1bb20d
adding dev workflow
neothematrix Jan 9, 2022
9caf6ac
Remove redundant $USER input from setup.sh
benyjr Jan 15, 2022
29df23e
Merge pull request #21 from benyjr/patch-2
neothematrix Jan 22, 2022
8e37f3b
New Login Page
Angel0ffDeath Jan 24, 2022
a4f38b2
Merge pull request #23 from Angel0ffDeath/patch-1
neothematrix Jan 24, 2022
48efb4b
code cleanup and small login button fix
neothematrix Jan 25, 2022
7a3cd1d
small login fix to avoid 419 error on fast connections
neothematrix Feb 7, 2022
71a1773
revert to ENTER for login form
neothematrix Feb 20, 2022
c4e25fd
ChromDriver must be installed and Up To Date
benyjr Mar 7, 2022
508ba43
Merge pull request #26 from benyjr/patch-1
neothematrix Mar 26, 2022
732387f
adapting to changes to logged-in page
neothematrix Mar 26, 2022
08c8194
fix login redirect
neothematrix Mar 27, 2022
eea5340
added --shm-size="512m" info for docker usage
neothematrix Mar 27, 2022
a3ad336
revert to previous version as website reverted their changes too
neothematrix Mar 30, 2022
d4c6203
added "shm-size" note for docker usage
neothematrix Mar 30, 2022
a5a3f5a
added arm docker builds
neothematrix May 4, 2022
ac7b702
Update dev-docker-build.yml
neothematrix May 4, 2022
28b27da
support debian 11 on amd64
Jul 23, 2022
08f6126
Merge pull request #32 from ntzb/master
neothematrix Jul 29, 2022
2493688
Added support for Python 3.5
Angel0ffDeath Dec 3, 2022
24f661a
Version number
Angel0ffDeath Dec 3, 2022
6e45925
Update README.md
Angel0ffDeath Dec 3, 2022
054b861
Merge pull request #38 from Angel0ffDeath/patch-2
neothematrix Jan 20, 2024
eaf23f0
Merge pull request #39 from Angel0ffDeath/patch-3
neothematrix Jan 20, 2024
a2162ea
Merge pull request #40 from Angel0ffDeath/patch-4
neothematrix Jan 20, 2024
af26a15
fixes #47 and increases timeout on host_page
neothematrix Jan 20, 2024
446f61d
fixed Dockerfile build
neothematrix Jan 23, 2024
88cfe44
fixed renew url
neothematrix Jan 23, 2024
bf33f3c
Update README.md
Angel0ffDeath Jan 29, 2024
ac2845c
Merge pull request #49 from Angel0ffDeath/patch-5
neothematrix Feb 5, 2024
57ddc8d
Update README.md
Angel0ffDeath Feb 10, 2024
d09f002
Update setup.sh
Angel0ffDeath Feb 10, 2024
dd55ff7
Update noip-renew-skd.sh - preparation for change to resolve #42
Angel0ffDeath Feb 10, 2024
6614f3b
Update README.md
Angel0ffDeath Feb 10, 2024
b5ad676
Merge pull request #52 from Angel0ffDeath/patch-6
neothematrix Feb 11, 2024
6aaa113
Merge pull request #53 from Angel0ffDeath/patch-7
neothematrix Feb 11, 2024
f56ba84
Merge pull request #54 from Angel0ffDeath/patch-8
neothematrix Feb 11, 2024
613edcc
Update setup.sh
neothematrix Feb 11, 2024
ba3e31c
Altering noip-renew-skd.sh - randomized cronjob
Angel0ffDeath Feb 11, 2024
a39e916
Merge pull request #55 from Angel0ffDeath/patch-9
neothematrix Feb 11, 2024
a1299d9
fix a typo
Angel0ffDeath Feb 11, 2024
92cb2b5
Added info about randomized cronjob
Angel0ffDeath Feb 11, 2024
558913a
Merge pull request #56 from Angel0ffDeath/patch-10
neothematrix Feb 12, 2024
3d8440d
Merge pull request #57 from Angel0ffDeath/patch-11
neothematrix Feb 12, 2024
9dc4c4d
first 2fa test implementation
neothematrix May 1, 2024
fe7ed6c
adapting to 2fa required support
neothematrix May 2, 2024
06aa540
Merge pull request #61 from neothematrix/2fa
neothematrix May 2, 2024
5c6944b
Update README.md
neothematrix May 2, 2024
989d1a7
Update README.md
neothematrix May 3, 2024
6d54653
added parameter sanity check for docker execution
neothematrix May 4, 2024
1a4d23d
version bump
neothematrix May 5, 2024
897fff3
Fix 2FA
ray1025 May 17, 2024
ecfb8c7
Merge pull request #64 from ray1025/patch-1
neothematrix May 20, 2024
8362486
noip website change and version bump
neothematrix Sep 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/dev-docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: DEV docker image auto build

on:
push:
branches: [ "dev" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2


- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
platform: linux/arm/v7,linux/arm/v6,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: moebiuss/noip-renew:dev

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
57 changes: 57 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Docker Image CI

on:
push:
tags:
- "v*.*.*"

jobs:

build:

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Prepare
id: prep
run: |
DOCKER_IMAGE=moebiuss/noip-renew
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
if [ "${{ github.event_name }}" = "schedule" ]; then
VERSION=nightly
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=tags::${TAGS}

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
platforms: linux/amd64,linux/arm64,linux/arm
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ ENV/

# mypy
.mypy_cache/
debug1.png
debug2.png

.bash_history
.pki
.wget-hsts
*success.png
exception.png
debug*.png
results.png
vps_mon.py
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
FROM debian
LABEL maintainer="loblab"

#ARG TZ=Asia/Shanghai
#ARG APT_MIRROR=mirrors.163.com
ARG DEBIAN_FRONTED=noninteractive
ARG PYTHON=python3

#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
#RUN sed -i "s/deb.debian.org/$APT_MIRROR/" /etc/apt/sources.list
ENV CONTAINER=1

RUN apt-get update && apt-get -y upgrade
RUN apt-get -y install chromium-chromedriver || \
apt-get -y install chromium-driver || \
apt-get -y install chromedriver
RUN apt-get -y install ${PYTHON}-pip
RUN $PYTHON -m pip install selenium
RUN apt-get -y install ${PYTHON}-selenium
RUN apt-get -y install ${PYTHON}-pyotp
RUN apt-get -y install curl wget

RUN mkdir -p /home/loblab && \
Expand All @@ -22,4 +21,4 @@ RUN mkdir -p /home/loblab && \
USER loblab
WORKDIR /home/loblab
COPY /noip-renew.py /home/loblab/
ENTRYPOINT ["python3", "/home/loblab/noip-renew.py"]
ENTRYPOINT ["python3", "/home/loblab/noip-renew.py"]
67 changes: 35 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
[![Docker Image CI](https://github.com/neothematrix/noip-renew/actions/workflows/docker-image.yml/badge.svg)](https://github.com/neothematrix/noip-renew/actions/workflows/docker-image.yml)

# Script to auto renew/confirm noip.com free hosts

[noip.com](https://www.noip.com/) free hosts expire every month.
This script auto clicks web pages to renew the hosts,
using Python/Selenium with Chrome headless mode.

- Platform: Debian/Ubuntu/Raspbian/Arch Linux, no GUI needed (tested on Debian 9.x/10.x/Arch Linux); python 3.6+
- Ver: 1.2
NOTE: this is an up-to-date fork of loblab/noip-renew repository as it seems it's not anymore actively developed, I'll try to keep this fork up to date and working as much as possible. Feel free to contribute!

- Platform: Debian/Ubuntu/Raspbian/Arch Linux, no GUI needed (tested on Debian 9.x/10.x/11.x/Arch Linux); python 3.5+
- Chrome webdriver - tested up to version 120.0.6099.102-rpt1
- Selenium - v.3.x (python 3.5+); v. 4.0.0 (python 3.7+); v.4.10.0 and above (python 3.8+); Tested up to v. 4.17.2
- Ref: [Technical explanation for the code (Chinese)](http://www.jianshu.com/p/3c8196175147)
- Updated: 1/2/2021
- Created: 11/04/2017
- Author: loblab
- Contributor: [IDemixI](https://www.github.com/IDemixI)
- Original Author: loblab
- Fork Mantainer: neothematrix
- Contributors: [Angel0ffDeath](https://github.com/Angel0ffDeath), [benyjr](https://github.com/benyjr)

![noip.com hosts](https://raw.githubusercontent.com/loblab/noip-renew/master/screenshot.png)

## Prerequisites

ENABLE 2FA authentication on your account and save the 2FA Secret key that is shared only once when you activate it

ChromeDriver is required for the script to interface with noip.com from within the script.
ChromeDriver must be maintained to match the installed version of Chrome.
There is no automated repository that provides ChromeDriver package beyond Ubuntu 18 LTS.
Installing Chromium via Snap and then linking chromedriver to /usr/bin/chromedriver should keep chromediver sufficiently up to date without manual intervention

## Usage

1. Clone this repository to the device you will be running it from. (`git clone https://github.com/loblab/noip-renew.git`)
1. Clone this repository to the device you will be running it from. (`git clone https://github.com/neothematrix/noip-renew.git`)
2. Run setup.sh and set your noip.com account information,
3. Run noip-renew-USERNAME command.
3. If you want to use randomized cronjob answer y to the question and give time interval hours, i.e. 7-18 (for instance). This will give a window from 7:00 to 18:59; Take into account it is possible script to try to run on days on which Daylight Saving Time (DST) occurs (if you have such thing in your country), so avoid hours in which this event occurs, otherwise the scrippt may not run. For instance in Europe DST events are last Sundays of March and October at 3AM (March) or 4AM (October). Script probably will not run on the DST day in March if scheduled between 3 and 4 AM. It is too complicated to incorporate such logic, but if someone would like then try.
4. Run noip-renew-USERNAME command.

Check confirmed records from multiple log files:

Expand All @@ -27,36 +42,24 @@ grep -h Confirmed *.log | grep -v ": 0" | sort
```
## Usage with Docker

For docker users, run the following:
For docker users you need to define the following ENV variables:

```
'NOIP_USERNAME = <your username>'
'NOIP_PASSWORD = <your password (plain not base64 encoded)>'
'NOIP_2FA_SECRET_KEY = <your 2FA secret key that appeared when you setup 2FA>'
NOIP_DEBUG = <optional, defaults to 1>
```

so you can run the following:
```sh
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 -
echo -e "$(crontab -l)"$'\n'"12 3 * * 1,3,5 docker run --rm --network host -e 'NOIP_USERNAME=<your_username>' -e 'NOIP_PASSWORD=<your_password>' -e 'NOIP_2FA_SECRET_KEY=<your 2fa secret key>' -e NOIP_DEBUG=2 moebiuss/noip-renew" | crontab -
```
NOTE: with newer versions of ChromeDriver (>v99) you might need to increase the shm size of the container otherwise ChromeDriver will crash and throw an exception. To do it, you can just add the "--shm-size="512m" flag to the docker run command.

## Remarks

The script is not designed to renew/update the dynamic DNS records, though the latest version does have this ability if requested.
The script is not designed to renew/update the dynamic DNS records, but only to renew the hostnames expiring every 30 days due to the free tier.
Check [noip.com documentation](https://www.noip.com/integrate) for that purpose.
Most wireless routers support noip.com. For more information, check [here](https://www.noip.com/support/knowledgebase/what-devices-support-no-ips-dynamic-dns-update-service/).
You can also check [DNS-O-Matic](https://dnsomatic.com/) to update multiple noip.com DNS records.

If you need notification functionality, please try [IDemixI's branch](https://github.com/IDemixI/noip-renew/tree/notifications).

## 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.
8 changes: 5 additions & 3 deletions noip-renew-skd.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash
Min=30
Hour=0
USER=
SUDO=sudo
LOGDIR=/var/log/noip-renew/$USER
INSTDIR=/usr/local/bin
INSTEXE=$INSTDIR/noip-renew-$USER
CRONJOB="30 0 * * * $USER $INSTEXE $LOGDIR"
NEWCJOB="30 0 $1 $2 * $USER $INSTEXE $LOGDIR"
INSTEXE=$INSTDIR/noip-renew-$USER.sh
CRONJOB="$Min $Hour * * * $INSTEXE $LOGDIR"
NEWCJOB="$Min $Hour $1 $2 * $INSTEXE $LOGDIR"
$SUDO crontab -u $USER -l | grep -v '/noip-renew*' | $SUDO crontab -u $USER -
if [[ $3 = "True" ]]; then
($SUDO crontab -u $USER -l; echo "$NEWCJOB") | $SUDO crontab -u $USER -
Expand Down
Loading