---
name: "Net::DRI::Shell"
section: "3pm"
platform: "linux"
package: "libnet-dri-perl"
version: "0.96-1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/Net::DRI::Shell"
---

# Net::DRI::Shell(3pm)

Command Line Shell for Net::DRI, with batch features and autocompletion support

## NAME

Net::DRI::Shell - Command Line Shell for Net::DRI, with batch features and autocompletion support

## SYNOPSYS

```
 perl -I../../ ./Shell.pm
 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 shell, version 1.07
 Net::DRI object created with a cache TTL of 10 seconds and logging into files in current directory
 NetDRI> add_registry registry=EURid clID=YOURLOGIN
 NetDRI(EURid)> add_current_profile name=profile1 type=epp defer=0 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
```

## DESCRIPTION

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.

## AVAILABLE COMMANDS

After having started this shell, the available commands are the following.

### SESSION COMMANDS

*add\_registry registry=REGISTRYNAME clID=YOURLOGIN*

Replace REGISTRYNAME with the Net::DRI::DRD module you want to use, and YOURLOGIN with your client login for this registry.

*add\_current\_profile name=profile1 type=epp defer=0 client\_login=YOURLOGIN client\_password=YOURPASSWORD*

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 !

*add registry=REGISTRYNAME clID=YOURLOGIN name=profile1 type=epp defer=0 client\_login=YOURLOGIN client\_password=YOURPASSWORD*

This is a shortcut, doing the equivalent of add\_registry, and then add\_current\_profile.

*get\_info\_all*

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 profiles*

Show the list of registries and associated profiles currently in use (opened in this shell with add\_registry + add\_current\_profile, or add).

*show tlds*

Show the list of TLDs handled by the currently selected registry.

*show periods*

Show the list of allowed periods (domain name durations) for the currently selected registry.

*show objects*

Show the list of managed objects types at the currently selected registry.

*show types*

Show the list of profile types at the currently selected registry

*show status*

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).

*show config*

This will show all current config options. See `"set"` command below for the list of config options.

*set OPTION=VALUE*

The set command can be used to change some options inside the shell.

The current list of available options is:

verbose

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.

*target REGISTRYNAME PROFILENAME*

Switch to registry REGISTRYNAME (from currently available registries) and profile PROFILENAME (from currently available profiles in registry REGISTRYNAME).

*run FILENAME*

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.

*record FILENAME*

If called with a filename argument, all subsequent commands, and their results will be printed in the filename given. If called without argument, it stops a current recording session.

*!cmd*

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.

*help*

Returns a succinct list of available commands.

*quit*

Leave the shell.

### DOMAIN COMMANDS

*domain\_create DOMAIN \[duration=X\] \[ns=HOSTNAMEA IPA1 IPA2 ... HOSTNAMEB IPB1 IPB2 ...\] \[admin=SRID1\] \[registrant=SRID2\] \[billing=SRID3\] \[tech=SRID4\] \[auth=X\]*

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.

*domain\_info DOMAIN*

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.

*domain\_check DOMAIN*

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.

*domain\_exist DOMAIN*

A kind of simpler domain\_check, just reply by YES or NO for the given domain name.

*domain\_transfer\_start DOMAIN auth=AUTHCODE \[duration=PERIOD\]*

*domain\_transfer\_stop DOMAIN \[auth=AUTHCODE\]*

*domain\_transfer\_query DOMAIN \[auth=AUTHCODE\]*

*domain\_transfer\_accept DOMAIN \[auth=AUTHCODE\]*

*domain\_transfer\_refuse DOMAIN \[auth=AUTHCODE\]*

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).

*domain\_update\_ns\_set DOMAIN HOSTNAMEA IPA1 IPA2 ... HOSTNAMEB IPB1 IPB2 ...*

*domain\_update\_ns\_add DOMAIN HOSTNAMEA IPA1 IPA2 ... HOSTNAMEB IPB1 IPB2 ...*

*domain\_update\_ns\_del DOMAIN HOSTNAMEA IPA1 IPA2 ... HOSTNAMEB IPB1 IPB2 ...*

Set the current list of nameservers associated to this DOMAIN, add to the current list or delete from the current list.

*domain\_update\_status\_set DOMAIN STATUS1 STATUS2 ...*

*domain\_update\_status\_add DOMAIN STATUS1 STATUS2 ...*

*domain\_update\_status\_del DOMAIN STATUS1 STATUS2 ...*

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).

*domain\_update\_contact\_set DOMAIN SRVID1 SRVID2 ...*

*domain\_update\_contact\_add DOMAIN SRVID2 SRVID2 ...*

*domain\_update\_contact\_del DOMAIN SRVID1 SRVID2 ...*

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.

*domain\_update DOMAIN +status=S1 -status=S2 +admin=C1 -tech=C2 -billing=C3 registrant=C4 auth=A +ns=... -ns=...*

Combination of the previous methods, plus ability to change authInfo and other parameters depending on registry.

*domain\_renew DOMAIN \[duration=X\] \[current\_expiration=YYYY-MM-DD\]*

Renew the given domain name. Duration and current expiration are optional. See above for the duration format to use.

*domain\_delete DOMAIN*

Delete the given domain name.

### HOST COMMANDS

For registries handling nameservers as separate objects.

*host\_create HOSTNAME IP1 IP2 ...*

Create the host named HOSTNAME at the registry with the list of IP (IPv4 and IPv6 depending on registry support) given.

*host\_delete HOSTNAME*

*host\_info HOSTNAME*

*host\_check HOSTNAME*

Various operations on host objects.

*host\_update\_ip\_set HOSTNAME IP1 IP2 ...*

*host\_update\_ip\_add HOSTNAME IP1 IP2 ...*

*host\_update\_ip\_del HOSTNAME IP1 IP2 ...*

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.

*host\_update\_status\_set HOSTNAME STATUS1 STATUS2 ...*

*host\_update\_status\_add HOSTNAME STATUS1 STATUS2 ...*

*host\_update\_status\_del HOSTNAME STATUS1 STATUS2 ...*

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.

The status names are those in the list given back by the show status command (see above).

*host\_update HOSTNAME +ip=IP1 +ip=IP2 -ip=IP3 +status=STATUS1 -status=STATUS2 name=NEWNAME*

Combines the previous operations.

*host\_update\_name\_set HOSTNAME NEWNAME*

Change the current name of host objects from HOSTNAME to NEWNAME.

### CONTACT COMMANDS

For registries handling contacts as separate objects.

*contact\_create name=X org=Y street=Z1 street=Z2 email=A voice=B ...*

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.

*contact\_delete SRID*

*contact\_info SRID*

*contact\_check SRID*

Various operations on contacts.

*contact\_update\_status\_set SRID STATUS1 STATUS2 ...*

*contact\_update\_status\_add SRID STATUS1 STATUS2 ...*

*contact\_update\_status\_del SRID STATUS1 STATUS2 ...*

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.

The status names are those in the list given back by the show status command (see above).

*contact\_update SRID name=X org=Y ... +status=... -status=...*

Change some contacts attributes, as well as statuses.

*contact\_transfer\_start SRID*

*contact\_transfer\_stop SRID*

*contact\_transfer\_query SRID*

*contact\_transfer\_accept SRID*

*contact\_transfer\_refuse SRID*

Start, or stop an incoming transfer, query status of a current running transfer, accept or refuse an outgoing contact transfer.

### MESSAGE COMMANDS

For registries handling messages, like EPP poll features.

*message\_retrieve \[ID\]*

Retrieve a message waiting at registry.

*message\_delete \[ID\]*

Delete a message waiting at registry.

*message\_waiting*

Notifies if messages are waiting at registry.

*message\_count*

Get the numbers of messages waiting at the registry.

## COMPLETION

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.

## LOGGING

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

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.

## SUPPORT

For now, support questions should be sent to:

\<netdri@dotandco.com\>

Please also see the SUPPORT file in the distribution.

## SEE ALSO

\<http://www.dotandco.com/services/software/Net-DRI/\>

## AUTHOR

Patrick Mevzek, \<netdri@dotandco.com\>

## COPYRIGHT

Copyright (c) 2008-2010 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.
