!c99Shell v. 1.0 pre-release build #16!

Software: Apache/2.2.3 (CentOS). PHP/5.1.6 

uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44
EDT 2010 i686
 

uid=48(apache) gid=48(apache) groups=48(apache) 

Safe-mode: OFF (not secure)

/usr/libexec/webmin/mailboxes/   drwxr-xr-x
Free 53.79 GB of 127.8 GB (42.09%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     mail_search.cgi (3.68 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/perl
# mail_search.cgi
# Find mail messages matching some pattern

require './mailboxes-lib.pl';
&ReadParse();
&can_user($in{'user'}) || &error($text{'mail_ecannot'});
@folders = &list_user_folders($in{'user'});
$uuser = &urlize($in{'user'});

if ($in{'simple'}) {
    # Make sure a search was entered
    $in{'search'} || &error($text{'search_ematch'});
    $ofolder = $folders[$in{'folder'}];
    }
else {
    # Validate search fields
    for($i=0; defined($in{"field_$i"}); $i++) {
        if ($in{"field_$i"}) {
            $in{"what_$i"} || &error(&text('search_ewhat', $i+1));
            $neg = $in{"neg_$i"} ? "!" : "";
            push(@fields, [ $neg.$in{"field_$i"}, $in{"what_$i"} ]);
            }
        }
    @fields || &error($text{'search_enone'});
    $ofolder = $folders[$in{'ofolder'}];
    }

if ($in{'folder'} == -2) {
    $desc = $text{'search_local'};
    }
elsif ($in{'folder'} == -1) {
    $desc = $text{'search_all'};
    }
else {
    $folder = $folders[$in{'folder'}];
    $desc = &text('mail_for', $folder->{'name'});
    }
&ui_print_header($desc, $text{'search_title'}, "", undef, 0, 0, undef,
    &folder_link($in{'user'}, $ofolder));

if ($in{'simple'}) {
    if ($in{'search'} =~ /^(\S+):\s*(.*)$/) {
        # A specific field was entered
        local ($field, $what) = ($1, $2);
        @searchlist = ( [ $field, $what ] );
        @rv = &mailbox_search_mail(\@searchlist, 0, $folder);
        print "<p><b>",&text('search_results5', scalar(@rv),
                "<tt>$field</tt>", "<tt>$what</tt>")," ..</b><p>\n";
        }
    else {
        # Just search by Subject and From in one folder
        ($mode, $words) = &parse_boolean($in{'search'});
        if ($mode == 0) {
            # Can just do a single 'or' search
            @searchlist = map { ( [ 'subject', $_ ],
                          [ 'from', $_ ] ) } @$words;
            @rv = &mailbox_search_mail(\@searchlist, 0, $folder);
            }
        elsif ($mode == 1) {
            # Need to do two 'and' searches and combine
            @searchlist1 = map { ( [ 'subject', $_ ] ) } @$words;
            @rv1 = &mailbox_search_mail(\@searchlist1, 1, $folder);
            @searchlist2 = map { ( [ 'from', $_ ] ) } @$words;
            @rv2 = &mailbox_search_mail(\@searchlist2, 1, $folder);
            @rv = @rv1;
            %gotidx = map { $_->{'idx'}, 1 } @rv;
            foreach $mail (@rv2) {
                push(@rv, $mail) if (!$gotidx{$mail->{'idx'}});
                }
            }
        else {
            &error($text{'search_eboolean'});
            }
        print "<p><b>",&text('search_results2', scalar(@rv),
                     "<tt>$in{'search'}</tt>")," ..</b><p>\n";
        }
    foreach $mail (@rv) {
        $mail->{'folder'} = $folder;
        }
    }
else {
    # Complex search, perhaps over multiple folders!
    if ($in{'folder'} == -2) {
        @sfolders = grep { !$_->{'remote'} } @folders;
        $multi_folder = 1;
        }
    elsif ($in{'folder'} == -1) {
        @sfolders = @folders;
        $multi_folder = 1;
        }
    else {
        @sfolders = ( $folder );
        }
    foreach $sf (@sfolders) {
        local @frv = &mailbox_search_mail(\@fields, $in{'and'}, $sf);
        foreach $mail (@frv) {
            $mail->{'folder'} = $sf;
            }
        push(@rv, @frv);
        }
    print "<p><b>",&text('search_results4', scalar(@rv))," ..</b><p>\n";
    }
@rv = reverse(@rv);

# Show list of messages, with form
if (@rv) {
    print &ui_form_start("delete_mail.cgi", "post");
    print &ui_hidden("user", $in{'user'});
    print &ui_hidden("dom", $in{'dom'});
    print &ui_hidden("folder", $in{'folder'});
    if ($config{'top_buttons'} && !$multi_folder) {
        &show_buttons(1, \@folders, $folder, \@rv, $in{'user'}, 1);
        }
    &show_mail_table(\@rv, $multi_folder ? undef : $ofolder, 0);
    if (!$multi_folder) {
        &show_buttons(2, \@folders, $folder, \@rv, $in{'user'}, 1);
        }
    print &ui_form_end();
    }
else {
    print "<b>$text{'search_none'}</b> <p>\n";
    }

&ui_print_footer($in{'simple'} ? ( ) : ( "search_form.cgi?folder=$in{'folder'}",
                $text{'sform_return'} ),
    "list_mail.cgi?user=$in{'user'}&folder=$in{'folder'}&dom=$in{'dom'}",
      $text{'mail_return'},
    &user_list_link(), $text{'index_return'});


:: Command execute ::

Enter:
 
Select:
 

:: Shadow's tricks :D ::

Useful Commands
 
Warning. Kernel may be alerted using higher levels
Kernel Info:

:: Preddy's tricks :D ::

Php Safe-Mode Bypass (Read Files)

File:

eg: /etc/passwd

Php Safe-Mode Bypass (List Directories):

Dir:

eg: /etc/

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0106 ]--