[원문: http://tools.kali.org/information-gathering/nmap]


정의

Nmap (“Network Mapper”) is a free and open source (license) utility for network discovery and security auditing. Many systems and network administrators also find it useful for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. It was designed to rapidly scan large networks, but works fine against single hosts. Nmap runs on all major computer operating systems, and official binary packages are available for Linux, Windows, and Mac OS X. In addition to the classic command-line Nmap executable, the Nmap suite includes an advanced GUI and results viewer (Zenmap), a flexible data transfer, redirection, and debugging tool (Ncat), a utility for comparing scan results (Ndiff), and a packet generation and response analysis tool (Nping).


Nmap was named “Security Product of the Year” by Linux Journal, Info World, LinuxQuestions.Org, and Codetalker Digest. It was even featured in twelve movies, including The Matrix Reloaded, Die Hard 4, Girl With the Dragon Tattoo, and The Bourne Ultimatum.

 기존과는 다르게 nmap은 간략하게 소개 할 수가 없다. nmap에는 상당히 많은 기능과 옵션이 존재하기 때문이다.

그래도 굳이 정의하자면 포트스캐닝 도구로서 호스트나 네트워크를 스캐닝 할 때 매우 우용한 도구다. 라고 표현하고 싶다.

위의 정의를 보면 nmap은 네트워크 검사나 보안 감사를 위한 무료이자 오픈소스 유틸리티로 표현하고 있다.

nmap은 raw ip 패킷을 이용하여 네트워크상의 호스트 검사, 사용하는 서비스가 무엇인지, 운영하는 OS, 사용 중인 패킷 필터, 방화벽 타입 등을 검사한다.

 원문 페이지를 방문하면 nmap에 대한 장점을 소개하였는데 간략하게 소개하자면

1) 다양한 포트스캐닝 메커니즘(TCP&UDP), os 감지, 버전 감지, ping sweeps 등을 제공하는 유연성

2) huge network 상에서 제공할 수 있는 강력함

3) 윈도우, 리눅스, 솔라리스, 맥 등에서 사용할 수 있음

4) 자세한 다큐먼트 등을 소개하고 있다.


Usage

위에서 볼 수 있듯이 엄청많다....


#nmap [Scan Type(s)] [Options] {target specification}

기본 syntax는 위와 같다.

자주 사용하는 옵션에 대해 소개하고자 한다. 나머지 옵션 및 기능들은 man page 참고!

(분류는 보기좋게(?) 개인적으로 판단하였습니다.)

[Scan Type(s)]

1)Port Scanning

-sT: TCP connect() scan: TCP scanning의 가장 기초적인 형태로 connect()함수를 사용해서 모든 포트에 대해 스캔

-sS: TCP SYN scan: full TCP접속을 하지 않으므로 "half-open" 스캐닝이라 한다. 하나의 SYN 패킷을 보내어 SYN|ACK 응답이 오면 그 포트는 listening 상태임을 나타내며, RST(ReSeT)응답이 오면 non-listener임을 나타냄

이 기술은 하나의 패킷을 보내어 응답을 받으면 그 즉시 RST 패킷을 보내서 접속을 끊어버리기 때문에 로그를 남기지 않는 경우가 대부분임. 즉 추적이 어렵다.

-sF: Stealth FIN: SYN 패킷을 막아놓은 방화벽이나 패킷 필터 또는 Synlogger와 Courtney 같은 스캔을 탐지하는 프로그램들을 무사히 통과할 수 있다. open 포트로 FIN 패킷을 보내면 이 패킷을 무시하고, closed 포트로 보내면 RST 패킷이 온다.

-sX: Xmas Tree: FIN, URG, PUSH 코드 비트를 설정한 채 패킷을 보냄. RESET은 포트가 닫혔다는 것을 말해주며, 반응이 없는 것은 포트가 열려있음을 뜻함

-sN: Null scan: 어떤 코드 비트도 설정하지 않은 패킷을 보냄. RESET은 포트가 닫힌 것을 말하며, 반응이 없는 것은 포트가 열린 것을 뜻함

-sP: Ping scanning: 네트워크의 어느 호스트가 살아있는지를 알고 싶을 때 사용(-sn 과 동일)

-sU; UDP scan, 시간이 상당히 오래 걸림

-sA: ACK scan 

-sW: window scan 

-sR: RPC scan

2)Service And Version Detection

-sV:Version detection

-sR:RPC scan

3)OS Detection

-O: Enable OS detection

리눅스 3.x를 사용한다고 추측하고 있다. 정확한 버전까지는 확인할 수 없으나 대략적으로 판단할 수 있다.


[Options]

1)Port Specification And Scan Order

-p: port ranges(Only scan specified ports): 특정 포트를 지정하는 것으로 예를 들어 -p 80 식으로 지정함, '-' 범위 지정 가능
(Udp:53, 111, 137, Tcp:21-25, 80, 139, 8080)

-F(fast scan)

-r(Don't randomize ports)

2) Timing and Performance

-T:paranoid|sneaky|polite|normar|aggressive|insane

->The first two are for IDS evasion. Polite mode slows down the scan to use less bandwidth and target machine resources. Normal mode is the default and so -T3 does nothing. Aggressive mode speeds scans up by making the assumption that you are on a reasonably fast and reliable network. Finally insane mode. assumes that you are on an extraordinarily fast network or are willing to sacrifice some accuracy for speed.

주로 4번(-T4)을 많이 사용하는 것 같음

3) Verbosity

nmap을 쓰는 사람은 기본적으로 v옵션을 사용

-v: Increase verbosity level: 자세히

Use it twice or more for even greater verbosity: -vv, or give a verbosity level directly, for example -v3


{target specification}

타겟을 지정하는 데 있어 단일 호스트 192.168.100.5, 다중 호스트 192.168.100.3-20 으로 주어지는게 가능하다.

또한 CIDR-style을 지원한다. 예를 들어 192.168.100.0/24는 192.168.100.0번부터 192.168.100.255까지 256의 호스트를 스캔

-iL inputfilename

작성한 파일이 제대로 동작하는지 tab기능과 enter를 통해 작성 결과 모두 정상적으로 출력되는 것을 확인할 수 있었다.

비록 위의 결과는 3개의 호스트에 대해서만 출력하였지만 같은 IP대역이 아닌 다양하고 상당히 많은 수의 호스트 리스트가 필요할 수 있다. 이 때 유용하게 쓰일 것으로 사료된다.


nmap을 모두 설명하기에는 실력의 부족도 있지만 nmap에 대한 기능만 다룬 두꺼운 책 한권이 있을 정도로 다루는 범위가 방대하다. 해당 포스트는 nmap에 대한 소개 정도로 보면 좋을 듯 싶다. 하지만 기능은 매우 강력하다라는 것을 표현하고 싶다.

'해킹 > kali tools' 카테고리의 다른 글

[Information-Gathering27]recon-ng  (0) 2016.04.12
[Information-Gathering26]p0f  (0) 2016.04.07
[Information-Gathering24]miranda  (0) 2016.03.29
[Information-Gathering23]masscan  (0) 2016.03.24
[Information-Gathering22]hping3  (0) 2016.03.18

+ Recent posts