Python					분류
				
						Domain IP 알아내기
컨텐츠 정보
- 4,112 조회
 - 0 추천
 - 
					
					
					
					
						
						목록
					
											
 
본문
				# 개요
1. 도메인은 nslookup 을 통해 IP를 반환 가능하다.
2. nslookup시 IP주소만 가져오고 싶다.
3. IP주소가 여러개일 수 도 있다.
## Bash
```
nslookup google.com | sed -n -e '3,$p'  |  grep "Address" |  awk '25 > length  { print $2"/32" }' | xargs echo | sed 's/ /,/g'
```
### ouput 
```
74.125.23.101/32,74.125.23.138/32,74.125.23.102/32,74.125.23.139/32,74.125.23.100/32,74.125.23.113/32
```
## Python에서 Bash 실행 
```
import os
os.system("nslookup google.com")
list = ["google.com"]
for i in list :
    print("============="+i)
    os.system("nslookup "+i+" | sed -n -e '3,$p'  |  grep \"Address\" |  awk '25 > length  { print $2\"/32\" }' | xargs echo | sed 's/ /,/g'")
```
# GoodLock :smile: :smile:			
					관련자료
			댓글 0
					
			
				등록된 댓글이 없습니다.
			
					
								




