信息收集之Nmap

Nmap

官网:https://nmap.org/

安装

Mac os: brew install nmap

Centos: yum install nmap

Ubuntu: apt-get install nmap

手册:https://nmap.org/man/zh/index.html

扫描方式

TCP : -sT

SYN : -sS

ACK : -sA

UDP : -sU

RPC : -sR

ICMP: -sP

Disable Port Scan: -sn

常见扫描方案

扫描10000端口、操作系统、版本

nmap -T4 -A <Target>

版本探测

nmap -sV <Target>

操作系统

nmap -O <Target>

其他技巧

--host-timeout 主机超时时间 通常选值:18000

--scan-delay 报文时间间隔 通常选值:1000

-S <源地址> 定义扫描源地址,为了不被发现

输出

-oN <File>

-oX <XML File>

-oG <filespec>

Grep输出 

参考:http://www.unspecific.com/nmap-oG-output/

masscan

项目地址:https://github.com/robertdavidgraham/masscan

 安装

$ sudo apt-get install git gcc make libpcap-dev
$ git clone https://github.com/robertdavidgraham/masscan
$ cd masscan
$ make

该工具兼容Nmap的参数

高级选项

--adapter-ip 指定发包的IP地址

--adapter-port 指定发包的源端口

--adapter-mac 指定发包的源MAC地址

--router-mac 指定网关的MAC地址

--exclude IP地址范围黑名单,防止masscan扫描

--excludefile 指定IP地址范围黑名单文件

--includefile,-iL 读取一个范围列表进行扫描

--wait 指定发送完包之后的等待时间,默认为10秒

nbtscan

在Kali Linux中已经安装:

$ whereis nbtscan
nbtscan: /usr/bin/nbtscan /usr/share/man/man1/nbtscan.1.gz
$ nbtscan
# ...
Usage:
nbtscan [-v] [-d] [-e] [-l] [-t timeout] [-b bandwidth] [-r] [-q] [-s separator] [-m retransmits] (-f filename)|(<scan_range>)
# ...

nbtscan 示例

$ nbtscan -r 192.168.1.0/24
扫描整个C段

$ nbtscan 192.168.1.25-137
扫描一个范围

$ nbtscan -v -s : 192.168.1.0/24
以 : 分割显示结果

$ nbtscan -f <File>
从文件读取扫描范围

高级用法

$ nbtscan -v -s ' ' 192.168.117.130

192.168.117.130 WIN-PKACSD7SHQL 20U

192.168.117.130 WIN-PKACSD7SHQL 00U

192.168.117.130 WORKGROUP       00G

192.168.117.130 WORKGROUP       1eG

192.168.117.130 WORKGROUP       1dU

192.168.117.130 __MSBROWSE__ 01G

192.168.117.130 MAC 00:0c:29:06:75:2f

$ nbtscan -v -s ' ' 192.168.117.130 | awk '{print $1}' | uniq

192.168.117.130

hping3

hping3 主要是测试防火墙的拦截规则,对网络设备进行测试

常用模式

-0 --rawip IP原始报文

-1 --icmp ICMP模式

-2 --udp UDP模式

-8 --scan 扫描模式

-9 --listen 监听模式

$ hping --scan 1-30,70-90 -S www.target.host

SYN方式扫描主机端口

  可以看到,目标主机回复了:S..A,代表SYN/ACK

$ hping3 -S -a 114.114.114.114 -p 53 114.114.114.114 -c 5

测试防火墙对ICMP包的反应、是否支持traceroute、是否开放某个端口、对防火墙进行拒绝服务攻击(DoS attack)。例如,以LandAttack方式测试目标防火墙(Land Attack是将发送源地址设置为与目标地址相同,诱使目标机与自己不停地建立连接)。

 DRDDOS 

$ hping3 --udp -a 114.114.114.114 -p 53 114.114.114.114 -c 5

基于UDP的DOS

 
作者:拾瑾
个性签名:愿历经千帆,归来仍少年.
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
原文地址:https://www.cnblogs.com/ayoung/p/15109562.html