Как я могу получить из консоли информацию о дате истечения срока действия домена для европейских доменов, например .eu
, .de
, .sk
?
Для . com
домены Я просто использую whois example.com
, но для европейских доменов я получаю только краткую информацию без даты (например, НЕ РАСКРЫВАЕТСЯ!
для . eu
)
В качестве альтернативного решения я нашел платную веб-службу www.whoisxmlapi.com , но она тоже ограничена (и я ищу решение для некоммерческих проектов) .
У большинства ccTLD (.de и .eu тоже) дата истечения срока действия не отображается при запуске whois, в то время как .sk - один из тех, которые имеют. Единственное решение, пока эта политика не изменится, - это использовать api для получения полного Whois из веб-интерфейса в национальном реестре. Здесь вы можете найти список с доступной информацией whois для большинства ccTLD: http://linuxmafia.com/pub/linux/network/domain-check-testdata
Как видите, большинство серверов whois ccTLD не возвращают даты истечения срока действия.
Вот онлайн-whois, который работал (отображается дата истечения срока действия) для доменного имени .eu: https://whois.eurid.eu/en/?domain=demosphere.eu
You should be able to get whois for almost any domain, actually there are regulations to make sure that's the case. But obviously it's not the case always. To do whois properly from command line, you have to first:
1) connect to whois using the -h switch with one of the servers on this list:
http://www.nirsoft.net/whois_servers_list.html
NOTE: each ending/tld has one "main registrar"
2) What you get in return, will include a field that gives you the whois server address of the registrar where the domain is actually registered.
NOTE: You can get the full registration information only from the registrar where the domain is actually registered.
If you run:
$ whois google.com
It will try to do this for you in the background (as far as I understand), but depending on the system and whois version, it's often not doing it well and might also be prone to being rate-limited.
Below a quick code example for doing whois "properly". I've tested it with a large number of sites, and it avoids the usual rate-limit issues and returns a much higher 'complete result' rate than any other method I had tried.
TLD=$(echo $DOMAIN | cut -d. -f2-)
WHOIS=$(grep -w ^$TLD whois_server.txt | cut -d ' ' -f2)
timeout 2 whois -h $WHOIS "domain "$DOMAIN"" | grep " " | grep -v "Status:" | tr ':' '=' | tr -d ' ' | tr '[a-z]' '[A-Z]' > whois.bash
REGIST=$(cat whois.bash | grep WHOISSERVER | cut -d= -f2)
timeout 2 whois -h $REGIST $DOMAIN | grep : | grep -w '^Admin City\|^Admin Country\|^Registrant Organization\|^Registrant Name' | tr [a-z] [A-Z] | sed 's/\ /_/' | sed 's/:/=("/' | tr -d ' ' | sed 's/$/")/' | tr '/' '_' >> whois.bash;