403Webshell
Server IP : 103.119.228.120  /  Your IP : 3.137.164.229
Web Server : Apache
System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : nobody ( 99)
PHP Version : 5.6.40
Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime
MySQL : ON |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : ON |  Pkexec : ON
Directory :  /usr/local/ssl/local/ssl/local/ssl/local/ssl/share/doc/rsync-3.1.2/support/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/local/ssl/local/ssl/local/ssl/local/ssl/share/doc/rsync-3.1.2/support/file-attr-restore
#!/usr/bin/perl
# This script will parse the output of "find ARG [ARG...] -ls" and
# apply (at your discretion) the permissions, owner, and group info
# it reads onto any existing files and dirs (it doesn't try to affect
# symlinks).  Run this with --help (-h) for a usage summary.

use strict;
use Getopt::Long;

our($p_opt, $o_opt, $g_opt, $map_file, $dry_run, $verbosity, $help_opt);

&Getopt::Long::Configure('bundling');
&usage if !&GetOptions(
    'all|a' => sub { $p_opt = $o_opt = $g_opt = 1 },
    'perms|p' => \$p_opt,
    'owner|o' => \$o_opt,
    'groups|g' => \$g_opt,
    'map|m=s' => \$map_file,
    'dry-run|n' => \$dry_run,
    'help|h' => \$help_opt,
    'verbose|v+' => \$verbosity,
) || $help_opt;

our(%uid_hash, %gid_hash);

$" = ', '; # How to join arrays referenced in double-quotes.

&parse_map_file($map_file) if defined $map_file;

my $detail_line = qr{
    ^ \s* \d+ \s+             # ignore inode
    \d+ \s+                   # ignore size
    ([-bcdlps])               # 1. File type
    ( [-r][-w][-xsS]          # 2. user-permissions
      [-r][-w][-xsS]          #    group-permissions
      [-r][-w][-xtT] ) \s+    #    other-permissions
    \d+ \s+                   # ignore number of links
    (\S+) \s+                 # 3. owner
    (\S+) \s+                 # 4. group
    (?: \d+ \s+ )?            # ignore size (when present)
    \w+ \s+ \d+ \s+           # ignore month and date
    \d+ (?: : \d+ )? \s+      # ignore time or year
    ([^\r\n]+) $              # 5. name
}x;

while (<>) {
    my($type, $perms, $owner, $group, $name) = /$detail_line/;
    die "Invalid input line $.:\n$_" unless defined $name;
    die "A filename is not properly escaped:\n$_" unless $name =~ /^[^"\\]*(\\(\d\d\d|\D)[^"\\]*)*$/;
    my $fn = $name;
    $fn =~ s/\\(\d+|.)/ eval "\"\\$1\"" /eg;
    if ($type eq '-') {
	undef $type unless -f $fn;
    } elsif ($type eq 'd') {
	undef $type unless -d $fn;
    } elsif ($type eq 'b') {
	undef $type unless -b $fn;
    } elsif ($type eq 'c') {
	undef $type unless -c $fn;
    } elsif ($type eq 'p') {
	undef $type unless -p $fn;
    } elsif ($type eq 's') {
	undef $type unless -S $fn;
    } else {
	if ($verbosity) {
	    if ($type eq 'l') {
		$name =~ s/ -> .*//;
		$type = 'symlink';
	    } else {
		$type = "type '$type'";
	    }
	    print "Skipping $name ($type ignored)\n";
	}
	next;
    }
    if (!defined $type) {
	my $reason = -e _ ? "types don't match" : 'missing';
	print "Skipping $name ($reason)\n";
	next;
    }
    my($cur_mode, $cur_uid, $cur_gid) = (stat(_))[2,4,5];
    $cur_mode &= 07777;
    my $highs = join('', $perms =~ /..(.)..(.)..(.)/);
    $highs =~ tr/-rwxSTst/00001111/;
    $perms =~ tr/-STrwxst/00011111/;
    my $mode = $p_opt ? oct('0b' . $highs . $perms) : $cur_mode;
    my $uid = $o_opt ? $uid_hash{$owner} : $cur_uid;
    if (!defined $uid) {
	if ($owner =~ /^\d+$/) {
	    $uid = $owner;
	} else {
	    $uid = getpwnam($owner);
	}
	$uid_hash{$owner} = $uid;
    }
    my $gid = $g_opt ? $gid_hash{$group} : $cur_gid;
    if (!defined $gid) {
	if ($group =~ /^\d+$/) {
	    $gid = $group;
	} else {
	    $gid = getgrnam($group);
	}
	$gid_hash{$group} = $gid;
    }

    my @changes;
    if ($mode != $cur_mode) {
	push(@changes, 'permissions');
	if (!$dry_run && !chmod($mode, $fn)) {
	    warn "chmod($mode, \"$name\") failed: $!\n";
	}
    }
    if ($uid != $cur_uid || $gid != $cur_gid) {
	push(@changes, 'owner') if $uid != $cur_uid;
	push(@changes, 'group') if $gid != $cur_gid;
	if (!$dry_run) {
	    if (!chown($uid, $gid, $fn)) {
		warn "chown($uid, $gid, \"$name\") failed: $!\n";
	    }
	    if (($mode & 06000) && !chmod($mode, $fn)) {
		warn "post-chown chmod($mode, \"$name\") failed: $!\n";
	    }
	}
    }
    if (@changes) {
	print "$name: changed @changes\n";
    } elsif ($verbosity) {
	print "$name: OK\n";
    }
}
exit;

sub parse_map_file
{
    my($fn) = @_;
    open(IN, $fn) or die "Unable to open $fn: $!\n";
    while (<IN>) {
	if (/^user\s+(\S+)\s+(\S+)/) {
	    $uid_hash{$1} = $2;
	} elsif (/^group\s+(\S+)\s+(\S+)/) {
	    $gid_hash{$1} = $2;
	} else {
	    die "Invalid line #$. in mapfile `$fn':\n$_";
	}
    }
    close IN;
}

sub usage
{
    die <<EOT;
Usage: file-attr-restore [OPTIONS] FILE [FILE...]
 -a, --all       Restore all the attributes (-pog)
 -p, --perms     Restore the permissions
 -o, --owner     Restore the ownership
 -g, --groups    Restore the group
 -m, --map=FILE  Read user/group mappings from FILE
 -n, --dry-run   Don't actually make the changes
 -v, --verbose   Increase verbosity
 -h, --help      Show this help text

The FILE arg(s) should have been created by running the "find"
program with "-ls" as the output specifier.

The input file for the --map option must be in this format:

    user FROM TO
    group FROM TO

The "FROM" should be an user/group mentioned in the input, and the TO
should be either a uid/gid number, or a local user/group name.
EOT
}

Youez - 2016 - github.com/yon3zu
LinuXploit