Skip to content

Add target domain selection #1

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

Merged
merged 1 commit into from
Oct 20, 2021
Merged
Changes from all commits
Commits
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
14 changes: 12 additions & 2 deletions one_com_ddns.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def findBetween(haystack, needle1, needle2):


# will create a requests session and log you into your one.com account in that session
def loginSession(USERNAME, PASSWORD):
def loginSession(USERNAME, PASSWORD, TARGET_DOMAIN=''):
print("Logging in...")

# create requests session
Expand All @@ -118,9 +118,19 @@ def loginSession(USERNAME, PASSWORD):

print("Sent Login Data")

# For accounts with multiple domains it seems to still be needed to select which target domain to operate on.
if TARGET_DOMAIN:
print("Setting active domain to: {}".format(TARGET_DOMAIN))
selectAdminDomain(session, TARGET_DOMAIN)

return session


def selectAdminDomain(session, DOMAIN):
request_str = "https://www.one.com/admin/select-admin-domain.do?domain={}".format(DOMAIN)
session.get(request_str)


# gets all DNS records on your domain.
def getCustomRecords(session, DOMAIN):
print("Getting Records")
Expand Down Expand Up @@ -156,7 +166,7 @@ def changeIP(session, ID, DOMAIN, SUBDOMAIN, IP, TTL=3600):


# Create login session
s = loginSession(USERNAME, PASSWORD)
s = loginSession(USERNAME, PASSWORD, DOMAIN)

# get dns records
records = getCustomRecords(s, DOMAIN)
Expand Down