centos 6.5下安装nmap工具及简单用法
Nmap是一款针对大型网络的端口扫描工具,被广泛应用于黑客领域做漏洞探测以及安全扫描,其主要功能有主机发现(Host Discovery)、 端口扫描(Port Scanning)、 版本侦测(Version Detection) 、操作系统侦测(Operating System Detection),可以适用于winodws,linux,mac等操作系统。
1、yum安装nmap
yum install nmap
nmap 命令参数:nmap -h
[root@lamp01 scripts]# nmap -h
Nmap 5.51 ( http://nmap.org )
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
-sn: Ping Scan - disable port scan
-Pn: Treat all hosts as online -- skip host discovery
-PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports
-PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes
-PO[protocol list]: IP Protocol Ping
-PR: ARP ping - does not need HW address -> IP translation
-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
--traceroute: Trace hop path to each host
SCAN TECHNIQUES:
-sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans
-sU: UDP Scan
-sN/sF/sX: TCP Null, FIN, and Xmas scans
--scanflags <flags>: Customize TCP scan flags
-sI <zombie host[:probeport]>: Idle scan
-sY/sZ: SCTP INIT/COOKIE-ECHO scans
-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,S:9
-F: Fast mode - Scan fewer ports than the default scan
-r: Scan ports consecutively - don't randomize
--top-ports <number>: Scan <number> most common ports
--port-ratio <ratio>: Scan ports more common than <ratio>
SERVICE/VERSION DETECTION:
-sV: Probe open ports to determine service/version info
-sR: Check what service uses opened ports using RPC scan
--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)
SCRIPT SCAN:
-sC: equivalent to --script=default
--script=<Lua scripts>: <Lua scripts> is a comma separated list of
directories, script-files or script-categories
--script-args=<n1=v1,[n2=v2,...]>: provide arguments to scripts
--script-trace: Show all data sent and received
--script-updatedb: Update the script database.
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 seconds, or append 'ms' (milliseconds),
'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 <numprobes>: 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
--min-rate <number>: Send packets no slower than <number> per second
--max-rate <number>: Send packets no faster than <number> per second
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
--ip-options <options>: Send packets with specified ip options
--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/SCTP 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 -vv or more for greater effect)
-d: Increase debugging level (use -dd or more for greater effect)
--reason: Display the reason a port is in a particular state
--open: Only show open (or possibly open) ports
--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 Nmap.Org for more portable XML
--no-stylesheet: Prevent associating of XSL stylesheet w/XML output
MISC:
-6: Enable IPv6 scanning
-A: Enable OS detection, version detection, script scanning, and traceroute
--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
--unprivileged: Assume the user lacks raw socket privileges
-V: Print version number
-h: Print this help summary page.
EXAMPLES:
nmap -v -A scanme.nmap.org
nmap -v -sn 192.168.0.0/16 10.0.0.0/8
nmap -v -iR 10000 -Pn -p 80
SEE THE MAN PAGE (http://nmap.org/book/man.html) FOR MORE OPTIONS AND EXAMPLES
2、nmap 常用命令介绍:
扫描单个主机:
nmap 192.168.43.118
扫描单个子网主机:
nmap 192.168.43.0/24
扫描多个主机:
nmap 192.168.43.117 192.168.43.43.99
扫描一个范围内的主机:
nmap 192.168.43.1-254
若你有一个ip地址表,将ip地址存在ip.log文件中,命令如下:
nmap -iL ip.log
若你想查看扫描的所有主机列表命令如下:
nmap -sL 192.168.43.1/24
扫描一子网主机且排除某一个ip命令:
nmap 192.168.43.1/24 -exclude 192.168.43.118
扫描一子网主机且排除某一个ip地址表命令:
nmap 192.168.43.1/24 -exclude ip.log
扫描主机路由跟踪信息:
nmap --traceroute 192.168.43.118
扫描主机信息结果详细输出:
nmap -vv --traceroute 192.168.43.118
扫描某主机上指定的端口或协议,例如80,21,22
nmap -p U:53,T:80,21,22,S:9 192.168.43.118 (其中T代表TCP协议、U代表UDP协议、S代表SCTP协议)
快速扫描端口模式,扫描100个最有可能开放的端口 -v 获取扫描的信息
nmap -F -v 192.168.43.118
Tcp SYN Scan (sS) 隐蔽扫描
这是一个不完整的扫描方式,它被称为半开放扫描,Nmap发送SYN包到远程主机,但是它不会产生任何会话,在syn扫描中不需要通过完整3次的握手,因此不会在目标主机上产生任何日志记录,这个就是SYN扫描的优势,但是这种扫描是需要root权限(对于windows用户来说,是没有root权限这个概念的,root权限是linux的最高权限,对应windows的管理员权限)
nmap -sS 192.168.43.118
Tcp connect() scan(sT) 最常用
如果不选择SYN扫描,TCP connect()扫描就是默认的扫描模式,不同于Tcp SYN扫描,Tcp connect()扫描需要完成三次握手,并且要求调用系统的connect(),Tcp connect()扫描技术只适用于找出TCP和UDP端口,但是这种方式扫描的速度快,准确性高,对操作者没有权限上的要求,但是容易被防火墙和IDS(防入侵系统)发现。
nmap -sT 192.168.43.118
UDP scan(sU)
顾名思义,这种扫描技术用来寻找目标主机打开的UDP端口,它不需要发送任何的SYN包,因为这种技术是针对UDP端口的。UDP扫描发送UDP数据包到目标主机,并等待响应,如果返回ICMP不可达的错误消息,说明端口是关闭的,如果得到正确的适当的回应,说明端口是开放的。
nmap -sU 192.168.43.118
FIN scan (sF)
有时候Tcp SYN扫描不是最佳的扫描模式,因为有防火墙的存在,目标主机有时候可能有IDS和IPS系统的存在,防火墙会阻止掉SYN数据包。发送一个设置了FIN标志的数据包并不需要完成TCP的握手,收到RST回复说明该端口关闭,否则说明是open或filtered状态
nmap -sF 192.168.43.118
PING Scan (sP) 扫描在线主机
PING扫描它只用于找出主机是否是存在在网络中的,它不是用来发现是否开放端口的,PING扫描需要ROOT权限,如果用户没有ROOT权限,PING扫描将会使用connect()调用。
nmap -sP 192.168.43.118
版本检测(sV)
版本检测是用来扫描目标主机和端口上运行的软件的版本,它不同于其它的扫描技术,它不是用来扫描目标主机上开放的端口,不过它需要从开放的端口获取信息来判断软件的版本,使用版本检测扫描之前需要先用TCP SYN扫描开放了哪些端口。
nmap -sV 192.168.43.118
Idle scan (sL)
Idle scan是一种先进的匿名扫描技术,它不是用你真实的主机Ip发送数据包,而是使用另外一个目标网络的主机发送数据包,例如:通过目标网络中的192.168.43.118向主机192.168.43.4发送数据,来获取192.168.1.1开放的端口。
nmap -sL 192.168.43.118 192.168.43.4
有需要其它的扫描技术,如 FTP bounce(FTP反弹), fragmentation scan(碎片扫描),IP protocol scan(IP协议扫描),以上讨论的是几种最主要的扫描方式。
Nmap的OS检测(O)
Nmap最重要的特点之一是能够远程检测操作系统,Nmap的OS检测技术在渗透测试中用来了解远程主机的操作系统是非常有用的,通过获取的信息你可以知道已知的漏洞
nmap -O 192.168.43.17
ACK扫描:
利用ACK扫描判断端口是否被过滤。针对ACK探测包,为被过滤的端口(无论打开或关闭)会回复RST包
nmap -sA -T4 p1521,80 192.168.43.17
使用TCP ACK (PA)和TCP Syn (PS)扫描远程主机
nmap -pA -T4 p1521,80 192.168.43.17
nmap -pA -T4 p1521,80 192.168.43.17
扫描前不进行Ping扫描测试:
nmap -Pn p1521,80 192.168.43.17
通过tcp空扫描以绕过防火墙检测:
nmap -sN 192.168.43.17
打印主机接口和路由
nmap --iflist
按顺序扫描端口:
nmap -r 192.168.43.118
扫描主机检测是否有防火墙过滤:
nmap -PN -p 1521 192.168.43.17
扫描操作系统信息和路由跟踪
使用Nmap,你可以检测远程主机上运行的操作系统和版本。为了启用操作系统和版本检测,脚本扫描和路由跟踪功能,我们可以使用NMAP的“-A“选项。
nmap -A 192.168.43.17
扫描端口时状态介绍:
Open 端口开启,数据有到达主机,有程序在端口上监控
Closed 端口关闭,数据有到达主机,没有程序在端口上监控
Filtered 数据没有到达主机,返回的结果为空,数据被防火墙或者是IDS过滤
UnFiltered 数据有到达主机,但是不能识别端口的当前状态
Open|Filtered 端口没有返回值,主要发生在UDP、IP、FIN、NULL和Xmas扫描中
Closed|Filtered 只发生在IP ID idle扫描
以上总结来源于网络。
centos 6.5下安装nmap工具及简单用法的更多相关文章
- CentOS 6.4 下安装vsftpd
概述: vsftpd是Linux下比较著名的FTP服务器,搭建FTP服务器当然首选这个. 本文介绍了在CentOS 6.4下安装vsftpd.配置虚拟用户登录FTP的过程. 正文: 一:安装vsftp ...
- centos 6.5下安装mysql+nginx+redmine 3.1.0 笔记
centos 6.5下安装mysql+nginx+redmine 3.1.0 笔记 目录[-] 过程 1.安装RVM 2.利用rvm安装 Ruby 1.9.3 并设为默认 3.安装rails 4.安装 ...
- CentOS 6系统下安装 JDK1.6
CentOS 6系统下安装 JDK1.6 JDK(Java Development Kit)是Sun Microsystems针对Java开发员的产品.自从Java推出以来,JDK已经成为使用最广泛的 ...
- centos 6.5下安装、配置并启动SSH远程访问
centos 6.5下安装.配置并启动SSH远程访问 1.登录centos 6.5系统,使用root用户登录,如果为非root用户则执行su或su - 或su root或su - root切换为roo ...
- Centos 7.0 下安装 Zabbix server 3.0服务器的安装及 监控主机的加入(1)
一.本系列分为6部分 1.Centos 7.0 下安装 Zabbix server 3.0服务器的安装及 监控主机的加入 2.Centos 6.5 下安装 Zabbix server 3.0服务器的安 ...
- CentOS 6.3下 安装 Mono 3.2 和Jexus 5.4
最新更新参看: Centos 7.0 安装Mono 3.4 和 Jexus 5.6 2012年初写过一篇<32和64位的CentOS 6.0下 安装 Mono 2.10.8 和Jexus 5.0 ...
- Linux下安装项目管理工具Redmine
http://www.redmine.org.cn/download Linux下安装项目管理工具Redmine1.Ruby安装Ruby on Rails网站推荐使用1.8.7版. 点击(此处)折叠或 ...
- CentOS 5.5 下安装Countly Web Server过程记录
CentOS 5.5 下安装Countly Web Server过程记录 1. 系统更新与中文语言包安装 2. 基本环境配置: 2.1. NodeJS安装 依赖项安装 yum -y install g ...
- CentOS 6.5 下安装 Redis 2.8.7(转)
转自:http://www.cnblogs.com/haoxinyue/p/3620648.html CentOS 6.5 下安装 Redis 2.8.7 wget http://download.r ...
随机推荐
- Hive ROW_NUMBER,RANK(),DENSE_RANK()
准备数据 浙江,杭州,300 浙江,宁波,150 浙江,温州,200 浙江,嘉兴,100 江苏,南京,270 江苏,苏州,299 江苏,某市,200 江苏,某某市,100 创建表 CREATE t ...
- 等宽高的ImageButton
@SuppressLint("AppCompatCustomView") public class SquareImageButton extends ImageButton { ...
- Oracle的数据并发与一致性详解(上)
今天想了解下oracle中事务与锁的原理,但百度了半天,发现网上介绍的内容要么太短,要么版本太旧,而且抄袭现象严重,所以干脆查官方帮助文档(oracle 11.2),并将其精华整理成中文,供大家一起学 ...
- 目标检测模型的性能评估--MAP(Mean Average Precision)
目标检测模型中性能评估的几个重要参数有精确度,精确度和召回率.本文中我们将讨论一个常用的度量指标:均值平均精度,即MAP. 在二元分类中,精确度和召回率是一个简单直观的统计量,但是在目标检测中有所不同 ...
- 通过证书请求Https站点
前几天在做与平安银行对接接口,主要是给平安银行推送用户数据(申请贷款的用户),平安银行提供的是https的地址,请求https地址的时候还要发送证书,刚接到这个任务的时候一头雾水,百度上各种所搜,最后 ...
- Spring Boot初识(3)- Spring Boot整合Swagger
一.本文介绍 如果Web项目是完全前后端分离的话(我认为现在完全前后端分离已经是趋势了)一般前端和后端交互都是通过接口的,对接口入参和出参描述的文档就是Mock文档.随着接口数量的增多和参数的个数增加 ...
- C语言第十讲,枚举类型简单说明
C语言第十讲,枚举类型简单说明 一丶C语言中的枚举类型(ENUM) 在我们实际工作中,或者编写代码中.我们有的时候会用固定的值.而且不是很多. 这个时候就可以使用枚举了.如果我们使用#define显然 ...
- jquery easyui datagrid mvc server端分页排序筛选的实现
1自定义一个ModelBinder public class filterRule { public string field { get; set; } public string op { get ...
- lightswitch 添加 TreeView 控件
代码片段 <UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk&q ...
- SpringMVC教程1
一.SpringMVC介绍 1.MVC介绍 ==模型-视图-控制器(MVC== 是一个众所周知的以设计界面应用程序为基础的设计模式.它主要通过分离模型.视图及控制器在应用程序中的角色将业务逻辑从界面中 ...