nmap命令

简介: nmap命令

十条常用nmap命令行格式


1)获取远程主机的系统类型及开放端口

Get info about remote host ports and OS detection

nmap -sS -P0 -sV -O <target>

这里的 < target > 可以是单一 IP, 或主机名,或域名,或子网

-sS TCP SYN 扫描 (又称半开放,或隐身扫描)

-P0 允许你关闭 ICMP pings.

-sV 打开系统版本检测

-O 尝试识别远程操作系统

-sS TCP SYN scanning (also known as half-open, or stealth scanning)

-P0 option allows you to switch off ICMP pings.

-sV option enables version detection

-O flag attempt to identify the remote operating system

Other option:

-A 同时启用操作系统指纹识别和版本检测

-A option enables both OS fingerprinting and version detection

-v use -v twice for more verbosity.

nmap -sS -P0 -A -v < target >


2)列出开放了指定端口的主机列表

Get list of servers with a specific port open

nmap -sT -p 80 -oG – 192.168.1.* | grep open

Change the -p argument for the port number. See “man nmap” for

different ways to specify address ranges.


3)在网络寻找所有在线主机

4)

Find all active IP addresses in a network

nmap -sP 192.168.0.*

或者也可用以下命令:

nmap -sP 192.168.0.0/24

指定 subnet


4)Ping 指定范围内的 IP 地址

Ping a range of IP addresses

nmap -sP 192.168.1.100-254

nmap accepts a wide variety of addressing notation, multiple

targets/ranges, etc.


5)在某段子网上查找未占用的 IP

Find unused IPs on a given subnet

nmap -T4 -sP 192.168.2.0/24 && egrep "00:00:00:00:00:00" /proc/net/arp


6)在局域网上扫找 Conficker 蠕虫病毒

Scan for the Conficker virus on your LAN ect.

nmap -PN -T4 -p139,445 -n -v –script=smb-check-vulns –script-args

safe=1 192.168.0.1-254

replace 192.168.0.1-256 with the IP’s you want to check.


7)扫描网络上的恶意接入点 rogue APs.

Scan Network for Rogue APs.

nmap -A -p1-85,113,443,8080-8100 -T4 –min-hostgroup 50 –max-rtt-

timeout 2000 –initial-rtt-timeout 300 –max-retries 3 –host-timeout

20m –max-scan-delay 1000 -oA wapscan 10.0.0.0/8

I’ve used this scan to successfully find many rogue APs on a very,

very large network.


8)使用诱饵扫描方法来扫描主机端口

Use a decoy while scanning ports to avoid getting caught by the sys

admin

sudo nmap -sS 192.168.0.10 -D 192.168.0.2

Scan for open ports on the target device/computer (192.168.0.10) while

setting up a decoy address (192.168.0.2). This will show the decoy ip

address instead of your ip in targets security logs. Decoy address

needs to be alive. Check the targets security log at /var/log/secure

to make sure it worked.


9)为一个子网列出反向 DNS 记录

List of reverse DNS records for a subnet

nmap -R -sL 209.85.229.99/27 | awk '{if($3=="not")print"("$2") no

PTR";else print$3" is "$2}' | grep '('


10)显示网络上共有多少台 Linux 及 Win 设备?

How Many Linux And Windows Devices Are On Your Network?

sudo nmap -F -O 192.168.1.1-255 | grep "Running: " > /tmp/os; echo "$(cat /tmp/os | grep Linux | wc -l) Linux device(s)"; echo "$(cat /tmp/os | grep Windows | wc -l) Window(s) devices"

相关文章
|
10天前
|
人工智能 JSON 自然语言处理
让教学更智慧:用阿里云百炼工作流,自动生成中小学教材内容#小有可为#有温度的AI
通过可视化工作流编排,将大模型推理能力转化为标准化的教学内容生成引擎。教师只需输入教材标题和适用学段,即可自动获得结构完整、符合课程标准的章节内容,大幅降低备课门槛,助力教育资源均衡化。
486 126
|
19天前
|
Linux 程序员 数据格式
【2026最新】Notepad++下载、安装和使用一篇搞定(附中文版安装包)
Notepad++ 是一款免费开源、轻量高效的 Windows 文本编辑器,支持 C/Python/HTML 等 80+ 语言语法高亮、代码折叠、正则替换、编码转换及插件扩展,专为程序员与文本处理用户打造,完美替代系统记事本。(239字)
|
5天前
|
人工智能 缓存 安全
Claude Code 封号真实原因曝光,这次彻底不装了,直接针对国内开发者的账号下手?
Claude Code 封号潮背后:逆向扒出客户端隐写区域标记,Anthropic 政策收紧叠加 DeepSeek 7 月涨价,国产替代更紧迫。
|
6天前
|
人工智能 安全 Cloud Native
Higress 新发布:AI Gateway 能力增强,Gateway API 及其推理扩展持续打磨
增强 AI 网关能力,持续打磨 Gateway API 及其推理扩展。
349 124
|
5天前
|
人工智能 安全 程序员
终于,Claude Code 封号的原因被曝光了!竟然针对中国用户,植入隐形代码?!
通俗易懂地揭秘 Claude Code 封号的手段,分享一些自己对 AI 编程困境的思考,Codex、Cursor、DeepSeek、智谱 GLM、甚至是豆包,都有所行动了
352 1
|
14天前
|
机器学习/深度学习 人工智能 调度
🐴 HappyHorse 1.1 现已上线阿里云百炼!快来查收模型使用指南,现在调用享 6 折~
HappyHorse 1.1 是新一代视频生成大模型,全面升级动态表现力、角色一致性、指令遵循、视觉质感与音画协同能力。支持I2V/T2V/R2V三类生成,适配短剧、电商广告、品牌营销等场景,提供高质、流畅、可控的AI视频生产力。
846 5
🐴 HappyHorse 1.1 现已上线阿里云百炼!快来查收模型使用指南,现在调用享 6 折~
|
12天前
|
人工智能 定位技术 SEO
我学 GEO 第 15 天:终于知道AI GEO该如何做?
我是暴走的莉莉酱,边旅行边研究AI GEO的数字游民。专注普通人如何提升“AI可见度”——让AI在回答用户问题时准确识别、理解并推荐你。不讲玄学,只做可测、可调、可持续的GEO实践。
469 127