-
-
Save lokori/53434cc43c464c5d82e692c814a876de to your computer and use it in GitHub Desktop.
Skripti joka hakee Y-tunnuksella kaikki firman omistamat .fi -verkkotunnukset. (alkuperäinen https://gist.github.com/woltage/5b7a744f9562b9348c90c6e0d038d92a)
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
#!/bin/bash | |
## 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 | |
set -eu | |
if [ "$#" -ne 1 ]; then | |
echo "Anna parametrina Y-tunnus, jolla haetaan." | |
fi | |
echo "Haetaan Y-tunnuksella $1" | |
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 | |
} | |
getdomains $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment