2013-03-21 1 views
4

내 서버에 연락처 정보를 얻는 데 필요한 도메인 목록이있는 큰 텍스트 파일이 있습니다. 내가해야 할 일은whois 정보를 얻으려면 명령 줄을 어떻게 사용합니까?

[email protected] [~]# whois stackoverflow.com 
[Querying whois.verisign-grs.com] 
[Redirected to whois.name.com] 
[Querying whois.name.com] 
[whois.name.com] 

__ _        ____ 
| \ | | __ _ _ __ ___ ___  /___|___ _ __ ___ 
| \| |/ _` | '_ ` _ \/_ \  | | /_ \| '_ ` _ \ 
| |\ | (_| | | | | | | __/ _ | |__| (_) | | | | | | 
|_| \_|\__,_|_| |_| |_|\___| (_) \____\___/|_| |_| |_| 
     On a first name basis with the rest of the world. 


Get your <a href="http://www.name.com">domains</a> at Name.com. 


Domain Name:  stackoverflow.com 
Registrar:  Name.com LLC 

Expiration Date: 2015-12-26 19:18:07 
Creation Date: 2003-12-26 19:18:07 

Name Servers: 
     ns1.serverfault.com 
     ns2.serverfault.com 
     ns3.serverfault.com 
     ns4.serverfault.com 

REGISTRANT CONTACT INFO 
Stack Exchange, Inc. 
Sysadmin Team 
1 Exchange Plaza 
Floor 26 
New York 
NY 
10006 
US 
Phone:   +1.2122328280 
Email Address: [email protected] 

ADMINISTRATIVE CONTACT INFO 
Stack Exchange, Inc. 
Sysadmin Team 
1 Exchange Plaza 
Floor 26 
New York 
NY 
10006 
US 
Phone:   +1.2122328280 
Email Address: [email protected] 

TECHNICAL CONTACT INFO 
Stack Exchange, Inc. 
Sysadmin Team 
1 Exchange Plaza 
Floor 26 
New York 
NY 
10006 
US 
Phone:   +1.2122328280 
Email Address: [email protected] 

BILLING CONTACT INFO 
Stack Exchange, Inc. 
Sysadmin Team 
1 Exchange Plaza 
Floor 26 
New York 
NY 
10006 
US 
Phone:   +1.2122328280 
Email Address: [email protected] 

Timestamp: 1363827248.6992 

The Data in the Name.com LLC WHOIS database is provided by Name.com LLC for information purposes, and to assist persons in obtaining information about or related to a domain name registration record. Name.com LLC does not guarantee its accuracy. By submitting a WHOIS query, you agree that you will use this Data only for lawful purposes and that, under no circumstances will you use this Data to: (1) allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations via e-mail (spam); or (2) enable high volume, automated, electronic processes that apply to Name.com LLC (or its systems). Name.com LLC reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy. 

Cached on: 2013-03-20T18:54:08-06:00 

는 각 쿼리의 특정 정보를 추출 할 수 있습니다 : 여기에 내가 stackoverflow.com에 후이즈를 실행할 때의 예는 나에게 보여주는 것입니다. 문제는 각 whois 결과가 등록 기관에 따라 다르므로 각 도메인 who의 연락처 전자 메일을 추출하는 방법을 이해할 수 없다는 것입니다.

는 예를 들어, 내가이 일을하고 싶은 방법입니다

명령 줄을 통해 각 도메인 이름에 대한 WHOIS 정보를 확인하고 단지 포함하는 새로운 텍스트 파일로 모든 결과를 내 보내야합니다 내 서버 도메인 이름 소유자의 이메일 주소 모든 도메인을 포함하는 파일의 이름은 domains.txt이며 가능한 경우 새 파일의 이름을 new.txt로 지정합니다.

이 문제에 도움을 주시면 매우 감사하겠습니다. 미리 감사드립니다!

답변

1

당신은 먼저 whois on cpan 검색을 수행해야하며, 구식이 적고 가장 비난과 가장 관련성이 높은 항목을 선택해야합니다.

+1

내가 생각하기에 Net :: Whois :: IANA는 도메인 이름이 아닌 IP 주소의 whois를 가져 오는 것입니다. 그게 내가 잘못한거야? 그것은 내가 오해를하지 않는 한 이메일 주소와 IANA가 IP 할당을 제어하고 도메인 이름을 반환하지 않는 것처럼 보입니다. – syf101

0

반드시 펄 일 필요는 없지만 커맨드 라인 (아마 linux)에서 이것을하고 있기 때문에 쉘 스크립트를 사용하여 다음을 할 수 있습니다.

cat domain.txt | while read line 
do 
echo "$line - `whois $line | grep \"@\"`" >> new.txt 
done 

당신의 domain.txt 파일이 보이는 경우와 같은 :

stackoverflow.com 

그런 다음 new.txt 같은 것을 볼 것이다 : 당신은 어떤 '종류'에 추가 할 수

stackoverflow.com - [email protected] 
stackoverflow.com - [email protected] 
stackoverflow.com - [email protected] 
stackoverflow.com - [email protected] 

및 ' uniq '명령을 사용하여 반복되는 값을 정리합니다. 필요한 경우 알려 주시면 자세히 설명해 드리겠습니다.

관련 문제