https://github.com/terribledev/shodan.net
c# client for shodan.io api
https://github.com/terribledev/shodan.net
Last synced: 9 months ago
JSON representation
c# client for shodan.io api
- Host: GitHub
- URL: https://github.com/terribledev/shodan.net
- Owner: TerribleDev
- License: mit
- Created: 2016-05-21T03:42:57.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-08-05T13:16:15.000Z (almost 2 years ago)
- Last Synced: 2025-09-29T23:30:45.523Z (9 months ago)
- Language: C#
- Homepage: http://tparnell8.github.io/Shodan.Net
- Size: 68.4 KB
- Stars: 58
- Watchers: 11
- Forks: 25
- Open Issues: 3
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://ci.appveyor.com/project/tparnell8/shodan-net/branch/master)
Visit the official Shodan API documentation at:
[https://developer.shodan.io](https://developer.shodan.io)
This is still in active development, error handling might not well handle well. Best bet when working with any libraries you didn't write..harden your calls!
## APi Docs
You can find doxygen docs [here](http://shodan-csharp-docs.azurewebsites.net/)
## Installation
`install-package Shodan.Net`
## Getting started
You need to have an Api key. Get your [api key here](http://www.shodanhq.com/api_doc).
Create a shodan client. Note that ShodanClient inerhits from IDisposable, so you should wrap it in a using, or make sure it will be disposed. Shodan client is thread safe, so you should be able to keep 1 object around for many requests.
`var client = new Shodan.Net.ShodanClient("myapiKey");`
Now just query away. You should be able to find all the actions [in the docs](http://shodan-csharp-docs.azurewebsites.net/class_shodan_1_1_net_1_1_shodan_client.html) or just through the docs in intellisense.
```csharp
await client.GetPortsAsync();
await client.GetHostAsync("172.1.1.0");
await client.GetMyIpAsync();
```
## Searching
Searching shodan requires you to build up queries, and facets to make it easier we have used a generator pattern to produce queries.
```csharp
await client.SearchHosts(
query: a => a.Withcity("boston")
.Withcountry("usa")
.Before(DateTime.Now.AddDays(-5)),
facet: b => b.WithAsn()
);
```