{"id":17311758,"url":"https://github.com/zan8in/masscan","last_synced_at":"2025-10-12T18:44:36.810Z","repository":{"id":38366219,"uuid":"343976847","full_name":"zan8in/masscan","owner":"zan8in","description":"Masscan is a golang library to run masscan scans, parse scan results. ","archived":false,"fork":false,"pushed_at":"2023-12-24T09:33:39.000Z","size":1016,"stargazers_count":106,"open_issues_count":4,"forks_count":26,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-14T13:59:01.604Z","etag":null,"topics":["go","golang","json","masscan","port","scanner"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zan8in.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}},"created_at":"2021-03-03T02:28:37.000Z","updated_at":"2025-04-07T09:16:38.000Z","dependencies_parsed_at":"2023-12-24T10:26:26.275Z","dependency_job_id":"d60460b1-6ec2-4ff7-85f6-b37443bd53db","html_url":"https://github.com/zan8in/masscan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zan8in/masscan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zan8in%2Fmasscan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zan8in%2Fmasscan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zan8in%2Fmasscan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zan8in%2Fmasscan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zan8in","download_url":"https://codeload.github.com/zan8in/masscan/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zan8in%2Fmasscan/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279012519,"owners_count":26085134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"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":["go","golang","json","masscan","port","scanner"],"created_at":"2024-10-15T12:41:24.989Z","updated_at":"2025-10-12T18:44:36.781Z","avatar_url":"https://github.com/zan8in.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# masscan\n![Just I love it](https://github.com/zan8in/masscan/blob/main/assets/golang.png)\nMasscan is a golang library to run masscan scans, parse scan results. \n\n# What is masscan\nMasscan is an Internet-scale port scanner. It can scan the entire Internet in under 5 minutes, transmitting 10 million packets per second, from a single machine.\n\nIts usage (parameters, output) is similar to nmap, the most famous port scanner. When in doubt, try one of those features -- features that support widespread scanning of many machines are supported, while in-depth scanning of single machines aren't.\n\nInternally, it uses asynchronous transmission, similar to port scanners like scanrand, unicornscan, and ZMap. It's more flexible, allowing arbitrary port and address ranges.\n# Installation\n```\ngo get github.com/zan8in/masscan\n```\nto install the package\n```\nimport \"github.com/zan8in/masscan\"\n```\n# Dependencies\n- `go` (\u003e `1.10`)\n- masscan (\u003e `1.3.0`)\n  - [download windows masscan](https://github.com/zan8in/masscan/blob/main/bin/masscan-win/masscan.exe)\n  - [download linux masscan](https://github.com/zan8in/masscan/blob/main/bin/masscan-linux/masscan)\n\n\n# Table of content\n- masscan run timeout setting\n- Get process ID (PID)\n- Select network interface automatically\n# TODO\n- Support more parameters\n# Simple example\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/zan8in/masscan\"\n)\n\n// Example\nfunc main() {\n\tscanner, err := masscan.NewScanner(\n\t\tmasscan.SetParamTargets(\"146.56.202.100/24\"),\n\t\tmasscan.SetParamPorts(\"80\"),\n        masscan.EnableDebug(),\n\t\tmasscan.SetParamWait(0),\n\t\tmasscan.SetParamRate(10000),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"unable to create masscan scanner: %v\", err)\n\t}\n\n\tscanResult, _, err := scanner.Run()\n\tif err != nil {\n\t\tlog.Fatalf(\"masscan encountered an error: %v\", err)\n\t}\n\n\tif scanResult != nil {\n\t\tfor i, v := range scanResult.Hosts {\n\t\t\tfmt.Printf(\"Host: %s Port: %v\\n\", v.IP, scanResult.Ports[i].Port)\n\t\t}\n\t\tfmt.Println(\"hosts len : \", len(scanResult.Hosts))\n\t}\n\n}\n```\nThe program above outputs:\n```\n/usr/bin/masscan 146.56.202.100/24 -p 80 --wait=0 --rate=10000 -oJ -\nHost: 146.56.202.15 Port: 80\nHost: 146.56.202.251 Port: 80\nHost: 146.56.202.112 Port: 80\n...\n...\nHost: 146.56.202.17 Port: 80\nHost: 146.56.202.209 Port: 80\nHost: 146.56.202.190 Port: 80\nHost: 146.56.202.222 Port: 80\nHost: 146.56.202.207 Port: 80\nhosts len :  37\n```\n# Async scan example\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/zan8in/masscan\"\n)\n\nfunc main() {\n\tcontext, cancel := context.WithTimeout(context.Background(), 1*time.Minute)\n\tdefer cancel()\n\n\tvar (\n\t\tscannerResult []masscan.ScannerResult\n\t\terrorBytes    []byte\n\t)\n\n\tscanner, err := masscan.NewScanner(\n\t\tmasscan.SetParamTargets(\"60.10.116.10\"),\n\t\tmasscan.SetParamPorts(\"80\"),\n\t\tmasscan.EnableDebug(),\n\t\tmasscan.SetParamWait(0),\n\t\tmasscan.SetParamRate(50),\n\t\tmasscan.WithContext(context),\n\t)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"unable to create masscan scanner: %v\", err)\n\t}\n\n\tif err := scanner.RunAsync(); err != nil {\n\t\tpanic(err)\n\t}\n\n\tstdout := scanner.GetStdout()\n\n\tstderr := scanner.GetStderr()\n\n\tgo func() {\n\t\tfor stdout.Scan() {\n\t\t\tsrs := masscan.ParseResult(stdout.Bytes())\n\t\t\tfmt.Println(srs.IP, srs.Port)\n\t\t\tscannerResult = append(scannerResult, srs)\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tfor stderr.Scan() {\n\t\t\tfmt.Println(\"err: \", stderr.Text())\n\t\t\terrorBytes = append(errorBytes, stderr.Bytes()...)\n\t\t}\n\t}()\n\n\tif err := scanner.Wait(); err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"masscan result count : \", len(scannerResult), \" PID : \", scanner.GetPid())\n\n}\n```\nThe program above outputs:\n```\nC:\\masscan\\masscan.exe 146.56.202.100-146.56.202.200 -p 3306 --wait=0 --rate=2000\nerr:  Starting masscan 1.3.2 (http://bit.ly/14GZzcT) at 2021-03-19 14:52:27 GMT\nerr:  Initiating SYN Stealth Scan\nerr:  Scanning 101 hosts [1 port/host]\n146.56.202.115 3306\n146.56.202.190 3306\n146.56.202.188 3306\n146.56.202.125 3306\n146.56.202.185 3306\n146.56.202.117 3306\n146.56.202.112 3306\n146.56.202.161 3306\n146.56.202.165 3306\n146.56.202.166 3306\n                                                                             \nmasscan result count :  10\n\nProcess finished with exit code 0\n```\n# The development soul comes from\n[Ullaakut](https://github.com/Ullaakut/nmap)\n\n# Special thanks \n李雪松 XueSong Lee\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzan8in%2Fmasscan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzan8in%2Fmasscan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzan8in%2Fmasscan/lists"}