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

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

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


Viewing file:     save_jail.cgi (3.6 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/perl
# Create, update or delete a jail

use strict;
use warnings;
require './fail2ban-lib.pl';
our (%in, %text, %config);
&ReadParse();
&error_setup($text{'jail_err'});

my $jail;
my @jails = &list_jails();

if ($in{'new'}) {
    # Create new jail object
    my $jfile = "$config{'config_dir'}/jail.conf";
    my $jlfile = "$config{'config_dir'}/jail.local";
    $jail = { 'members' => [ ],
          'file' => -r $jlfile ? $jlfile : $jfile };
    }
else {
    # Find existing jail
    ($jail) = grep { $_->{'name'} eq $in{'name'} } @jails;
    $jail || &error($text{'jail_egone'});
    }

if ($in{'delete'}) {
    # Just delete the jail
    &lock_all_config_files();
    &delete_section($jail->{'file'}, $jail,
            $jail->{'file'} =~ /jail.local$/ ? 1 : 0);
    &unlock_all_config_files();
    }
else {
    # Validate inputs
    my $file;
    $in{'name'} =~ /^[a-z0-9\_\-]+$/i || &error($text{'jail_ename'});
    $jail->{'name'} = $in{'name'};
    if ($in{'new'} || $in{'name'} ne $in{'old'}) {
        # Check for clash
        my ($clash) = grep { $_->{'name'} eq $in{'name'} } @jails;
        $clash && &error($text{'jail_eclash'});
        }

    # Parse and validate actions
    my @actions;
    for(my $i=0; defined($in{"action_$i"}); $i++) {
        next if (!$in{"action_$i"});
        my @opts;
        if ($in{"name_$i"}) {
            $in{"name_$i"} =~ /^[A-Za-z0-9\.\_\-]+$/ ||
                &error(&text('jail_eaname', $i+1));
            push(@opts, "name=".$in{"name_$i"});
            }
        if ($in{"port_$i"}) {
            my @p = split(/,/, $in{"port_$i"});
            foreach my $p (split(/,/, $in{"port_$i"})) {
                $p =~ /^\d+$/ ||
                  $p =~ /^\d+:\d+$/ ||
                    getservbyname($p,
                      $in{"protocol_$i"} || "tcp") ||
                    &error(&text('jail_eport', $i+1));
                }
            if (@p > 1) {
                push(@opts, "port="."\"".$in{"port_$i"}."\"");
                }
            else {
                push(@opts, "port=".$in{"port_$i"});
                }
            }
        if ($in{"protocol_$i"}) {
            push(@opts, "protocol=".$in{"protocol_$i"});
            }
        push(@opts, split(/\s+/, $in{"others_$i"}));
        push(@actions, $in{"action_$i"}."[".join(", ", @opts)."]");
        }

    # Split and validate log file paths
    my @logpaths = grep { /\S/ } split(/\r?\n/, $in{'logpath'});
    @logpaths || &error($text{'jail_elogpaths'});
    foreach my $l (@logpaths) {
        $l =~ s/^\s*//;
        $l =~ s/\s*$//;
        $l =~ /^\/\S+$/ || $l =~ /^\%\(/ ||
            &error($text{'jail_elogpath'});
        }

    # Validate various counters
    foreach my $f ("maxretry", "findtime", "bantime") {
        $in{$f.'_def'} || $in{$f} =~ /^\-?\d+$/ ||
            &error($text{'jail_e'.$f});
        }

    # Split and validate IPs to ignore
    my @ignoreips = $in{'ignoreip_def'} ? ( )
                        : split(/\s+/, $in{'ignoreip'});
    foreach my $ip (@ignoreips) {
        &check_ipaddress($ip) || &check_ip6address($ip) ||
            ($ip =~ /^([0-9\.]+)\/(\d+)/ && &check_ipaddress("$1")) ||
            &to_ipaddress($ip) ||
            &error($text{'jail_eignoreip'});
        }

    # Create new section or rename existing if needed
    &lock_all_config_files();
    if ($in{'new'}) {
        &create_section($jail->{'file'}, $jail);
        }
    elsif ($in{'name'} ne $in{'old'}) {
        &modify_section($jail->{'file'}, $jail);
        }

    # Save directives within the section
    &save_directive("enabled", $in{'enabled'} ? 'true' : 'false', $jail);
    &save_directive("filter", $in{'filter'} || undef, $jail);
    &save_directive("action", @actions ? join("\n", @actions)
                       : undef, $jail);
    &save_directive("logpath", join("\n", @logpaths), $jail);
    foreach my $f ("maxretry", "findtime", "bantime") {
        &save_directive($f, $in{$f."_def"} ? undef : $in{$f}, $jail);
        }
    &save_directive("ignoreip",
        @ignoreips ? join(" ", @ignoreips) : undef, $jail);

    &unlock_all_config_files();
    }

# Log and redirect
&webmin_log($in{'delete'} ? 'delete' : $in{'new'} ? 'create' : 'update',
        'jail', $jail->{'name'});
&redirect("list_jails.cgi");

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0028 ]--