a drop-in replacement for Nmap powered by shodan.io
Smap is a passive port scanner built with shodan.io's free API. It takes the same command line arguments as Nmap and produces the same output, which makes it a drop-in replacement for Nmap.
You can download a pre-built binary from here and use it right away.
go install -v github.com/s0md3v/smap/cmd/smap@latest
Confused or something not working? For more detailed instructions, click here
Smap is available on AUR as smap-git (builds from source) and smap-bin (pre-built binary).
Smap is also available on Homebrew.
brew update
brew install smapSmap takes the same arguments as Nmap, but options other than -p, -h, -V, -o*, -iL, --concurrency, and --append-output are ignored in passive mode. Use --nmap to pass Nmap options to a real Nmap scan after passive port discovery. If you are unfamiliar with Nmap, here's how to use Smap.
smap 127.0.0.1 127.0.0.2You can also use a list of targets, separated by newlines.
smap -iL targets.txtSupported formats
1.1.1.1 // IPv4 address
example.com // hostname
178.23.56.0/8 // CIDR
1.1.1.1-20 // IPv4 rangeSmap supports 7 output formats which can be used with -o* as follows:
smap example.com -oX output.xmlIf you want to print the output to terminal, use hyphen (-) as filename.
Supported formats
oX // nmap's xml format
oG // nmap's greppable format
oN // nmap's default format
oA // output in all 3 formats above at once
oP // IP:PORT pairs separated by newlines
oS // custom smap format
oJ // jsonNote: Since Nmap doesn't scan/display vulnerabilities and tags, that data is not available in nmap's formats. Use
-oSto view that info.
Smap scans these ~4000 ports by default. If you want to display results for certain ports, use the -p option.
smap -p21-30,80,443 -iL targets.txtUse --nmap to narrow a scan with your local nmap. Smap first collects the union of ports reported by Shodan and then runs Nmap once against the original targets with that smaller port range.
smap --nmap -Pn -sV --version-light 1.1.1.1Except for --nmap and --concurrency, the supplied arguments are passed to Nmap. Smap replaces the port range with the Shodan candidates; if you specify -p, it first limits the candidates to that range. Nmap handles the scan and output directly, so its options and output formats behave normally. Host-only operations such as -sL and -sn are passed through without passive port discovery.
Smap's custom output formats are passive-mode features; with --nmap, output options have their normal Nmap meanings. If Shodan reports no candidate ports, Nmap is not run.
This can save time if passive data is good enough for your use case.
Smap defaults to 3 workers to avoid hitting Shodan too aggressively. You can change that with --concurrency.
smap --concurrency 5 -iL targets.txtSince Smap simply fetches existent port data from shodan.io, it is super fast but there's more to it. You should use Smap if:
Note: if you use
--nmap, Smap will runnmapagainst the target and make active connections. Because Shodan's data can be stale or incomplete, using it as a port filter can miss open ports.
No open issues yet, or sync has not completed.