stopping for now

This commit is contained in:
Tommy Parnell
2016-06-01 19:15:11 -04:00
parent 1f85dfd096
commit bbb863a5ea
11 changed files with 85 additions and 29 deletions

View File

@@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace Shodan.Net.UnitTests
{
// This project can output the Class library as a NuGet Package.
// To enable this option, right-click on the project and select the Properties menu item. In the Build tab select "Produce outputs on build".
public class Class1
{
[Fact]
public void privateGetsPorts()
{
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace Shodan.Net.UnitTests.Intergration
{
public class TestSuite
{
private readonly ShodanClient shodanClient = new ShodanClient("9F0mxmNSaHbe0mYmefwoCZrChT2h0KzC");
[Fact]
public async Task GetHost()
{
var result = await shodanClient.GetHostAsync("41.21.249.170");
}
[Fact]
public async Task PerformSearch()
{
var result = await shodanClient.SearchHosts(a => a.With_state("NY"));
}
}
}

View File

@@ -5,7 +5,8 @@
"NETStandard.Library": "1.5.0-rc2-24027",
"xunit": "2.1.0",
"dotnet-test-xunit": "1.0.0-rc2-build10015",
"Shodan.Net": "1.0.0-*"
"Shodan.Net": "1.0.0-*",
"Newtonsoft.Json": "8.0.3"
},
"frameworks": {

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
namespace Shodan.Net.Models
{
public class Certificate
{
[DataMember(Name = "sig_alg")]
public string SignatureAlgorithmm { get; set; }
[DataMember(Name = "issued")]
public string Issued { get; set; }
[DataMember(Name = "expires")]
public DateTime Expires { get; set; }
[DataMember(Name = "expired")]
public bool Expired { get; set; }
[DataMember(Name = "version")]
public int Version { get; set; }
[DataMember(Name = "fingerprint")]
public Fingerprint Fingerprint { get; set; }
[DataMember(Name = "subject")]
public dynamic Subject { get; set; }
[DataMember(Name = "pubkey")]
public dynamic PublicKey { get; set; }
[DataMember(Name = "issuer")]
public dynamic Issuer { get; set; }
[DataMember(Name = "ciper")]
public dynamic Ciper { get; set; }
}
public class Fingerprint
{
public string sha256 { get; set; }
public string sha1 { get; set; }
}
}

View File

@@ -36,7 +36,6 @@ namespace Shodan.Net.Models
[DataMember(Name = "country_code")]
public string CountryCode { get; set; }
[DataMember(Name = "data")]
public List<Banner> Data { get; set; }
[DataMember(Name = "city")]

View File

@@ -12,7 +12,6 @@ namespace Shodan.Net.Models
[DataContract]
public class SearchHostResults
{
[DataMember(Name = "matches")]
public List<Banner> Matches { get; set; }
[DataMember(Name = "facets")]

View File

@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
@@ -13,7 +14,10 @@ namespace Shodan.Net.Models
/// The parsed certificate properties that includes information such as when it was issued, the SSL extensions, the issuer, subject etc.
/// </summary>
[DataMember(Name = "cert")]
public dynamic Cert { get; set; }
public Certificate Cert { get; set; }
[IgnoreDataMember]
public decimal[] Serial { get; set; }
/// <summary>
/// Preferred cipher for the SSL connection

View File

@@ -13,7 +13,7 @@ namespace Shodan.Net
/// </summary>
public class RequestHandler : IRequstHandler
{
private HttpClient client { get; set; }
private HttpClient client = new HttpClient();
public async Task<T> MakeRequestAsync<T>(Uri url, HttpContent content = null, RequestType requstType = RequestType.GET)
where T : class

View File

@@ -8,7 +8,7 @@ namespace Shodan.Net
{
public class QueryGenerator
{
internal Dictionary<string, string> queryData { get; set; }
internal Dictionary<string, string> queryData = new Dictionary<string, string>();
private HashSet<string> CalledMethods = new HashSet<string>();
private string searchText = string.Empty;

View File

@@ -63,7 +63,7 @@ namespace Shodan.Net
/// <param name="page">The page number to page through results 100 at a time (default: 1) </param>
/// <param name="minify">True or False; whether or not to truncate some of the larger fields (default: True) </param>
/// <returns></returns>
public Task<SearchHostResults> SearchHosts(Action<QueryGenerator> query, Action<FacetGenerator> facet = null, int page = 1, bool minify = true)
public Task<dynamic> SearchHosts(Action<QueryGenerator> query, Action<FacetGenerator> facet = null, int page = 1, bool minify = true)
{
if(query == null)
{
@@ -86,7 +86,7 @@ namespace Shodan.Net
{
url.Query = $"{url.Query}&page={page}";
}
return RequestHandler.MakeRequestAsync<SearchHostResults>(url.Uri);
return RequestHandler.MakeRequestAsync<dynamic>(url.Uri);
}
/// <summary>

View File

@@ -1,5 +1,5 @@
{
"version": "0.2.0",
"version": "0.3.0",
"authors": [ "Tommy Parnell" ],
"dependencies": {