August 30, 2020

Debian: установка nmap

Nmap — это инструмент командной строки для исследования сети или аудита безопасности. Он поддерживает пинг сканирование, многие методы сканирования портов, и снятие отпечатков TCP / IP.

Установка

Чтобы установить nmap для серверных систем на основе Debian и Ubuntu Linux, введите следующую команду apt или apt-get:

sudo apt-get install nmap

Пример ответа:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  liblinear3 ndiff python-bs4 python-html5lib python-lxml python-webencodings
Suggested packages:
  liblinear-tools liblinear-dev python-genshi python-lxml-dbg python-lxml-doc
The following NEW packages will be installed:
  liblinear3 ndiff nmap python-bs4 python-html5lib python-lxml python-webencodings
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,518 kB of archives.
After this operation, 29.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu artful/main amd64 liblinear3 amd64 2.1.0+dfsg-2 [39.3 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu artful/main amd64 python-bs4 all 4.6.0-1 [67.9 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu artful/main amd64 python-webencodings all 0.5-2 [10.3 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu artful/main amd64 python-html5lib all 0.999999999-1 [83.6 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu artful/main amd64 python-lxml amd64 4.0.0-1 [1,120 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu artful/main amd64 ndiff all 7.60-1ubuntu1 [20.4 kB]                                                                                                                     
Get:7 http://in.archive.ubuntu.com/ubuntu artful/main amd64 nmap amd64 7.60-1ubuntu1 [5,176 kB]                                                                                                                   
Fetched 6,518 kB in 22s (284 kB/s)                                                                                                                                                                                
Selecting previously unselected package liblinear3:amd64.
(Reading database ... 196139 files and directories currently installed.)
Preparing to unpack .../0-liblinear3_2.1.0+dfsg-2_amd64.deb ...
Unpacking liblinear3:amd64 (2.1.0+dfsg-2) ...
Selecting previously unselected package python-bs4.
Preparing to unpack .../1-python-bs4_4.6.0-1_all.deb ...
Unpacking python-bs4 (4.6.0-1) ...
Selecting previously unselected package python-webencodings.
Preparing to unpack .../2-python-webencodings_0.5-2_all.deb ...
Unpacking python-webencodings (0.5-2) ...
Selecting previously unselected package python-html5lib.
Preparing to unpack .../3-python-html5lib_0.999999999-1_all.deb ...
Unpacking python-html5lib (0.999999999-1) ...
Selecting previously unselected package python-lxml.
Preparing to unpack .../4-python-lxml_4.0.0-1_amd64.deb ...
Unpacking python-lxml (4.0.0-1) ...
Selecting previously unselected package ndiff.
Preparing to unpack .../5-ndiff_7.60-1ubuntu1_all.deb ...
Unpacking ndiff (7.60-1ubuntu1) ...
Selecting previously unselected package nmap.
Preparing to unpack .../6-nmap_7.60-1ubuntu1_amd64.deb ...
Unpacking nmap (7.60-1ubuntu1) ...
Processing triggers for libc-bin (2.26-0ubuntu2) ...
Setting up python-bs4 (4.6.0-1) ...
Setting up python-lxml (4.0.0-1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up liblinear3:amd64 (2.1.0+dfsg-2) ...
Setting up python-webencodings (0.5-2) ...
Setting up nmap (7.60-1ubuntu1) ...
Setting up ndiff (7.60-1ubuntu1) ...
Setting up python-html5lib (0.999999999-1) ...
Processing triggers for libc-bin (2.26-0ubuntu2) ...

Примеры использования

Сканирование IP адреса:

nmap 192.168.1.2

Пример ответа:

Starting Nmap 7.60 ( https://nmap.org ) at 2017-11-08 13:53 IST
Nmap scan report for gateway (192.168.1.1)
Host is up (0.23s latency).
Not shown: 994 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
23/tcp   open  telnet
53/tcp   open  domain
80/tcp   open  http
5431/tcp open  park-agent
MAC Address: 10:62:EB:6A:DB:FD (D-Link International)
 
Nmap done: 1 IP address (1 host up) scanned in 4.65 seconds

Сканирование диапазона IP адресов:

nmap 192.168.1.2-10

Для сканирования всей подсети:

nmap 192.168.1.0/24

Больше примеров:

## Пинг сканирование ##
nmap -sP 192.168.1.2
 
## Трассировка ##
nmap --traceroute IP-ADDRESS
nmap --traceroute DOMAIN-NAME-HERE
 
## TCP SYN сканирование ##
nmap -sS 192.168.1.2
 
## UDP сканирование ##
nmap -sU 192.168.1.2
 
## Сканирование IP протокола ##
nmap -sO 192.168.1.2
 
## Сканирование портов ##
nmap -p 80 192.168.1.2
nmap -p http 192.168.1.2
nmap -p 25 192.168.1.2
nmap -p smtp 192.168.1.2
nmap -p 443 192.168.1.2
nmap -p 80,24,443 192.168.1.2
 
## Сканирование диапазона портов ##
nmap -p 512-1024 192.168.1.2
 
## Определение операционной системы ##
nmap -O 192.168.1.2
nmap -O --osscan-guess 192.168.1.2
 
## Сканирование открытых портов для определения службы/версии ##
nmap -sV 192.168.1.2

Версия nmаp:

nmap -V