2010. 9. 4. 15:57

http://nmap.org/

http://nmap.org/




 1. 설치

http://www.insecure.org/nmap

 

nmap 의 홈페이지에서 소스파일을 내려 받습니다. 그 후에 설치할 디렉토리로 옮긴후에 압축을
풉니다. 그 후에 해당 디렉토리에서 ./configure 를 실행한 후에make, make install 을 실행합니다.

/* 소스 설치 */
# ./configure
# make; make install

 

/* 우분투 apt-get*/

# apt-get install nmap

 

2. 옵션 요약

Nmap [Scan Tyep…] [Options] {target specification}

 

옵션

설명

-sT

일반적인 TCP 포트스캐닝.

-sS

이른바 'half-open' 스캔으로 추적이 어렵다.

-sP

ping 을 이용한 일반적인 스캔.

-sU

UDP 포트 스캐닝.

-PO

대상 호스트에 대한 ping 응답을 요청하지 않음 .
log 기록과 filtering 을 피할 수 있다.

-PT

일반적이 ICMP ping이 아닌 ACK 패킷으로 ping 을 보내고
RST 패킷으로 응답을 받는다.

-PI

일반적인 ICMP ping 으로 방화벽이나 필터링에 의해 걸러진다.

-PB

ping 을 할 때 ICMP ping 과 TCP ping을 동시에 이용한다.

-PS

ping 을 할 때 ACK 패킷대신 SYN 패킷을 보내 스캔.

-O

대상 호스트의 OS 판별.

-p

대상 호스트의 특정 포트를 스캔하거나, 스캔할 포트의 범위를 지정.
ex) -p 1-1024

-D

Decoy 기능으로 대상 호스트에게 스캔을 실행한 호스트의 주소를 속인다.

-F

/etc/services 파일 내에 기술된 포트만 스캔.

-I

TCP 프로세서의 identd 정보를 가져온다.

-n

IP 주소를 DNS 호스트명으로 바꾸지 않는다. 속도가 빠르다.

-R

IP 주소를 DNS 호스트명으로 바꿔서 스캔. 속도가 느리다.

-o

스캔 결과를 택스트 파일로 저장.

-i

스캔 대상 호스트의 정보를 지정한 파일에서 읽어서 스캔.

-h

도움말 보기

 

3. 사용

몇가지 사용 예를 통해 nmap을 활용해 보시죠.


[root@gyn root]# nmap -sP xxx.xxx.xxx.xxx

Starting nmap V. 2.54BETA30 ( www.insecure.org/nmap/ )
Host gyn (xxx.xxx.xxx.xxx) appears to be up.

Nmap run completed -- 1 IP address (1 host up) scanned in 0 seconds

-sP 옵션으로 대상호스트가 살아 있음을 알아냈습니다. 이젠 특정 포트(80)를 검색해 보겠습니다.

[root@ home]# nmap -sP -PT80 xxx.xxx.xxx.xxx
TCP probe port is 80

Starting nmap V. 2.54BETA7 ( www.insecure.org/nmap/ )
Host (xxx.xxx.xxx.xxx) appears to be up.
Nmap run completed -- 1 IP address (1 host up) scanned in 1 second

지정된 포트가 아니라 대상호스트의 열린 포트를 모두 검색해 봅니다.


[root@ home]# nmap -sT xxx.xxx.xxx.xxx

Starting nmap V. 2.54BETA7 ( www.insecure.org/nmap/ )
Interesting ports on (xxx.xxx.xxx.xxx):
(The 1526 ports scanned but not shown below are in state: closed)
Port State Service
22/tcp open ssh
53/tcp open domain
80/tcp open http
Nmap run completed -- 1 IP address (1 host up) scanned in 5 seconds

대상 호스트의 열린 포트를 알수는 있지만 로그가 남으므로 위험합니다.
스텔스 스캔으로 감시를 피해야 겠지요.

[root@webserver log]# nmap -sS xxx.xxx.xxx.xxx

Starting nmap V. 2.54BETA7 ( www.insecure.org/nmap/ )
Interesting ports on (xxx.xxx.xxx.xxx):
(The 1526 ports scanned but not shown below are in state: closed)
Port State Service
22/tcp open ssh
53/tcp open domain
80/tcp open http

Nmap run completed -- 1 IP address (1 host up) scanned in 5 seconds

UDP port 스캔입니다. 시간이 많이 걸릴 수도 있습니다.


[root@gyn root]# nmap -sU localhost

Starting nmap V. 2.54BETA30 ( www.insecure.org/nmap/ )
Interesting ports on gyn (127.0.0.1):
(The 1450 ports scanned but not shown below are in state: closed)
Port State Service
53/udp open domain
699/udp open unknown

Nmap run completed -- 1 IP address (1 host up) scanned in 3 seconds

이번에는 -O 옵션으로 운영체제를 알아보겠습니다.


[root@webserver /root]# nmap -sS -O xxx.xxx.xxx.xxx

Starting nmap V. 2.54BETA7 ( www.insecure.org/nmap/ )
Interesting ports on db (xxx.xxx.xxx.xxx):
(The 1530 ports scanned but not shown below are in state: closed)
Port State Service
22/tcp open ssh
113/tcp open auth
3306/tcp open mysql

TCP Sequence Prediction: Class=random positive increments
Difficulty=2158992 (Good luck!)
Remote operating system guess: Linux 2.1.122 - 2.2.16

Nmap run completed -- 1 IP address (1 host up) scanned in 2 seconds

몇가지 예를 통해 사용법을 알아 보았습니다.

마지막을 부탁드릴 말씀은 자신이 직접 관리하지 않는, 호스트나 네트웍에서 테스트를 하는 것은
아주 무례한 행동이며, 관리가 엄격한 사이트의 경우 접속 제한은 당하는 경우도 있으므로
바람직하지 않은 방법으로 사용하는 일이 없길 바랍니다.

Posted by devanix