#!/usr/bin/perl $| = 1; BEGIN { do "" }; use strict; use lib $PATH_LIB; use IO::Socket; use OpenSRS::XML_Client qw(:default); use Term::ReadKey; my $registrant_ip = ''; ReadMode('noecho'); print "Username: "; my $username = ReadLine(0); print "\nPassword: "; my $password = ReadLine(0); print "\nDomain: "; my $domain = ReadLine(0); print "\n"; ReadMode( 0 ); chomp $username; chomp $password; chomp $domain; print "$username : $password : $domain"; sleep 5; print "\r" . (" " x 100) . "\r"; my $set_cookie = { protocol => "XCP", action => "set", object => "cookie", registrant_ip => $registrant_ip, attributes => { domain => $domain, reg_username => $username, reg_password => $password, } }; my $XML_Client = new OpenSRS::XML_Client( %OPENSRS ); print "Logging in...\n"; $XML_Client->login(); my $set_cookie_results = $XML_Client->send_cmd( $set_cookie ); if ( $set_cookie_results->{is_success} ) { print "Set cookie!\n"; my $cookie = $set_cookie_results->{attributes}->{cookie}; my $get_domains = { protocol => "XCP", action => "get", object => "domain", cookie => $cookie, attributes => { type => "list", page => "0" } }; my $get_domains_results = $XML_Client->send_cmd( $get_domains ); if ( $get_domains_results->{is_success} ) { print "Got list of domains!\n"; foreach my $d ( @{ $get_domains_results->{attributes}->{domain_list} } ) { my $resp = $XML_Client->send_cmd( { action => 'update', object => 'cookie', cookie => $cookie, attributes => { domain_new => $d } } ); if ( $resp->{is_success} ) { print "Switched to $d!\n"; } else { print "Didn't work: $resp->{response_text}.\n"; exit 0; } my $resp = $XML_Client->send_cmd( { action => 'modify', object => 'domain', cookie => $cookie, attributes => { data => 'status', lock_state => 1, } } ); if ( $resp->{is_success} ) { print " Locked $d!\n"; } else { print " Lock for $d didn't work: $resp->{response_text}.\n"; } } my $resp = $XML_Client->send_cmd( { action => "delete", object => "cookie", cookie => $cookie, attributes => { cookie => $cookie } } ); if ( $resp->{is_success} ) { print "Deleted cookie!\n"; } else { print "Failed to delete cookie: $resp->{response_text}.\n"; } } else { print "Didn't work: $get_domains_results->{response_text}.\n"; } } else { print "Didn't work: $set_cookie_results->{response_text}.\n"; } # close connection to the server print "Logging out...\n"; $XML_Client->logout(); ###########################################################################