Net::DRI::Shell - Command Line Shell for Net::DRI, with batch features and autocompletion support
perl -I../../ ./Shell.pm or perl -MNet::DRI::Shell -e run or perl -MNet::DRI::Shell -e 'Net::DRI::Shell->run()' or in your programs: use Net::DRI::Shell; Net::DRI::Shell->run(); Welcome to Net::DRI $version shell, pid $pid Net::DRI object created with a cache TTL of 10 seconds and logging into files in current directory NetDRI> add_registry registry=EURid client_id=YOURID NetDRI(EURid)> add_current_profile name=profile1 type=epp client_login=YOURLOGIN client_password=YOURPASSWORD Profile profile1 added successfully (1000/COMMAND_SUCCESSFUL) SUCCESS NetDRI(EURid,profile1)> domain_info example.eu Command completed successfully (1000/1000) SUCCESS NetDRI(EURid,profile1)> get_info_all ... all data related to the domain name queried ... NetDRI(EURid,profile1)> domain_check whatever.eu Command completed successfully (1000/1000) SUCCESS NetDRI(EURid,profile1)> get_info_all ... all data related to the domain name queried ... NetDRI(EURid,profile1)> show profiles EURid: profile1 NetDRI(EURid,profile1)> quit
This is a shell to be able to use Net::DRI without writing any code.
Most of the time commands are the name of methods to use on the Net::DRI object, with some extra ones and some variations in API to make passing parameters simpler.
After having started this shell, the available commands are the following.
Replace REGISTRYNAME with the Net::DRI::DRD module you want to use, and YOURID with your client identification for this registry (may be the same as the login used to connect, or not).
This will really connect to the registry, replace YOURLOGIN by your client login at registry, and YOURPASSWORD by the associated password. You may have to add parameters remote_host= and remote_port= to connect to other endpoints than the hardcoded default which is most of the time the registry OT&E server, and not the production one !
This is a shortcut, doing the equivalent of add_registry, and then add_current_profile.
After each call to the registry, like domain_info or domain_check, this will list all available data retrieved from registry. Things are pretty-printed as much as possible. You should call get_info_all right after your domain_something call otherwise if you do another operation previous information is lost. This is done automatically for you on the relevant commands, but you can also use it manually at any time.
Show the list of registries and associated profiles currently in use (opened in this shell with add_registry + add_current_profile, or add).
Show the list of TLDs handled by the currently selected registry.
Show the list of allowed periods (domain name durations) for the currently selected registry.
Show the list of managed objects types at the currently selected registry.
Show the list of profile types at the currently selected registry
Show the list of available status for the currently selected registry, to use as status name in some commands below (domain_update_status_* domain_update host_update_status_* host_update contact_update_status_* contact_update).
This will show all current config options. See set command below for the list of config options.
set
The set command can be used to change some options inside the shell.
The current list of available options is:
Set this option to 1 if you want a dump of all data retrieved from registry automatically after each operation, including failed ones, and including all displaying raw data exchanged with registry.
Switch to registry REGISTRYNAME (from currently available registries) and profile PROFILENAME (from currently available profiles in registry REGISTRYNAME).
Will open the local FILENAME and read in it commands and execute all of them; you can also start your shell with a filename as argument and its commands will be run at beginning of session before giving the control back. They will be displayed (username and password will be masked) with their results. FILENAME content must be UTF-8 encoded.
If called with a filename argument, all subsequent commands, and their results will be printed in the filename given, in UTF-8 encoding. If called without argument, it stops a current recording session.
All command line starting with a bang (!) will be treated as local commands to run through the local underlying OS shell.
Example: !ls -l will display the content of the current directory.
Returns a succinct list of available commands.
Leave the shell.
Create the given domain name. See above for the duration format to use. Admin, registrant, billing and tech contact ids are mandatory or optional depending on the registry. They may be repeated (except registrant) for registries allowing multiple contacts per role.
Do a domain_info call to the registry for the domain YOURDOMAIN ; most of the the registries prohibit getting information on domain names you do not sponsor.
Do a domain_check call to the registry for the domain ANYDOMAIN ; you can check any domain, existing or not, if you are the sponsoring registrar or not.
A kind of simpler domain_check, just reply by YES or NO for the given domain name.
Start, or stop an incoming transfer, query status of a current running transfer, accept or refuse an outgoing domain name transfer.
The AUTHCODE is mandatory or optional, depending on the registry.
The duration is optional and can be specified (the allowed values depend on the registry) as Ayears or Bmonths where A and B are integers for the number of years or months (this can be abbreviated as Ay or Bm).
Set the current list of nameservers associated to this DOMAIN, add to the current list or delete from the current list.
Set the current list of status associated to this DOMAIN, add to the current list or delete from the current list. First parameter is the domain name, then status names, as needed.
The status names are those in the list given back by the show status command (see above).
Set the current list of contacts associated to this DOMAIN, add to the current list or delete from the current list by providing the contact server ids.
Combination of the previous methods, plus ability to change authInfo and other parameters depending on registry.
Renew the given domain name. Duration and current expiration are optional. See above for the duration format to use.
Delete the given domain name.
For registries handling nameservers as separate objects.
Create the host named HOSTNAME at the registry with the list of IP (IPv4 and IPv6 depending on registry support) given.
Various operations on host objects.
Set the current list of IP addresses associated to this HOSTNAME, add to the current list or delete from the current list. First parameter is the nameserver hostname, then IP addresses, as needed.
Set the current list of status associated to this HOSTNAME, add to the current list or delete from the current list. First parameter is the nameserver hostname, then status names, as needed.
Combines the previous operations.
Change the current name of host objects from HOSTNAME to NEWNAME.
For registries handling contacts as separate objects.
Create a new contact object.
The list of mandatory attributes depend on the registry. Some attributes (like street) may appear multiple times.
Some registry allow setting an ID (using srid=yourchoice), others create the ID, in which case you need to do a get_info_all after contact_create to retrieve the given server ID.
Various operations on contacts.
Set the current list of status associated to this contact SRID, add to the current list or delete from the current list. First parameter is the contact server ID, then status names, as needed.
Change some contacts attributes, as well as statuses.
Start, or stop an incoming transfer, query status of a current running transfer, accept or refuse an outgoing contact transfer.
For registries handling messages, like EPP poll features.
Retrieve a message waiting at registry.
Delete a message waiting at registry.
Notifies if messages are waiting at registry.
Get the numbers of messages waiting at the registry.
If Term::Readline::Gnu or Term::Readline::Perl are installed, it will be automatically used by this shell to provide standard shell autocompletion for commands and parameters.
All commands described above will be available through autocompletion. As you use them, all parameters (domain names, contacts, hostnames, local files) will also be stored and provided to later autocompletion calls (with the [TAB] key).
It will also autocomplete registry= and type= parameters during add/add_registry, from a basic default set of values: registry= values are taken from a basic Net::DRI install without taking into account any private DRD module, and type= values are a default set, not checked against registry= value. Same for target calls, where registry and/or profile name will be autocompleted as possible.
It will even autocomplete TLD on domain names for your current registry after your typed the first label and a dot (and eventually some other characters), during any domain name operation. Same for durations and status values.
Contacts and nameservers will also be autocompleted when used in any domain_* operation.
Contacts attributes will be autocompleted during contact_create based on the current registry & profile.
Information retrieved with domain_info calls will also be used in later autocompletion tries, regarding contact ids and hostnames. During a contact creation, the registry returned contact id is also added for later autocompletion tries.
For autocompletion, contacts are specific to each registry. Hostnames are common to all registries, as are domain names, but domain names are checked against the available TLDs of the current registry when used for autocompletion.
By default, all operations will have some logging information done in files stored in the working directory. There will be a core.log file for all operations and then one file per tuple (registry,profile).
Batch operations are available for some domain name commands: domain_create, domain_delete, domain_renew, domain_check, domain_info, domain_transfer and all domain_update commands. It can be used on a list of domain names for which all other parameters needed by the command are the same.
To do that, just use the command normally as outlined above, but instead of the domain name, put a file path, with at least one / (so for a file "batch.txt" in the current directory, use "./batch.txt").
If you use backticks such as `command` for the domain name, the command will be started locally and its output will be used just like a file.
The shell will then apply the command and its parameters on the domain names listed in the specified file: you should have one domain name per line, blank lines and lines starting with # are ignored.
At the same place a new file is created with a name derived from the given name in which the result of each domain name command will be written. If "input" is the filename used, the results will be written to "input.PID.TIME.results" where PID is the program id of the running shell for these commands and TIME the Unix epoch when the batch started.
As output the shell will give a summary of the number of operations done for each possible outcome (success or error), as well as time statistics.
For now, support questions should be sent to:
<netdri@dotandco.com>
Please also see the SUPPORT file in the distribution.
<http://www.dotandco.com/services/software/Net-DRI/>
Patrick Mevzek, <netdri@dotandco.com>
Copyright (c) 2008-2014,2016-2017 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
See the LICENSE file that comes with this distribution for more details.
To install Net::DRI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::DRI
CPAN shell
perl -MCPAN -e shell install Net::DRI
For more information on module installation, please visit the detailed CPAN module installation guide.