Automated and Readable Network Discovery with Nmap [YouTube Release]

Additional Resources:


How To Use Nmap for Network Inventory and Asset Discovery
Nmap for Network Inventory and Asset Discovery

Connect With Us

Lawrence Systems Shirts and Swag

►👕 Lawrence Systems

AFFILIATES & REFERRAL LINKS

Amazon Affiliate Store
:shopping_cart: Lawrence Systems's Amazon Page

UniFi Affiliate Link
:shopping_cart: Ubiquiti Store

All Of Our Affiliates help us out and can get you discounts!
:shopping_cart: Partners We Love – Lawrence Systems

Gear we use on Kit
:shopping_cart: Kit

Use OfferCode LTSERVICES to get 10% off your order at
:shopping_cart: Tech Supply Direct - Premium Refurbished Servers & Workstations at Unbeatable Prices

Digital Ocean Offer Code
:shopping_cart: DigitalOcean | Cloud Infrastructure for Developers

HostiFi UniFi Cloud Hosting Service
:shopping_cart: HostiFi - Launch UniFi, UISP and Omada in the Cloud

Protect your privacy with a VPN from Private Internet Access
:shopping_cart: https://www.privateinternetaccess.com/pages/buy-vpn/LRNSYS

Patreon
:moneybag: https://www.patreon.com/lawrencesystems

Chapters
00:00 NMAP
00:58 Basic NMAP Scan Options
03:52 Converting NMAP XML to HTML
07:15 NMAP Movie Histroy

in some case, nmap blows up with …

Starting Nmap 7.80 ( https://nmap.org ) at 2025-01-16 11:33 MST
Nmap scan report for vault.lan (10.0.0.1)
Host is up (0.00037s latency).
Not shown: 996 filtered ports
PORT    STATE SERVICE  VERSION
22/tcp  open  ssh      OpenSSH 9.4 (protocol 2.0)
53/tcp  open  domain   (generic dns response: NOTIMP)
80/tcp  open  http     nginx
443/tcp open  ssl/http nginx
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port53-TCP:V=7.80%I=7%D=1/16%Time=678950F5%P=x86_64-pc-linux-gnu%r(DNSV
SF:ersionBindReqTCP,20,"\0\x1e\0\x06\x81\x85\0\x01\0\0\0\0\0\0\x07version\
SF:x04bind\0\0\x10\0\x03")%r(DNSStatusRequestTCP,E,"\0\x0c\0\0\x90\x04\0\0
SF:\0\0\0\0\0\0");
MAC Address: 00:E0:67:06:F4:19 (eac Automation-consulting Gmbh)

and post processing does not look good.

10.0.0.1 is my pfsense fw.

@LTS_Tom could you please share your XSL style sheet that was used in this video?

Thanks!

Here you go

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" indent="yes"/>

    <xsl:template match="/">
        <html>
            <head>
                <title>Nmap Detailed Scan Report</title>
                <style>
                    body {
                        font-family: Arial, sans-serif;
                        background-color: #f4f4f9;
                        color: #333;
                        margin: 0;
                        padding: 0;
                    }
                    h1, h2, h3 {
                        background-color: #007BFF;
                        color: white;
                        padding: 10px;
                        margin: 0;
                    }
                    h1 {
                        font-size: 24px;
                    }
                    h2 {
                        font-size: 18px;
                    }
                    h3 {
                        font-size: 16px;
                    }
                    table {
                        border-collapse: collapse;
                        width: 100%;
                        margin: 20px 0;
                    }
                    th, td {
                        border: 1px solid #ddd;
                        padding: 8px;
                        text-align: left;
                    }
                    th {
                        background-color: #007BFF;
                        color: white;
                    }
                    tr:nth-child(even) {
                        background-color: #f9f9f9;
                    }
                    tr:hover {
                        background-color: #f1f1f1;
                    }
                    ul {
                        list-style-type: none;
                        padding: 0;
                    }
                    li {
                        margin: 5px 0;
                    }
                </style>
            </head>
            <body>
                <h1>Nmap Detailed Scan Report</h1>
                <xsl:apply-templates select="nmaprun"/>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="nmaprun">
        <h2>Scan Summary</h2>
        <p>Command: <xsl:value-of select="@args"/></p>
        <p>Start Time: <xsl:value-of select="@startstr"/></p>
        <p>Finished Time: <xsl:value-of select="@endstr"/></p>

        <xsl:for-each select="host">
            <xsl:call-template name="hostDetails"/>
        </xsl:for-each>
    </xsl:template>

    <xsl:template name="hostDetails">
        <h2>
            <xsl:value-of select="address[@addrtype='ipv4']/@addr"/>
        </h2>
        <h3>Host Information</h3>
        <ul>
            <li>MAC Address: <xsl:value-of select="address[@addrtype='mac']/@addr"/></li>
            <li>Vendor: <xsl:value-of select="address[@addrtype='mac']/@vendor"/></li>
            <li>Status: <xsl:value-of select="status/@state"/></li>
        </ul>
        
        <h3>Open Ports</h3>
        <table>
            <tr>
                <th>Port</th>
                <th>Protocol</th>
                <th>State</th>
                <th>Service</th>
                <th>Version</th>
                <th>Extra Info</th>
            </tr>
            <xsl:for-each select="ports/port">
                <tr>
                    <td><xsl:value-of select="@portid"/></td>
                    <td><xsl:value-of select="@protocol"/></td>
                    <td><xsl:value-of select="state/@state"/></td>
                    <td><xsl:value-of select="service/@name"/></td>
                    <td><xsl:value-of select="service/@version"/></td>
                    <td><xsl:value-of select="service/@extrainfo"/></td>
                </tr>
            </xsl:for-each>
        </table>

        <h3>OS Detection</h3>
        <ul>
            <xsl:for-each select="os/osmatch">
                <li>
                    OS Match: <xsl:value-of select="@name"/> (<xsl:value-of select="@accuracy"/>%)
                </li>
            </xsl:for-each>
        </ul>
    </xsl:template>
</xsl:stylesheet>

1 Like

Thanks for sharing Tom
Have a great day!

1 Like

Yes, thank you for sharing @LTS_Tom

1 Like

Hey @LTS_Tom hope you make more Nmap videos. This is a really neat tool that is new to me. I know there’s a lot of videos out there on this topic already, but seeing even the basics from your point of view would be awesome.

1 Like