[ Avaa Bypassed ]




Upload:

Command:

www-data@3.144.134.101: ~ $
#!/usr/bin/perl

use strict;
use warnings;
no warnings 'redefine';
no warnings 'uninitialized';
BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
our %access = &get_module_acl();
our ($module_config_directory, $module_name, %text, %config, %gconfig);
our ($timezones_file, $currentzone_link, $currentzone_file, $timezones_dir,
     $sysclock_file);
our ($get_hardware_time_error);
our $cron_cmd = "$module_config_directory/sync.pl";
if ($config{'zone_style'}) {
	do "$config{'zone_style'}-lib.pl";
	}
&foreign_require("webmincron");

sub find_cron_job
{
&foreign_require("cron", "cron-lib.pl");
my @jobs = &cron::list_cron_jobs();
my ($job) = grep { $_->{'command'} && $_->{'user'} &&
		   $_->{'command'} eq $cron_cmd &&
		   $_->{'user'} eq 'root' } @jobs;
return $job;
}

sub find_webmin_cron_job
{
return &webmincron::find_webmin_cron($module_name, 'sync_time_cron');
}

# sync_time(server, hardware-too)
# Syncs the system and maybe hardware time with some server. Returns undef
# on success, or an error message on failure.
sub sync_time
{
my ($server, $hwtoo) = @_;
my @servs = split(/\s+/, $server);
my $servs = join(" ", map { quotemeta($_) } @servs);
my $out;
if (&has_command("ntpdate")) {
	$out = &backquote_logged("ntpdate -u $servs 2>&1");
	}
elsif (&has_command("sntp")) {
	$out = &backquote_logged("sntp -s $servs 2>&1");
	}
elsif (&has_command("chronyc")) {
	$out = &backquote_logged("systemctl restart chronyd 2>&1");
	$out .= &backquote_logged("chronyc makestep 2>&1");
	sleep 5;
	}
else {
	$out = "Missing ntpdate and sntp commands";
	$? = 1;
	}
if ($? && $config{'ntp_only'}) {
	# error using ntp, but nothing else is allowed
	return &text('error_entp', "$out");
	}
elsif ($?) {
	# error using ntp. use timeservice
	my ($err, $serv);
	my $rawtime;
	foreach $serv (@servs) {
		$err = undef;
		my $fh = "SOCK";
		&open_socket($serv, 37, $fh, \$err);
		read($fh, $rawtime, 4);
		close($fh);
		last if (!$err && $rawtime);
		}
	return $err if ($err);

	# Got a time .. set it
  	$rawtime = unpack("N", $rawtime);
  	$rawtime -= (17 * 366 + 53 * 365) * 24 * 60 * 60;
	my $diff = abs(time() - $rawtime);
	if ($diff > 365*24*60*60) {
		# Too big!
		return &text('error_ediff', int($diff/(24*60*60)));
		} 
  	my @tm = localtime($rawtime);
	&set_system_time(@tm);
	}

if ($hwtoo) {
	# Set hardware clock time to match system time (which is now correct)
	my $flags = &get_hwclock_flags();
	my $out = &backquote_logged("hwclock $flags --systohc");
	return $? ? $out : undef;
	}

return undef;
}

# sync_time_cron()
# Called from webmin cron to sync from the configured server
sub sync_time_cron
{
my $err = &sync_time($config{'timeserver'}, $config{'timeserver_hardware'});
print STDERR $err if ($err);
}

sub has_timezone
{
return 0 if (!defined(&list_timezones));
if (defined(&os_has_timezones)) {
	return &os_has_timezones();
	}
else {
	my @zones = &list_timezones();
	return @zones ? 1 : 0;
	}
}

# find_same_zone(file)
# Finds an identical timezone file to the one specified
sub find_same_zone
{
my @st = stat(&translate_filename($_[0]));
my $z;
foreach $z (&list_timezones()) {
	my $zf = &translate_filename("$timezones_dir/$z->[0]");
	my @zst = stat($zf);
	if ($zst[7] == $st[7]) {
		my $ex = system("diff ".&translate_filename($currentzone_link)." $zf >/dev/null 2>&1");
		if (!$ex) {
			return $z->[0];
			}
		}
	}
return undef;
}

# get_hwclock_flags()
# Returns command-line flags for hwclock
sub get_hwclock_flags
{
if ($config{'hwclock_flags'} && $config{'hwclock_flags'} eq "sysconfig") {
	my %clock;
	&read_env_file("/etc/sysconfig/clock", \%clock);
	return $clock{'CLOCKFLAGS'};
	}
else {
	return $config{'hwclock_flags'};
	}
}

# get_hardware_time()
# Returns the current hardware time, in localtime format. On failure returns
# an empty array, and sets the global $get_hardware_time_error
sub get_hardware_time
{
my $flags = &get_hwclock_flags();
$flags ||= "";
$get_hardware_time_error = undef;
&clean_language();
my $out = &backquote_command("hwclock $flags 2>/dev/null");
&reset_environment();
if ($out =~ /^(\S+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+(\d+)\s+/) {
	return ($6, $5, $4, $3, &month_to_number($2), $7-1900, &weekday_to_number($1));
	}
elsif ($out =~ /^(\S+)\s+(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+(am|pm)\s+/i) {
	return ($7, $6, $5+($8 eq 'pm' ? 12 : 0), $2, &month_to_number($3), $4-1900, &weekday_to_number($1));
	}
elsif ($out =~ /^(\d+)\-(\d+)\-(\d+)\s+(\d+):(\d+):(\d+)/) {
	# Format like 2016-06-10 22:58:17.999536+3:00
	return ($6, $5, $4, $3, $2-1, $1-1900);
	}
else {
	$get_hardware_time_error = &text('index_ehwclock',
			"<tt>".&html_escape("hwclock $flags")."</tt>",
			"<pre>".&html_escape($out)."</pre>");
	return ( );
	}
}

# get_system_time()
# Returns the current time, in localtime format
sub get_system_time
{
return localtime(time());
}

# set_hardware_time(secs, mins, hours, day, month, year)
sub set_hardware_time
{
my ($second, $minute, $hour, $date, $month, $year) = @_;
$month++;
$year += 1900;
my $format = "--set --date=".
		quotemeta("$month/$date/$year $hour:$minute:$second");
my $flags = &get_hwclock_flags();
my $out = &backquote_logged("hwclock $flags $format 2>&1");
return $? ? $out : undef;
}

# set_system_time(secs, mins, hours, day, month, year)
sub set_system_time
{
my ($second, $minute, $hour, $date, $month, $year) = @_;
$second = &zeropad($second, 2);
$minute = &zeropad($minute, 2);
$hour = &zeropad($hour, 2);
$date = &zeropad($date, 2);
$month = &zeropad($month+1, 2);
$year = &zeropad($year+1900, 4);
my $format;
if ($config{'seconds'} == 2) {
	$format = $year.$month.$date.$hour.$minute.".".$second;
	}
elsif ($config{'seconds'} == 1) {
	$format = $month.$date.$hour.$minute.$year.".".$second;
	}
else {
	$format = $month.$date.$hour.$minute.substr($year, -2);
	}
my $out = &backquote_logged("echo yes | date ".quotemeta($format)." 2>&1");
if ($gconfig{'os_type'} eq 'freebsd' || $gconfig{'os_type'} eq 'netbsd') {
	return int($?/256) == 1 ? $out : undef;
	}
else {
	return $? ? $out : undef;
	}
}

sub zeropad
{
my ($str, $len) = @_;
while(length($str) < $len) {
	$str = "0".$str;
	}
return $str;
}

our @weekday_names = ( "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" );

# weekday_to_number(day)
# Converts a day like Mon to a number like 1
sub weekday_to_number
{
for(my $i=0; $i<@weekday_names; $i++) {
	return $i if (lc(substr($weekday_names[$i], 0, 3)) eq lc($_[0]));
	}
return undef;
}

sub number_to_weekday
{
return defined($_[0]) ? ucfirst($weekday_names[$_[0]]) : undef;
}

# Returns 1 if this system supports setting the hardware clock.
sub support_hwtime
{
return &has_command("hwclock") &&
       &execute_command("hwclock") == 0 &&
       !&running_in_xen() && !&running_in_vserver() &&
       !&running_in_openvz() && !&running_in_zone();
}

# config_pre_load(mod-info-ref, [mod-order-ref])
# Check if some config options are conditional,
# and if not allowed, remove them from listing
sub config_pre_load
{
my ($modconf_info, $modconf_order) = @_;
my @forbidden_keys;

# Do not display timeformat for Linux systems
push(@forbidden_keys, 'seconds')
	if ($gconfig{'os_type'} =~ /linux$/);

# Remove forbidden from display
if ($modconf_info) {
	foreach my $fkey (@forbidden_keys) {
		delete($modconf_info->{$fkey});
		@{$modconf_order} = grep { $_ ne $fkey } @{$modconf_order}
			if ($modconf_order);
		}
	}
}

1;


Filemanager

Name Type Size Permission Actions
help Folder 0755
images Folder 0755
lang Folder 0755
CHANGELOG File 1.56 KB 0644
acl_security.pl File 687 B 0755
apply.cgi File 2.93 KB 0755
backup_config.pl File 775 B 0755
config-ALL-linux File 94 B 0644
config-freebsd File 95 B 0644
config-hpux File 76 B 0644
config-irix File 76 B 0644
config-macos File 76 B 0644
config-netbsd File 76 B 0644
config-openserver File 76 B 0644
config-redhat-linux File 117 B 0644
config-solaris File 95 B 0644
config.info File 537 B 0644
config.info.ca File 611 B 0644
config.info.cs File 587 B 0644
config.info.de File 566 B 0644
config.info.es File 611 B 0644
config.info.fa File 776 B 0644
config.info.fr File 634 B 0644
config.info.hr File 0 B 0644
config.info.hu File 594 B 0644
config.info.it File 615 B 0644
config.info.ja File 278 B 0644
config.info.ko File 577 B 0644
config.info.ms File 572 B 0644
config.info.nl File 549 B 0644
config.info.no File 560 B 0644
config.info.pl File 590 B 0644
config.info.pt_BR File 647 B 0644
config.info.ru File 923 B 0644
config.info.sk File 583 B 0644
config.info.sv File 179 B 0644
config.info.tr File 428 B 0644
config.info.uk File 473 B 0644
config.info.zh File 96 B 0644
config.info.zh_TW File 224 B 0644
defaultacl File 47 B 0644
freebsd-lib.pl File 1.29 KB 0755
index.cgi File 7.62 KB 0755
linux-lib.pl File 2.02 KB 0755
log_parser.pl File 936 B 0755
module.info File 228 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 117 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 152 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 188 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 185 B 0644
module.info.ca File 133 B 0644
module.info.ca.auto File 14 B 0644
module.info.cs File 25 B 0644
module.info.cs.auto File 100 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 112 B 0644
module.info.de File 116 B 0644
module.info.de.auto File 13 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 243 B 0644
module.info.es File 25 B 0644
module.info.es.auto File 115 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 125 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 177 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 135 B 0644
module.info.fr File 23 B 0644
module.info.fr.auto File 123 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 142 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 135 B 0644
module.info.hu File 35 B 0644
module.info.hu.auto File 122 B 0644
module.info.it File 23 B 0644
module.info.it.auto File 97 B 0644
module.info.ja File 27 B 0644
module.info.ja.auto File 145 B 0644
module.info.ko File 25 B 0644
module.info.ko.auto File 118 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 143 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 122 B 0644
module.info.ms File 117 B 0644
module.info.ms.auto File 13 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 134 B 0644
module.info.nl File 21 B 0644
module.info.nl.auto File 94 B 0644
module.info.no File 19 B 0644
module.info.no.auto File 93 B 0644
module.info.pl File 100 B 0644
module.info.pl.auto File 13 B 0644
module.info.pt File 25 B 0644
module.info.pt.auto File 105 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 138 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 130 B 0644
module.info.ru File 38 B 0644
module.info.ru.auto File 162 B 0644
module.info.sk File 25 B 0644
module.info.sk.auto File 104 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 125 B 0644
module.info.sv File 18 B 0644
module.info.sv.auto File 106 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 250 B 0644
module.info.tr File 23 B 0644
module.info.tr.auto File 107 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 180 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 180 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 168 B 0644
module.info.zh File 91 B 0644
module.info.zh_TW File 24 B 0644
module.info.zh_TW.auto File 91 B 0644
postinstall.pl File 674 B 0755
rbac-mapping File 73 B 0644
save_timezone.cgi File 359 B 0755
solaris-lib.pl File 1.39 KB 0755
time-lib.pl File 7.17 KB 0755
time.js File 785 B 0644
uninstall.pl File 330 B 0755