Shodan 0.1.1
See the version list below for details.
dotnet add package Shodan --version 0.1.1
NuGet\Install-Package Shodan -Version 0.1.1
<PackageReference Include="Shodan" Version="0.1.1" />
paket add Shodan --version 0.1.1
#r "nuget: Shodan, 0.1.1"
// Install Shodan as a Cake Addin #addin nuget:?package=Shodan&version=0.1.1 // Install Shodan as a Cake Tool #tool nuget:?package=Shodan&version=0.1.1
Intro
Features
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 valueable information (if such services were detected on host, of course - otherwise they will just have null value):
- Cassandra
- DB2
- DNS
- Docker
- Elastic
- Etcd
- EthernetIP
- FTP
- Hive
- HTTP
- ISAKMP
- Lantronix
- Monero
- MongoDB
- MQTT
- 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 documentantion - like ListScans()
(https://api.shodan.io/shodan/scans) and Services()
(https://api.shodan.io/shodan/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 themself or acces 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");
// If you prefer to use your own HttpClient, pass it to factory constructor - all clients will share it.
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);
// 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++)
{
Console.WriteLine(query.Parameters.Page);
query.Parameters.Page++;
SearchResult result = await client.Search(query);
PrintElasticsInfo(result);
query.Parameters.Page++; // ShodanSearchQuery object is mutable
if (result.Services.Count < 100)
break;
}
Console.ReadLine();
}
private static void PrintElasticsInfo(SearchResult result)
{
foreach (Service service in result.Services.Where(s => s.Elastic != null))
{
Elastic elastic = service.Elastic;
// you should be careful about nulls - Shodan responses are not stable 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}");
Console.WriteLine("Indices:");
foreach (string indexName in elastic.Indices.Keys)
{
Console.WriteLine($"\t{indexName}");
}
}
Console.WriteLine();
}
}
}
Product | Versions 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. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.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. |
-
.NETStandard 2.0
- Shodan.Models (>= 1.0.0.2)
- Unity (>= 5.11.1)
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.3 | 5,474 | 12/19/2023 |
2.0.2 | 12,082 | 2/10/2021 |
2.0.1 | 648 | 5/5/2020 |
2.0.0 | 484 | 4/22/2020 |
1.0.2 | 531 | 3/18/2020 |
1.0.1 | 499 | 2/7/2020 |
1.0.0 | 519 | 1/14/2020 |
0.2.0 | 529 | 1/9/2020 |
0.1.9 | 566 | 1/7/2020 |
0.1.8 | 458 | 12/25/2019 |
0.1.7 | 499 | 12/14/2019 |
0.1.6 | 517 | 10/23/2019 |
0.1.5 | 476 | 10/17/2019 |
0.1.4 | 481 | 10/16/2019 |
0.1.3 | 513 | 9/14/2019 |
0.1.2 | 512 | 9/12/2019 |
0.1.1 | 504 | 9/1/2019 |
0.1.0 | 548 | 8/24/2019 |
Fixed search parameters page increment