Giter Site home page Giter Site logo

whoislibrary's Introduction

WhoisLibrary

This is a java library that provides a simple yet powerful api to perform whois requests. It's currently in alpha status.

The requests it can perform actually are only for the following domains:

  • .com
  • .edu
  • .it
  • .info
  • .net
  • .org

WhoisLibrary doesn't only let you to get the raw result of a whois request. It's based on a templating system allowing to parse the raw data, the parser provide the results in a well-structured form by filling the WhoisEntry object. Since formats and responses may vary greatly, it's not possible to parse and organize all data from all TLDs. WhoisLibrary has been designed as a trade-off between data relevance, uniformity and completeness, but without bottlenecks preventing to create a custom version of the library that feets the specifical needs you have. Nonetheless WhoisEntry carry also with it the raw version of the data, that can get using the method WhoisEntry::getRawData(). This will allow to retrieve additional data without the need to modify the library at all.

Add support for a new TLD

The library template system is easy to use, and easy to extend, if you want to add a support for a new TLD, you have to just extend the Template class. Parse operations are filled into an array of objects derived from ParseOperation. If you add an unsupported domain or make some bugfix, please send us a patch.

There are actually three derived classes :

  • StringOperation

It's used to get strings from the input stream.

  • DateOperation

It's used to get, parse and convert dates from String to Date.

  • SkipOperation

This is optional, and should be use to instruct the parser to ignore a given number of lines.

The whois server URL is passed to the constructor as argument, you have to load operations using the loadOperations method, see the templates directory for more informations.

Once you created your Template, you have to add an entry into the file domain_map.properties, in the following format:

tld=fullclassName

For example:

org=org.whoislibrary.templates.TemplateOrg

TemplateGeneric is a start skeleton to develop a new template.

Compile

Using ant

You can create an executable jar using ant build system. If you haven't installed ant yet you can download it from here:

http://ant.apache.org/bindownload.cgi

Once you have installed it you can compile the program using (remember that if you haven't added the ant bin folder into yuour PATH you must use the full path: /yourpathtoant/bin/ant):

ant jar

To build an executable jar. Or you can just compile classes using:

ant compile

The binaries are stored into the bin folder of the project.

Using Maven

(DRAFT) If you haven't installed maven yet, you can download it here:

https://maven.apache.org/

Once you have installed it you can compile the program using (remember that if you haven't added the ant bin folder into yuour PATH you must use the full path: /yourpathtomaven/bin/mvn):

mvn clean package

The binaries are stored into the target folder.

Usage

You can test the library launching the WhoisMain class:

java WhoisMain

with no arguments it performs just three predefined whois query (for test)

If you specify a domain name, if the tld is implemented it gives you the result of your query (and then the three test queries):

java WhoisMain yourdomain.com

If you are using the jar file:

java -jar whois.jar yourdomain.com

Documentation

The documentation is available here: http://inuyasha82.github.io/WhoisLibrary/doc/index.html

Copyright and Licence

Authors: Ivan Gualandri Dario Casalinuovo

The library is released under the terms of GNU/GPL v3 License. If you like it please donate a coffee!

Flattr this git repo

whoislibrary's People

Contributors

barrett17 avatar inuyasha82 avatar numerio avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

whoislibrary's Issues

Create Unit Tests

Create Several unit tests for the library.

Partial list of tests:

  1. All supported TLD for existing domains
  2. All supported TLD for available domains.
  3. Unsupported TLD
  4. Null entry
    etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.