OPNsense links
This commit is contained in:
parent
c265a83300
commit
8a5375c5c8
2
opnsense/.gitignore
vendored
Normal file
2
opnsense/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
__pycache__
|
||||
test
|
187
opnsense/main.log
Normal file
187
opnsense/main.log
Normal file
@ -0,0 +1,187 @@
|
||||
[<div class="download_section">
|
||||
<h2>Australia</h2>
|
||||
<h3><a href="https://mirror.aarnet.edu.au/pub/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="AARNet Pty Ltd">AARNet Pty Ltd</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Brazil</h2>
|
||||
<h3><a href="https://mirror.cloudfence.com.br/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Cloudfence">Cloudfence</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>China</h2>
|
||||
<h3><a href="https://opnsense.aivian.org/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Aivian">Aivian</a></h3>
|
||||
<h3><a href="https://mirrors.pku.edu.cn/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Peking University open source software mirror">Peking University open source software mirror</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Colombia</h2>
|
||||
<h3><a href="https://mirror.venturasystems.tech/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Ventura Systems">Ventura Systems</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Denmark</h2>
|
||||
<h3><a href="https://mirrors.dotsrc.org/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Aalborg University">Aalborg University</a></h3>
|
||||
<h3><a href="https://opnsense.c0urier.net/releases/mirror/" rel="noopener noreferrer" target="_blank" title="c0urier.net">c0urier.net</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Ecuador</h2>
|
||||
<h3><a href="https://mirror.cedia.org.ec/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="CEDIA">CEDIA</a></h3>
|
||||
<h3><a href="https://mirror.ueb.edu.ec/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Universidad Estatal de Bolívar">Universidad Estatal de Bolívar</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>France</h2>
|
||||
<h3><a href="https://mirror.vraphim.com/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Vraphim">Vraphim</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Germany</h2>
|
||||
<h3><a href="https://mirror.dns-root.de/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="dns-root.de (Cloudflare CDN)">dns-root.de (Cloudflare CDN)</a></h3>
|
||||
<h3><a href="https://mirror.level66.network/opnsense-dist/releases/mirror/" rel="noopener noreferrer" target="_blank" title="level66.network">level66.network</a></h3>
|
||||
<h3><a href="https://mirror.uvensys.de/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="uvensys GmbH">uvensys GmbH</a></h3>
|
||||
<h3><a href="https://mirror.fra10.de.leaseweb.net/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="LeaseWeb">LeaseWeb</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Greece</h2>
|
||||
<h3><a href="https://ftp.cc.uoc.gr/mirrors/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="University of Crete / Department of Physics">University of Crete / Department of Physics</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Hungary</h2>
|
||||
<h3><a href="https://quantum-mirror.hu/mirrors/pub/opnsense" rel="noopener noreferrer" target="_blank" title="Quantum Mirror">Quantum Mirror</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>India</h2>
|
||||
<h3><a href="https://mirrors.hopbox.net/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Hopbox">Hopbox</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Iran</h2>
|
||||
<h3><a href="https://mirror1.isatisidc.ir/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Isatis Data Center (isatisidc.ir)">Isatis Data Center (isatisidc.ir)</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Korea</h2>
|
||||
<h3><a href="https://mirror.amuksa.com/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="DAXNET, ROKFOSS PROJECT">DAXNET, ROKFOSS PROJECT</a></h3>
|
||||
<h3><a href="https://mirror.techlabs.co.kr/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Techlabs, ROKFOSS PROJECT">Techlabs, ROKFOSS PROJECT</a></h3>
|
||||
<h3><a href="https://mirror.zzunipark.com/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Zzunimirror, ROKFOSS PROJECT">Zzunimirror, ROKFOSS PROJECT</a></h3>
|
||||
<h3><a href="https://mirror.hemino.net/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="HMirror, ROKFOSS PROJECT">HMirror, ROKFOSS PROJECT</a></h3>
|
||||
<h3><a href="https://mirror.keiminem.com/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Keiverse (Gumi, South Korea)">Keiverse (Gumi, South Korea)</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Morocco</h2>
|
||||
<h3><a href="https://mirror.marwan.ma/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="MARWAN, Rabat">MARWAN, Rabat</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>New Zealand</h2>
|
||||
<h3><a href="https://mirror.catalyst.net.nz/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="catalyst.net Ltd.">catalyst.net Ltd.</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Portugal</h2>
|
||||
<h3><a href="https://mirror.leitecastro.com/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Community (Lisbon)">Community (Lisbon)</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Spain</h2>
|
||||
<h3><a href="https://mirror.raiolanetworks.com/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Raiola Networks (Madrid)">Raiola Networks (Madrid)</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Switzerland</h2>
|
||||
<h3><a href="https://opnsense-mirror.hiho.ch/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Hiho.ch">Hiho.ch</a></h3>
|
||||
<h3><a href="https://mirror.init7.net/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Init7">Init7</a></h3>
|
||||
<h3><a href="https://mirror-opnsense.serverbase.ch/releases/mirror/" rel="noopener noreferrer" target="_blank" title="ServerBase AG">ServerBase AG</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Taiwan</h2>
|
||||
<h3><a href="https://mirror.ntct.edu.tw/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Nantou County Education Network Center">Nantou County Education Network Center</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>The Netherlands</h2>
|
||||
<h3><a href="https://mirror.ams1.nl.leaseweb.net/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="LeaseWeb">LeaseWeb</a></h3>
|
||||
<h3><a href="https://mirror.serverion.com/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Serverion">Serverion</a></h3>
|
||||
<h3><a href="https://pkg.opnsense.org/releases/mirror/" rel="noopener noreferrer" target="_blank" title="OPNsense">OPNsense</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>Turkey</h2>
|
||||
<h3><a href="https://mirror.verinomi.com/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="Verinomi">Verinomi</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>United Kingdom</h2>
|
||||
<h3><a href="https://www.mirrorservice.org/sites/opnsense.org/releases/mirror/" rel="noopener noreferrer" target="_blank" title="University of Kent">University of Kent</a></h3>
|
||||
</div>, <div class="download_section">
|
||||
<h2>United States</h2>
|
||||
<h3><a href="https://mirrors.nycbug.org/pub/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="NYC*BUG (East Coast)">NYC*BUG (East Coast)</a></h3>
|
||||
<h3><a href="https://mirror.wdc1.us.leaseweb.net/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="LeaseWeb (East Coast)">LeaseWeb (East Coast)</a></h3>
|
||||
<h3><a href="https://mirror.sfo12.us.leaseweb.net/opnsense/releases/mirror/" rel="noopener noreferrer" target="_blank" title="LeaseWeb (West Coast)">LeaseWeb (West Coast)</a></h3>
|
||||
<h3><a href="https://mirrors.ocf.berkeley.edu/opnsense/" rel="noopener noreferrer" target="_blank" title="Open Computing Facility at UC Berkeley (Berkeley, California)">Open Computing Facility at UC Berkeley (Berkeley, California)</a></h3>
|
||||
</div>]
|
||||
Found the URL: https://opnsense.org
|
||||
Found the URL: /
|
||||
Found the URL: #
|
||||
Found the URL: https://opnsense.org/get-started/
|
||||
Found the URL: #
|
||||
Found the URL: https://opnsense.org/blog/
|
||||
Found the URL: https://shop.opnsense.com/
|
||||
Found the URL: https://opnsense.org/download/
|
||||
Found the URL: https://opnsense.org/opnsense/
|
||||
Found the URL: https://opnsense.org/roadmap/
|
||||
Found the URL: https://opnsense.org/features/
|
||||
Found the URL: https://opnsense.org/partners/
|
||||
Found the URL: https://opnsense.org/legal-guidelines/
|
||||
Found the URL: https://opnsense.org/contact/
|
||||
Found the URL: https://opnsense.org/get-started/
|
||||
Found the URL: https://docs.opnsense.org/
|
||||
Found the URL: https://opnsense.org/your-invited/
|
||||
Found the URL: http://forum.opnsense.org/
|
||||
Found the URL: https://docs.opnsense.org/
|
||||
Found the URL: https://opnsense.org/donate/
|
||||
Found the URL: mailto:project@opnsense.org
|
||||
Found the URL: /
|
||||
Found the URL: #
|
||||
Found the URL: https://opnsense.org/opnsense/
|
||||
Found the URL: https://opnsense.org/roadmap/
|
||||
Found the URL: https://opnsense.org/features/
|
||||
Found the URL: https://opnsense.org/partners/
|
||||
Found the URL: https://opnsense.org/legal-guidelines/
|
||||
Found the URL: https://opnsense.org/contact/
|
||||
Found the URL: https://opnsense.org/get-started/
|
||||
Found the URL: https://opnsense.org/get-started/
|
||||
Found the URL: https://docs.opnsense.org/
|
||||
Found the URL: #
|
||||
Found the URL: https://opnsense.org/your-invited/
|
||||
Found the URL: http://forum.opnsense.org/
|
||||
Found the URL: https://docs.opnsense.org/
|
||||
Found the URL: https://opnsense.org/donate/
|
||||
Found the URL: https://opnsense.org/blog/
|
||||
Found the URL: https://shop.opnsense.com/
|
||||
Found the URL: https://opnsense.org/download/
|
||||
Found the URL: https://opnsense.org/
|
||||
Found the URL: https://opnsense.org/donate/
|
||||
Found the URL: https://mirror.ams1.nl.leaseweb.net/opnsense/releases/25.1/OPNsense-25.1-dvd-amd64.iso.bz2
|
||||
Found the URL: #full-mirror-listing
|
||||
Found the URL: https://docs.opnsense.org/manual/install.html#download-and-verification
|
||||
Found the URL: https://shop.opnsense.com/product/opnsense-business-edition/
|
||||
Found the URL: https://www.amazon.de/Practical-OPNsense-Building-Enterprise-Firewalls/dp/3757805364/
|
||||
Found the URL: https://shop.opnsense.com/product/opnsense-business-edition/
|
||||
Found the URL: https://mynetworktraining.com/p/official-opnsense-introduction-course
|
||||
Found the URL: https://mirror.aarnet.edu.au/pub/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.cloudfence.com.br/opnsense/releases/mirror/
|
||||
Found the URL: https://opnsense.aivian.org/releases/mirror/
|
||||
Found the URL: https://mirrors.pku.edu.cn/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.venturasystems.tech/opnsense/releases/mirror/
|
||||
Found the URL: https://mirrors.dotsrc.org/opnsense/releases/mirror/
|
||||
Found the URL: https://opnsense.c0urier.net/releases/mirror/
|
||||
Found the URL: https://mirror.cedia.org.ec/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.ueb.edu.ec/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.vraphim.com/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.dns-root.de/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.level66.network/opnsense-dist/releases/mirror/
|
||||
Found the URL: https://mirror.uvensys.de/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.fra10.de.leaseweb.net/opnsense/releases/mirror/
|
||||
Found the URL: https://ftp.cc.uoc.gr/mirrors/opnsense/releases/mirror/
|
||||
Found the URL: https://quantum-mirror.hu/mirrors/pub/opnsense
|
||||
Found the URL: https://mirrors.hopbox.net/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror1.isatisidc.ir/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.amuksa.com/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.techlabs.co.kr/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.zzunipark.com/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.hemino.net/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.keiminem.com/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.marwan.ma/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.catalyst.net.nz/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.leitecastro.com/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.raiolanetworks.com/opnsense/releases/mirror/
|
||||
Found the URL: https://opnsense-mirror.hiho.ch/releases/mirror/
|
||||
Found the URL: https://mirror.init7.net/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror-opnsense.serverbase.ch/releases/mirror/
|
||||
Found the URL: https://mirror.ntct.edu.tw/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.ams1.nl.leaseweb.net/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.serverion.com/opnsense/releases/mirror/
|
||||
Found the URL: https://pkg.opnsense.org/releases/mirror/
|
||||
Found the URL: https://mirror.verinomi.com/opnsense/releases/mirror/
|
||||
Found the URL: https://www.mirrorservice.org/sites/opnsense.org/releases/mirror/
|
||||
Found the URL: https://mirrors.nycbug.org/pub/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.wdc1.us.leaseweb.net/opnsense/releases/mirror/
|
||||
Found the URL: https://mirror.sfo12.us.leaseweb.net/opnsense/releases/mirror/
|
||||
Found the URL: https://mirrors.ocf.berkeley.edu/opnsense/
|
||||
Found the URL: mailto:project@opnsense.org
|
||||
Found the URL: mailto:sales@opnsense.com
|
||||
Found the URL: https://forum.opnsense.org/
|
||||
Found the URL: https://web-cdn.bsky.app/profile/did:plc:vpna73dxrqinj6ttwh3wryxv
|
||||
Found the URL: https://www.linkedin.com/groups/6958160/
|
||||
Found the URL: https://www.reddit.com/r/opnsense/?rdt=38653
|
||||
Found the URL: https://github.com/opnsense
|
||||
Found the URL: /donate
|
||||
Found the URL: https://deciso.com
|
||||
Found the URL: https://opnsense.org/terms-conditions/
|
||||
Found the URL: https://opnsense.org/privacy-en-cookies/
|
206
opnsense/main.py
Normal file
206
opnsense/main.py
Normal file
@ -0,0 +1,206 @@
|
||||
import requests, schedule, time
|
||||
from bs4 import BeautifulSoup
|
||||
from whatDomain import *
|
||||
|
||||
|
||||
|
||||
OPNSNSMIRRORURL = "https://opnsense.org/download/#full-mirror-listing"
|
||||
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 "https://" in inpurl:
|
||||
outurl = inpurl[8:]
|
||||
elif "http://" in inpurl:
|
||||
outurl = inpurl[7:]
|
||||
elif "http://" or "https://" not in url:
|
||||
outurl = inpurl
|
||||
else:
|
||||
return -1
|
||||
|
||||
# how the fuck does it work?
|
||||
# I mean I wrote this but I don't know why does it work.
|
||||
i = 0
|
||||
for char in outurl:
|
||||
i += 1
|
||||
if char == "/":
|
||||
outurl = outurl[:i]
|
||||
|
||||
if char == "/":
|
||||
outurl = outurl[:-1]
|
||||
return outurl
|
||||
|
||||
|
||||
def getFreshData():
|
||||
payload = requests.get(DEBMIRRORURL)
|
||||
soup = BeautifulSoup(payload.content, "html.parser")
|
||||
return soup
|
||||
|
||||
|
||||
def sanitizeUrlsGodWhatTheFuckIsThis(SoupInput: BeautifulSoup):
|
||||
|
||||
outMirrorDict = {}
|
||||
current_country = None
|
||||
|
||||
# Iterate through all table rows
|
||||
for table in SoupInput.find_all("table"):
|
||||
for row in table.find_all("tr"):
|
||||
# Check for country name in a full-row header (<strong><big>)
|
||||
strong = row.find("strong")
|
||||
if strong:
|
||||
country_name = strong.get_text(strip=True)
|
||||
if country_name in target_countries:
|
||||
current_country = country_name
|
||||
else:
|
||||
current_country = None
|
||||
continue # move to next row
|
||||
|
||||
# Check for inline country name in first column
|
||||
cols = row.find_all("td")
|
||||
if len(cols) >= 2:
|
||||
possible_country = cols[0].get_text(strip=True)
|
||||
link_tag = cols[1].find("a", href=True)
|
||||
if possible_country in target_countries:
|
||||
current_country = possible_country
|
||||
if current_country and link_tag:
|
||||
url = link_tag['href']
|
||||
if current_country not in outMirrorDict:
|
||||
outMirrorDict[current_country] = []
|
||||
outMirrorDict[current_country].append(url)
|
||||
|
||||
outMirrorDict.update({"Security": DEBSECURITYURL})
|
||||
outMirrorDict.update({"Extras": EXTRASURL})
|
||||
|
||||
return outMirrorDict
|
||||
|
||||
def LeJob():
|
||||
|
||||
print("Starting lookup")
|
||||
|
||||
LeSoup = getFreshData()
|
||||
|
||||
LeMirrorDict = sanitizeUrlsGodWhatTheFuckIsThis(LeSoup)
|
||||
|
||||
# print(LeMirrorDict)
|
||||
|
||||
with open(IPv4FILE, "r",) as fR, open(IPv4FILE, "w",) as fW:
|
||||
|
||||
for key, urls in LeMirrorDict.items():
|
||||
# print(urls)
|
||||
if key in target_countries:
|
||||
|
||||
for url in urls:
|
||||
# print(url)
|
||||
|
||||
if url not in fR:
|
||||
|
||||
goodurl = sanitizeURL(url)
|
||||
# print(goodurl)
|
||||
|
||||
ip4Dict = ermWhatATheIpFromDomainYaCrazy(goodurl)
|
||||
|
||||
if ip4Dict == -1:
|
||||
continue
|
||||
|
||||
for key, ip in ip4Dict.items():
|
||||
print(ip)
|
||||
|
||||
fW.write(ip + "/32" + "\n")
|
||||
|
||||
|
||||
with open(IPv6FILE, "r",) as fR, open(IPv6FILE, "w",) as fW:
|
||||
|
||||
for key, urls in LeMirrorDict.items():
|
||||
if key in target_countries:
|
||||
|
||||
for url in urls:
|
||||
|
||||
if url not in fR:
|
||||
|
||||
goodurl = sanitizeURL(url)
|
||||
# print(goodurl)
|
||||
|
||||
ip6Dict = ermWhatAAAATheIpFromDomainYaCrazy(goodurl)
|
||||
|
||||
if ip6Dict == -1:
|
||||
continue
|
||||
|
||||
for key, ip in ip6Dict.items():
|
||||
# print(ip)
|
||||
|
||||
fW.write(ip + "/128" + "\n")
|
||||
|
||||
|
||||
# schedule.every().day.at("12:45").do(LeJob)
|
||||
# schedule.every().day.at("17:44").do(LeJob)
|
||||
|
||||
# while True:
|
||||
# schedule.run_pending()
|
||||
# print("Waiting...")
|
||||
# time.sleep(30) #Wait one minute
|
||||
# # LeJob()
|
||||
|
||||
gigalist = []
|
||||
|
||||
payload = requests.get(OPNSNSMIRRORURL)
|
||||
soup = BeautifulSoup(payload.content, "html.parser")
|
||||
|
||||
# print(soup)
|
||||
|
||||
# divs = soup.find_all("div", {"class": "download_section"})
|
||||
|
||||
for data in soup.find_all('div', class_='download_section'):
|
||||
for a in data.find_all('a', href=True):
|
||||
|
||||
url = a['href']
|
||||
|
||||
saniturl = sanitizeURL(url)
|
||||
|
||||
print(saniturl)
|
||||
IPv4Dict = ermWhatATheIpFromDomainYaCrazy(saniturl)
|
||||
IPv6Dict = ermWhatAAAATheIpFromDomainYaCrazy(saniturl)
|
||||
|
||||
if IPv4Dict == -1:
|
||||
print(f"ERROR RESOLVING {saniturl} IPv4 address")
|
||||
continue
|
||||
elif IPv6Dict == -1:
|
||||
print(f"ERROR RESOLVING {saniturl} IPv6 address")
|
||||
continue
|
||||
|
||||
for key, ip in IPv4Dict.items():
|
||||
print(f"Found the ipv4: {ip}")
|
||||
|
||||
for key, ip in IPv6Dict.items():
|
||||
print(f"Found the ipv6: {ip}")
|
||||
|
||||
# print(a.get('href')) #for getting link
|
||||
# print(a.text) #for getting text between the link
|
||||
|
||||
|
||||
|
||||
# for a in soup.find_all("div", {"class": "download_section"}, "a", href=True):
|
||||
|
||||
|
||||
|
||||
# h2zz = divs = soup.find_all("h3")
|
||||
|
||||
# print(f" one link is: {h2zz}")
|
4
opnsense/requirements.txt
Normal file
4
opnsense/requirements.txt
Normal file
@ -0,0 +1,4 @@
|
||||
beautifulsoup4==4.13.4
|
||||
requests==2.32.3
|
||||
schedule==1.2.2
|
||||
nslookup==1.8.1
|
93
opnsense/whatDomain.py
Normal file
93
opnsense/whatDomain.py
Normal file
@ -0,0 +1,93 @@
|
||||
#from nslookup import Nslookup
|
||||
from typing import Optional, Annotated
|
||||
import dns, dns.resolver
|
||||
|
||||
# https://www.codeunderscored.com/nslookup-python/
|
||||
|
||||
def ermWhatATheIpFromDomainYaCrazy(inpDomainNameOrSomething: Annotated[str, "Domain name to lookup IP for"]):
|
||||
#dns_query = Nslookup()
|
||||
"""
|
||||
Tells you what IPv4 address/es a domain point to.
|
||||
Returns:
|
||||
dict: A dictionary with IP addresses associated with that domain.
|
||||
|
||||
"""
|
||||
|
||||
# i = 0
|
||||
outDict = {}
|
||||
|
||||
#result = dns_query.dns_lookup("example.com")
|
||||
#result = Nslookup.dns_lookup(inpDomainNameOrSomething)
|
||||
try:
|
||||
result = dns.resolver.resolve(inpDomainNameOrSomething, 'A')
|
||||
except dns.resolver.NoAnswer:
|
||||
return -1
|
||||
except dns.resolver.NoNameservers or dns.resolver.LifetimeTimeout:
|
||||
return -1
|
||||
for i, something in enumerate(result):
|
||||
outDict[i] = something.to_text()
|
||||
# i += 1
|
||||
|
||||
return outDict
|
||||
|
||||
def ermWhatAAAATheIpFromDomainYaCrazy(inpDomainNameOrSomething: Annotated[str, "Domain name to lookup IP for"]):
|
||||
#dns_query = Nslookup()
|
||||
"""
|
||||
Tells you what IPv6 address/es a domain point to.
|
||||
Returns:
|
||||
dict: A dictionary with IP addresses associated with that domain.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
# i = 0
|
||||
outDict = {}
|
||||
|
||||
#result = dns_query.dns_lookup("example.com")
|
||||
#result = Nslookup.dns_lookup(inpDomainNameOrSomething)
|
||||
try:
|
||||
result = dns.resolver.resolve(inpDomainNameOrSomething, 'AAAA')
|
||||
except dns.resolver.NoAnswer:
|
||||
return -1
|
||||
except dns.resolver.NoNameservers or dns.resolver.LifetimeTimeout:
|
||||
return -1
|
||||
for i, something in enumerate(result):
|
||||
outDict[i] = something.to_text()
|
||||
# i += 1
|
||||
|
||||
return outDict
|
||||
|
||||
|
||||
def ermWhatPTRTheIpFromDomainYaCrazy(inpIpAddressOrSomething: Annotated[str, "IP address to lookup domain for"]):
|
||||
#dns_query = Nslookup()
|
||||
"""
|
||||
Tells you what IPv6 address/es a domain point to.
|
||||
Returns:
|
||||
dict: A dictionary with IP addresses associated with that domain.
|
||||
|
||||
"""
|
||||
|
||||
whatToCheck = inpIpAddressOrSomething + ".in-addr.arpa"
|
||||
|
||||
|
||||
# i = 0
|
||||
outDict = {}
|
||||
|
||||
#result = dns_query.dns_lookup("example.com")
|
||||
#result = Nslookup.dns_lookup(inpDomainNameOrSomething)
|
||||
try:
|
||||
result = dns.resolver.resolve(whatToCheck, 'PTR')
|
||||
except dns.resolver.NoAnswer:
|
||||
return -1
|
||||
except dns.resolver.NoNameservers:
|
||||
return -1
|
||||
for i, something in enumerate(result):
|
||||
outDict[i] = something.to_text()
|
||||
# i += 1
|
||||
|
||||
return outDict
|
||||
|
||||
|
||||
#print(ermWhatATheIpFromDomainYaCrazy("fubukus.net"))
|
||||
#print(ermWhatAAAATheIpFromDomainYaCrazy("fubukus.net"))
|
||||
#print(ermWhatPTRTheIpFromDomainYaCrazy("192.168.1.226"))
|
Loading…
x
Reference in New Issue
Block a user