Shodan 2.0.2

.NET Standard 2.0
Install-Package Shodan -Version 2.0.2
dotnet add package Shodan --version 2.0.2
<PackageReference Include="Shodan" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Shodan --version 2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Shodan, 2.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Shodan as a Cake Addin
#addin nuget:?package=Shodan&version=2.0.2

// Install Shodan as a Cake Tool
#tool nuget:?package=Shodan&version=2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


This library is an asynchronous C# client for REST API.


The main feature of this library is a rich models - they contain a lot of properties, which other libraries just not aware of. For example, Service object has the following properties with valuable information (if such services were detected on host, of course - otherwise they will just have null value):

  • Cassandra
  • CoAP
  • DB2
  • DNS
  • Docker
  • Elastic
  • Etcd
  • EthernetIP
  • FTP
  • Hive
  • HTTP
  • InfluxDB
  • Lantronix
  • Monero
  • MongoDB
  • MQTT
  • Minecraft
  • Netbios
  • NTP
  • Redis
  • RIP
  • Rsync
  • SMB
  • SNMP
  • SSH
  • Vertx

All models and their complex properties also has ExtraValues property for an unknown keys in response.

The second feature, which makes this library unique, is a set of methods - all API is covered, including exploits and stream. There are even methods, that are not listed in documentation - like ListScans() and Services()

Third feature is a search query classes, which allows you to create query as CLR object, modify and even serialize it. The object is mutable, so you can, for example, increase a page in search parameters. Of course, such approach has its own limitations, that's why you can always use just a string for performing search.

Also, because of very big set of API methods, there are separate client classes for exploits, stream and alerts APIs. You can use them by themselves or access via ShodanClient class properties.

Basic usage example

This example shows how to create a client, compose a search query and how to use models later.

    class Program
        static async Task Main()
            string key = Environment.GetEnvironmentVariable("SHODAN_API_KEY");

            ShodanClient client = new ClientFactory(key).GetFullClient();

            // All client methods are asynchronous;
            // The only exception is StreamClient, which has generator methods.
            ApiInfo apiInfo = await client.ApiInfo();
            Console.WriteLine("Unlocked credits left: {0}", apiInfo.UnlockedLeft);

            // Some other clients are properties of full client
            var alerts = await client.Alerts.ListAlerts();

            // You can create a query object for search or just pass a string to search method;
            // Fill "Text" property of query to specify a search term.
            ShodanSearchQuery query = new ShodanSearchQuery
                // We want to find exposed ElasticSearch instances in China with a "readme" index
                // (typically it's an index with ransom note)
                Text = "readme",
                Country = "CN",
                Port = 9200

            for (int i = 0; i < 10; i++)

                SearchResult result = await client.Search(query);

                query.Parameters.Page++; // ShodanSearchQuery object is mutable

                if (result.Services.Count < 100)


        // This method prints some of ElasticSearch properties to stdout
        private static void PrintElasticsInfo(SearchResult result)
            foreach (Service service in result.Services.Where(s => s.Elastic != null))
                var elastic = service.Elastic;

                // you should be careful about nulls - Shodan responses are not statically typed and can lack some keys
                if (elastic.Cluster?.Indices?.Count > 0 && elastic.Cluster?.Indices?.Docs?.Count > 0)
                    Console.WriteLine($"Exposed ElasticSearch at {service.IPStr}:{service.Port}");
                    Console.WriteLine($"Total docs: {elastic.Cluster.Indices.Docs.Count}");
                    Console.WriteLine($"Total bytes: {elastic.Cluster.Indices.Store?.SizeInBytes}");
                    Console.WriteLine($"Cluster name: {elastic.Cluster.ClusterName}");

                    foreach (string indexName in elastic.Indices.Keys)

Since version 1.0.0 library supports Microsoft dependency injection. For example, in ASP.NET project you can register all available clients in your Startup.cs in ConfigureServices method like this:

        using Shodan.Extensions;  // namespace with DI extensions


        public void ConfigureServices(IServiceCollection services)

Now you can create your services with any client type as dependency.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.2 1,264 2/10/2021
2.0.1 416 5/5/2020
2.0.0 241 4/22/2020
1.0.2 285 3/18/2020
1.0.1 267 2/7/2020
1.0.0 284 1/14/2020
0.2.0 293 1/9/2020
0.1.9 324 1/7/2020
0.1.8 264 12/25/2019
0.1.7 295 12/14/2019
0.1.6 286 10/23/2019
0.1.5 269 10/17/2019
0.1.4 267 10/16/2019
0.1.3 282 9/14/2019
0.1.2 292 9/12/2019
0.1.1 283 9/1/2019
0.1.0 295 8/24/2019

Fixed alert stram route