stopping for now
This commit is contained in:
@@ -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()
|
||||
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
25
src/Shodan.Net.UnitTests/Intergration/TestSuite.cs
Normal file
25
src/Shodan.Net.UnitTests/Intergration/TestSuite.cs
Normal 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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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": {
|
||||
|
||||
47
src/Shodan.Net/Models/Certificate.cs
Normal file
47
src/Shodan.Net/Models/Certificate.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -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")]
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace Shodan.Net.Models
|
||||
[DataContract]
|
||||
public class SearchHostResults
|
||||
{
|
||||
[DataMember(Name = "matches")]
|
||||
public List<Banner> Matches { get; set; }
|
||||
|
||||
[DataMember(Name = "facets")]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"authors": [ "Tommy Parnell" ],
|
||||
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user