79 lines
2.9 KiB
Python
79 lines
2.9 KiB
Python
import requests
|
|
from selenium import webdriver
|
|
from selenium.webdriver.chrome.options import Options
|
|
import time
|
|
from datetime import datetime
|
|
import base64
|
|
import json
|
|
import urllib.parse
|
|
|
|
from selenium.webdriver.chrome.options import Options
|
|
|
|
def has_numbers(inputString):
|
|
return any(char.isdigit() for char in inputString)
|
|
|
|
# Login credentials
|
|
username = "" # Your noip username
|
|
password = "" # Your noip passowrd
|
|
|
|
while(1):
|
|
try:
|
|
now = datetime.now()
|
|
dt_string = now.strftime("%d-%m-%Y %H:%M:%S")
|
|
|
|
# To bypass CloudFlare's detection
|
|
user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36'
|
|
|
|
|
|
options = Options()
|
|
options.add_argument('--headless')
|
|
options.add_argument('--disable-gpu')
|
|
options.add_argument('--no-sandbox') # Required if you run your script as Administrators / sudoers
|
|
options.add_argument('--window-size=1920,1080')
|
|
|
|
# To bypass CloudFlare's detection
|
|
# options.add_argument('--disable-blink-features=AutomationControlled')
|
|
options.add_argument(f'user-agent={user_agent}')
|
|
|
|
browser = webdriver.Chrome(executable_path="/usr/bin/chromedriver", chrome_options=options)
|
|
|
|
browser.delete_all_cookies()
|
|
browser.get("https://www.noip.com/login")
|
|
|
|
browser.implicitly_wait(3)
|
|
|
|
browser.save_screenshot('ss_noip.png')
|
|
|
|
browser.find_element_by_xpath("/html/body/section[3]/section/div/div/div/div/div/div[2]/form/section[1]/input").send_keys(username)
|
|
browser.find_element_by_xpath("/html/body/section[3]/section/div/div/div/div/div/div[2]/form/section[2]/input").send_keys(password)
|
|
browser.find_element_by_xpath("/html/body/section[3]/section/div/div/div/div/div/div[2]/form/button").click()
|
|
|
|
browser.get("https://my.noip.com/dynamic-dns")
|
|
|
|
try:
|
|
browser.find_element_by_xpath("/html/body/div[1]/div/div/div[3]/div[1]/div[2]/div/div/div[1]/div[1]/table/tbody/tr[1]/td[5]/button[1]").click()
|
|
except:
|
|
print("Skip")
|
|
try:
|
|
browser.find_element_by_xpath("/html/body/div[1]/div/div/div[3]/div[1]/div[2]/div/div/div[1]/div[1]/table/tbody/tr[2]/td[5]/button[1]").click()
|
|
except:
|
|
print("Skip")
|
|
try:
|
|
browser.find_element_by_xpath("/html/body/div[1]/div/div/div[3]/div[1]/div[2]/div/div/div[1]/div[1]/table/tbody/tr[3]/td[5]/button[1]").click()
|
|
except:
|
|
print("Skip")
|
|
|
|
# Optional, to see the result in the form of screenshot image
|
|
browser.save_screenshot('ss_noip.png')
|
|
|
|
browser.quit()
|
|
print("Sleep for 1 hour")
|
|
time.sleep(60*60)
|
|
|
|
except Exception as e:
|
|
print(e)
|
|
browser.quit()
|
|
print("Sleep for 1 hour")
|
|
time.sleep(60*60)
|
|
|