GIF89a=( �' 7IAXKgNgYvYx\%wh&h}t�h%�s%x�}9�R��&�0%� (�.��5�SD��&�a)�x5��;ͣ*ȡ&ղ)ׯ7׵<ѻ4�3�H֧KͯT��Y�aq��q��F� !� ' !� NETSCAPE2.0 , =( ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g���E�������R���E����B�� ��ȸ��D���"�Ů� �H��L��D٫D�B�����D���T���H �G��A R�ڐ |�� ٭&��E8�S�kG�A�px�a��� R2XB��E8I���6X�:vT)�~��q�賥��"F~%x� � 4#Z�0O|-4Bs�X:= Q� Sal��yXJ`GȦ|s h��K3l7�B|�$'7Jީܪ0!��D�n=�P� ����0`�R�lj����v>���5 �.69�ϸd�����nlv�9��f{���Pbx �l5}�p� ��� �3a���I�O����!ܾ���i��9��#��)p�a ޽ �{�)vm��%D~ 6f��s}Œ�D�W E�`!� �&L8x� �ܝ{)x`X/>�}m��R�*|`D�=�_ ^�5 !_&'a�O�7�c��`DCx`�¥�9�Y�F���`?��"� �n@`�} lď��@4>�d S �v�xN��"@~d��=�g�s~G��� ���ud &p8Q�)ƫlXD����A~H�ySun�j���k*D�LH�] ��C"J��Xb~ʪwSt}6K,��q�S:9ت:���l�@�`�� �.۬�t9�S�[:��=`9N����{¿�A !R�:���6��x�0�_ �;������^���#����!����U���;0L1�����p% A��U̬ݵ��%�S��!���~`�G���� ���=4�np�3���������u�u�ٮ|%2�I��r�#0��J``8�@S@5� ���^`8E�]�.�S���7 � �0�j S�D� z���i�S�����!���l��w9*�D�I�nEX��� &A�Go�Qf��F��;���}�J����F5��Q|���X��T��y���]� o ��C=��:���PB@ D׽S�(>�C�x}`��xJЬ�۠��p+eE0`�}`A �/NE�� �9@��� H�7�!%B0`�l*��!8 2�%� �:�1�0E��ux%nP1�!�C)�P81l�ɸF#Ƭ{����B0>�� �b�`��O3��()yRpb��E.ZD8�H@% �Rx+%���c� ���f��b�d�`F�"8�XH"��-�|1�6iI, 2�$+](A*j� QT�o0.�U�`�R�}`�SN����yae�����b��o~ S)�y�@��3 �tT�0�&�+~L�f"�-|�~��>!�v��~�\Q1)}@�}h#aP72�"�$ !� " , =( &7IAXG]KgNgYvYxR"k\%w]'}h}t�h%�g+�s%r.m3ax3�x�}9��&��+�!7�0%� (�.�SD��&��;�"&ײ)׻4��6�K� �@pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E �� �������E �´��C���ǶR��D��"Ʒ�ʱH��M��GڬD�B����D��T����G���C�C� l&�~:'�tU�6ɹ#��)�'�.6�&��Ȼ K(8p0N�?!�2"��NIJX>R��OM '��2�*x�>#n� �@<[:�I�f ��T���Cdb��[�}E�5MBo��@�`@��tW-3 �x�B���jI�&E�9[T&$��ﯧ&"s��ȳ����dc�UUρ#���ldj?����`\}���u|3'�R]�6 �S#�!�FKL�*N E���`$�:e�YD�q�.�촁�s \-�jA 9�����-��M[�x(�s��x�|���p��}k�T�DpE@W� ��]k`1� ���Yb ��0l��*n0��"~zBd�~u�7�0Bl��0-�x~|U�U0 �h�*HS�|��e"#"?vp�i`e6^�+q��`m8 #V�� ��VS|`��"m"сSn|@:U���~`pb�G�ED����2F�I�? >�x� R� ��%~jx��<�a�9ij�2�D��&: Z`�]w���:�6��B�7eFJ|�ҧ�,���FǮcS�ʶ+B�,�ܺN���>PAD�HD��~���n��}�#�� Q��S���2�X�{�k�lQ�2�����w�|2� h9��G�,m���3��6-��E�L��I�³*K���q�`DwV�QXS��peS��� qܧTS����R�u �<�a�*At�lmE� � ��N[P1�ۦ��$��@`��Dpy�yXvCAy�B`}D� 0QwG#� �a[^�� $���Ǧ{L�"[��K�g�;�S~��GX.�goT.��ư��x���?1z��x~:�g�|�L� ��S`��0S]P�^p F<""�?!,�!N4&P� ����:T�@h�9%t��:�-~�I<`�9p I&.)^ 40D#p@�j4�ج:�01��rܼF2oW�#Z ;$Q q  �K��Nl#29 !F@�Bh�ᏬL!XF�LHKh�.�hE&J�G��<"WN!�����Y@� >R~19J"�2,/ &.GXB%�R�9B6�W]���W�I�$��9�RE8Y� ��"�A5�Q.axB�&ة�J�! �t)K%tS-�JF b�NMxL��)�R��"���6O!TH�H� 0 !� ) , =( &AXKgNgYvYxR"k\%wh&h}h%�g+�s%r.x3�x�}9��&��+�R,�!7�0%� (�.��5��&�a)��;�"&ף*Ȳ)ׯ7׻4�3��6�H֧KͻH�T��Y��q��h� ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E$����� � ����$E$��"��D� � ������R��C��� E ��H�M��G�D� �B��ϾD��a��`1r��Ӑ�� �o~�zU!L�C'�yW�UGt����ll�0���uG�)A�s[��x� �xO%��X2�  P�n:R/��aHae+�Dm?# ǣ6�8�J�x�Di�M���j���5oQ7�- <! *�l��R2r/a!l)d� A"�E���� &� ;��c �%����b��pe~C"B���H�eF2��`8qb�t_`ur`e� w�u3��Pv�h""�`�Íx�LĹ��3� �~ֺ�:���MDfJ� �۵�W�%�S�X �؁)�@��:E��w�u�Sxb8y\m�zS��Zb�E�L��w!y(>�"w�=�|��s�d �C�W)H�cC$�L �7r.�\{)@�`@ �X�$PD `aaG:���O�72E�amn]�"Rc�x�R� &dR8`g��i�xLR!�P &d����T���i�|�_ � Qi�#�`g:��:noM� :V �)p����W&a=�e�k� j���1߲s�x�W�jal|0��B0�, \j۴:6���C ��W��|��9���zĸV {�;��n��V�m�I��.��PN� ����C��+��By�ѾHŸ:��� 7�Y�FTk�SaoaY$D�S���29R�kt� ��f� ��:��Sp�3�I��DZ� �9���g��u�*3)O��[_hv ,���Et x�BH� �[��64M@�S�M7d�l�ܶ5-��U܍��z�R3Ԭ3~ ��P��5�g: ���kN�&0�j4���#{��3S�2�K�'ợl���2K{� {۶?~m𸧠�I�nE�='����^���_�=��~�#O���'���o..�Y�n��CSO��a��K��o,���b�����{�C�� "�{�K ��w��Ozdը�:$ ���v�] A#� ���a�z)Rx׿ƥ�d``�w-�y�f�K!����|��P��=�`�(f��'Pa ��BJa%��f�%`�}F����6>��`G"�}�=�!o`�^FP�ةQ�C���`(�}\�ݮ ��$<��n@dĠE#��U�I�!� #l��9`k���'Rr��Z�NB�MF �[�+9���-�wj���8�r� ,V�h"�|�S=�G_��"E� 0i*%̲��da0mVk�):;&6p>�jK ��# �D�:�c?:R Ӭf��I-�"�<�="��7�3S��c2RW ,�8(T"P0F¡Jh�" ; 403WebShell
403Webshell
Server IP : 81.88.48.95  /  Your IP : 10.2.217.94, 216.73.216.227
Web Server : Apache
System : Linux opus15 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u3 x86_64
User : nobody ( 99)
PHP Version : 5.3.3-7+squeeze3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/bin/print
#! /usr/bin/perl
###############################################################################
#
#  Run-Mailcap:  Run a program specified in the mailcap file based on a mime
#  type.
#
#  Written by Brian White <bcwhite@pobox.com>
#  This file has been placed in the public domain (the only true "free").
#
###############################################################################


$debug=0;
$norun=0;
$nopager=0;
$etcmimetyp="/etc/mime.types";
$shrmimetyp="/usr/share/etc/mime.types";
$locmimetyp="/usr/local/etc/mime.types";
$usrmimetyp="$ENV{HOME}/.mime.types";
$xtermprgrm="/usr/bin/x-terminal-emulator"; # xterm?
$defmimetyp="application/octet-stream";
$quotedsemi=chr(255);
$quotedprct=chr(254);
$retcode=0;


%patterntypes =
(
 '(^|/)crontab[^/]+$'                           => 'text/x-crontab',            #'
 '/man\d*/'                                     => 'application/x-troff-man',   #'
 '\.\d[^\.]*$'                                  => 'application/x-troff-man',   #'
);



sub Usage {
    my($error) = @_;
    print STDERR $error,"\n\n" if $error;

    print STDERR "Use: $0 <--action=VAL> [--debug] [MIME-TYPE:[ENCODING:]]FILE [...]\n\n";
    print STDERR "Options:\n";
    print STDERR "  action        specify what action to do on these files (default=view)\n";
    print STDERR "  debug         be verbose about what's going on\n";
    print STDERR "  nopager       ignore any \"copiousoutput\" directives and never use a \"pager\"\n";
    print STDERR "  norun         just print but don't execute the command (useful with --debug)\n";
    print STDERR "\n";
    print STDERR "Mime-Type:\n";
    print STDERR "  any standard mime type designation in the form <class>/<subtype> -- if\n";
    print STDERR "  not specified, it will be determined from the filename extension\n\n";
    print STDERR "Encoding:\n";
    print STDERR "  how the file (and type) has been encoded (only \"gzip\", \"bzip\", \"bzip2\"\n";
    print STDERR "  and \"compress\" are supported) -- if not specified, it will be determined\n";
    print STDERR "  from the filename extension\n\n";

    exit ($error ? 1 : 0);
}



sub EncodingForFile {
    my($file) = @_;
    my $encoding;

    if ($file =~ m/\.gz$/)  { $encoding = "gzip";       }
    if ($file =~ m/\.bz$/)  { $encoding = "bzip";       }
    if ($file =~ m/\.bz2$/) { $encoding = "bzip2";      }
    if ($file =~ m/\.Z$/)   { $encoding = "compress";   }

    print STDERR " - file \"$file\" has encoding \"$encoding\"\n" if $debug && $encoding;

    return $encoding;
}



sub ReadMimetypes {
    my($file) = @_;

    return unless -r $file;

    print STDERR " - Reading mime.types file \"$file\"...\n" if $debug;
    open(MIMETYPES,"<$file") || die "Error: could not read \"$file\" -- $!\n";
    while (<MIMETYPES>) {
        chomp;
        s/\#.*$//;
        next if (m/^\s*$/);

        $_=lc($_);
        my($type,@exts) = split;

        foreach (@exts) {
            $mimetypes{$_} = $type unless exists $mimetypes{$_};
        }
    }
    close MIMETYPES;
}



sub ReadMailcap {
    my($file) = @_;
    my $line = "";

    return unless -r $file;

    print STDERR " - Reading mailcap file \"$file\"...\n" if $debug;
    open(MAILCAP,"<$file") || die "Error: could not read \"$file\" -- $!\n";
    while (<MAILCAP>) {
        chomp;
        s/^\s+// if $line;
        $line .= $_;
        next unless $line;
        if ($line =~ m/^\s*\#/) {
            $line = "";
            next;
        }
        if ($line =~ m/\\$/) {
            $line =~ s/\\$//;
        } else {
            $line =~ s/\\;/$quotedsemi/go;
            $line =~ s/\\%/$quotedprct/go;
            push @mailcap,$line;
            $line = "";
        }
    }
    close MAILCAP;
}



sub TempFile {
    my($template) = @_;
    my($cmd,$head,$tail,$tmpfile);
    $template = "" unless (defined $template);

    ($head,$tail) = split(/%s/,$template,2);

#   $tmpfile = POSIX::tmpnam($name);
#   unlink($tmpfile);

    $cmd  = "tempfile --mode=600";
    $cmd .= " --prefix $head" if $head;
    $cmd .= " --suffix $tail" if $tail;

    $tmpfile = `$cmd`;
    chomp($tmpfile);

#   $tmpfile = $ENV{TMPDIR};
#   $tmpfile = "/tmp" unless $tmpfile;
#   $tmpfile.= "/$name";
#   unlink($tmpfile);

    return $tmpfile;
}



sub SaveStdin {
    my($match) = @_;
    my($tmpfile,$amt,$buf);

    $tmpfile = $1 if ($match =~ m/nametemplate=(.*?)\s*($|;)/);
    $tmpfile = TempFile($tmpfile);
    open(TMPFILE,">$tmpfile") || die "Error: could not write \"$tmpfile\" -- $!\n";
    do {
        $amt = read(STDIN,$buf,102400);
        print TMPFILE $buf if $amt;
    } while ($amt != 0);
    close(TMPFILE);

    return $tmpfile;
}



sub DecodeFile {
    my($efile,$encoding,$action) = @_;
    my($file,$res);

    $file = $efile;
    $file =~ s!^.*/!!;          # remove leading directories
    $file =~ s!\.[^\.]*$!!;     # remove encoding extension
    $file =~ s!^\.?[^\.]*!%s!;  # replace name with placeholder
    $file = undef if ($efile eq '-');
    my $tmpfile = TempFile($file);

    print STDERR " - decoding \"$efile\" as \"$tmpfile\"\n" if $debug;

#   unlink($tmpfile); # should still be acceptable for "compose" output even if exists
    return $tmpfile if (($efile ne '-' && ! -e $efile) || $action eq 'compose');

    if ($encoding eq "gzip") {
        if ($efile eq '-') {
            $res = system "gzip -d >\Q$tmpfile\E";
        } else {
            $res = system "gzip -dc \Q$efile\E >\Q$tmpfile\E";
        }
    } elsif ($encoding eq "bzip") {
        if ($efile eq '-') {
            $res = system "bzip -d >\Q$tmpfile\E";
        } else {
            $res = system "bzip -dc <\Q$efile\E >\Q$tmpfile\E";
        }
    } elsif ($encoding eq "bzip2") {
        if ($efile eq '-') {
            $res = system "bzip2 -d >\Q$tmpfile\E";
        } else {
            $res = system "bzip2 -dc <\Q$efile\E >\Q$tmpfile\E";
        }
    } elsif ($encoding eq "compress") {
        if ($efile eq '-') {
            $res = system "uncompress >\Q$tmpfile\E";
        } else {
            $res = system "uncompress <\Q$efile\E >\Q$tmpfile\E";
        }
    } else {
        die "Fatal: unknown encoding \"$encoding\" at";
    }

    $res = int($res/256);
    if ($res != 0) {
        print STDERR "Error: could not decode \"$efile\" -- $!\n";
        $retcode = 2 if ($retcode < 2);
        unlink($tmpfile);
        return;
    }

#   chmod 0600,$tmpfile; # done already by TempFile
    return $tmpfile;
}



sub EncodeFile {
    my($dfile,$efile,$encoding) = @_;
    my($res);

    print STDERR " - encoding \"$dfile\" as \"$efile\"\n";

    if ($encoding eq "gzip") {
        if ($efile eq '-') {
            $res = system "gzip -c \Q$dfile\E";
        } else {
            $res = system "gzip -c \Q$dfile\E >\Q$efile\E";
        }
    } elsif ($encoding eq "compress") {
        if ($efile eq '-') {
            $res = system "compress <\Q$dfile\E";
        } else {
            $res = system "compress <\Q$dfile\E >\Q$efile\E";
        }
    } else {
        die "Fatal: unknown encoding \"$encoding\" at";
    }

    $res = int($res/256);
    if ($res != 0) {
        print STDERR "Error: could not encode \"$efile\" (left as \"$dfile\")\n";
        $retcode = 2 if ($retcode < 2);
        return;
    }

    return $dfile;
}



sub ExtensionMimetype {
    my($ext) = @_;
    my($typ);

    unless ($donemimetypes) {
        ReadMimetypes($usrmimetyp);
        ReadMimetypes($locmimetyp);
        ReadMimetypes($shrmimetyp);
        ReadMimetypes($etcmimetyp);
        $donemimetypes = 1;
    }

    $typ = $mimetypes{lc($ext)};

    print STDERR " - extension \"$ext\" maps to mime-type \"$typ\"\n" if $debug;
    return $typ;
}



sub PatternMimetype {
    my($file) = @_;
    my($key,$val);

    while (($key,$val) = each %patterntypes) {
        if ($file =~ m!$key!i) {
            print STDERR " - file \"$file\" maps to mime-type \"$val\"\n" if $debug;
            return $val;
        }
    }

    print STDERR " - file \"$file\" does not conform to any known pattern\n" if $debug;
    return;
}



sub FileMimetype {
    my($file) = @_;
    my($ext)  = ($file =~ m!\.([^/\.]+)$!);

    my $type;

    $type = ExtensionMimetype($ext) if $ext;
    $type = PatternMimetype($file) unless $type;

    return $type;
}



@files = ();
foreach (@ARGV) {
    print STDERR " - parsing parameter \"$_\"\n" if $debug;
    if (m!^(-h|--help)$!) {
        Usage();
        exit(0);
    } elsif (m!^--(.*?)=(.*)$!) {
        print STDERR "Warning: definition of \"$1=$2\" overrides value \"${$1}\"\n" if ($ {$1} && $ {$1} != $2);
        $ {$1}=$2;
    } elsif (m!^--(.*?)$!) {
        print STDERR "Warning: definition of \"$1=$2\" overrides value \"${$1}\"\n" if ($ {$1} && $ {$1} != 1);
        $ {$1}=1;
    } elsif (m!^[^/:]+/[^/:]+:[^/:]+:!) {
        push @files,$_;
    } elsif (m!^([^/:]+/[^/:]+):(.*)! && ! -e $_) {
        my $file = $_;
        my $type = $1;
        my $file = $2;
        my $code = EncodingForFile($file);
        push @files,"${type}:${code}:${file}";
        print STDERR " - file \"$file\" does not exist -- assuming mime-type specification of \"${type}\"\n" if $debug;
    } else {
        my $file = $_;
        my $code = EncodingForFile($file);
        my $type;
        if ($code) {
            my $efile = $file;
            $efile =~ s/\.[^\.]+$//;
            $type = FileMimetype($efile);
        } else {
            $type = FileMimetype($file);
        }
        if ($type) {
            push @files,"${type}:${code}:${file}";
        } else {
            print STDERR "Warning: unknown mime-type for \"$file\" -- using \"$defmimetyp\"\n";
            push @files,"${defmimetyp}:${code}:${file}";
        }
    }
}

unless ($action) {
       if ($0 =~ m!(^|/)view$!)     { $action="view";   }
    elsif ($0 =~ m!(^|/)see$!)      { $action="view";   }
    elsif ($0 =~ m!(^|/)cat$!)      { $action="cat";    }
    elsif ($0 =~ m!(^|/)edit$!)     { $action="edit";   }
    elsif ($0 =~ m!(^|/)change$!)   { $action="edit";   }
    elsif ($0 =~ m!(^|/)compose$!)  { $action="compose";}
    elsif ($0 =~ m!(^|/)print$!)    { $action="print";  }
    elsif ($0 =~ m!(^|/)create$!)   { $action="compose";}
    else                            { $action="view";   }
}


$mailcaps = $ENV{MAILCAPS};
$mailcaps = "$ENV{HOME}/.mailcap:/etc/mailcap:/usr/local/etc/mailcap:/usr/share/etc/mailcap:/usr/etc/mailcap" unless $mailcaps;
foreach (split(/:/,$mailcaps)) {
    ReadMailcap($_);
}

foreach (@files) {
    my($type,$code,$file) = m/^(.*?):(.*?):(.*)$/;
    print STDERR "Processing file \"$file\" of type \"$type\" (encoding=",$code?$code:"none",")...\n" if $debug;

    if ($file ne '-') {
        if ($action eq 'compose' || $action eq 'edit') {
            if (-e $file) {
                if (! -w $file) {
                    print STDERR "Error: no write permission for file \"$file\"\n";
                    $retcode = 2 if ($retcode < 2);
                    next;
                }
            } else {
                if (open(TEST,">$file")) {
                    close(TEST);
                    unlink($file);
                } else {
                    print STDERR "Error: no write permission for file \"$file\"\n";
                    $retcode = 2 if ($retcode < 2);
                    next;
                }
            }
        } else {
            if (! -e $file) {
                print STDERR "Error: no such file \"$file\"\n";
                $retcode = 2 if ($retcode < 2);
                next;
            }
            if (! -r $file) {
                print STDERR "Error: no read permission for file \"$file\"\n";
                $retcode = 2 if ($retcode < 2);
                next;
            }
        }
    }

    my(@matches,$entry,$res,$efile);
    if ($code) {
        $efile = $file;
        $file  = DecodeFile($efile,$code,$action);
        next unless $file;
    }

    foreach $entry (@mailcap) {
        $entry =~ m/^(.*?)\s*;/;
        $_ = "\Q$1\E"; s/\\\*/\.\*/g;
        push @matches,$entry if ($type =~ m!^$_$!i);
    }
    @matches = grep(/\Q$action\E=/,@matches) unless ($action eq "view" || $action eq "cat");

    my $done=0;
    my $fail=0;
    foreach $match (@matches) {
        my $comm;
        print STDERR " - checking mailcap entry \"$match\"\n" if $debug;
        if ($action eq "view" || $action eq "cat") {
            ($comm) = ($match =~ m/^.*?;\s*(.*?)\s*($|;)/);
        } else {
            ($comm) = ($match =~ m/\Q$action\E=(.*?)\s*($|;)/);
        }
        next if (!$comm || $comm =~ m!(^|/)false$!i);
        print STDERR " - program to execute: $comm\n" if $debug;

	if ($action eq 'cat' && $match !~ m/;\s*copiousoutput\s*($|;)/) {
	    print STDERR " - \"copiousoutput\" is required for \"cat\" action\n" if $debug;
	    $fail++;
	    next;
	}

        my($tmpfile,$tmplink);
        if ($action ne 'print' && $match =~ m/;\s*needsterminal\s*($|;)/ && ! -t STDOUT) {
            if ($ENV{DISPLAY}) {
                $comm = "$xtermprgrm -T '$file ($type)' -e $0 --action=$action '${type}:%s'";
            } else {
                print STDERR " - no terminal available for rule (needsterminal)\n" if $debug;
                $fail++;
                next;
            }
        } elsif ($action eq 'view' && !$nopager && $match =~ m/;\s*copiousoutput\s*($|;)/ && $type ne 'text/plain') {
            $comm .= " | $0 --action=$action text/plain:-";
        }

        if ($match =~ m/;\s*test=(.*?)\s*($|;)/) {
            my $test;
            print STDERR " - running test: $1 " if $debug;
            $test   = system "$1 >/dev/null 2>&1";
            $test >>= 8;
            print STDERR " (result=$test=",($test!=0?"false":"true"),")\n" if $debug;
            if ($test) {
                $fail++;
                next;
            }
        }

        if ($file ne "-") {
            if ($comm =~ m/[^%]%s/) {
                if ($file =~ m![^ a-z0-9,.:/@%^+=_-]!i) {
                    $match =~ m/nametemplate=(.*?)\s*($|;)/;
                    my $prefix = $1;
                    my $linked = 0;
                    while (!$linked) {
                        $tmplink = TempFile($prefix);
                        unlink($tmplink);
                        if ($file =~ m!^/!) {
                            $linked = symlink($file,$tmplink);
                        } else {
                            my $pwd = `/bin/pwd`;
                            chomp($pwd);
                            $linked = symlink("$pwd/$file",$tmplink);
                        }
                    }
                    print STDERR " - filename contains shell meta-characters; aliased to '$tmplink'\n" if $debug;
                    $comm =~ s/([^%])%s/$1$tmplink/g;
                } else {
                    $comm =~ s/([^%])%s/$1$file/g;
                }
            } else {
                if ($comm =~ m/\|/) {
                    $comm =~ s/\|/<\Q$file\E \|/;
                } else {
                    $comm .= " <\Q$file\E";
                }
                if ($action eq 'edit' || $action eq 'compose') {
                    $comm .= " >\Q$file\E";
                }
            }
        } else {
            if ($comm =~ m/[^%]%s/) {
                $tmpfile = SaveStdin($match);
                $comm =~ s/([^%])%s/$1$tmpfile/g;
            } else {
                # no name means same as "-"... read from stdin
            }
        }

        $comm =~ s!([^%])%t!$1$type!g;
        $comm =~ s!([^%])%F!$1!g;
        $comm =~ s!%{(.*?)}!$_="'$ENV{$1}'";s/\`//g;s/\'\'//g;$_!ge;
        $comm =~ s!\\(.)!$1!g;
        $comm =~ s!\'\'!\'!g;
        $comm =~ s!$quotedsemi!;!go;
        $comm =~ s!$quotedprct!%!go;

        print STDERR " - executing: $comm\n" if $debug;
	if ($norun) {
	    print $comm,"\n";
	    $res = 0;
	} else {
	    $res = system $comm;
	    $res = int($res/256);
	}
        if ($res != 0) {
            print STDERR "Warning: program returned non-zero exit code \#$res\n";
            $retcode = $res;
        }
        $done=1;
        unlink $tmpfile if $tmpfile;
        unlink $tmplink if $tmplink;
        last;
    }

    if (!$done) {
        if ($fail) {
            print STDERR "Error: no \"$action\" rule for type \"$type\" passed its test case\n";
            print STDERR "       (for more information, add \"--debug=1\" on the command line)\n";
            $retcode = 3 if ($retcode < 3);
        } else {
            print STDERR "Error: no \"$action\" mailcap rules found for type \"$type\"\n";
            $retcode = 3 if ($retcode < 3);
        }
        unlink $file if $code;
        $retcode = 1 unless $retcode;
        next;
    }

    if ($code) {
        if ($action eq 'edit' || $action eq 'compose') {
            my $file = EncodeFile($file,$efile,$code);
            unlink $file if $file;
        } else {
            unlink $file;
        }
    }
}

exit($retcode);

Youez - 2016 - github.com/yon3zu
LinuXploit