live
  "   ˆl–Ðz¾”Jj"TÒ�zàœ¸”Å£Áƒ/ƒÀ¿ 	V    #!/usr/local/cpanel/3rdparty/bin/perl

package scripts::whmlogin;

# cpanel - scripts/whmlogin                    Copyright 2022 cPanel L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use strict;
use warnings;

use Cpanel::SafeRun::Object ();
use Cpanel::JSON            ();

exit( __PACKAGE__->run(@ARGV) ) unless caller();

sub run {
    my ( $self, @args ) = @_;

    unless ( $> == 0 || $< == 0 ) {
        print "You must run this program as the root user.\n";
        return 1;
    }

    my $nowait;
    if (@args) {
        my $help = grep( m/help/, @args ) ? 1 : 0;
        my $msg  = <<EOS;
Usage: $0 [--nowait]
Generate a single use auto-login url for WHM

Options:
   --nowait     Do not wait for /var/cpanel/cpinit-ip.wait to be removed,
                instead exit with return status 2 if waiting would have
                occurred.

EOS
        if ($help) {
            print STDOUT $msg;
            return 0;
        }
        if ( grep m/nowait/, @args ) {
            $nowait = 1;
        }
        else {
            print STDERR "Invalid arguments: @args\n\n$msg";
            return 1;
        }
    }

    my $elapsed_wait = 0;
    my $wait_file    = '/var/cpanel/cpinit-ip.wait';
    if ( -e $wait_file ) {
        if ($nowait) {
            return 2;
        }
        print STDERR "Please wait for initial setup to complete.";
        while ( -e $wait_file ) {
            sleep 1;
            ++$elapsed_wait;
            print STDERR ".";
            if ( $elapsed_wait > 300 ) {
                print STDERR "\nGiving up on waiting.\n";
                unlink $wait_file or print STDERR "Could not remove $wait_file: $!";
                last;
            }
        }
        print STDERR "\n\n";
    }

    my $run = Cpanel::SafeRun::Object->new_or_die(
        'program' => '/usr/local/cpanel/bin/whmapi1',
        'args'    => [ '--output=json', 'create_user_session', 'user=root', 'service=whostmgrd' ]
    );
    my $json = $run->stdout();
    my $out  = Cpanel::JSON::Load($json);
    if ( !$out->{'metadata'}{'result'} ) { die "whmapi1 create_user_session failed: $out->{'metadata'}{'reason'}" }
    print $out->{data}{url} . "\n";
    return 0;
}

  #   ˆl–äY>”je¶…8 Cq§nµ1hßÂ„u—YÁÀ ?÷     a
    WpWj+¹ ã                   @   s  d Z dZdZdZddlmZ ddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddlZddlZddlZzddlZW n eyŽ   dZY n0 zddlZW n ey²   dZY n0 eefZzeef7 ZW n eyÜ   Y n0 g d¢ZdZd	Zd
ZdZed ZdZdZ dZ!dZ"dZ#dZ$d
Z%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4d Z5e5Z6e$e%e&e'e*e+e,e(e)e-e.e/fZ7e$e%e,e/fZ8e-e.e/fZ9d!Z:h d"£Z;e<e<e<e=e=e=d#œZ>ej?d$k�rÀd%Z@ne A¡ Z@d&d'„ ZBd(d)„ ZCd*d+„ ZDd,e6fd-d.„ZEd/d0„ ZFdedfd1d2„ZGd3d4„ ZHG d5d6„ d6eIƒZJG d7d8„ d8eJƒZKG d9d:„ d:eJƒZLG d;d<„ d<eJƒZMG d=d>„ d>eJƒZNG d?d@„ d@eJƒZOG dAdB„ dBeOƒZPG dCdD„ dDeOƒZQG dEdF„ dFeOƒZRG dGdH„ dHeOƒZSG dIdJ„ dJeOƒZTG dKdL„ dLƒZUG dMdN„ dNƒZVG dOdP„ dPeWƒZXG dQdR„ dReWƒZYG dSdT„ dTe	jZƒZ[G dUdV„ dVeJƒZ\G dWdX„ dXe\ƒZ]G dYdZ„ dZe\ƒZ^G d[d\„ d\e\ƒZ_G d]d^„ d^e\ƒZ`G d_d`„ d`e\ƒZaG dadb„ dbe\ƒZbe\eeKfZcdvdcdd„Zddedf„ Zedgdh„ Zfdidj„ ZgeeefegdkœZheWƒ Zie jdl¡ZkG dmdn„ dneWƒZlG dodp„ dpeWƒZmdqdr„ ZnemjZdsdt„ Zoepduk�r
eoƒ  dS )wz,Read from and write to tar format archives.
z0.9.0u"   Lars GustÃ¤bel (lars@gustaebel.de)u4   Gustavo Niemeyer, Niels GustÃ¤bel, Richard Townsend.é    )ÚopenN)ÚTarFileÚTarInfoÚ
is_tarfileÚTarErrorÚ	ReadErrorÚCompressionErrorÚStreamErrorÚExtractErrorÚHeaderErrorÚENCODINGÚUSTAR_FORMATÚ
GNU_FORMATÚ
PAX_FORMATÚDEFAULT_FORMATr   Tz/etc/python/tarfile.cfgó    i   é   s   ustar   s   ustar 00éd   é›   ó   0ó   1ó   2ó   3ó   4ó   5ó   6ó   7ó   Ló   Kó   Só   xó   gó   Xé   