More opnsense
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import requests, schedule, time
|
||||
from bs4 import BeautifulSoup
|
||||
from whatDomain import *
|
||||
from whatDomain import ermWhatAAAATheIpFromDomainYaCrazy, ermWhatATheIpFromDomainYaCrazy
|
||||
|
||||
|
||||
|
||||
@@ -9,25 +9,9 @@ IPv4FILE = "./OPNS_MirrorListV4"
|
||||
IPv6FILE = "./OPNS_MirrorListV6"
|
||||
|
||||
|
||||
# Define EU and American countries as well as Security for security updates
|
||||
target_countries = set([
|
||||
# Europe
|
||||
"Austria", "Belgium", "Bulgaria", "Croatia", "Czech Republic", "Denmark",
|
||||
"Estonia", "Finland", "France", "Germany", "Greece", "Hungary", "Iceland",
|
||||
"Ireland", "Italy", "Latvia", "Lithuania", "Netherlands", "Norway", "Poland",
|
||||
"Portugal", "Romania", "Slovakia", "Slovenia", "Spain", "Sweden", "Switzerland",
|
||||
"United Kingdom", "Moldova",
|
||||
# America
|
||||
"Argentina", "Brazil", "Canada", "Chile", "Colombia", "Costa Rica", "Ecuador",
|
||||
"Mexico", "Peru", "United States", "Uruguay", "Venezuela",
|
||||
# Others
|
||||
"Security", "Extras"
|
||||
])
|
||||
|
||||
|
||||
def sanitizeURL(inpurl: str):
|
||||
# if not "/" in inpurl[:-1]:
|
||||
# inpurl += "/"
|
||||
if not "/" in inpurl[:-1]:
|
||||
inpurl += "/"
|
||||
if "https://" in inpurl:
|
||||
outurl = inpurl[8:]
|
||||
elif "http://" in inpurl:
|
||||
@@ -159,6 +143,25 @@ def LeJob():
|
||||
# time.sleep(30) #Wait one minute
|
||||
# # LeJob()
|
||||
|
||||
|
||||
def DNSerrHandling(inpErrorCode: int):
|
||||
|
||||
match inpErrorCode:
|
||||
case -1:
|
||||
return "No answer from dns server."
|
||||
case -2:
|
||||
# return "All nameservers failed to answer the query."
|
||||
print("All nameservers failed to answer the query.\n Fix your DNS servers.")
|
||||
exit(-1)
|
||||
case -3:
|
||||
return "The DNS query name does not exist."
|
||||
case -4:
|
||||
return "The DNS querry got timed out."
|
||||
case _:
|
||||
return "Not implemented"
|
||||
|
||||
|
||||
|
||||
gigalist = []
|
||||
|
||||
payload = requests.get(OPNSNSMIRRORURL)
|
||||
@@ -179,11 +182,12 @@ for data in soup.find_all('div', class_='download_section'):
|
||||
IPv4Dict = ermWhatATheIpFromDomainYaCrazy(saniturl)
|
||||
IPv6Dict = ermWhatAAAATheIpFromDomainYaCrazy(saniturl)
|
||||
|
||||
if IPv4Dict == -1:
|
||||
print(f"ERROR RESOLVING {saniturl} IPv4 address")
|
||||
|
||||
if type(IPv4Dict) == int:
|
||||
print(f"{DNSerrHandling(IPv4Dict)}")
|
||||
continue
|
||||
elif IPv6Dict == -1:
|
||||
print(f"ERROR RESOLVING {saniturl} IPv6 address")
|
||||
elif type(IPv6Dict) == int:
|
||||
print(f"ERROR RESOLVING {saniturl} IPv6 address with error code {IPv6Dict}")
|
||||
continue
|
||||
|
||||
for key, ip in IPv4Dict.items():
|
||||
|
||||
Reference in New Issue
Block a user