fix: changing file checking functionality
This commit is contained in:
parent
1d60596178
commit
47afc79d53
2 changed files with 14 additions and 12 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
mail._domainkey.mail
|
mail._domainkey.mail
|
||||||
mail
|
mail
|
||||||
_dmarc.mail
|
_dmarc.mail
|
||||||
skyguy
|
|
||||||
|
|
|
||||||
|
|
@ -39,12 +39,14 @@ def getSubDomains():
|
||||||
def filterRecords():
|
def filterRecords():
|
||||||
ignoredSubdomains = []
|
ignoredSubdomains = []
|
||||||
filteredSubdomains = []
|
filteredSubdomains = []
|
||||||
|
ISEMPTY = False
|
||||||
|
|
||||||
if not os.path.exists("data/ignoredSubdomains"):
|
if not os.path.isfile("./data/ignoredSubdomains"):
|
||||||
with open("data/ignoredSubdomains", "w") as file:
|
open(os.path.join("./data/", "ignoredSubdomains"), "w").close()
|
||||||
file.close()
|
ISEMPTY = True
|
||||||
|
|
||||||
with open("data/ignoredSubdomains", "r") as ignoredSubdomainsFile:
|
if not ISEMPTY:
|
||||||
|
with open(os.path.join("./data/", "ignoredSubdomains"), "r") as ignoredSubdomainsFile:
|
||||||
for subdomain in ignoredSubdomainsFile:
|
for subdomain in ignoredSubdomainsFile:
|
||||||
ignoredSubdomains.append(subdomain)
|
ignoredSubdomains.append(subdomain)
|
||||||
|
|
||||||
|
|
@ -98,8 +100,9 @@ def changeRecords():
|
||||||
def checkIP():
|
def checkIP():
|
||||||
if not os.path.exists("data"):
|
if not os.path.exists("data"):
|
||||||
os.mkdir("data")
|
os.mkdir("data")
|
||||||
with open("data/currentIP", "w") as file:
|
|
||||||
file.close()
|
if not os.path.isfile("./data/currentIP"):
|
||||||
|
open(os.path.join("./data/", "currentIP"), "x").close()
|
||||||
|
|
||||||
# Request IP from website
|
# Request IP from website
|
||||||
global requestIP
|
global requestIP
|
||||||
|
|
@ -107,14 +110,14 @@ def checkIP():
|
||||||
requestIP = getRequestIP.text
|
requestIP = getRequestIP.text
|
||||||
|
|
||||||
# Grab file data and close for data safety.
|
# Grab file data and close for data safety.
|
||||||
currentIPFile = open("data/currentIP", "r")
|
currentIPFile = open(os.path.join("./data/", "currentIP"), "r")
|
||||||
currentIP = currentIPFile.readline().replace("\n", "")
|
currentIP = currentIPFile.readline().replace("\n", "")
|
||||||
currentIPFile.close()
|
currentIPFile.close()
|
||||||
|
|
||||||
# If both IP's are differnet (New external IP!)
|
# If both IP's are differnet (New external IP!)
|
||||||
if requestIP != currentIP:
|
if requestIP != currentIP:
|
||||||
changeRecords()
|
changeRecords()
|
||||||
with open("data/currentIP", "w") as currentIPFile:
|
with open(os.path.join("./data/", "currentIP"), "w") as currentIPFile:
|
||||||
currentIPFile.write(requestIP)
|
currentIPFile.write(requestIP)
|
||||||
currentIPFile.close()
|
currentIPFile.close()
|
||||||
print("All IP's Changed!")
|
print("All IP's Changed!")
|
||||||
|
|
@ -139,7 +142,7 @@ def checkInternet():
|
||||||
|
|
||||||
|
|
||||||
def appendSubdomain(args: list):
|
def appendSubdomain(args: list):
|
||||||
with open("data/ignoredSubdomains", "a") as ignoredSubdomainsFile:
|
with open(os.path.join("./data/", "ignoredSubdomains"), "a") as ignoredSubdomainsFile:
|
||||||
for subdomain in args:
|
for subdomain in args:
|
||||||
ignoredSubdomainsFile.write(subdomain + "\n")
|
ignoredSubdomainsFile.write(subdomain + "\n")
|
||||||
print("Added subdomain: " + subdomain)
|
print("Added subdomain: " + subdomain)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue