maxhorstmann / arinwhois.net Goto Github PK
View Code? Open in Web Editor NEW.NET client for ARIN's Whois RESTful Web Service, the API to accessing ARIN's Whois data
License: MIT License
.NET client for ARIN's Whois RESTful Web Service, the API to accessing ARIN's Whois data
License: MIT License
I've found a bug with reassigned blocks that causes the return object to be null.
string foundIpAddress = "40.107.14.45";
ArinClient arinClient = new ArinClient();
Response ipResponse = arinClient.QueryIpAsync(IPAddress.Parse(foundIpAddress)).Result;
The ipResponse
object will be null when it is accessed and I believe that this is because the return from ARIN is not in the serialised type that the ARIN Client is expecting. In other words, it obtains data but not in the JSON form that it's expecting.
Below is the content from ARIN, so it's generating a response:
{"net":{"@xmlns":{"ns3":"http:\/\/www.arin.net\/whoisrws\/netref\/v2","ns2":"http:\/\/www.arin.net\/whoisrws\/rdns\/v1","$":"http:\/\/www.arin.net\/whoisrws\/core\/v1"},"@copyrightNotice":"Copyright 1997-2019, American Registry for Internet Numbers, Ltd.","@inaccuracyReportUrl":"https:\/\/www.arin.net\/resources\/registry\/whois\/inaccuracy_reporting\/","@termsOfUse":"https:\/\/www.arin.net\/resources\/registry\/whois\/tou\/","registrationDate":{"$":"2015-02-23T14:30:24-05:00"},"rdapRef":{"$":"https:\/\/rdap.arin.net\/registry\/ip\/40.74.0.0"},"ref":{"$":"https:\/\/whois.arin.net\/rest\/net\/NET-40-74-0-0-1"},"endAddress":{"$":"40.125.127.255"},"handle":{"$":"NET-40-74-0-0-1"},"name":{"$":"MSFT"},"netBlocks":{"netBlock":[{"cidrLength":{"$":"15"},"endAddress":{"$":"40.75.255.255"},"description":{"$":"Direct Assignment"},"type":{"$":"DS"},"startAddress":{"$":"40.74.0.0"}},{"cidrLength":{"$":"17"},"endAddress":{"$":"40.125.127.255"},"description":{"$":"Direct Assignment"},"type":{"$":"DS"},"startAddress":{"$":"40.125.0.0"}},{"cidrLength":{"$":"14"},"endAddress":{"$":"40.79.255.255"},"description":{"$":"Direct Assignment"},"type":{"$":"DS"},"startAddress":{"$":"40.76.0.0"}},{"cidrLength":{"$":"13"},"endAddress":{"$":"40.119.255.255"},"description":{"$":"Direct Assignment"},"type":{"$":"DS"},"startAddress":{"$":"40.112.0.0"}},{"cidrLength":{"$":"16"},"endAddress":{"$":"40.124.255.255"},"description":{"$":"Direct Assignment"},"type":{"$":"DS"},"startAddress":{"$":"40.124.0.0"}},{"cidrLength":{"$":"14"},"endAddress":{"$":"40.123.255.255"},"description":{"$":"Direct Assignment"},"type":{"$":"DS"},"startAddress":{"$":"40.120.0.0"}},{"cidrLength":{"$":"12"},"endAddress":{"$":"40.111.255.255"},"description":{"$":"Direct Assignment"},"type":{"$":"DS"},"startAddress":{"$":"40.96.0.0"}},{"cidrLength":{"$":"12"},"endAddress":{"$":"40.95.255.255"},"description":{"$":"Direct Assignment"},"type":{"$":"DS"},"startAddress":{"$":"40.80.0.0"}}]},"resources":{"@copyrightNotice":"Copyright 1997-2019, American Registry for Internet Numbers, Ltd.","@inaccuracyReportUrl":"https:\/\/www.arin.net\/resources\/registry\/whois\/inaccuracy_reporting\/","@termsOfUse":"https:\/\/www.arin.net\/resources\/registry\/whois\/tou\/","limitExceeded":{"@limit":"256","$":"false"}},"orgRef":{"@handle":"MSFT","@name":"Microsoft Corporation","$":"https:\/\/whois.arin.net\/rest\/org\/MSFT"},"parentNetRef":{"@handle":"NET-40-0-0-0-0","@name":"NET40","$":"https:\/\/whois.arin.net\/rest\/net\/NET-40-0-0-0-0"},"startAddress":{"$":"40.74.0.0"},"updateDate":{"$":"2015-05-27T13:38:53-04:00"},"version":{"$":"4"}}}
So far, this seems specific to all reassigned blocks.
The following code does not provide the same output as whois.arin.net (when IP = 4.4.4.4) and throws an exception:
ArinWhois.Client.ArinClient myArinClient = new ArinWhois.Client.ArinClient();
var myWhoIsResults = myArinClient.QueryIpAsync(IP).Result;
var myWhoIsOrgResults = myArinClient.QueryResourceAsync(myWhoIsResults.Network.OrgRef.Handle, ArinWhois.Client.ArinClient.ResourceType.Organization).Result;
mywhoisorgname = myWhoIsOrgResults.Organization.Name.Value;
mywhoisorgcity = myWhoIsOrgResults.Organization.City.Value;
mywhoisorgpostalcode = myWhoIsOrgResults.Organization.PostalCode.Value;
mywhoispocrawlink = myWhoIsOrgResults.PointOfContact.Ref.Value;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.