A Julia interface to nmap that allows scan and output manipulation
NMAP.jl is still under active development, changes are likely to occur until the first stable release
Nmap, short for Network Mapper, is a free and open source utility for network discovery and security auditing.
Nmap provides users with a powerful and flexible set of features for probing computer networks and perform host discovery, service and operating system detection. Nmap's features are also extensible through scripts - Nmap scripting engine - that provide more advanced features and automate a wider variety of network tasks, such as vulnerability detection or improved service detection. There is as collection of documented scripts available under nsedoc.
- Interface for defining and running nmap scans
- Parse XML output
- XML elements mapped to Julia structures
- Parse externally generated xml files
- Incorporate all xml elements
- Universe of
nmap
's native options- String based options
- Enums and helpers for nmap options or flags
- Time templates
- TCP flags
- Port states
- OS families
- Documentation
- Usage examples and docstrings
- Options documentation aligned with nmap's usage documentation
- Additional examples (
docs/examples
)
- Improve library tests
- Error handling
- Add package to Julia Registry
- Integration with CPE library
using NMAP
? NMAP
? NMAP.Scanner
? NMAP.Scan
Define a Scanner
scanner = NMAP.Scanner(
NMAP.ports("22","80","443"),
NMAP.targets("scanme.nmap.org"),
NMAP.traceroute())
Execute the scan
Option -oX
is automatically added to produce XML output
scan = NMAP.run!(scanner)
#Display port id, state and service names
for host in scan.hosts
for ports in host.ports
for (port, extraport) in ports
println(@sprintf("%s: %s %s", NMAP.id(port), NMAP.name(port), NMAP.state(port).state))
#= Alternatively =#
println("$(port.id): $(port.service.name) $(port.state.state)")
end
end
end
80: http open
443: https closed
Scanners arguments can be defined as strings, NMAP.Option or both
scanner = NMAP.Scanner("127.0.0.1", "-sV", NMAP.top_ports(100))
Cmd(scanner)
# `nmap 127.0.0.1 -sV --top-ports 100`
scan = NMAP.Scan(read("path/to/output.xml"))
Documentation available under docs/examples/Output.md
Additional examples available under docs/examples
NMAP.jl is licensed under the MIT License
Option documentation available under docs/examples/Options.md
{
"xml": "String",
"args": "String",
"scanner": "String",
"startstr": "String",
"version": "String",
"xmloutputversion": "String",
"start": "NMAP.Timestamp",
"verbose": "NMAP.Verbose",
"debugging": "NMAP.Debugging",
"stats": "NMAP.RunStats",
"scaninfo": "NMAP.ScanInfo",
"hosts": "Array{NMAP.Host,1}",
"targets": "Array{NMAP.Target,1}",
"taskbegin": "Array{NMAP.Task,1}",
"taskend": "Array{NMAP.Task,1}"
}