CHips L MINI SHELL

CHips L pro

Current Path : /proc/self/root/proc/2/root/proc/2/root/scripts/
Upload File :
Current File : //proc/self/root/proc/2/root/proc/2/root/scripts/regenerate_tokens

#!/usr/local/cpanel/3rdparty/bin/perl
# cpanel - scripts/regenerate_tokens               Copyright 2020 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

package scripts::regenerate_tokens;

use strict;
use warnings;
use Cpanel::Imports;
use Cpanel::Hyperscaler::Regenerate ();

exit run(@ARGV) unless caller;

sub run {
    my (@args) = @_;
    my ( $exit_code, $force ) = _handle_args( \@args );
    return $exit_code if defined $exit_code;

    if ( !Cpanel::Hyperscaler::Regenerate::is_cloud() ) {
        logger()->info('This system does not appear to be a cloud instance.');
        return 0;
    }

    return ( Cpanel::Hyperscaler::Regenerate::regenerate_tokens($force) ? 0 : 1 );
}

sub _handle_args {
    my ($args) = @_;
    if ( @$args == 1 && $args->[0] eq '--help' ) {
        print _usage();
        return 0;
    }
    elsif ( @$args == 1 && $args->[0] eq '--force' ) {
        return ( undef, 1 );
    }
    elsif ( @$args > 0 ) {
        print STDERR "ERROR unknown option: $args->[0]\n\n";
        print STDERR _usage();
        return 1;
    }
    return undef;
}

sub _usage {
    return <<EOU;
usage: $0 [--force]

 This script regenerates secret data on a virtual machine that
 is not handled properly by most virtual machine templating
 systems.

flags:

 --force  Rerun all cleanups regardless of whether they have run before.

EOU
}

1;

Copyright 2K16 - 2K18 Indonesian Hacker Rulez