Skip to content

coj337/Nmap.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nmap.NET

Nmap.NET is an nmap wrapper library for .NET 7 which aims to provide a simple interface for host discovery, firewall detection, and port scanning.

Usage & Examples

Using the library is fairly simple. A demo project is included in Nmap.NET.Demo, and some examples are provided below.

Host discovery

Host discovery will yield a collection of Host objects, each containing information about the discovered host.

    using Nmap.NET;
    using Nmap.NET.Container;

    class Program
    {
        public static void Main(string[] args)
        {
            var target = new Target("192.168.0.0/24");
            var result = new Scanner(target).HostDiscovery();
            // do something with the result
        }
    }

Port scan (TCP SYN scan)

    using Nmap.NET;
    using Nmap.NET.Container;

    class Program
    {
        public static void Main(string[] args)
        {
            var target = new Target("192.168.1.101");
            var result = new Scanner(target).PortScan(ScanType.Syn);
            // do something with the result
        }
    }

A more advanced scan

    using Nmap.NET;
    using Nmap.NET.Container;

    class Program
    {
        public static void Main(string[] args)
        {
            // target can be a string, an IPAddress or an IEnumerable of either
            var target = new Target("192.168.1.0/24");
            var scanner = new Scanner(target);

            // multiple calls to scanner will always exclude this host
            scanner.PersistentOptions = new NmapOptions {
                {NmapFlag.ExcludeHosts, "192.168.0.12"}
            };
            var result = scanner.HostDiscovery();
            // do something with the result
        }
    }

About

A simple Nmap wrapper for .NET 7

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages