[ Avaa Bypassed ]




Upload:

Command:

www-data@3.141.164.124: ~ $
# vgetty-lib.pl
# Common functions for editing the vgetty config files
# XXX options under ring_type 
# XXX DTMF command shells http://vocp.sourceforge.net/
# XXX DTMF terminals http://telephonectld.sourceforge.net/

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

# vgetty_inittabs()
# Returns a list of inittab entries for mgetty, with options parsed
sub vgetty_inittabs
{
local @rv;
foreach $i (&inittab::parse_inittab()) {
	if ($i->{'process'} =~ /^(\S*vgetty)\s*(.*)\s+((\/.*)?tty\S+)(\s+(\S+))?$/) {
		$i->{'vgetty'} = $1;
		$i->{'args'} = $2;
		$i->{'tty'} = $3;
		$i->{'ttydefs'} = $6;
		push(@rv, $i);
		}
	elsif ($i->{'process'} =~ /^(\S*mgetty)\s*(.*)\s+((\/.*)?tty\S+)/) {
		$i->{'mgetty'} = $1;
		$i->{'tty'} = $3;
		push(@rv, $i);
		}
	}
return @rv;
}

# get_config()
# Parse the vgetty config file into a series of directives
sub get_config
{
local @rv;
local $lnum = 0;
open(CONFIG, "<".$config{'vgetty_config'});
while(<CONFIG>) {
	s/\r|\n//g;
	s/#.*$//;
	local @v;
	while(/^\s*"([^"]*)"(.*)/ ||
	      /^\s*'([^']*)'(.*)/ ||
	      /^\s*(\S+)(.*)/) {
		push(@v, $1);
		$_ = $2;
		}
	if (@v) {
		push(@rv, { 'line' => $lnum,
			    'index' => scalar(@rv),
			    'name' => shift(@v),
			    'values' => \@v });
		}
	$lnum++;
	}
close(CONFIG);
return @rv;
}

# find(name, &config)
# Finds one more more config entries with the given name
sub find
{
local ($c, @rv);
foreach $c (@{$_[1]}) {
	push(@rv, $c) if (lc($c->{'name'}) eq lc($_[0]));
	}
return wantarray ? @rv : $rv[0];
}

# find_value(name, &config)
sub find_value
{
local @v = &find($_[0], $_[1]);
return undef if (!@v);
return wantarray ? @{$v[0]->{'values'}} : $v[0]->{'values'}->[0];
}

# tty_opt_file(base, tty)
sub tty_opt_file
{
local $tf = $_[1];
$tf =~ s/^\/dev\///;
$tf =~ s/\//\./g;
$tf = "$_[0].$tf";
return $tf;
}

# answer_mode_input(value, name)
sub answer_mode_input
{
local @modes = ( '', 'voice', 'fax', 'data' );
local @am = split(/:/, $_[0]);
local ($i, $rv);
for($i=0; $i<3; $i++) {
	$rv .= "<select name=$_[1]_$i>\n";
	foreach $m (@modes) {
		$rv .= sprintf "<option value='%s' %s>%s</option>\n",
		    $m, $am[$i] eq $m ? "selected" : "", $text{"vgetty_ans_$m"};
		}
	$rv .= "</select>&nbsp;";
	}
return $rv;
}

# parse_answer_mode(name)
sub parse_answer_mode
{
local (@rv, $i, $m);
for($i=0; defined($m = $in{"$_[0]_$i"}); $i++) {
	push(@rv, $m) if ($m);
	}
return join(":", @rv);
}

# receive_dir(&config)
sub receive_dir
{
local $vdir = &find_value("voice_dir", \@conf);
local $rdir = &find_value("receive_dir", \@conf);
return $rdir =~ /^\// ? $rdir : "$vdir/$rdir";
}

# messages_dir(&config)
sub messages_dir
{
local $vdir = &find_value("voice_dir", \@conf);
local $rdir = &find_value("message_dir", \@conf);
return $rdir =~ /^\// ? $rdir : "$vdir/$rdir";
}

# messages_index(&config)
sub messages_index
{
local $dir = &messages_dir($_[0]);
local $ifile = &find_value("message_list", \@conf);
return "$dir/$ifile";
}

# rmd_file_info(file)
sub rmd_file_info
{
local $out = `rmdfile '$_[0]' 2>&1`;
return undef if ($?);
local @st = stat($_[0]);
$_[0] =~ /\/([^\/]+)$/;
local $rv = { 'file' => "$1",
	      'path' => $_[0],
	      'size' => $st[7],
	      'date' => $st[9],
	      'speed' => $out =~ /speed:\s+(\d+)/i ? "$1" : undef,
	      'type' => $out =~ /type\s+is:\s+"([^"]+)"/i ? "$1" : undef,
	      'bits' => $out =~ /sample:\s+(\d+)/i ? "$1" : undef
	    };
return $rv;
}

# list_rmd_formats()
sub list_rmd_formats
{
local @rv;
open(RMD, "pvftormd -L 2>&1 |");
while(<RMD>) {
	if (/^\s+\-\s+(\S+)\s+([0-9, ]+)\s+(.*)/) {
		local $code = $1;
		local $bits = $2;
		local $desc = $3;
		$bits =~ s/\s//g;
		foreach $b (split(/,/, $bits)) {
			push(@rv, { 'code' => $code,
				    'bits' => $b,
				    'desc' => &text('pvfdesc',
						    "$code ($desc)", $b),
				    'index' => scalar(@rv) });
			}
		}
	}
close(RMD);
return @rv;
}

# save_directive(&config, name, value)
sub save_directive
{
local $lref = &read_file_lines($config{'vgetty_config'});
local $old = &find($_[1], $_[0]);
if ($old) {
	$lref->[$old->{'line'}] = "$_[1] $_[2]";
	}
else {
	push(@$lref, "$_[1] $_[2]");
	}
}

# apply_configuration()
# Apply the vgetty serial port configuration. Returns undef on success, or an
# error message on failure
sub apply_configuration
{
local $out = &backquote_logged("telinit q 2>&1 </dev/null");
return "<tt>$out</tt>" if ($?);
&system_logged("killall vgetty");
return undef;
}

1;


Filemanager

Name Type Size Permission Actions
images Folder 0755
lang Folder 0755
backup_config.pl File 923 B 0755
config File 63 B 0644
config.info File 109 B 0644
config.info.ca File 131 B 0644
config.info.cs File 124 B 0644
config.info.de File 119 B 0644
config.info.es File 131 B 0644
config.info.hu File 127 B 0644
config.info.ms File 111 B 0644
config.info.nl File 113 B 0644
config.info.no File 108 B 0644
config.info.pl File 133 B 0644
config.info.ru File 169 B 0644
config.info.uk File 172 B 0644
delete.cgi File 1.32 KB 0755
edit_options.cgi File 4.86 KB 0755
edit_vgetty.cgi File 2.78 KB 0755
email.pl File 1018 B 0755
index.cgi File 1.41 KB 0755
install_check.pl File 387 B 0755
list_messages.cgi File 2.49 KB 0755
list_received.cgi File 1.87 KB 0755
list_vgetty.cgi File 1.18 KB 0755
listen.cgi File 511 B 0755
log_parser.pl File 749 B 0755
module.info File 172 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 113 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 187 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 192 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 199 B 0644
module.info.ca File 116 B 0644
module.info.ca.auto File 15 B 0644
module.info.cs File 25 B 0644
module.info.cs.auto File 82 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 112 B 0644
module.info.de File 91 B 0644
module.info.de.auto File 15 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 225 B 0644
module.info.es File 41 B 0644
module.info.es.auto File 95 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 122 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 182 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 117 B 0644
module.info.fr File 0 B 0644
module.info.fr.auto File 127 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 133 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 116 B 0644
module.info.hu File 28 B 0644
module.info.hu.auto File 100 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 118 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 145 B 0644
module.info.ko File 0 B 0644
module.info.ko.auto File 119 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 122 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 125 B 0644
module.info.ms File 120 B 0644
module.info.ms.auto File 15 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 115 B 0644
module.info.nl File 25 B 0644
module.info.nl.auto File 78 B 0644
module.info.no File 25 B 0644
module.info.no.auto File 86 B 0644
module.info.pl File 32 B 0644
module.info.pl.auto File 95 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 131 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 140 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 124 B 0644
module.info.ru File 51 B 0644
module.info.ru.auto File 142 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 108 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 100 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 112 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 260 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 116 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 185 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 211 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 140 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 97 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 106 B 0644
save_options.cgi File 3.9 KB 0755
save_vgetty.cgi File 3.09 KB 0755
upload.cgi File 1.79 KB 0755
vgetty-lib.pl File 4.31 KB 0755
vgetty_apply.cgi File 228 B 0755