Last active
January 18, 2024 12:57
-
-
Save woltage/5b7a744f9562b9348c90c6e0d038d92a to your computer and use it in GitHub Desktop.
Skripti jolla saa Y-tunnukella kaikki firman omistamat .fi -verkkotunnukset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Y-Tunnukseen perustuva domainejen haku (.fi) | |
## Esimerkki: getdomains 1093944-1 # MTV Oy | |
# Laita tämä .bashrc tai .zshrc | |
# Käyttöesimerkkejä: | |
# Looppaa Y-tunnuksetn kaikki domainit läpi ja tee kysely | |
# for i in $(getdomains 1093944-1); do echo $i && host -t cname www.$i; done | |
function getdomains() { | |
curl 'https://odata.domain.fi/OpenDomainData.svc/Domains()?$orderby=GrantDate%20desc&$top=500&$filter=OrganizationId%20eq%20%27'$1'%27' -s| grep -oP "<d:Name>\K([a-å]+)<"|sed 's/</.fi/g' | |
} | |
# Hae domainiin perustuen: domain_getdomains | |
function domain_getdomains() { | |
CODE=`whois $1|grep -oP "register number(.*): \K(.*)"` | |
getdomains $CODE | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Myös awk on ihan ok väline tähänkin. Sekin on tarjolla kaikissa *nix jakeluissa.