Shodan 2.0.2

.NET Standard 2.0
dotnet add package Shodan --version 2.0.2
NuGet\Install-Package Shodan -Version 2.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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
#r "nuget: Shodan, 2.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. 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


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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
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 4,354 2/10/2021
2.0.1 536 5/5/2020
2.0.0 365 4/22/2020
1.0.2 418 3/18/2020
1.0.1 400 2/7/2020
1.0.0 423 1/14/2020
0.2.0 428 1/9/2020
0.1.9 461 1/7/2020
0.1.8 399 12/25/2019
0.1.7 429 12/14/2019
0.1.6 418 10/23/2019
0.1.5 404 10/17/2019
0.1.4 398 10/16/2019
0.1.3 412 9/14/2019
0.1.2 425 9/12/2019
0.1.1 420 9/1/2019
0.1.0 436 8/24/2019

Fixed alert stram route