{"id":37240222,"url":"https://github.com/nmmapper/python3-nmap","last_synced_at":"2026-01-22T11:01:36.282Z","repository":{"id":38474816,"uuid":"223364468","full_name":"nmmapper/python3-nmap","owner":"nmmapper","description":"A python 3  library which helps in using nmap port scanner. This is done by converting each nmap command into a callable python3 method or function. System administrators can now automatic nmap scans using python","archived":false,"fork":false,"pushed_at":"2025-09-10T10:05:23.000Z","size":128,"stargazers_count":298,"open_issues_count":5,"forks_count":83,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-09-29T08:08:34.579Z","etag":null,"topics":["detection","discovery","network-scanner","nmap","nmap-command","nmap-port-scanner","nmap-scanning","nmmapper","os-identifier","osint","portscanner","python3-nmap","python3-script","service-discovery","subdomain-finder"],"latest_commit_sha":null,"homepage":"https://www.nmmapper.com/sys/networkmapper/nmap/online-port-scanning/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nmmapper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-11-22T09:02:56.000Z","updated_at":"2025-09-13T04:24:17.000Z","dependencies_parsed_at":"2023-09-28T09:42:46.585Z","dependency_job_id":"66b0f66a-54e9-4b02-92a9-0b64ac723472","html_url":"https://github.com/nmmapper/python3-nmap","commit_stats":{"total_commits":102,"total_committers":25,"mean_commits":4.08,"dds":0.5196078431372548,"last_synced_commit":"9eb4bfa15cd1666a28697059d1fc55f798f0953c"},"previous_names":["wangoloj/python3-nmap"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/nmmapper/python3-nmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmmapper%2Fpython3-nmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmmapper%2Fpython3-nmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmmapper%2Fpython3-nmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmmapper%2Fpython3-nmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nmmapper","download_url":"https://codeload.github.com/nmmapper/python3-nmap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmmapper%2Fpython3-nmap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28661882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["detection","discovery","network-scanner","nmap","nmap-command","nmap-port-scanner","nmap-scanning","nmmapper","os-identifier","osint","portscanner","python3-nmap","python3-script","service-discovery","subdomain-finder"],"created_at":"2026-01-15T07:00:29.136Z","updated_at":"2026-01-22T11:01:36.276Z","avatar_url":"https://github.com/nmmapper.png","language":"Python","readme":"\n\n# python3-nmap\n\nA python 3  library which helps in using nmap port scanner. The way this tools works is by defining each nmap command into a python function making it very easy to use sophisticated nmap commands in other python scripts. Nmap is a complicated piece of software used for reconnaissance on target networks, over the years new features have been added making it more sophisticated.\n\nWith this python3-nmap we make using nmap in python very easy and painless\n\nFor example in nmap if you want to scan for common ports you would to something like this\n```sh\n$ nmap your-host.com --top-ports 10\n```\nBut in this python3-nmap  script you would do something like this\n```py\nimport nmap3\nnmap = nmap3.Nmap()\nresults = nmap.scan_top_ports(\"your-host.com\")\n# And you would get your results in json\n```\nYou will notice each nmap command is defined as a python function/method. this make it easy to remember this in python and easily use them.\n\nAgain in nmap if you want to use the famous dns-brute script you would do something like this\n```sh\n$ nmap your-host.com  --script dns-brute.nse\n```\nBut in this python3 script again it's very easy you just do something like this\n```py\nimport nmap3\nnmap = nmap3.Nmap()\nresults = nmap.nmap_dns_brute_script(\"your-host.com\")\n\n# And you would get your results in json\n[\n    {\n        \"address\": \"mail.your-host.com\",\n        \"hostname\": \"68.65.122.10\"\n    },\n    {\n        \"address\": \"www.your-host.com\",\n        \"hostname\": \"5.189.129.43\"\n    }\n]\n```\n\n#### How to use python3-nmap\nUsing this scripts is very easy, though it assumes you have nmap already installed, as it is the primary dependence required. Also this tools supports both windows and linux, it's cross platform so to say.\n\n**Installation**\n```sh\n$ git clone https://github.com/wangoloj/python3-nmap.git\n\n$ pip3 install -r requirements.txt\n\n# Install nmap online\n\n$ apt-get install nmap\n\n# That's all is needed to get started\n```\nIn nmap some commands require root privileges for example the command to identify OS requires root privileges;\n```sh\n$ nmap -O your-host.com\n\nTCP/IP fingerprinting (for OS scan) requires root privileges.\nQUITTING!\n# Until you sudo\n\n$ sudo nmap -O your-host.com\n\n```\nThe same applies to the script to be able to run the os identifier  you have to be a super user.\n\n### How to use the script to identify OS\n```py\nimport nmap3\nnmap = nmap3.Nmap()\nos_results = nmap.nmap_os_detection(\"192.168.178.2\") # MOST BE ROOT\n```\n```json\n[\n    {\n        \"accuracy\": \"100\",\n        \"cpe\": \"cpe:/o:linux:linux_kernel:2.6\",\n        \"line\": \"45249\",\n        \"name\": \"Linux 2.6.14 - 2.6.34\",\n        \"osclass\": {\n            \"accuracy\": \"100\",\n            \"osfamily\": \"Linux\",\n            \"osgen\": \"2.6.X\",\n            \"type\": \"general purpose\",\n            \"vendor\": \"Linux\"\n        }\n    },\n    {\n        \"accuracy\": \"100\",\n        \"cpe\": \"cpe:/o:linux:linux_kernel:2.6.17\",\n        \"line\": \"45775\",\n        \"name\": \"Linux 2.6.17\",\n        \"osclass\": {\n            \"accuracy\": \"100\",\n            \"osfamily\": \"Linux\",\n            \"osgen\": \"2.6.X\",\n            \"type\": \"general purpose\",\n            \"vendor\": \"Linux\"\n        }\n    },\n    {\n        \"accuracy\": \"100\",\n        \"cpe\": \"cpe:/o:linux:linux_kernel:2.6.17\",\n        \"line\": \"45811\",\n        \"name\": \"Linux 2.6.17 (Mandriva)\",\n        \"osclass\": {\n            \"accuracy\": \"100\",\n            \"osfamily\": \"Linux\",\n            \"osgen\": \"2.6.X\",\n            \"type\": \"general purpose\",\n            \"vendor\": \"Linux\"\n        }\n    },\n    {\n        \"accuracy\": \"100\",\n        \"cpe\": \"cpe:/o:linux:linux_kernel:3.13\",\n        \"line\": \"60884\",\n        \"name\": \"Linux 3.13\",\n        \"osclass\": {\n            \"accuracy\": \"100\",\n            \"osfamily\": \"Linux\",\n            \"osgen\": \"3.X\",\n            \"type\": \"general purpose\",\n            \"vendor\": \"Linux\"\n        }\n    }\n]\n```\n\n### Class components of python3-nmap\nThe script is made of up the following classes, each holding different nmap abilities and scan types.\n\n - Nmap\n - NmapHostDiscovery\n - NmapScanTechniques\n\n### Identifying service version\nIn nmap if you want to identify versions you would run this kind of command\n```sh\n$ nmap 192.168.178.1  -sV\n```\nIn this python script you would do something like this\n```py\nimport nmap3\nnmap = nmap3.Nmap()\nversion_result = nmap.nmap_version_detection(\"your-host.com\")\n```\n```json\n[\n    {\n        \"cpe\": [\n            {\n                \"cpe\": \"cpe:/o:linux:linux_kernel\"\n            }\n        ],\n        \"port\": \"80\",\n        \"protocol\": \"tcp\",\n        \"service\": {\n            \"conf\": \"10\",\n            \"extrainfo\": \"Ubuntu\",\n            \"method\": \"probed\",\n            \"name\": \"http\",\n            \"ostype\": \"Linux\",\n            \"product\": \"nginx\",\n            \"version\": \"1.14.0\"\n        }\n    },\n    {\n        \"cpe\": [\n            {\n                \"cpe\": \"cpe:/o:linux:linux_kernel\"\n            }\n        ],\n        \"port\": \"443\",\n        \"protocol\": \"tcp\",\n        \"service\": {\n            \"conf\": \"10\",\n            \"extrainfo\": \"Ubuntu\",\n            \"method\": \"probed\",\n            \"name\": \"http\",\n            \"ostype\": \"Linux\",\n            \"product\": \"nginx\",\n            \"tunnel\": \"ssl\",\n            \"version\": \"1.14.0\"\n        }\n    },\n    {\n        \"cpe\": [\n            {\n                \"cpe\": \"cpe:/o:linux:linux_kernel\"\n            }\n        ],\n        \"port\": \"2000\",\n        \"protocol\": \"tcp\",\n        \"service\": {\n            \"conf\": \"10\",\n            \"extrainfo\": \"Ubuntu Linux; protocol 2.0\",\n            \"method\": \"probed\",\n            \"name\": \"ssh\",\n            \"ostype\": \"Linux\",\n            \"product\": \"OpenSSH\",\n            \"version\": \"7.6p1 Ubuntu 4ubuntu0.3\"\n        }\n    }\n]\n```\n### Nmap commands available\nThe following nmaps commands have been added to the following scripts\n\n - get Nmap version details\n   ```python\n   import nmap3\n   nmap = nmap3.Nmap()\n   results = nmap.nmap_version()\n   ```\n - Nmap top port scan\n   ```python\n   import nmap3\n   nmap = nmap3.Nmap()\n   results = nmap.scan_top_ports(\"your-host\")\n   ```\n - Nmap Dns-brute-script( to get subdomains )\n ```python\n    import nmap3\n    nmap = nmap3.Nmap()\n    results = nmap.nmap_dns_brute_script(\"domain\")\n  ```\n - Nmap list scan\n ```python\n    import nmap3\n    nmap = nmap3.Nmap()\n    results = nmap.nmap_list_scan(\"your-host\")\n ```\n - Nmap Os detection\n ```python\n   import nmap3\n   nmap = nmap3.Nmap()\n   results = nmap.nmap_os_detection(\"your-host\");\n ```\n - Nmap subnet scan\n ```python\n    import nmap3\n    nmap = nmap3.Nmap()\n    results = nmap.nmap_subnet_scan(\"your-host\") #Must be root\n ```\n - Nmap version detection\n```python\n   import nmap3\n   nmap = nmap3.Nmap()\n   results = nmap.nmap_version_detection(\"your-host\") # Must be root\n```\n\n###  Nmap Scanning Techniques\nThe script offers nmap scan techniques also as python function/methods\n - nmap_fin_scan\n   ```python\n   import nmap3\n   nmap = nmap3.NmapScanTechniques()\n   result = nmap.nmap_fin_scan(\"192.168.178.1\")\n   ```\n   \n - nmap_idle_scan\n ```python\n    import nmap3\n    nmap = nmap3.NmapScanTechniques()\n    result = nmap.nmap_idle_scan(\"192.168.178.1\")\n ```\n - nmap_ping_scan\n ```python\n    import nmap3\n    nmap = nmap3.NmapScanTechniques()\n    result = nmap.nmap_ping_scan(\"192.168.178.1\")\n ```\n - nmap_syn_scan\n ```python\n    import nmap3\n    nmap = nmap3.NmapScanTechniques()\n    result = nmap.nmap_syn_scan(\"192.168.178.1\")\n ```\n - nmap_tcp_scan\n ```python\n    import nmap3\n    nmap = nmap3.NmapScanTechniques()\n    result = nmap.nmap_tcp_scan(\"192.168.178.1\")\n ```\n \n- nmap_udp_scan\n ```python\n    import nmap3\n    nmap = nmap3.NmapScanTechniques()\n    result = nmap.nmap_udp_scan(\"192.168.178.1\")\n ```\n### Supporting the nmap host discovery\nThe script also offers support for map Added Nmap Host discovery techniques still as python function/methods\n\n - Only port scan    (-Pn)\n - Only host discover    (-sn)\n - Arp discovery on a local network  (-PR)\n - Disable DNS resolution    (-n)\n\nNmapHostDiscovery\n\n -  `def nmap_portscan_only(self, host, args=None)`\n ```python\n    import nmap3\n    nmap = nmap3.NmapHostDiscovery()\n    results = nmap.nmap_portscan_only(\"your-host\")\n ```\n -  `def nmap_no_portscan(self, host, args=None):`\n ```python\n    import nmap3\n    nmap = nmap3.NmapHostDiscovery()\n    results = nmap.nmap_no_portscan(\"your-host\")\n ```\n -  `def nmap_arp_discovery(self, host, args=None):`\n  ```python\n    import nmap3\n    nmap = nmap3.NmapHostDiscovery()\n    results = nmap.nmap_arp_discovery(\"your-host\")\n ```\n -  `def nmap_disable_dns(self, host, args=None):`\n  ```python\n    import nmap3\n    nmap = nmap3.NmapHostDiscovery()\n    results = nmap.nmap_disable_dns(\"your-host\")\n ```\n\nNmap is a large tool, as you can see python3-nmap provides only things what you could say commonly used nmap features.\n\n### Using custom nmap command line arguments.\nAs we said, the script defines each set of nmap command as python function/methods. You can also pass arguments to those methods/function thus extending your capabilities for example.\nLet's say we want to scan top ports but also perform version detection .\n\n```python\n   import nmap3\n   nmap = nmap3.Nmap()\n   results = nmap.scan_top_ports(\"host\", args=\"-sV\")\n```\n\n### Using the nmap vulners script to identify vulnerabilities (CVE's)\nYou scan the the target IP using version detection ('-sV') to get the service and, the script performs a lookup in the CVE database. The nmap vulners script is part of the default Nmap installation, so you shouldn't need to install any other packages.  \n\n```python\n   import nmap3\n   nmap = nmap3.Nmap()\n   results = nmap.nmap_version_detection(\"host\", args=\"--script vulners --script-args mincvss+5.0\")\n```\n\n## Cross-Selling\n* [Ethical-tools](https://ethicaltools.gitbook.io/subdomainfinder/)\n* [Wappalyzer online](https://www.nmmapper.com/st/cms-detection/wappalyzer-online/)\n* [Whatweb online](https://www.nmmapper.com/tools/cms-detection/whatweb-online/WhatWeb/)\n* [Raccoon By Offensive security](https://www.nmmapper.com/tools/reconnaissance-tools/raccoon-vulnerability-scanning/Raccoon%20tool/)\n* [Detect WAF](https://www.nmmapper.com/tools/reconnaissance-tools/waf/web-application-firewall-detector/)\n* [Dnsdumpster](https://dnsdumpster.readthedocs.io/)\n* [Become a patreon](https://www.patreon.com/nmmapper)\n* [Online port scanner](https://www.nmmapper.com/st/networkmapper/nmap/online-port-scanning/)\n\n\n## Stargazers over time\n[![Stargazers over time](https://starchart.cc/nmmapper/python3-nmap.svg?variant=adaptive)](https://starchart.cc/nmmapper/python3-nmap)\n","funding_links":["https://www.patreon.com/nmmapper"],"categories":["ابزارهای امنیتی"],"sub_categories":["کار با زمان و تقویم"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmmapper%2Fpython3-nmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnmmapper%2Fpython3-nmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmmapper%2Fpython3-nmap/lists"}