Showdan.Net
c# client for the shodan api
Readme.md
1 Visit the official Shodan API documentation at:
2 
3 [https://developer.shodan.io](https://developer.shodan.io)
4 
5 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!
6 
7 ## Installation
8 
9 `install-package Shodan.Net`
10 
11 ## Getting started
12 
13 You need to have an Api key. Get your [api key here](http://www.shodanhq.com/api_doc).
14 
15 
16 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.
17 
18 `var client = new Shodan.Net.ShodanClient("myapiKey");`
19 
20 Now just query away.
21 
22 ```csharp
23 
24 await client.GetPortsAsync();
25 await client.GetHostAsync("172.1.1.0");
26 await client.GetMyIpAsync();
27 
28 
29 ```
30 
31 
32 ## Searching
33 
34 Searching shodan requires you to build up queries, and facets to make it easier we have used a generator pattern to produce queries.
35 
36 ```csharp
37 
38  await client.SearchHosts(
39  query: a => a.Withcity("boston")
40  .Withcountry("usa")
41  .Before(DateTime.Now.AddDays(-5)),
42  facet: b => b.WithAsn()
43 
44  );
45 
46 
47 ```