{"id":83877,"date":"2024-03-29T10:56:16","date_gmt":"2024-03-29T02:56:16","guid":{"rendered":"https:\/\/docs.pingcode.com\/?p=83877"},"modified":"2024-03-29T10:56:16","modified_gmt":"2024-03-29T02:56:16","slug":"linux%e4%b8%8b%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8nmap%e8%bf%9b%e8%a1%8c%e7%bd%91%e7%bb%9c%e6%89%ab%e6%8f%8f","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/83877.html","title":{"rendered":"Linux\u4e0b\u5982\u4f55\u4f7f\u7528Nmap\u8fdb\u884c\u7f51\u7edc\u626b\u63cf"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/03\/uploading_images2024-03-19_16-47-14_2986.png?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"Linux\u4e0b\u5982\u4f55\u4f7f\u7528Nmap\u8fdb\u884c\u7f51\u7edc\u626b\u63cf\" \/><\/p>\n<p>\u5728Linux\u4e0b\u4f7f\u7528Nmap\u8fdb\u884c\u7f51\u7edc\u626b\u63cf\uff0c\u53ef\u4ee5\u8fdb\u884c\u4e3b\u673a\u53d1\u73b0\u3001\u7aef\u53e3\u626b\u63cf\u3001\u670d\u52a1\u7248\u672c\u68c0\u6d4b<strong>\u4ee5\u53ca\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u63a2\u6d4b<\/strong>\u3002\u7b80\u5355\u6765\u8bf4\uff0cNmap\u5229\u7528\u539f\u59cbIP\u6570\u636e\u5305\u4fa6\u6d4b\u8fdc\u7a0b\u4e3b\u673a\u63d0\u4f9b\u7684\u7f51\u7edc\u670d\u52a1\uff0c\u4ee5\u53ca\u8fd9\u4e9b\u670d\u52a1\u6240\u8fd0\u884c\u7684\u64cd\u4f5c\u7cfb\u7edf\u4fe1\u606f\u3001\u7c7b\u578b\u4ee5\u53ca\u7248\u672c\u53f7\u7b49\u3002<\/p>\n<p>\u4ee5\u7aef\u53e3\u626b\u63cf\u4e3a\u4f8b\uff0c\u9996\u5148\u5b89\u88c5Nmap\u8f6f\u4ef6\u5305\uff0c\u7136\u540e\u4f7f\u7528\u57fa\u672c\u7684\u547d\u4ee4\u5982`nmap [\u9009\u9879] [\u76ee\u6807]`\u6765\u6267\u884c\u626b\u63cf\u3002\u5728\u8fdb\u884c\u7aef\u53e3\u626b\u63cf\u65f6\uff0cNmap \u80fd\u591f\u901a\u8fc7\u68c0\u6d4b\u7279\u5b9a\u7aef\u53e3\u7684\u54cd\u5e94\u6765\u786e\u5b9a\u8be5\u7aef\u53e3\u662f\u5f00\u653e\u3001\u5173\u95ed\u8fd8\u662f\u88ab\u8fc7\u6ee4\u3002Nmap \u6709\u591a\u79cd\u626b\u63cf\u6280\u672f\uff0c\u5982TCP SYN\u626b\u63cf\u3001TCP\u8fde\u63a5\u626b\u63cf\u3001UDP\u626b\u63cf\u7b49\u3002\u5176\u4e2d\uff0c<strong>TCP SYN\u626b\u63cf<\/strong>\u662f\u9ed8\u8ba4\u4e14\u8f83\u4e3a\u9690\u853d\u7684\u626b\u63cf\u65b9\u5f0f\uff0c\u5b83\u901a\u8fc7\u53d1\u9001\u4e00\u4e2aTCP SYN\u6570\u636e\u5305\u5230\u76ee\u6807\u7aef\u53e3\u6765\u68c0\u6d4b\u7aef\u53e3\u72b6\u6001\u3002<\/p>\n<h2><strong>\u4e00\u3001NMAP\u4ecb\u7ecd<\/strong><\/h2>\n<p>\u5728Linux\u73af\u5883\u4e0b\uff0cNmap\u662f\u7f51\u7edc\u7ba1\u7406\u5458\u5fc5\u5907\u7684\u5de5\u5177\u4e4b\u4e00\u3002Nmap\u662f\u201cNetwork Mapper\u201d\u7684\u7f29\u5199\uff0c\u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u7f51\u7edc\u626b\u63cf\u548c\u4e3b\u673a\u68c0\u6d4b\u5de5\u5177\u3002<\/p>\n<p><strong>Nmap\u7684\u7279\u70b9<\/strong>\u5305\u62ec\u7075\u6d3b\u6027\u3001\u5f3a\u5927\u7684\u626b\u63cf\u529f\u80fd\u4ee5\u53ca\u5e7f\u6cdb\u7684\u64cd\u4f5c\u7cfb\u7edf\u652f\u6301\u3002\u8fd9\u6b3e\u5de5\u5177\u53ef\u7528\u4e8e\u8fdb\u884c\u7f51\u7edc\u53d1\u73b0\u3001\u7ba1\u7406\u670d\u52a1\u5347\u7ea7\u8ba1\u5212\u3001\u76d1\u63a7\u4e3b\u673a\u6216\u670d\u52a1\u8fd0\u884c\u65f6\u95f4\uff0c\u4ee5\u53ca\u5728\u5b89\u5168\u9886\u57df\u8fdb\u884c\u6f0f\u6d1e\u68c0\u6d4b\u3002<\/p>\n<h2><strong>\u4e8c\u3001\u5b89\u88c5\u548c\u57fa\u672c\u4f7f\u7528<\/strong><\/h2>\n<p>\u5728\u5f00\u59cb\u4f7f\u7528Nmap\u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u8be5\u5de5\u5177\u5df2\u7ecf\u6b63\u786e\u5b89\u88c5\u5728Linux\u7cfb\u7edf\u4e0a\u3002<\/p>\n<p><strong>\u5b89\u88c5\u547d\u4ee4<\/strong>\u901a\u5e38\u4e3a `sudo apt-get install nmap` \u6216 `sudo yum install nmap`\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u4f60\u4f7f\u7528\u7684Linux\u53d1\u884c\u7248\u3002<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u8f93\u5165 `nmap` \u547d\u4ee4\u67e5\u770b\u4f7f\u7528\u9009\u9879\u3002\u4e00\u4e2a\u7b80\u5355\u7684\u4f7f\u7528\u793a\u4f8b\u662f\u5bf9\u5355\u4e2a\u4e3b\u673aIP\u8fdb\u884c\u626b\u63cf\uff0c\u547d\u4ee4\u5f62\u5982 `nmap 192.168.1.1`\u3002\u6b64\u7c7b\u626b\u63cf\u901a\u5e38\u7528\u4e8e\u5bfb\u627e\u5f00\u653e\u7684\u7f51\u7edc\u7aef\u53e3\u4ee5\u53ca\u8fd0\u884c\u7684\u670d\u52a1\u3002<\/p>\n<h2><strong>\u4e09\u3001\u4e3b\u673a\u53d1\u73b0<\/strong><\/h2>\n<p>\u5728\u4e48\u7f51\u7edc\u626b\u63cf\u4e2d\uff0c<strong>\u4e3b\u673a\u53d1\u73b0<\/strong>\u662f\u4e00\u4e2a\u57fa\u672c\u7684\u6b65\u9aa4\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u786e\u5b9a\u7f51\u7edc\u4e2d\u54ea\u4e9b\u662f\u6d3b\u8dc3\u7684\u4e3b\u673a\u3002<\/p>\n<p><strong>PING\u626b\u63cf<\/strong>\uff0c\u5373\u4f7f\u7528 `-sn` \u9009\u9879\uff0c\u53ef\u4ee5\u8fc5\u901f\u68c0\u67e5\u76ee\u6807\u5730\u5740\u8303\u56f4\u5185\u54ea\u4e9b\u4e3b\u673a\u662f\u6d3b\u7684\u3002\u4f8b\u5982 `nmap -sn 192.168.1.0\/24` \u7528\u4e8e\u68c0\u67e5\u6574\u4e2a\u5b50\u7f51\u3002<\/p>\n<h2><strong>\u56db\u3001\u7aef\u53e3\u626b\u63cf<\/strong><\/h2>\n<p>\u7aef\u53e3\u626b\u63cf\u662fNmap\u6700\u5f3a\u5927\u7684\u529f\u80fd\u4e4b\u4e00\uff0c\u7528\u4e8e\u63a2\u6d4b\u76ee\u6807\u4e3b\u673a\u7684\u7f51\u7edc\u7aef\u53e3\u72b6\u6001\u3002<\/p>\n<p><strong>TCP SYN\u626b\u63cf\uff08-sS\uff09<\/strong>\u662f\u6700\u5e38\u7528\u7684\u626b\u63cf\u7c7b\u578b\uff0c\u9002\u7528\u4e8e\u4e0d\u4e0e\u76ee\u6807\u673a\u5668\u5efa\u7acb\u5b8c\u5168\u7684TCP\u8fde\u63a5\u3002\u4f8b\u5982 `nmap -sS 192.168.1.1`\u3002<\/p>\n<p>\u8fd8\u6709\u5176\u4ed6\u7aef\u53e3\u626b\u63cf\u65b9\u5f0f\uff0c\u5982<strong>TCP Connect\u626b\u63cf\uff08-sT\uff09<\/strong>\u3001<strong>UDP\u626b\u63cf\uff08-sU\uff09<\/strong>\u4ee5\u53ca<strong>SCTP INIT\u626b\u63cf\uff08-sY\uff09<\/strong>\u7b49\uff0c\u8fd9\u4e9b\u90fd\u6709\u5404\u81ea\u53d1\u73b0\u7aef\u53e3\u5f00\u653e\u60c5\u51b5\u7684\u7279\u70b9\u3002<\/p>\n<h2><strong>\u4e94\u3001\u670d\u52a1\u548c\u7248\u672c\u68c0\u6d4b<\/strong><\/h2>\n<p>\u51c6\u786e\u8bc6\u522b\u7f51\u7edc\u670d\u52a1\u7684\u7248\u672c\u662f\u7406\u89e3\u7cfb\u7edf\u5b89\u5168\u6027\u7684\u91cd\u8981\u7ec4\u6210\u90e8\u5206\u3002<\/p>\n<p>\u901a\u8fc7\u4f7f\u7528 <strong>\u670d\u52a1\u7248\u672c\u63a2\u6d4b\uff08-sV\uff09<\/strong>\u9009\u9879\uff0cNmap\u53ef\u4ee5\u786e\u5b9a\u7aef\u53e3\u4e0a\u8fd0\u884c\u7684\u5e94\u7528\u7a0b\u5e8f\u53ca\u5176\u7248\u672c\u4fe1\u606f\u3002\u547d\u4ee4\u4f8b\u5982 `nmap -sV 192.168.1.1`\u3002<\/p>\n<h2><strong>\u516d\u3001\u64cd\u4f5c\u7cfb\u7edf\u63a2\u6d4b<\/strong><\/h2>\n<p>\u77e5\u9053\u7f51\u7edc\u4e2d\u7684\u4e3b\u673a\u8fd0\u884c\u54ea\u4e9b\u64cd\u4f5c\u7cfb\u7edf\u662f\u4e86\u89e3\u6574\u4f53\u7f51\u7edc\u73af\u5883\u7684\u8981\u7d20\u3002<\/p>\n<p>\u4f7f\u7528<strong>\u64cd\u4f5c\u7cfb\u7edf\u63a2\u6d4b\uff08-O\uff09<\/strong>\u9009\u9879\uff0cNmap\u80fd\u591f\u901a\u8fc7\u5206\u6790IP\u6570\u636e\u5305\u7684\u54cd\u5e94\u884c\u4e3a\u6765\u731c\u6d4b\u8fdc\u7a0b\u4e3b\u673a\u53ef\u80fd\u8fd0\u884c\u7684\u64cd\u4f5c\u7cfb\u7edf\u3002\u4f8b\u5982\uff0c`nmap -O 192.168.1.1`\u3002<\/p>\n<h2><strong>\u4e03\u3001\u4f7f\u7528NMAP\u811a\u672c\u5f15\u64ce\uff08NSE\uff09\u8fdb\u884c\u9ad8\u7ea7\u626b\u63cf<\/strong><\/h2>\n<p>Nmap\u811a\u672c\u5f15\u64ce\uff08NSE\uff09\u662fNmap\u6700\u5f3a\u5927\u7684\u7279\u6027\u4e4b\u4e00\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u7f16\u5199\u6216\u5e94\u7528\u811a\u672c\u6765\u6269\u5c55Nmap\u7684\u529f\u80fd\u3002<\/p>\n<p>\u901a\u8fc7\u4f7f\u7528 <strong>&#8211;script<\/strong> \u9009\u9879\uff0c\u53ef\u4ee5\u6267\u884c\u7279\u5b9a\u7684\u811a\u672c\u6216\u811a\u672c\u7c7b\u522b\u3002\u4f8b\u5982 `nmap &#8211;script=vulnerability 192.168.1.1` \u7528\u4e8e\u68c0\u6d4b\u5df2\u77e5\u7684\u6f0f\u6d1e\u3002<\/p>\n<h2><strong>\u516b\u3001\u603b\u7ed3<\/strong><\/h2>\n<p>Nmap\u662f\u4e00\u4e2a\u6781\u5176\u5f3a\u5927\u4e14\u7075\u6d3b\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u4e0d\u540c\u7684\u7f51\u7edc\u626b\u63cf\u4efb\u52a1\u3002\u6b63\u786e\u5730\u4f7f\u7528Nmap\u4e0d\u53ea\u7cfb\u4e8e\u5176\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u66f4\u53d6\u51b3\u4e8e\u7528\u6237\u5bf9\u7f51\u7edc\u4ee5\u53caNmap\u5de5\u4f5c\u65b9\u5f0f\u7684\u6df1\u5165\u7406\u89e3\u3002\u5b89\u5168\u4e13\u4e1a\u4eba\u5458\u3001\u7cfb\u7edf\u7ba1\u7406\u5458\u548c\u7f51\u7edc\u7ba1\u7406\u5458\u90fd\u53ef\u5229\u7528Nmap\u8fdb\u884c\u6709\u6548\u7684\u7f51\u7edc\u76d1\u5bdf\u548c\u7ef4\u62a4\u3002<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e0a\u5b89\u88c5Nmap\uff1f<\/strong><\/p>\n<p>\u4f60\u53ef\u4ee5\u901a\u8fc7\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c`sudo apt install nmap`\u547d\u4ee4\u6765\u5b89\u88c5Nmap\u5de5\u5177\u3002\u8fd9\u6837\u5c31\u53ef\u4ee5\u5728Linux\u7cfb\u7edf\u4e0a\u4f7f\u7528Nmap\u8fdb\u884c\u7f51\u7edc\u626b\u63cf\u4e86\u3002<\/p>\n<p><strong>Nmap\u5de5\u5177\u6709\u54ea\u4e9b\u5e38\u7528\u7684\u7f51\u7edc\u626b\u63cf\u9009\u9879\uff1f<\/strong><\/p>\n<p>Nmap\u5de5\u5177\u6709\u8bb8\u591a\u9009\u9879\u53ef\u4f9b\u4f7f\u7528\uff0c\u6bd4\u5982`-sP`\u7528\u4e8e\u8fdb\u884cPing\u626b\u63cf\u3001`-sS`\u7528\u4e8e\u8fdb\u884cTCP SYN\u626b\u63cf\u3001`-sU`\u7528\u4e8e\u8fdb\u884cUDP\u626b\u63cf\u7b49\u3002\u6839\u636e\u5b9e\u9645\u9700\u6c42\uff0c\u9009\u62e9\u5408\u9002\u7684\u9009\u9879\u53ef\u4ee5\u63d0\u9ad8\u626b\u63cf\u6548\u7387\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Nmap\u626b\u63cf\u7ed3\u679c\u4e2d\u8bc6\u522b\u76ee\u6807\u7cfb\u7edf\u5f00\u653e\u7684\u7aef\u53e3\uff1f<\/strong><\/p>\n<p>\u5728Nmap\u626b\u63cf\u7ed3\u675f\u540e\uff0c\u4f60\u53ef\u4ee5\u67e5\u770b\u626b\u63cf\u7ed3\u679c\u4e2d\u7684\u7aef\u53e3\u4fe1\u606f\u3002\u5f00\u653e\u7684\u7aef\u53e3\u5c06\u5728\u626b\u63cf\u62a5\u544a\u4e2d\u663e\u793a\u4e3a\u201copen\u201d\uff0c\u540c\u65f6\u8fd8\u4f1a\u5217\u51fa\u7aef\u53e3\u53f7\u4ee5\u53ca\u5bf9\u5e94\u7684\u670d\u52a1\u3002\u901a\u8fc7\u5206\u6790\u8fd9\u4e9b\u4fe1\u606f\uff0c\u4f60\u53ef\u4ee5\u4e86\u89e3\u76ee\u6807\u7cfb\u7edf\u4e0a\u54ea\u4e9b\u7aef\u53e3\u662f\u5f00\u653e\u7684\uff0c\u6709\u52a9\u4e8e\u8bc4\u4f30\u7cfb\u7edf\u7684\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Linux\u4e0b\u4f7f\u7528Nmap\u8fdb\u884c\u7f51\u7edc\u626b\u63cf\uff0c\u53ef\u4ee5\u8fdb\u884c\u4e3b\u673a\u53d1\u73b0\u3001\u7aef\u53e3\u626b\u63cf\u3001\u670d\u52a1\u7248\u672c\u68c0\u6d4b\u4ee5\u53ca\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u63a2\u6d4b\u3002\u7b80\u5355\u6765\u8bf4 [&hellip;]","protected":false},"author":1,"featured_media":83878,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[384],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/83877"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=83877"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/83877\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/83878"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=83877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=83877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=83877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}