{"id":1111547,"date":"2025-01-08T17:30:16","date_gmt":"2025-01-08T09:30:16","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1111547.html"},"modified":"2025-01-08T17:30:20","modified_gmt":"2025-01-08T09:30:20","slug":"win7%e4%b8%8b%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85python_nmap","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1111547.html","title":{"rendered":"win7\u4e0b\u5982\u4f55\u5b89\u88c5python_nmap"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25073950\/46eafa9c-3795-43b4-ae15-f81212bb0ac9.webp\" alt=\"win7\u4e0b\u5982\u4f55\u5b89\u88c5python_nmap\" \/><\/p>\n<p><p> <strong>win7\u4e0b\u5982\u4f55\u5b89\u88c5python_nmap<\/strong><\/p>\n<\/p>\n<p><p>\u5728Windows 7\u4e0b\u5b89\u88c5python_nmap\uff0c\u4e3b\u8981\u6b65\u9aa4\u5305\u62ec\uff1a\u5b89\u88c5Python\u3001\u5b89\u88c5Nmap\u3001\u5b89\u88c5python-nmap\u5e93\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u7b49\u3002<strong>\u786e\u4fdd\u5b89\u88c5Python\u3001\u786e\u4fdd\u5b89\u88c5Nmap\u3001\u4f7f\u7528pip\u5b89\u88c5python-nmap\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/strong>\u3002\u5176\u4e2d\uff0c\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u662f\u5173\u952e\u90e8\u5206\uff0c\u5b83\u786e\u4fdd\u7cfb\u7edf\u80fd\u591f\u6b63\u786e\u8bc6\u522b\u548c\u4f7f\u7528Nmap\u3002<\/p>\n<\/p>\n<p><p><strong>\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/strong>\uff1a\u5728Windows 7\u4e2d\uff0c\u786e\u4fddNmap\u53ef\u6267\u884c\u6587\u4ef6\u7684\u8def\u5f84\u88ab\u6b63\u786e\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u8fd9\u6837\u7cfb\u7edf\u53ef\u4ee5\u5728\u4efb\u4f55\u8def\u5f84\u4e0b\u8bc6\u522b\u5e76\u8fd0\u884cNmap\u3002\u5177\u4f53\u6b65\u9aa4\u5305\u62ec\uff1a\u53f3\u952e\u70b9\u51fb\u201c\u8ba1\u7b97\u673a\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\uff0c\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\uff0c\u7136\u540e\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u3002\u5728\u7cfb\u7edf\u53d8\u91cf\u4e2d\u627e\u5230\u201cPath\u201d\uff0c\u53cc\u51fb\u8fdb\u884c\u7f16\u8f91\uff0c\u5c06Nmap\u5b89\u88c5\u76ee\u5f55\u7684\u8def\u5f84\u6dfb\u52a0\u5230\u53d8\u91cf\u503c\u4e2d\uff0c\u786e\u4fdd\u5404\u8def\u5f84\u4e4b\u95f4\u7528\u5206\u53f7\u9694\u5f00\u3002\u5b8c\u6210\u540e\uff0c\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u66f4\u6539\u3002<\/p>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u6bcf\u4e2a\u6b65\u9aa4\uff0c\u786e\u4fdd\u4f60\u5728Windows 7\u4e0b\u80fd\u591f\u987a\u5229\u5b89\u88c5\u5e76\u4f7f\u7528python_nmap\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u786e\u4fdd\u5b89\u88c5Python<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4e0b\u8f7dPython\u5b89\u88c5\u5305<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u4ecePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%E4%B8%8B%E8%BD%BD%E9%80%82%E7%94%A8%E4%BA%8EWindows\">https:\/\/www.python.org\/\uff09\u4e0b\u8f7d\u9002\u7528\u4e8eWindows<\/a> 7\u7684\u5b89\u88c5\u5305\u3002\u5efa\u8bae\u4e0b\u8f7dPython 3.x\u7248\u672c\uff0c\u56e0\u4e3a\u5b83\u662f\u6700\u65b0\u7684\u5e76\u4e14\u6709\u66f4\u591a\u7684\u652f\u6301\u548c\u66f4\u65b0\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u53cc\u51fb\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\uff0c\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u786e\u4fdd\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u6837\u53ef\u4ee5\u81ea\u52a8\u5c06Python\u7684\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08Win + R\uff0c\u8f93\u5165cmd\u5e76\u56de\u8f66\uff09\uff0c\u8f93\u5165<code>python --version<\/code>\uff0c\u5982\u679c\u663e\u793a\u51faPython\u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660ePython\u5b89\u88c5\u6210\u529f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u786e\u4fdd\u5b89\u88c5Nmap<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4e0b\u8f7dNmap\u5b89\u88c5\u5305<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u4eceNmap\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/nmap.org\/download.html%EF%BC%89%E4%B8%8B%E8%BD%BD%E9%80%82%E7%94%A8%E4%BA%8EWindows%E7%9A%84Nmap%E5%AE%89%E8%A3%85%E5%8C%85%E3%80%82\">https:\/\/nmap.org\/download.html\uff09\u4e0b\u8f7d\u9002\u7528\u4e8eWindows\u7684Nmap\u5b89\u88c5\u5305\u3002<\/a><\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Nmap<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u53cc\u51fb\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\uff0c\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u3002\u5efa\u8bae\u5c06Nmap\u5b89\u88c5\u5728\u9ed8\u8ba4\u76ee\u5f55\uff08\u901a\u5e38\u662fC:\\Program Files (x86)\\Nmap\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u8f93\u5165<code>nmap --version<\/code>\uff0c\u5982\u679c\u663e\u793a\u51faNmap\u7684\u7248\u672c\u53f7\uff0c\u8bf4\u660eNmap\u5b89\u88c5\u6210\u529f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u4f7f\u7528pip\u5b89\u88c5python-nmap<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u4f7f\u7528\u7ba1\u7406\u5458\u6743\u9650\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08\u5728\u5f00\u59cb\u83dc\u5355\u4e2d\u641c\u7d22cmd\uff0c\u53f3\u952e\u70b9\u51fb\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5python-nmap<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5python-nmap\u5e93\uff1a\n<pre><code>pip install python-nmap<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165<code>pip show python-nmap<\/code>\uff0c\u5982\u679c\u663e\u793a\u51fapython-nmap\u7684\u76f8\u5173\u4fe1\u606f\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00\u7cfb\u7edf\u5c5e\u6027<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u8ba1\u7b97\u673a\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u7f16\u8f91\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002\u5728\u7cfb\u7edf\u53d8\u91cf\u5217\u8868\u4e2d\u627e\u5230\u201cPath\u201d\uff0c\u53cc\u51fb\u8fdb\u884c\u7f16\u8f91\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6dfb\u52a0Nmap\u8def\u5f84<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5c06Nmap\u5b89\u88c5\u76ee\u5f55\u7684\u8def\u5f84\u6dfb\u52a0\u5230\u53d8\u91cf\u503c\u4e2d\u3002\u5047\u8bbeNmap\u5b89\u88c5\u5728C:\\Program Files (x86)\\Nmap\uff0c\u5c06\u8be5\u8def\u5f84\u6dfb\u52a0\u5230Path\u53d8\u91cf\u4e2d\uff0c\u786e\u4fdd\u5404\u8def\u5f84\u4e4b\u95f4\u7528\u5206\u53f7\u9694\u5f00\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4fdd\u5b58\u66f4\u6539<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u66f4\u6539\uff0c\u7136\u540e\u5173\u95ed\u6240\u6709\u7a97\u53e3\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001\u9a8c\u8bc1\u5b89\u88c5\u548c\u914d\u7f6e<\/h3>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6d4b\u8bd5Nmap<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u8f93\u5165<code>nmap<\/code>\uff0c\u5982\u679c\u663e\u793a\u51faNmap\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u8bf4\u660eNmap\u8def\u5f84\u914d\u7f6e\u6b63\u786e\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6d4b\u8bd5python-nmap<\/strong><\/p>\n<\/p>\n<ul>\n<li>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165<code>python<\/code>\u8fdb\u5165Python\u4ea4\u4e92\u73af\u5883\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6d4b\u8bd5python-nmap\u5e93\uff1a\n<pre><code class=\"language-python\">import nmap<\/p>\n<p>nm = nmap.PortScanner()<\/p>\n<p>nm.scan(&#39;127.0.0.1&#39;, &#39;22-443&#39;)<\/p>\n<p>print(nm.all_hosts())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5982\u679c\u6ca1\u6709\u62a5\u9519\u5e76\u4e14\u8fd4\u56de\u7ed3\u679c\uff0c\u8bf4\u660epython-nmap\u5b89\u88c5\u548c\u914d\u7f6e\u6210\u529f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u5728Windows 7\u4e0b\u6210\u529f\u5b89\u88c5\u5e76\u4f7f\u7528python_nmap\u3002\u786e\u4fdd\u6bcf\u4e00\u6b65\u90fd\u6309\u7167\u6307\u793a\u8fdb\u884c\uff0c\u7279\u522b\u662f\u5728\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u65f6\uff0c\u8def\u5f84\u4e00\u5b9a\u8981\u6b63\u786e\uff0c\u5426\u5219\u4f1a\u5bfc\u81f4\u7cfb\u7edf\u65e0\u6cd5\u8bc6\u522bNmap\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528python-nmap\u8fdb\u884c\u7f51\u7edc\u626b\u63cf\u7b49\u64cd\u4f5c\uff0c\u5145\u5206\u5229\u7528\u5176\u5f3a\u5927\u7684\u529f\u80fd\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Windows 7\u4e0a\u5b89\u88c5Python\u548cnmap\uff1f<\/strong><br \/>\u5728Windows 7\u4e0a\u5b89\u88c5Python\u548cnmap\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a\u9996\u5148\uff0c\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u9002\u5408Windows 7\u7684Python\u7248\u672c\uff0c\u5b89\u88c5\u65f6\u786e\u4fdd\u9009\u4e2d\u201cAdd Python to PATH\u201d\u9009\u9879\u3002\u63a5\u4e0b\u6765\uff0c\u8bbf\u95eenmap\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7dnmap\u7684Windows\u5b89\u88c5\u5305\uff0c\u5e76\u6309\u7167\u63d0\u793a\u5b8c\u6210\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9a8c\u8bc1Python\u548cnmap\u662f\u5426\u6b63\u5e38\u5de5\u4f5c\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u8f93\u5165<code>python --version<\/code>\u548c<code>nmap --version<\/code>\u68c0\u67e5\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/p>\n<p><strong>\u5b89\u88c5Python_nmap\u9700\u8981\u54ea\u4e9b\u4f9d\u8d56\u9879\uff1f<\/strong><br \/>\u5728\u5b89\u88c5Python_nmap\u4e4b\u524d\uff0c\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u5df2\u5b89\u88c5Python\uff0c\u901a\u5e38\u63a8\u8350\u4f7f\u7528Python 3.x\u7248\u672c\u3002\u6b64\u5916\uff0cPython_nmap\u4f9d\u8d56\u4e8enmap\u5de5\u5177\uff0c\u56e0\u6b64\u5728\u5b89\u88c5Python_nmap\u4e4b\u524d\u9700\u8981\u5148\u5b89\u88c5nmap\u3002\u4f60\u8fd8\u9700\u8981pip\u5de5\u5177\u6765\u5b89\u88c5Python_nmap\uff0c\u901a\u5e38pip\u4f1a\u968fPython\u4e00\u8d77\u5b89\u88c5\uff0c\u4f46\u4f60\u4e5f\u53ef\u4ee5\u5355\u72ec\u5b89\u88c5\u3002<\/p>\n<p><strong>\u5982\u4f55\u9a8c\u8bc1Python_nmap\u662f\u5426\u5b89\u88c5\u6210\u529f\uff1f<\/strong><br \/>\u5b8c\u6210Python_nmap\u7684\u5b89\u88c5\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684Python\u811a\u672c\u6765\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e0b\u6253\u5f00Python\u89e3\u91ca\u5668\uff0c\u8f93\u5165<code>import nmap<\/code>\uff0c\u5982\u679c\u6ca1\u6709\u9519\u8bef\u63d0\u793a\uff0c\u8868\u793a\u5b89\u88c5\u6210\u529f\u3002\u4f60\u8fd8\u53ef\u4ee5\u5c1d\u8bd5\u8fd0\u884c\u4e00\u4e9b\u57fa\u672c\u7684nmap\u547d\u4ee4\u6765\u786e\u8ba4\u529f\u80fd\u662f\u5426\u6b63\u5e38\uff0c\u4f8b\u5982\u4f7f\u7528<code>nm = nmap.PortScanner()<\/code>\u6765\u521b\u5efa\u4e00\u4e2anmap\u7684\u5b9e\u4f8b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"win7\u4e0b\u5982\u4f55\u5b89\u88c5python_nmap \u5728Windows 7\u4e0b\u5b89\u88c5python_nmap\uff0c\u4e3b\u8981\u6b65\u9aa4\u5305\u62ec\uff1a\u5b89\u88c5 [&hellip;]","protected":false},"author":3,"featured_media":1111552,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1111547"}],"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\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1111547"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1111547\/revisions"}],"predecessor-version":[{"id":1111555,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1111547\/revisions\/1111555"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1111552"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1111547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1111547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1111547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}