0
  "   ˆl–äY>””Ëm
€jãM\jbÑ¿Èƒ-‹¿Å 	0    #!/bin/sh
eval 'if [ -x /usr/local/cpanel/3rdparty/bin/perl ]; then exec /usr/local/cpanel/3rdparty/bin/perl -x -- $0 ${1+"$@"}; else exec /usr/bin/perl -x $0 ${1+"$@"}; fi;'    ## no critic qw(ProhibitStringyEval RequireUseStrict)
  if 0;

#!/usr/bin/perl
# cpanel - scripts/dump_databases_and_users          Copyright 2014 cPanel, Inc.
#                                                           All Rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

# NOTE: This script is designed to run on other systems during a transfer, usually as /usr/bin/perl.

use strict;

BEGIN {
    unshift @INC, '/usr/local/cpanel';
    my %seen_inc;
    @INC = grep { !/(?:^\.|\.\.|\/\.+)/ && !$seen_inc{$_}++ } @INC;
    undef %seen_inc;
}

our $VERSION = '1.2';

#
# No USE statements so this runs on other platforms
# We must require everything in AFTER the version line
#

if ( @ARGV && grep( m/version/, @ARGV ) ) {
    print "dump_databases_and_users VERSION $VERSION\n";
    exit(0);
}

require Cpanel::Config::Users;
require Cpanel::DB::Map::Reader;
require Cpanel::JSON;
require Cpanel::PwCache::Build;

Cpanel::PwCache::Build::init_passwdless_pwcache();

my @cpusers    = Cpanel::Config::Users::getcpusers();
my $master_map = {};

foreach my $cpuser ( Cpanel::Config::Users::getcpusers() ) {
    my $dbmap = eval { Cpanel::DB::Map::Reader->new( cpuser => $cpuser, engine => 'mysql' ) };
    if ($dbmap) {

        my @myusers = $dbmap->get_dbusers();
        my @mydbs   = $dbmap->get_databases();

        my @pgusers = $dbmap->get_dbusers();
        my @pgdbs   = $dbmap->get_databases();

        @{ $master_map->{'dbs'}{'PGSQL'} }{@pgdbs} = ( ( { 'owner' => $cpuser } ) x scalar @pgdbs );
        @{ $master_map->{'dbs'}{'MYSQL'} }{@mydbs} = ( ( { 'owner' => $cpuser } ) x scalar @mydbs );

        @{ $master_map->{'users'}{'PGSQL'} }{@pgusers} = ( ( { 'owner' => $cpuser } ) x scalar @pgusers );
        @{ $master_map->{'users'}{'MYSQL'} }{@myusers} = ( ( { 'owner' => $cpuser } ) x scalar @myusers );
    }
}

delete $master_map->{'users'}{'PGSQL'}{''};
delete $master_map->{'users'}{'MYSQL'}{''};
delete $master_map->{'dbs'}{'PGSQL'}{''};
delete $master_map->{'dbs'}{'MYSQL'}{''};

print Cpanel::JSON::Dump($master_map);
     ˆÀÈƒh¹¿Å      auto
  "   ˆl–ß=¿J	µ2ÛR‚ œPÜ÷
˜´oÉƒh¹ÀÆ      13:63
  "   ˆl–ßi~”ªe¶…@ã-\mÅ1hßÊƒAsÁÇ 	p    #!/usr/local/cpanel/3rdparty/bin/perl

my $hasnetsslftp;
eval {
    require Net::FTPSSL;
    $hasnetsslftp = 1;
};
die if ( !$hasnetsslftp );

my (%ARGS) = parseargv();

if ( $ARGS{user} eq "" ) {
    die "Sorry, you must specify a user to login to the remote server as.";
}
if ( $ARGS{host} eq "" ) {
    die "Sorry, you must specify a remote server.";
}
if ( $ARGS{srcfile} eq "" ) {
    die "Sorry you must specify a source file.\n";
}
if ( $ARGS{destfile} eq "" ) {
    die "Sorry you must specify a destfile file.\n";
}
if ( $ARGS{port} eq "22" ) {
    print "Assuming port 21 since 22 was specified!\n";
    $ARGS{port} = 21;
}

my $pass = <STDIN>;
chomp($pass);

if ( my $pid = fork() ) {
    while ( waitpid( $pid, 1 ) != -1 ) {
        print ".\n";
        sleep(1);
    }
}
else {
    my $ftp;
    if ( $ARGS{'port'} ne "" ) {
        $ftp = Net::FTPSSL->new( $ARGS{host}, Debug => 1, Passive => 1, Port => $ARGS{'port'}, encryption => 'E' )
          || die "Cannot connect to $ARGS{host}:$ARGS{port} $@";
    }
    else {
        $ftp = Net::FTPSSL->new( $ARGS{host}, Debug => 1, Passive => 1, Port => 21, encryption => 'E' )
          || die "Cannot connect to $ARGS{host}:21:  $@";
    }
    $ftp->login( $ARGS{user}, $pass ) || die "Cannot login ", $ftp->last_message;
    my (@FINFO) = split( /\//, $ARGS{srcfile} );
    my $file;
    my $dir;
    if ( $ARGS{srcfile} =~ /^\// ) {
        shift(@FINFO);    #/
        shift(@FINFO);    #home
        shift(@FINFO);    #user
    }
    $file = pop(@FINFO);
    $dir  = join( "/", @F