-

贤钟的博客

一个人的奋斗
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

nmap 扫描软件

Posted on 2010-06-08 21:09  贤钟  阅读(621)  评论(0编辑  收藏  举报

 

nmap 是一款扫描软件, Windows 和 Linux 平台都有版本。

 

Linux 平台下安装比较简单,使用  yum install nmap ,我的服务器因为安装了MySQL 好像和yum 有冲突 ,必须加--disableplugin=fastestmirror  参数,以前BLOG里说过。

Windows 平台 Nmap 5.21  华军下载   http://www.onlinedown.net/soft/69679.htm 


 

 

[root@243 ~]# yum --disableplugin=fastestmirror install nmap
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nmap.i386 2:4.11-1.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package         Arch            Version                  Repository       Size
================================================================================
Installing:
 nmap            i386            2:4.11-1.1               base            672 k

Transaction Summary
================================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 672 k
Is this ok [y/N]: y
Downloading Packages:
nmap-4.11-1.1.i386.rpm                                   | 672 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : nmap                                                     1/1

Installed:
  nmap.i386 2:4.11-1.1

Complete!
[root@243 ~]# nmap
Nmap 4.11 ( http://www.insecure.org/nmap/ )
Usage: nmap [Scan Type(s)] [Options] {target specification}
TARGET SPECIFICATION:
  Can pass hostnames, IP addresses, networks, etc.
  Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254
  -iL <inputfilename>: Input from list of hosts/networks
  -iR <num hosts>: Choose random targets
  --exclude <host1[,host2][,host3],...>: Exclude hosts/networks
  --excludefile <exclude_file>: Exclude list from file
HOST DISCOVERY:
  -sL: List Scan - simply list targets to scan
  -sP: Ping Scan - go no further than determining if host is online
  -P0: Treat all hosts as online -- skip host discovery
  -PS/PA/PU [portlist]: TCP SYN/ACK or UDP discovery to given ports
  -PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes
  -n/-R: Never do DNS resolution/Always resolve [default: sometimes]
  --dns-servers <serv1[,serv2],...>: Specify custom DNS servers
  --system-dns: Use OS's DNS resolver
SCAN TECHNIQUES:
  -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans
  -sN/sF/sX: TCP Null, FIN, and Xmas scans
  --scanflags <flags>: Customize TCP scan flags
  -sI <zombie host[:probeport]>: Idlescan
  -sO: IP protocol scan
  -b <ftp relay host>: FTP bounce scan
PORT SPECIFICATION AND SCAN ORDER:
  -p <port ranges>: Only scan specified ports
    Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080
  -F: Fast - Scan only the ports listed in the nmap-services file)
  -r: Scan ports consecutively - don't randomize
SERVICE/VERSION DETECTION:
  -sV: Probe open ports to determine service/version info
  --version-intensity <level>: Set from 0 (light) to 9 (try all probes)
  --version-light: Limit to most likely probes (intensity 2)
  --version-all: Try every single probe (intensity 9)
  --version-trace: Show detailed version scan activity (for debugging)
OS DETECTION:
  -O: Enable OS detection
  --osscan-limit: Limit OS detection to promising targets
  --osscan-guess: Guess OS more aggressively
TIMING AND PERFORMANCE:
  Options which take <time> are in milliseconds, unless you append 's'
  (seconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m).
  -T[0-5]: Set timing template (higher is faster)
  --min-hostgroup/max-hostgroup <size>: Parallel host scan group sizes
  --min-parallelism/max-parallelism <time>: Probe parallelization
  --min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout <time>: Specifies
      probe round trip time.
  --max-retries <tries>: Caps number of port scan probe retransmissions.
  --host-timeout <time>: Give up on target after this long
  --scan-delay/--max-scan-delay <time>: Adjust delay between probes
FIREWALL/IDS EVASION AND SPOOFING:
  -f; --mtu <val>: fragment packets (optionally w/given MTU)
  -D <decoy1,decoy2[,ME],...>: Cloak a scan with decoys
  -S <IP_Address>: Spoof source address
  -e <iface>: Use specified interface
  -g/--source-port <portnum>: Use given port number
  --data-length <num>: Append random data to sent packets
  --ttl <val>: Set IP time-to-live field
  --spoof-mac <mac address/prefix/vendor name>: Spoof your MAC address
  --badsum: Send packets with a bogus TCP/UDP checksum
OUTPUT:
  -oN/-oX/-oS/-oG <file>: Output scan in normal, XML, s|<rIpt kIddi3,
     and Grepable format, respectively, to the given filename.
  -oA <basename>: Output in the three major formats at once
  -v: Increase verbosity level (use twice for more effect)
  -d[level]: Set or increase debugging level (Up to 9 is meaningful)
  --packet-trace: Show all packets sent and received
  --iflist: Print host interfaces and routes (for debugging)
  --log-errors: Log errors/warnings to the normal-format output file
  --append-output: Append to rather than clobber specified output files
  --resume <filename>: Resume an aborted scan
  --stylesheet <path/URL>: XSL stylesheet to transform XML output to HTML
  --webxml: Reference stylesheet from Insecure.Org for more portable XML
  --no-stylesheet: Prevent associating of XSL stylesheet w/XML output
MISC:
  -6: Enable IPv6 scanning
  -A: Enables OS detection and Version detection
  --datadir <dirname>: Specify custom Nmap data file location
  --send-eth/--send-ip: Send using raw ethernet frames or IP packets
  --privileged: Assume that the user is fully privileged
  -V: Print version number
  -h: Print this help summary page.
EXAMPLES:
  nmap -v -A scanme.nmap.org
  nmap -v -sP 192.168.0.0/16 10.0.0.0/8
  nmap -v -iR 10000 -P0 -p 80
SEE THE MAN PAGE FOR MANY MORE OPTIONS, DESCRIPTIONS, AND EXAMPLES

[root@243 ~]# nmap -v http://www.pipc.net/

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2010-06-08 20:44 HKT
Note: Host seems down. If it is really up, but blocking our ping probes, try -P0
Nmap finished: 1 IP address (0 hosts up) scanned in 2.383 seconds
               Raw packets sent: 4 (136B) | Rcvd: 0 (0B)
[root@243 ~]# Nmap

 

 

nmap命令使用详细解释

-P0 -PT -PS -PU -PE -PP -PM -PB 当nmap进行某种类型的端口或协议扫描时,通常都会尝试先ping 主机,这种尝试可使nmap不会浪费时间在那些未开机的主机上,但是许多主机与防火墙会阻塞ICMP报文,我们希望能通过控制使用。

-P0  告诉nmap不ping 主机,只进行扫描

-PT  告诉nmap使用TCP的ping

-PS  发送SYN报文。

-PU  发送一个udp ping

-PE  强制执行直接的ICMP ping 

-PB  这是默认类型,可以使用ICMP ping 也可以使用TCP ping .

-6   该标志允许IPv6支持

-v  -d  使用-v选项可得到更详细的输出,而-d选项则增加调试输出。

-oN  按照人们阅读的格式记录屏幕上的输出,如果是在扫描多台机器,则该选项很有用。

-oX  以xml格式向指定的文件记录信息

-oG  以一种易于检索的格式记录信息,即每台主机都以单独的行来记录所有的端口和0s信息。

-oA  使用为基本文件名,以普通格式(-oN)、XML格式(-oX)和易于检索的格式(-oG)jilu  xinxi  

-oM  把输出格式化为机器可阅读的文件

-oS  把输出进行傻瓜型排版

--resume如果你取消了扫描,但生成了供人或者供机器阅读的文件,那么可以把该文件提供给nmap继续让它扫描。

-iR-iL可以不在命令行中指定目标主机,而是使用-iR选项随即产生待扫描的主机,或者使用-iL选项从一个包含主机名或IP地址列表的文件中读取目标主机,这些主机名或IP地址使用空格、制表符或换行隔开。

-F nmap只扫描在nmap内建的服务文件中已知的端口,如果不指定该选项,nmap将扫描端口1-1024及包含在nmap-services文件中的所有其他端口。如果用-sO选项扫描协议,nmap将用它内建的协议文件(nmap-protocols文件)而不是默认地扫描所有256个协议。

-A nmap使用所有的高级扫描选项

-p 参数可以是一个单独的端口、一个用逗号隔开的端口列表、一个使用“-”表示的端口范围或者上述格式的任意组合。如果没有指定该选项,nmap将对包含前1024个端口的所有端口进行一次快速扫描。

-e在多穴主机中,可以指定你用来进行网络通信的网络接口。

-g可以选择一个源端口,从该端口执行所有的扫描。

--ttlnmap其发送的任何报文在到中间路由器的跳后会失效。

--packet-trace 可以显示扫描期间nmap发送和接收的各个报文的详细列表,这对调试非常有用。要与-o选项之一联合使用,需要根权限,以将所有的数据记录到文件。

--scanflags可以使用这个选项手工的指定欲在扫描报文中设置的TCP标志。也可以指定TCP标志的OOred值的整数形式,或者标志的字符串表示形式。

 

 

 

以下说明摘自百度百科   http://baike.baidu.com/view/77455.htm

 

是Linux,FreeBSD,UNIX,Windows下的网络扫描和嗅探工 具包,其基本功能有三个,一是探测一组主机是否在线;其次是扫描 主机端口,嗅探所提供的网络服务;还可以推断主机所用的操作系统 。Nmap可用于扫描仅有两个节点的LAN,直至500个节点以上的网络。Nmap 还允许用户定制扫描技巧。通常,一个简单的使用ICMP协议的ping操 作可以满足一般需求;也可以深入探测UDP或者TCP端口,直至主机所 使用的操作系统;还可以将所有探测结果记录到各种格式的日志中, 供进一步分析操作。

  官方下载及文档地址:http://insecure.org/nmap/

 

 

进行ping扫描,打印出对扫描做出响应的主机,不做进一步测试(如端口扫描或者操作系统探测):

  nmap -sP 192.168.1.0/24

  仅列出指定网络上的每台主机,不发送任何报文到目标主机:

  nmap -sL 192.168.1.0/24

  探测目标主机开放的端口,可以指定一个以逗号分隔的端口列表(如-PS22,23,25,80):

  nmap -PS 192.168.1.234

  不判断该主机是否存活,进行强制性扫描:

  nmap -PN 192.168.1.234

  使用UDP ping探测主机:

  nmap -PU 192.168.1.0/24

  使用频率最高的扫描选项:SYN扫描,又称为半开放扫描,它不打开一个完全的TCP连接,执行得很快:

  nmap -sS 192.168.1.0/24

  当SYN扫描不能用时,TCP Connect()扫描就是默认的TCP扫描:

  nmap -sT 192.168.1.0/24

  UDP扫描用-sU选项,UDP扫描发送空的(没有数据)UDP报头到每个目标端口:

  nmap -sU 192.168.1.0/24

  确定目标机支持哪些IP协议 (TCP,ICMP,IGMP等):

  nmap -sO 192.168.1.19

  探测目标主机的操作系统:

  nmap -O 192.168.1.19

  nmap -A 192.168.1.19

  另外,nmap官方文档中的例子:

  nmap -v scanme.nmap.org

  这个选项扫描主机scanme.nmap.org中 所有的保留TCP端口。选项-v启用细节模式。

  nmap -sS -O scanme.nmap.org/24

  进行秘密SYN扫描,对象为主机Saznme所在的“C类”网段 的255台主机。同时尝试确定每台工作主机的操作系统类型。因为进行SYN扫描 和操作系统检测,这个扫描需要有根权限。

  nmap -sV -p 22,53,110,143,4564 198.116.0-255.1-127

  进行主机列举和TCP扫描,对象为B类188.116网段中255个8位子网。这 个测试用于确定系统是否运行了sshd、DNS、imapd或4564端口。如果这些端口 打开,将使用版本检测来确定哪种应用在运行。

  nmap -v -iR 100000 -P0 -p 80

  随机选择100000台主机扫描是否运行Web服务器(80端口)。由起始阶段 发送探测报文来确定主机是否工作非常浪费时间,而且只需探测主机的一个端口,因 此使用-P0禁止对主机列表。

  nmap -P0 -p80 -oX logs/pb-port80scan.xml -oG logs/pb-port80scan.gnmap 216.163.128.20/20

  扫描4096个IP地址,查找Web服务器(不ping),将结果以Grep和XML格式保存。

  host -l company.com | cut -d -f 4 | nmap -v -iL -

  进行DNS区域传输,以发现company.com中的主机,然后将IP地址提供给 Nmap。上述命令用于GNU/Linux -- 其它系统进行区域传输时有不同的命令。

  其他选项:

  -p &lt;port ranges&gt; (只扫描指定的端口)

  单个端口和用连字符表示的端口范 围(如 1-1023)都可以。当既扫描TCP端口又扫描UDP端口时,可以通过在端口号前加上T: 或者U:指定协议。 协议限定符一直有效直到指定另一个。 例如,参数 -p U:53,111,137,T:21-25,80,139,8080 将扫描UDP 端口53,111,和137,同时扫描列出的TCP端口。

  -F (快速 (有限的端口) 扫描)


--
---