nmap2md icon indicating copy to clipboard operation
nmap2md copied to clipboard

Default 'sort' doesn't sort numerically.

Open djjoa opened this issue 3 years ago • 1 comments

Expected ports should be in ascending order by lowest => highest; however, the script organizes them in an arbitrary format.

(Example)

─$nmap2md.py ./internal/nmap/script-version.xml -c "Port,State,Service,Version,Notes" --sort=Port;asc --hs 5 --rc "[port.number],[state],[service.name],[service.product] [service.version], "        
/usr/local/bin/nmap2md.py:102: FutureWarning: The behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.
  if ports:
()
()
##### 192.168.99.40

| Port | State | Service | Version | Notes |
|------|-------|---------|---------|-------|
| 3389 | open | ms-wbt-server |   |   |
| 49152 | open | msrpc | Microsoft Windows RPC  |   |
| 49153 | open | msrpc | Microsoft Windows RPC  |   |
| 49154 | open | msrpc | Microsoft Windows RPC  |   |
| 49155 | open | msrpc | Microsoft Windows RPC  |   |
| 49156 | open | msrpc | Microsoft Windows RPC  |   |
| 49157 | open | msrpc | Microsoft Windows RPC  |   |
| 49158 | open | msrpc | Microsoft Windows RPC  |   |
| 53 | open | domain | Microsoft DNS 6.0.6001 (17714650) |   |
| 5357 | open | http | Microsoft HTTPAPI httpd 2.0 |   |

djjoa avatar Jan 17 '22 23:01 djjoa

It's not quite arbitrary, it's sorting not numerically, but alphabetically. I think It's possible to add an exception use-case for ports in this case.

vdjagilev avatar Mar 18 '22 15:03 vdjagilev