[ Avaa Bypassed ]




Upload:

Command:

www-data@18.216.248.35: ~ $
# tcpwrappers-lib.pl
# Library for TCP Wrappers

BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();

# list_rules($filename)
# Parse rules from /etc/hosts.*
# File format described in "man 5 hosts_access"
sub list_rules {
    my $file = shift;
    my @ret;
    my $id = 0;

    open(HOSTS, "<".$file) || return ();
    my $line;
    my $last_line = '';
    my $lnum = 0;
    while ($line = <HOSTS>) {
	my ($slnum, $elnum) = ($lnum, $lnum);
	s/\r|\n//g;

	while ($line =~ /^(.*)\\/) {
	    # Continuation line! Read the next one and append it
	    local $before = $1;
	    local $nxt = <HOSTS>;
	    $nxt =~ s/\r|\n//g;
	    $line = $before.$nxt;
	    $elnum++; $lnum++;
        }

	if ($line =~ /^\#(.*)/) {
	    # Comment
	    $cmt = $cmt ? $cmt."\n".$1 : $1;
	} elsif ($line =~ /^\s*$/) {
	    $cmt = undef;
	} else {
	    my @cmtlines = split(/\n/, $cmt);
	    $cmt = undef;

        # Fix further splitting on : to work with ipv6
        my $ipv6;
        my $ipv6_enc;

        # Match ipv6 with or without range
        if ($line =~ /(?|(\[[:\da-f]+\]\/\d+)|(\[[:\da-f]+\]))/i) {
            $ipv6 = $1;
            $ipv6_enc = &encode_base64($ipv6);
            $line =~ s/\Q$ipv6\E/$ipv6_enc/;
        }
        my ($service, $host, $cmd) = split /:/, $line, 3;
	    $service =~ s/^\s*//; $service =~ s/\s*$//;
	    $host =~ s/^\s*\Q$ipv6_enc\E/$ipv6/; $host =~ s/\s*$//;
	    
	    push @ret, { 'id' => $id++,
			 'service' => $service,
			 'host' => $host,
			 'cmd' => $cmd,
			 'line' => $slnum-scalar(@cmtlines),
			 'eline' => $elnum
			 };
	}
	$lnum++;
    }
    close FILE;

    return @ret;
}

# list_services()
# List system services from (x)inetd or return ()
sub list_services {
    my @ret;

    if (&foreign_installed("xinetd")) {
	&foreign_require("xinetd", "xinetd-lib.pl");
	my @conf = &foreign_call('xinetd', 'get_xinetd_config');
	foreach $x (@conf) {
	    next if ($x->{'quick'}{'server'}[0] !~ /\/([^\/]+)$/);
	    push @ret, $1;
	}
    } elsif (&foreign_installed("inetd")) {
	&foreign_require("inetd", "inetd-lib.pl");
	my @conf = &foreign_call('inetd', 'list_inets');
	foreach $x (@conf) {
	    next unless ($x->[9] =~ /^(\S+)/);
	    push @ret, $1;
	}
    }

    return &unique(@ret);
}

# delete_rule($filename, &rule)
# Removes one rule entry from the file
sub delete_rule {
    my ($filename, $rule) = @_;

    my $lref = &read_file_lines($filename);
    my $len = $rule->{'eline'} - $rule->{'line'} + 1;
    splice(@$lref, $rule->{'line'}, $len);
    &flush_file_lines($filename);
}

# create_rule($filename, &rule)
# Adds new rule
sub create_rule {
    my ($file, $rule) = @_;

    my $lref = &read_file_lines($file);
    my $newline = $rule->{'service'}.' : '.$rule->{'host'}.($rule->{'cmd'} ? ' : '.$rule->{'cmd'} : '');
    push(@$lref, $newline);
    &flush_file_lines($file);
}

# modify_rule($filename, &old_rule, &new_rule)
# Updates rule
sub modify_rule {
    my ($filename, $oldrule, $newrule) = @_;

    my @newline = ($newrule->{'service'}.' : '.$newrule->{'host'}.($newrule->{'cmd'} ? ' : '.$newrule->{'cmd'} : ''));

    my $lref = &read_file_lines($filename);
    my $len = $oldrule->{'eline'} - $oldrule->{'line'} + 1;
    splice(@$lref, $oldrule->{'line'}, $len, @newline);
    &flush_file_lines($filename);
}

1;

Filemanager

Name Type Size Permission Actions
help Folder 0755
images Folder 0755
lang Folder 0755
CHANGELOG File 266 B 0644
backup_config.pl File 613 B 0755
cgi_args.pl File 357 B 0755
config File 73 B 0644
config.info File 138 B 0644
config.info.ca File 179 B 0644
config.info.de File 141 B 0644
config.info.fr File 174 B 0644
config.info.hu File 0 B 0644
config.info.ms File 153 B 0644
config.info.nl File 93 B 0644
config.info.no File 133 B 0644
config.info.pl File 141 B 0644
delete_rules.cgi File 541 B 0755
edit_rule.cgi File 3.35 KB 0755
index.cgi File 1.44 KB 0755
module.info File 144 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 106 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 139 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 167 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 179 B 0644
module.info.ca File 104 B 0644
module.info.ca.auto File 20 B 0644
module.info.cs File 0 B 0644
module.info.cs.auto File 113 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 113 B 0644
module.info.de File 96 B 0644
module.info.de.auto File 20 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 163 B 0644
module.info.es File 0 B 0644
module.info.es.auto File 125 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 115 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 173 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 110 B 0644
module.info.fr File 0 B 0644
module.info.fr.auto File 124 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 150 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 123 B 0644
module.info.hu File 96 B 0644
module.info.hu.auto File 21 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 121 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 135 B 0644
module.info.ko File 0 B 0644
module.info.ko.auto File 106 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 126 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 122 B 0644
module.info.ms File 95 B 0644
module.info.ms.auto File 20 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 137 B 0644
module.info.nl File 21 B 0644
module.info.nl.auto File 101 B 0644
module.info.no File 21 B 0644
module.info.no.auto File 92 B 0644
module.info.pl File 94 B 0644
module.info.pl.auto File 20 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 123 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 132 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 124 B 0644
module.info.ru File 0 B 0644
module.info.ru.auto File 167 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 111 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 124 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 107 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 178 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 138 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 174 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 172 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 133 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 93 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 102 B 0644
save_rule.cgi File 2.31 KB 0755
tcpwrappers-lib.pl File 3.2 KB 0755