imonc/0040750000000000000000000000000007452672755010703 5ustar rootrootimonc/lang/0040750000000000000000000000000007452672634011620 5ustar rootrootimonc/lang/de0100640000000000000000000000527207452672634012137 0ustar rootrootyes=Ja no=Nein err_no-dsl=Keine DSL-Circuits vorhanden. err_channel-notexist=Die angegebene Leitung (Channel) exisitert nicht. err_wrong-password=Angegebenes Benutzerpasswort ist falsch. err_wrong-adminpassword=ADMIN-Passwort wurde vom Router als Falsch abgelehnt tablets_main=IMonC tablets_routing=Routing main_channels_channel=Kanal main_channels_circuit=Circuit main_channels_direction=Richtung main_channels_ip=IP-Adresse main_channels_onlinetime=Online seit main_channels_chargetime=Berechnete Zeit main_channels_charge=Kosten main_channels_showdatarates=Datenraten zeigen main_channels_addlink=Kanal hinzufügen main_channels_addlink=Kanal entfernen main_channels_other=Andere main_reboot_confirmation-title=Wirklich neu starten? main_reboot_confirmation-question=Sind Sie sicher, dass sie den Router neu starten wollen? main_reboot_notallowed=Ihnen fehlt die Berechtigung, den Router neu zu starten. main_halt_confirmation-title=Wirklich herunterfahren? main_halt_confirmation-question=Sind Sie sicher, dass sie den Router herunterfahren wollen? main_halt_notallowed=Sie haben nicht die Berechtigung, den Router herunterzufahren. sub_infoline_router-address=Router-Adresse sub_infoline_imond-ver=IMonD-Version sub_infoline_proto-ver=Protokollversion sub_infoline_date=Datum sub_infoline_time=Zeit sub_functionline_dial=Wählen sub_functionline_hangup=Auflegen sub_functionline_reboot=Neustart sub_functionline_halt=Herunterfahren sub_functionline_dialmode=Wählmodus sub_functionline_dialmode-off=aus (nie wählen) sub_functionline_dialmode-manual=manuell sub_functionline_dialmode-auto=automatisch sub_functionline_dialmode-set=setzen sub_functionline_open-cpu-usage=CPU-Auslastung routing_wrong-route=Sie müssen eine gültige Route wählen routing_wrong-noaccess=Sie haben nicht das Recht, die Routen zu verändern. routing_droute=Standard-Route routing_timetable=Circuit Zeittabelle routing_circuits=Circuits routing_droute_set=setzen routing_table_head-day=Tag routing_table_head-su=Sonntag routing_table_head-mo=Montag routing_table_head-tu=Dienstag routing_table_head-we=Mittwoch routing_table_head-th=Donnerstag routing_table_head-fr=Freitag routing_table_head-sa=Samstag routing_circtable_head-no=Nr. routing_circtable_head-name=Name routing_circtable_head-lcr=Least Cost Routing routing_circtable_head-droute=Standard-Route routing_circtable_head-device=Gerät routing_circtable_head-charge=Kosten/Minute routing_circtable_head-chargeint=Abrechnungsintervall err_wrong-adminpassword=Das Admin-Passwort ist falsch. rates_datarates=Datenraten rates_act-rates=Aktuelle Datenraten (kB/s) rates_transferred-data=Übertragene Daten (kB) rates_cpu-usage=CPU-Belastung rates_in=EIN: rates_out=AUS:imonc/lang/en0100640000000000000000000000512107452672623012140 0ustar rootrootyes=Yes no=No err_no-dsl=No DSL circuits available. err_channel-notexist=The given channel does not exist err_wrong-password=The user password in the configuration is wrong. err_wrong-adminpassword=The ADMIN password in the configuration is wrong. tablets_main=IMonC tablets_routing=Routing main_channels_channel=channel main_channels_circuit=circuit main_channels_direction=direction main_channels_ip=IP-address main_channels_onlinetime=online since main_channels_chargetime=charged time main_channels_charge=charge main_channels_showdatarates=show data rates main_channels_addlink=add link main_channels_removelink=remove link main_channels_other=other main_reboot_confirmation-title=Really reboot? main_reboot_confirmation-question=Are you sure that you want to reboot the router? main_reboot_notallowed=You are not allowed to reboot the router!! main_halt_confirmation-title=Really halt? main_halt_confirmation-question=Are you sure that you want to shut down the router? main_halt_notallowed=You are not allowed to shut down the router!! sub_infoline_router-address=Router address sub_infoline_imond-ver=IMonD version sub_infoline_proto-ver=Protocol version sub_infoline_date=Date sub_infoline_time=Time sub_functionline_dial=Dial sub_functionline_hangup=Hang up sub_functionline_reboot=Reboot sub_functionline_halt=Shutdown sub_functionline_dialmode=Dial mode sub_functionline_dialmode-off=off (never dial) sub_functionline_dialmode-manual=manual sub_functionline_dialmode-auto=automatic sub_functionline_dialmode-set=set sub_functionline_open-cpu-usage=CPU usage window routing_wrong-route=You must choose a valid route. routing_wrong-noaccess=You do not have the permission to change routeserr_wrong-password=The user password in the configuration is wrong. routing_droute=Default Route routing_timetable=Circuit timetable routing_circuits=Circuits routing_droute_set=set routing_table_head-day=Day routing_table_head-su=Sunday routing_table_head-mo=Monday routing_table_head-tu=Tuesday routing_table_head-we=Wednesday routing_table_head-th=Thursday routing_table_head-fr=Friday routing_table_head-sa=Saturday routing_circtable_head-no=No. routing_circtable_head-name=Name routing_circtable_head-lcr=Least Cost Routing routing_circtable_head-droute=DefaultRoute routing_circtable_head-device=Device routing_circtable_head-charge=Charge/Minute routing_circtable_head-chargeint=Charge Interval err_wrong-adminpassword=The ADMIN password in the configuration is wrong. rates_datarates=data rates rates_act-rates=current data rates (kB/s) rates_transferred-data=transferred data (kB) rates_cpu-usage=CPU usage rates_in=IN: rates_out=OUT:imonc/lang/en~0100640000000000000000000000505407433701233012330 0ustar rootrootyes=Yes no=No err_no-dsl=No DSL circuits available. err_channel-notexist=The given channel does not exist err_wrong-password=The user password in the configuration is wrong. err_wrong-adminpassword=The ADMIN password in the configuration is wrong. tablets_main=IMonC tablets_routing=Routing main_channels_channel=channel main_channels_circuit=circuit main_channels_direction=direction main_channels_ip=IP-address main_channels_onlinetime=online since main_channels_chargetime=charged time main_channels_charge=charge main_channels_showdatarates=show data rates main_channels_addlink=add link main_channels_other=other main_reboot_confirmation-title=Really reboot? main_reboot_confirmation-question=Are you sure that you want to reboot the router? main_reboot_notallowed=You are not allowed to reboot the router!! main_halt_confirmation-title=Really halt? main_halt_confirmation-question=Are you sure that you want to shut down the router? main_halt_notallowed=You are not allowed to shut down the router!! sub_infoline_router-address=Router address sub_infoline_imond-ver=IMonD version sub_infoline_proto-ver=Protocol version sub_infoline_date=Date sub_infoline_time=Time sub_functionline_dial=Dial sub_functionline_hangup=Hang up sub_functionline_reboot=Reboot sub_functionline_halt=Shutdown sub_functionline_dialmode=Dial mode sub_functionline_dialmode-off=off (never dial) sub_functionline_dialmode-manual=manual sub_functionline_dialmode-auto=automatic sub_functionline_dialmode-set=set sub_functionline_open-cpu-usage=CPU usage window routing_wrong-route=You must choose a valid route. routing_wrong-noaccess=You do not have the permission to change routeserr_wrong-password=The user password in the configuration is wrong. routing_droute=Default Route routing_timetable=Circuit timetable routing_circuits=Circuits routing_droute_set=set routing_table_head-day=Day routing_table_head-su=Sunday routing_table_head-mo=Monday routing_table_head-tu=Tuesday routing_table_head-we=Wednesday routing_table_head-th=Thursday routing_table_head-fr=Friday routing_table_head-sa=Saturday routing_circtable_head-no=No. routing_circtable_head-name=Name routing_circtable_head-lcr=Least Cost Routing routing_circtable_head-droute=DefaultRoute routing_circtable_head-device=Device routing_circtable_head-charge=Charge/Minute routing_circtable_head-chargeint=Charge Interval err_wrong-adminpassword=The ADMIN password in the configuration is wrong. rates_datarates=data rates rates_act-rates=current data rates (kB/s) rates_transferred-data=transferred data (kB) rates_cpu-usage=CPU usage rates_in=IN: rates_out=OUT:imonc/lang/de~0100640000000000000000000000522407433704425012323 0ustar rootrootyes=Ja no=Nein err_no-dsl=Keine DSL-Circuits vorhanden. err_channel-notexist=Die angegebene Leitung (Channel) exisitert nicht. err_wrong-password=Angegebenes Benutzerpasswort ist falsch. err_wrong-adminpassword=ADMIN-Passwort wurde vom Router als Falsch abgelehnt tablets_main=IMonC tablets_routing=Routing main_channels_channel=Kanal main_channels_circuit=Circuit main_channels_direction=Richtung main_channels_ip=IP-Adresse main_channels_onlinetime=Online seit main_channels_chargetime=Berechnete Zeit main_channels_charge=Kosten main_channels_showdatarates=Datenraten zeigen main_channels_addlink=Kanal hinzufügen main_channels_other=Andere main_reboot_confirmation-title=Wirklich neu starten? main_reboot_confirmation-question=Sind Sie sicher, dass sie den Router neu starten wollen? main_reboot_notallowed=Ihnen fehlt die Berechtigung, den Router neu zu starten. main_halt_confirmation-title=Wirklich herunterfahren? main_halt_confirmation-question=Sind Sie sicher, dass sie den Router herunterfahren wollen? main_halt_notallowed=Sie haben nicht die Berechtigung, den Router herunterzufahren. sub_infoline_router-address=Router-Adresse sub_infoline_imond-ver=IMonD-Version sub_infoline_proto-ver=Protokollversion sub_infoline_date=Datum sub_infoline_time=Zeit sub_functionline_dial=Wählen sub_functionline_hangup=Auflegen sub_functionline_reboot=Neustart sub_functionline_halt=Herunterfahren sub_functionline_dialmode=Wählmodus sub_functionline_dialmode-off=aus (nie wählen) sub_functionline_dialmode-manual=manuell sub_functionline_dialmode-auto=automatisch sub_functionline_dialmode-set=setzen sub_functionline_open-cpu-usage=CPU-Auslastung routing_wrong-route=Sie müssen eine gültige Route wählen routing_wrong-noaccess=Sie haben nicht das Recht, die Routen zu verändern. routing_droute=Standard-Route routing_timetable=Circuit Zeittabelle routing_circuits=Circuits routing_droute_set=setzen routing_table_head-day=Tag routing_table_head-su=Sonntag routing_table_head-mo=Montag routing_table_head-tu=Dienstag routing_table_head-we=Mittwoch routing_table_head-th=Donnerstag routing_table_head-fr=Freitag routing_table_head-sa=Samstag routing_circtable_head-no=Nr. routing_circtable_head-name=Name routing_circtable_head-lcr=Least Cost Routing routing_circtable_head-droute=Standard-Route routing_circtable_head-device=Gerät routing_circtable_head-charge=Kosten/Minute routing_circtable_head-chargeint=Abrechnungsintervall err_wrong-adminpassword=Das Admin-Passwort ist falsch. rates_datarates=Datenraten rates_act-rates=Aktuelle Datenraten (kB/s) rates_transferred-data=Übertragene Daten (kB) rates_cpu-usage=CPU-Belastung rates_in=EIN: rates_out=AUS:imonc/config.info.de0100640000000000000000000000062207433655640013403 0ustar rootrootgwhost=Rechnername oder IP des Gateways,0 gwport=Portnummer von ImonD auf dem Gateway,0 gwpassword=Passwort für ImonD (Normalmodus),0 gwadminpassword=Passwort für ImonD (Adminmodus),0 subwindow_refresh=Aktualisierungsintervall für Unterfenster (in Sekunden),0 index_refresh=Aktualisierungsintervall für das Hauptfenster (ACHTUNG: der Refresh verhindert das Auto-Logout von Webmin),0imonc/common_main_windows.pl0100640000000000000000000000632307433621360015271 0ustar rootroot#!/usr/lib/perl # Common functions for Webmin Main Window #use strict; use Carp; sub print_infoline { my ($t_date, $t_time, $imond_ver, $proto_ver, $date_day, $date_month, $date_year, $time_hour, $time_minute, $time_second); # Daten sammeln ($proto_ver, $imond_ver) = split ' ', imonc_command('version'); ($_, $t_date, $t_time) = split ' ', imonc_command('date'); ($date_day, $date_month, $date_year) = split '/', $t_date; ($time_hour, $time_minute, $time_second) = split ':', $t_time; print <<"EOT";
$text{'sub_infoline_router-address'}:
  $text{'sub_infoline_imond-ver'}:
  $text{'sub_infoline_proto-ver'}:
  $text{'sub_infoline_date'}:
  $text{'sub_infoline_time'}:
EOT }; 1;imonc/common.pl0100640000000000000000000000364107433665411012520 0ustar rootroot#!/usr/bin/perl -w use strict; use Carp; our (%text,%config, %access); sub wrong { croak ("wrong(): sytax: wrong(bool printheader, string helpfile, string error[]);") unless (@_ > 2); my ($printheader, $helpfile, @errors)=@_; my ($errormsg) = join ' ', @errors; ($printheader) && &header($printheader, '', $helpfile, (-f 'config.info'), 0); print << "EOT";

$text{'error'}



$errormsg


 


EOT &footer(); exit 0; }; sub print_styles { print<<"EOT"; EOT }; sub imonc_init { imonc_connect($config{'gwhost'}, $config{'gwport'}) || wrong('IMonC','','cannot connect to router'); if ($access{'admin'} eq 'yes') { if ((defined $config{'gwadminpassword'}) && ($config{'gwadminpassword'} ne '')) { wrong('IMonC','',$text{'err_wrong-adminpassword'}) unless imonc_command ("pass", $config{'gwadminpassword'}); } elsif ((defined $config{'gwpassword'}) && ($config{'gwpassword'} ne '')) { wrong('IMonC','',$text{'err_wrong-password'}) unless imonc_command ("pass", $config{'gwpassword'}); }; } else { if ((defined $config{'gwpassword'}) && ($config{'gwpassword'} ne '')) { wrong('IMonC','',$text{'err_wrong-password'}) unless imonc_command ("pass", $config{'gwpassword'}); }; }; }; 1; # return a true valueimonc/routing.cgi0100640000000000000000000002163407452671315013051 0ustar rootroot#!/usr/bin/perl # Abhngigkeiten ################################################################################ do '../web-lib.pl'; do 'common.pl'; do 'common_main_windows.pl'; use strict; use IMonC; use POSIX; use IO::Socket; # Initialisieren ################################################################################ our (%config, %in, %access, %text); my (%data, $module_config_directory, %circuits, $count); &init_config(); &ReadParse(); %access=get_module_acl(); # Aufrufparameter und Hauptteil ################################################################################ # Verbindung herstellen imonc_init(); if ($in{'function'}) { do_params(); } else { do_main(); }; imonc_disconnect(); # Funktionen (aufgerufen ueber Parameter) ################################################################################ sub do_params { my ($command, $output, $stat); $data{'circuits'} = imonc_command('circuits'); SWITCH: { ($in{'function'} eq 'ROUTE') && do { unless (($access{'routing'} eq 'yes') && (imonc_command('is-allowed','route'))) { wrong('IMonC','', $text{'routing_wrong-noaccess'}); } else { wrong ('IMonC','', $text{'routing_wrong-route'}) unless (($in{'route'} >= 0) && ($in{'route'} <= $data{'circuits'})) || (($in{'route'} eq 'pppoe') && (imonc_command('pppoe') eq 1)); $command='route '.$in{'route'}; $output=imonc_command($command); } last SWITCH;}; } $stat='FAILED'; $stat='SUCCESS' if (defined $output); # Information an Benutzer print <<"EOT"; Content-type: text/html executing command:
$command
$stat
EOT print <<"EOT" if ($output ne ''); command output was:
$output
EOT print<<"EOT"; EOT }; # sub do_params # Hauptprogramm ################################################################################ sub do_main { my ($output, $counter, @routes, %circuits, $line); $data{'modconf'}=$module_config_directory; # Header ausgeben &header("IMonC", "", undef, 1, 1); # Daten sammeln $data{'route'} = imonc_command('route'); $data{'timetable'} = imonc_command('timetable'); $data{'times'} = ''."\n"; $data{'had-heading'}=0; foreach $line (split /^/, $data{'timetable'}) { chomp $line; last if ($line =~ /^[\s\t ]*$/); next if ($line =~ /^[\s-]+$/); $data{'times'}.="\n \n"; unless ($data{'had-heading'}) { $data{'times'} .= " \n"; foreach (split /\s+/, $line) { next if (/^\s*$/); $data{'times'} .= " \n"; }; $data{'had-heading'} = 1; } else { $data{'had-day'}=0; foreach (split /\s+/, $line) { next if (/^\s*$/); unless ($data{'had-day'}) { if ($_ eq 'Su') { $data{'day'}=$text{'routing_table_head-su'}; } elsif ($_ eq 'Mo') { $data{'day'}=$text{'routing_table_head-mo'}; } elsif ($_ eq 'Tu') { $data{'day'}=$text{'routing_table_head-tu'}; } elsif ($_ eq 'We') { $data{'day'}=$text{'routing_table_head-we'}; } elsif ($_ eq 'Th') { $data{'day'}=$text{'routing_table_head-th'}; } elsif ($_ eq 'Fr') { $data{'day'}=$text{'routing_table_head-fr'}; } elsif ($_ eq 'Sa') { $data{'day'}=$text{'routing_table_head-sa'}; }; $_ = $data{'day'}; $data{'had-day'} = 1; $data{'times'} .= " \n"; } else { $data{'times'} .= " \n"; }; }; }; $data{'times'} .= " \n" }; $data{'times'} .= "
$text{'routing_table_head-day'}$_$_$_
\n"; $data{'circuit-table'} =''."\n"; $data{'had-heading'} = 0; $data{'had-separator'} = 0; foreach $line (split /^/, $data{'timetable'}) { chomp $line; unless ($data{'had-separator'}) { next unless ($line =~ /^[\s\t ]*$/); $data{'had-separator'} = 1; next; }; $data{'circuit-table'} .= " \n"; unless ($data{'had-heading'}) { for ($data{'field'} = 1; $data{'field'} < 8; $data{'field'}++) { if ($data{'field'} == 1) { $_ = $text{'routing_circtable_head-no'}; $data{'circuit-table'} .= " \n" } elsif ($data{'field'} == 2) { $_ = $text{'routing_circtable_head-name'}; } elsif ($data{'field'} == 3) { $_ = $text{'routing_circtable_head-lcr'}; } elsif ($data{'field'} == 4) { $_ = $text{'routing_circtable_head-droute'}; } elsif ($data{'field'} == 5) { $_ = $text{'routing_circtable_head-device'}; } elsif ($data{'field'} == 6) { $_ = $text{'routing_circtable_head-charge'}; } elsif ($data{'field'} == 7) { $_ = $text{'routing_circtable_head-chargeint'}; }; $data{'circuit-table'} .= " \n" if ($data{'field'} > 1); }; $data{'had-heading'} = 1; } else { $data{'field'} = 1; foreach (split /\s+/, $line) { next if (/^\s*$/); if ($data{'field'} == 1) { $data{'circuit-table'} .= " \n"; } else { $data{'circuit-table'} .= " \n"; }; $data{'field'}++; }; }; $data{'circuit-table'} .= " \n"; }; $data{'circuit-table'} .= "
". "$_". "$_". "$_$_
\n"; $data{'circuits'} = imonc_command('circuits'); $circuits{'0'}='Automatic (LCR)'; while ($counter++<$data{'circuits'}) { $circuits{$counter}=imonc_command('circuit', $counter); }; #if (imonc_command('pppoe') == 1) { # $circuits{'pppoe'} = imonc_command('circuit', 'pppoe'); #}; if (($access{'routing'} eq 'yes') && (imonc_command('is-allowed','route') == 1)) { foreach (keys %circuits) { if ($_ eq $data{'route'}) { push @routes, ""; } else { push @routes, ""; }; }; $data{'routing-setting'} = <<"EOT";
     
EOT } else { $data{'routing-setting'} = $circuits{$data{'route'}}; }; # Seite aufbauen print<<"EOT";
 IMonC  Routing            

EOT print_styles(); print_infoline(); print<<"EOT";

$text{'routing_droute'}
$data{'routing-setting'}

$text{'routing_circuits'}

$data{'circuit-table'}

$text{'routing_timetable'}

$data{'times'}

EOT &footer('/','index'); }; # sub do_main imonc/rates.cgi0100640000000000000000000000714007433665212012472 0ustar rootroot#!/usr/bin/perl # Abhngigkeiten ################################################################################ do '../web-lib.pl'; do 'common.pl' || die "$@"; use strict; use IMonC; use POSIX; # Initialisieren ################################################################################ our (%config, %in, %text, %access); my (%data, $module_config_directory, $mname, $channel, $circuit, $channel_name); $mname='./rates.cgi'; &init_config(); &ReadParse(); imonc_init(); if ($in{'channel'} eq 'pppoe') { if (imonc_command('pppoe') eq 1) { $channel='pppoe'; $circuit='DSL'; } else { wrong ('IMonC', '', $text{'err_no-dsl'}); }; } elsif ($in{'channel'} =~ /^\d+$/) { if (($in{'channel'} < imonc_command('channels')) && ($in{'channel'} >0)) { $channel=$in{'channel'}; $circuit=imonc_command('phone', $channel); } else { wrong('IMonC', '', $text{'err_channel-notexist'}.': '.$in{'channel'}.'.'); }; } else { $circuit=$text{'rates_datarates'}; }; $channel=$in{'channel'}; ($channel eq 'pppoe') && ($channel_name = 'DSL'); if ($channel eq 'pppoe') { $channel_name='DSL ('.$circuit.')'; } else { $channel_name=''.(POSIX::floor($channel / 2)).'|'.(($channel % 2) ? 'B2' : 'B1').' ('.$circuit.')'; }; # Daten sammeln ################################################################################ $data{'internetstatus'} = imonc_command('status', $channel); if ($data{'internetstatus'} =~ /Offline/i) { $data{'datarate_in'}=$data{'datarate_out'}=' ---'; $data{'volumen_in'}=$data{'volumen_out'}=' ---'; } else { ($data{'dr_in'}, $data{'dr_out'}) = split ' ', imonc_command('rate', $channel); $data{'dr_inkb'} = POSIX::floor($data{'dr_in'}/1024); $data{'dr_inkbdez'} = POSIX::floor($data{'dr_in'}*10/1024) % 10; $data{'datarate_in'} = ' '.$data{'dr_inkb'}.'.'.$data{'dr_inkbdez'}; $data{'dr_outkb'} = POSIX::floor($data{'dr_out'}/1024); $data{'dr_outkbdez'} = POSIX::floor($data{'dr_out'}*10/1024) % 10; $data{'datarate_out'} = ' '.$data{'dr_outkb'}.'.'.$data{'dr_outkbdez'}; ($data{'vol_in'}, $data{'vol_out'}) = split ' ', imonc_command('quantity', $channel); $data{'volumen_in'} = POSIX::floor($data{'vol_in'}/1024); $data{'volumen_out'} = POSIX::floor($data{'vol_out'}/1024); }; $data{'cpu'} = imonc_command('cpu'); imonc_disconnect; # AUSGABE ################################################################################ print "Content-Type: text/html\nRefresh: $config{'subwindow_refresh'};url=./$mname?channel=$in{'channel'}\n\n"; print "$channel_name; CPU: $data{'cpu'}%"; print "
"; print "$text{'rates_act-rates'}"; # aktuelle DR print '

'. $text{'rates_in'}.' '. '       '.$text{'rates_out'}.'
'. '

'; # Datenvolumen print "$text{'rates_transferred-data'}"; print '

'. $text{'rates_in'}.' '. '       '.$text{'rates_out'}.'
'. '

'; # CPU-Auslastung print "$text{'rates_cpu-usage'}
"; ($data{'cpu'} = ' '.$data{'cpu'}) if ($data{'cpu'} < 10); print '
'. ''; print '
'; imonc/config0100640000000000000000000000014407433700611012046 0ustar rootrootgwhost=192.168.1.254 gwport=5000 gwpassword= gwadminpassword= subwindow_refresh=2 index_refresh=300 imonc/acl_security.pl0100640000000000000000000000262507433767775013737 0ustar rootroot#!/usr/bin/perl use strict; our (%yesno); $yesno{'dial-hangup'} = 'Can use "dial" and "hangup" commands'; $yesno{'halt-reboot'} = 'Can use "halt" and "reboot" commands'; $yesno{'dialmode'} = 'Can change dialmode setting'; $yesno{'routing'} = 'Can change routing setup'; $yesno{'admin'} = 'Has admin acces (when this user
is logged on, admin pw will be used)'; $yesno{'bundling-commands'} = 'Can add and remove bundled channels'; sub acl_security_form { my ($aclref)=@_; my %acl=%$aclref; my ($yesselected, $noselected, $key); # Dial and Hangup Siteblocker foreach $key (keys %yesno) { $yesselected=''; $noselected=''; ($acl{$key} eq 'yes') && ($yesselected="checked"); ($acl{$key} eq 'no') && ($noselected="checked"); print<<"EOT"; $yesno{$key}: Yes No EOT }; }; # sub acl_security_form_save; sub acl_security_save { my ($aclref, $inputref)=@_; my %acl=%$aclref; my %input=%$inputref; my $key; # yes-no-values foreach $key (keys %yesno) { $acl{$key}='no'; $acl{$key}='yes' if ($input{$key} eq 'yes'); } %$aclref=%acl; }; # sub acl_security_save; 1;imonc/images/0040750000000000000000000000000007433604675012143 5ustar rootrootimonc/images/icon.gif0100640000000000000000000000274707433602512013556 0ustar rootrootGIF89a00 *:.: "F*6j>RVz~66b&6*z.fnV**Z*:6Jj"ZnfN&N&BBb.j>f2.VZffb RN*VjZ:~RRR~V*&VRRFN.bnjj:*6V~&BRFRʪbbfb_.BNN:R6.6ZZzzvffBN2^nvvu6Nr&r. .:2F^^\622~~bbƂ>v>&Rf:66Rz:RFN>RVa:FrZf:NZ^ .2JrNNFFCFF~~.6FFRbRBB.:ZfVZZZZB><:rrJJHf"FJBf26rr>>jrj:fz**.>*F &~VRN:Rv~bNv".J*>>V>nbrJNFBB6B6>..F^JJnNNR :bvF6>vrn >VblNXV"&FBBNZNJJ6J T|ڄ:: \hv~L.>>L^ZZZVVzvrb^^nv:Rn& VN..JRBV :R2:J^jjj2>jff :Vf&4JVRNN.B.>6F2> Vz~*! ,+(@ H!4‡m]KC[-tU_!0HJ(O6)v cDrlπQ.L.%EpMYXjݺ5X2Qp x` -l)0>|͔ɓZ0`S'-X Q,U!3*Wنp|~4ZƎu&ɖJÞ-gvoeFaeL )~<3'+E!PJQJ %1Ќx#lL! _Q JP#DO F|^zs@I;@( jAx"~ BD55SuBUPN) 417LwP)itdst,7ܒb"T-QC8 hLifI\K¸Id-K@U8肃 bNJ)^ArT=ā2AJd?@2z(Q6(x/!!5(a2*$X,#?LjsO@@!*ro!La(aNdbb;No=9 RNQ8P,t%K* q P(P7@Ea$T1܈ T4, `Io(F;imonc/images/fli4l-klein.gif0100640000000000000000000000276207433604401014734 0ustar rootrootGIF89a*( *:.: "F*6j>RVz~66b&6*z.fnV**Z*:6Jj"ZnfN&N&BBb.j>f2.VZffb RN*VjZ:~RRR~V*&VRRFN.bnjj:*6V~&BRFRʪbbfb_.BNN:R6.6ZZzzvffBN2^nvvu6Nr&r. .:2F^^\622~~bbƂ>v>&Rf:66Rz:RFN>RVa:FrZf:NZ^ .2JrNNFFCFF~~.6FFRbRBB.:ZfVZZZZB><:rrJJHf"FJBf26rr>>jrj:fz**.>*F &~VRN:Rv~bNv".J*>>V>nbrJNFBB6B6>..F^JJnNNR :bvF6>vrn >VblNXV"&FBBNZNJJ6J T|ڄ:: \hv~L.>>L^ZZZVVzvrb^^nv:Rn& VN..JRBV :R2:J^jjj2>jff :Vf&4JVRNN.B.>6F2> Vz~*! Fli4L-Logo! ,*(@ H!,‡m]KB[-tU_!0HJ(O6(p ;0A"u?lrgQ P ` "@D&ͬXj, O (8Oԁh< t0b ^ŒfId-0ʙ֋p *+lC8[>B^6$:tcݺIaҰgظݝͻ`)FAF40G z)JQR`TjuKp[|]hF,QrI!E,ċ` qli ^ȕ+DN&z"ld S.88/椔:J(MAs@(!cJA/ @(lCH`@@P"P&r R= YXQ?5K "/hA"θ0@? VP0 ٓ(1p*Eԋ!H@'PNt{SuC]R)юM=<CO(AHB>T֎I& d@;imonc/index.cgi0100640000000000000000000005106607452673476012505 0ustar rootroot#!/usr/bin/perl # Abhngigkeiten ################################################################################ do '../web-lib.pl'; do 'common.pl' || die "cannot do common.pl"; do 'common_main_windows.pl' || die "cannot do common_main_windows.pl"; use strict; use IMonC; use POSIX; use IO::Socket; # Initialisieren ################################################################################ our (%config, %in, %access, %text); my (%data, $module_config_directory, %circuits, $count, $mname); $mname="./index.cgi"; &init_config(); &ReadParse(); %access=&get_module_acl(); # Aufrufparameter und Hauptteil ################################################################################ # Verbindung herstellen imonc_init(); $data{'circuits'}=imonc_command('circuits'); wrong('IMonC','',"no circuits defined on router") if ( (! defined $data{'circuits'}) || (1>$data{'circuits'})); for ($count = 1; $count <= $data{'circuits'}; $count++) { $circuits{$count}=imonc_command('device', $count); }; # for if ($in{'function'}) { do_params(); } else { do_main(); }; imonc_disconnect() || wrong(undef, undef, "Cannot close connection to router."); exit 0; # Funktionen (aufgerufen ueber Parameter) ################################################################################ sub do_params { my ($command, $output, $stat, $closewindow); $closewindow=0; SWITCH: { ($in{'function'} eq 'FUNCTIONLINE') && do { SWITCHSUB: { if ($in{'dial'}) { unless ((imonc_command('is-allowed','dial') == 1) && ($access{'dial-hangup'} eq 'yes')) { wrong('IMonC', '', 'You are not allowed to dial.'); } else { $command='dial'; }; last SWITCHSUB; }; if ($in{'hangup'}) { unless ((imonc_command('is-allowed','hangup') == 1) && ($access{'dial-hangup'} eq 'yes')) { wrong('IMonC', '', 'You are not allowed to hangup.'); } else { $command='hangup'; }; last SWITCHSUB; }; if ($in{'dialmode'}) { unless ((imonc_command('is-allowed','dialmode') == 1) && ($access{'dialmode'} eq 'yes')) { wrong('IMonC', '', 'You are not allowed to change the dialmode setting.'); } else { if ($in{'dialmode'} eq $text{'sub_functionline_dialmode-off'}) { $_ = 'off'; } elsif ($in{'dialmode'} eq $text{'sub_functionline_dialmode-auto'}) { $_ = 'auto'; } elsif ($in{'dialmode'} eq $text{'sub_functionline_dialmode-manual'}) { $_ = 'manual'; } else { wrong('IMonC', '', 'You must use the form to work. The following is not a correct dialmode: '. $in{'dialmode'}.'.'); }; $command='dialmode '. $_; }; last SWITCHSUB; }; if ($in{'reboot'}) { unless ((imonc_command('is-allowed','reboot') == 1) && ($access{'halt-reboot'} eq 'yes')) { wrong('IMonC', '', $text{'main_reboot_notallowed'}); } else { unless ($in{'ack'}) { print "Content-Type: text/html\n\n"; print "$text{'main_reboot_confirmation-title'}"; print "
"; print "

$text{'main_reboot_confirmation-question'}

\n"; print "\n"; print "\n"; print "\n"; print ""; return; } else { $closewindow=1; if ($in{'ack'} eq 'YES') { $command='reboot'; } else { $command=''; }; }; }; last SWITCHSUB; }; if ($in{'halt'}) { unless ((imonc_command('is-allowed','halt') == 1) && ($access{'halt-reboot'} eq 'yes')) { wrong('IMonC', '', $text{'main_halt_notallowed'}); } else { unless ($in{'ack'}) { print "Content-Type: text/html\n\n"; print "$text{'main_halt_confirmation-title'}"; print "
"; print "

$text{'main_halt_confirmation-question'}

\n"; print "
". "$text{'yes'}$text{'no'}
\n"; print "\n"; print "\n"; print ""; return; } else { $closewindow=1; if ($in{'ack'} eq 'YES') { $command='halt'; } else { $command=''; }; }; }; last SWITCHSUB; }; last SWITCHSUB; }; if ($command ne '') { $output=imonc_command($command); } else { $command = 'Bitte schliessen sie dieses Fenster!'; }; last SWITCH; }; ($in{'function'} eq 'ADDLINK') && do { if (($access{'admin'} eq 'yes') && ($access{'bundling-commands'} eq 'yes')) { $command='addlink '.imonc_command('route'); $output=imonc_command($command); } else { wrong('IMonC', '', 'Cannot execute ADDLINK command due to missing access rights.'); }; last SWITCH; }; ($in{'function'} eq 'REMOVELINK') && do { if (($access{'admin'} eq 'yes') && ($access{'bundling-commands'} eq 'yes')) { $command='removelink '.imonc_command('route'); $output=imonc_command($command); } else { wrong('IMonC', '', 'Cannot execute REMOVE command due to missing access rights.'); }; last SWITCH; }; $command = ''; } $stat='FAILED'; $stat='SUCCESS' if (defined $output); if ($closewindow) { $closewindow=""; } else { $closewindow=''; }; # Information an Benutzer print <<"EOT"; Content-type: text/html $closewindow executing command:
$command
$stat
EOT print <<"EOT" if ($output ne ''); command output was:
$output
EOT print<<"EOT"; EOT }; # sub do_params # Hauptprogramm ################################################################################ # Die Fuktionsleiste ausgeben sub print_functionline { my ($dialmode, @dialmodes, $dial, $hangup, $dialmode, $reboot, $halt); print ""; $dial = ' '; ($dial = '') if ((imonc_command('is-allowed','dial') == 1) && ($access{'dial-hangup'} eq 'yes')); $hangup = ' '; ($hangup='') if ((imonc_command('is-allowed','hangup') == 1) && ($access{'dial-hangup'} eq 'yes')); $reboot = ' '; ($reboot='') if ((imonc_command('is-allowed','reboot') == 1) && ($access{'halt-reboot'} eq 'yes')); $halt = ' '; ($halt='') if ((imonc_command('is-allowed','halt') == 1) && ($access{'halt-reboot'} eq 'yes')); if ((imonc_command('is-allowed','dialmode') == 1) && ($access{'dialmode'} eq 'yes')) { $dialmode = imonc_command('dialmode'); foreach (('auto', 'manual', 'off')) { if ($_ eq $dialmode) { push @dialmodes, ''; } else { push @dialmodes, ''; }; }; # foreach dialmode $dialmode = $text{'sub_functionline_dialmode'}.':   '. ''. ''; }; print<<"EOT";
". "$text{'yes'}$text{'no'}
$dial   $hangup   $dialmode   $reboot   $halt   $text{'sub_functionline_open-cpu-usage'}
EOT }; # Einen Channel ausgeben sub print_channel { my ($channel) = @_; my ($isonline, $onlinetime, $onlinetime_h, $onlinetime_m, $onlinetime_s, $chargetime, $chargetime_h, $chargetime_m, $chargetime_s, $online_color, $channel_name, $ip, $charge, $inout, $outphone, $bundling, $bundling_text); if ($channel eq 'head') { # HEADER print<<"EOT";
 
EOT } elsif ($channel eq 'foot') { # FOOTER print<<"EOT";
  $text{'main_channels_channel'} $text{'main_channels_circuit'} ($text{'main_channels_direction'}) $text{'main_channels_ip'} $text{'main_channels_onlinetime'} $text{'main_channels_chargetime'} $text{'main_channels_charge'} $text{'main_channels_other'}
EOT } elsif ($channel eq 'dist') { # EMPTY LINE IN BETWEEN print<<"EOT";   EOT } else { # CHANNEL if ($channel eq 'pppoe') { $channel_name='DSL ('.imonc_command('driverid',$channel).')'; } else { $channel_name=''.(POSIX::floor(($channel+1) / 2)).'|'.(($channel % 2) ? 'B1' : 'B2').' ('.(imonc_command('driverid', $channel)).')'; }; if (imonc_command('status',$channel) !~ /Online/i) { $isonline = 0; $online_color = '#FF0000'; $inout=' '; $ip=' '; $onlinetime=' '; } else { $isonline = 1; $online_color = '#009000'; $inout='('.imonc_command('inout', $channel).')'; $ip=imonc_command('ip', $channel); $onlinetime = imonc_command('online-time', $channel); $outphone = imonc_command('phone', $channel); ($onlinetime_h, $onlinetime_m, $onlinetime_s) = split ':', $onlinetime; ($onlinetime_h=0) unless (defined $onlinetime_h); ($onlinetime_m=0) unless (defined $onlinetime_m); ($onlinetime_s=0) unless (defined $onlinetime_s); $onlinetime=<<"EOT";
EOT $bundling_text=''; if (($access{'bundling-commands'} eq 'yes') && ($access{'admin'} eq 'yes')) { $bundling=imonc_command('links',$outphone); # wrong('','',$bundling); if ($bundling == 1) { $bundling_text=''. $text{'main_channels_addlink'}.''. '            '; } elsif ($bundling == 2) { $bundling_text=''. $text{'main_channels_removelink'}.''. '            '; }; }; }; $charge=imonc_command('charge', $channel); $chargetime = imonc_command('chargetime', $channel); ($chargetime_h, $chargetime_m, $chargetime_s) = split ':', $chargetime; ($chargetime_h=0) unless (defined $chargetime_h); ($chargetime_m=0) unless (defined $chargetime_m); ($chargetime_s=0) unless (defined $chargetime_s); $chargetime=<<"EOT";
EOT print<<"EOT" if ($isonline) ; EOT print<<"EOT";   $channel_name $outphone $inout $ip $onlinetime $chargetime $bundling_text $text{'main_channels_showdatarates'} EOT print<<"EOT" if ($isonline); EOT }}; # HAUPTTEIL sub do_main { my ($output, $i); $data{'modconf'}=$module_config_directory; # Header ausgeben &header('IMonC', "", undef, 1, 1); # Seite aufbauen print_styles(); print<<"EOT";
 $text{'tablets_main'}  $text{'tablets_routing'}            

EOT print_infoline(); print "
\n"; print_functionline(); print "
\n"; print_channel('head'); $data{'channels'} = imonc_command('channels'); for ($i=1; $i <= $data{'channels'}; $i++) { print_channel ($i); } if (imonc_command('pppoe')) { print_channel('pppoe'); }; print_channel ('dist'); print_channel('foot'); print<<"EOT";

EOT &footer('/','index'); }; # sub do_main imonc/config.info0100640000000000000000000000055107433762762013021 0ustar rootrootgwhost=Host name or adress of gateway,0 gwport=ImonD port number on gateway,0 gwpassword=Password to access ImonD (user mode),0 gwadminpassword=Password to access ImonD (admin mode),0 subwindow_refresh=Refresh interval (seconds) for rates/cpu window,0 index_refresh=Refresh interval (seconds) for main window
(warning: refresh disables webmin auto-login!!),0imonc/defaultacl0100640000000000000000000000014407433700342012706 0ustar rootrootnoconfig=0 dialmode=yes dial-hangup=yes halt-reboot=yes bundling-commands=yes admin=yes routing=yes imonc/cpu-usage.cgi0100640000000000000000000000200107433611120013221 0ustar rootroot#!/usr/bin/perl # Abhngigkeiten ################################################################################ do '../web-lib.pl'; do 'common.pl' || die "$@"; use strict; use IMonC; use POSIX; # Initialisieren ################################################################################ our (%config, %in); my ($cpu_usage, $module_config_directory, $mname); $mname='./cpu-usage.cgi'; &init_config(); &ReadParse(); imonc_init(); $cpu_usage = imonc_command('cpu'); imonc_disconnect; # AUSGABE ################################################################################ print "Content-Type: text/html\nRefresh: $config{'subwindow_refresh'};url=./$mname\n\n"; print "CPU: ${cpu_usage}%"; print "
"; print "CPU-Auslastung
"; ($cpu_usage = ' '.$cpu_usage) if ($cpu_usage < 10); print '
'. ''; print '
'; imonc/module.info0100640000000000000000000000006307433605400013020 0ustar rootrootname=imonc desc=IMonD Client (fli4l) category=otherimonc/IMonC.pm0100640000000000000000000000530007433662017012167 0ustar rootroot#!/usr/bin/perl # Abhngigkeiten und Pragmas ################################################################################ use strict; use IO::Socket; use Carp; require Exporter; our(@ISA, @EXPORT); @ISA = ('Exporter'); @EXPORT = qw(imonc_connect imonc_command imonc_disconnect); # Initialisieren ################################################################################ my ($myconnection, %data, $module_config_directory, %circuits, $count); # Verbindung herstellen ################################################################################ sub imonc_connect { croak ("Cannot connect if host or port are not specified.") unless (@_ == 2); $myconnection = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $_[0], PeerPort => $_[1] ) or croak ("cannot connect to IMOND at $_[0]:$_[1]"); return undef unless (defined $myconnection); return 1; }; # sub connect # Befehl schicken und Antwort auswerten ################################################################################ # Mit dieser Funktion kann ein Befehl an IMonC geschickt werden. # Dies erfolgt entweder durch die Angabe eines Strings oder mehrerer Strings, # der Erste ist der Befehl der Rest sind Parameter. Alternativ koennen auch # Teile mit Blanks getrennt uebergeben werden. # Der Rueckgabewert ist bei einem Fehler undef, sonst die Antwort ohne den # Status. # imonc_command("", [@args]); returns undef on error or command return status sub imonc_command { error("issue_command: illegal request") if (@_ < 1); my ($cmd, @args) = @_; chomp($cmd); my ($stat, $returnval, $arg, $line, $text); $arg=''; foreach (@args) { $arg .= ' '.$_; }; return undef unless ($myconnection); print $myconnection "$cmd$arg\n"; $text=''; while ($line = <$myconnection>) { $line =~ s/\n|\r\n|\n\r|\n//; if ($line =~ /^(?:OK|ERR)/) { ($stat, $returnval) = split ' ', $line, 2; last; } else { $text.=$line."\n"; }; }; return undef unless ($stat eq "OK"); $returnval = '' unless (defined $returnval); return $text if ($text ne ''); return $returnval; }; # sub issue_command # Verbindung sauber trennen ################################################################################ sub imonc_disconnect { close $myconnection; }; # sub disconnect # Ist die Verbindung aktiv? ################################################################################ sub imonc_connected { return $myconnection; }; # ENDE ################################################################################ 1;imonc/routing.cgi~0100640000000000000000000002163407433703442013243 0ustar rootroot#!/usr/bin/perl # Abhngigkeiten ################################################################################ do '../web-lib.pl'; do 'common.pl'; do 'common_main_windows.pl'; use strict; use IMonC; use POSIX; use IO::Socket; # Initialisieren ################################################################################ our (%config, %in, %access, %text); my (%data, $module_config_directory, %circuits, $count); &init_config(); &ReadParse(); %access=get_module_acl(); # Aufrufparameter und Hauptteil ################################################################################ # Verbindung herstellen imonc_init(); if ($in{'function'}) { do_params(); } else { do_main(); }; imonc_disconnect(); # Funktionen (aufgerufen ueber Parameter) ################################################################################ sub do_params { my ($command, $output, $stat); $data{'circuits'} = imonc_command('circuits'); SWITCH: { ($in{'function'} eq 'ROUTE') && do { unless (($access{'routing'} eq 'yes') && (imonc_command('is-allowed','route'))) { wrong('IMonC','', $text{'routing_wrong-noaccess'}); } else { wrong ('IMonC','', $text{'routing_wrong-route'}) unless (($in{'route'} >= 0) && ($in{'route'} <= $data{'circuits'})) || (($in{'route'} eq 'pppoe') && (imonc_command('pppoe') eq 1)); $command='route '.$in{'route'}; $output=imonc_command($command); } last SWITCH;}; } $stat='FAILED'; $stat='SUCCESS' if (defined $output); # Information an Benutzer print <<"EOT"; Content-type: text/html executing command:
$command
$stat
EOT print <<"EOT" if ($output ne ''); command output was:
$output
EOT print<<"EOT"; EOT }; # sub do_params # Hauptprogramm ################################################################################ sub do_main { my ($output, $counter, @routes, %circuits, $line); $data{'modconf'}=$module_config_directory; # Header ausgeben &header("IMonC", "", undef, 1, 1); # Daten sammeln $data{'route'} = imonc_command('route'); $data{'timetable'} = imonc_command('timetable'); $data{'times'} = ''."\n"; $data{'had-heading'}=0; foreach $line (split /^/, $data{'timetable'}) { chomp $line; next if ($line =~ /^[\s-]+$/); last if ($line =~ /^[\s\t ]*$/); $data{'times'}.="\n \n"; unless ($data{'had-heading'}) { $data{'times'} .= " \n"; foreach (split /\s+/, $line) { next if (/^\s*$/); $data{'times'} .= " \n"; }; $data{'had-heading'} = 1; } else { $data{'had-day'}=0; foreach (split /\s+/, $line) { next if (/^\s*$/); unless ($data{'had-day'}) { if ($_ eq 'Su') { $data{'day'}=$text{'routing_table_head-su'}; } elsif ($_ eq 'Mo') { $data{'day'}=$text{'routing_table_head-mo'}; } elsif ($_ eq 'Tu') { $data{'day'}=$text{'routing_table_head-tu'}; } elsif ($_ eq 'We') { $data{'day'}=$text{'routing_table_head-we'}; } elsif ($_ eq 'Th') { $data{'day'}=$text{'routing_table_head-th'}; } elsif ($_ eq 'Fr') { $data{'day'}=$text{'routing_table_head-fr'}; } elsif ($_ eq 'Sa') { $data{'day'}=$text{'routing_table_head-sa'}; }; $_ = $data{'day'}; $data{'had-day'} = 1; $data{'times'} .= " \n"; } else { $data{'times'} .= " \n"; }; }; }; $data{'times'} .= " \n" }; $data{'times'} .= "
$text{'routing_table_head-day'}$_$_$_
\n"; $data{'circuit-table'} =''."\n"; $data{'had-heading'} = 0; $data{'had-separator'} = 0; foreach $line (split /^/, $data{'timetable'}) { chomp $line; unless ($data{'had-separator'}) { next unless ($line =~ /^[\s\t ]*$/); $data{'had-separator'} = 1; next; }; $data{'circuit-table'} .= " \n"; unless ($data{'had-heading'}) { for ($data{'field'} = 1; $data{'field'} < 8; $data{'field'}++) { if ($data{'field'} == 1) { $_ = $text{'routing_circtable_head-no'}; $data{'circuit-table'} .= " \n" } elsif ($data{'field'} == 2) { $_ = $text{'routing_circtable_head-name'}; } elsif ($data{'field'} == 3) { $_ = $text{'routing_circtable_head-lcr'}; } elsif ($data{'field'} == 4) { $_ = $text{'routing_circtable_head-droute'}; } elsif ($data{'field'} == 5) { $_ = $text{'routing_circtable_head-device'}; } elsif ($data{'field'} == 6) { $_ = $text{'routing_circtable_head-charge'}; } elsif ($data{'field'} == 7) { $_ = $text{'routing_circtable_head-chargeint'}; }; $data{'circuit-table'} .= " \n" if ($data{'field'} > 1); }; $data{'had-heading'} = 1; } else { $data{'field'} = 1; foreach (split /\s+/, $line) { next if (/^\s*$/); if ($data{'field'} == 1) { $data{'circuit-table'} .= " \n"; } else { $data{'circuit-table'} .= " \n"; }; $data{'field'}++; }; }; $data{'circuit-table'} .= " \n"; }; $data{'circuit-table'} .= "
". "$_". "$_". "$_$_
\n"; $data{'circuits'} = imonc_command('circuits'); $circuits{'0'}='Automatic (LCR)'; while ($counter++<$data{'circuits'}) { $circuits{$counter}=imonc_command('circuit', $counter); }; #if (imonc_command('pppoe') == 1) { # $circuits{'pppoe'} = imonc_command('circuit', 'pppoe'); #}; if (($access{'routing'} eq 'yes') && (imonc_command('is-allowed','route') == 1)) { foreach (keys %circuits) { if ($_ eq $data{'route'}) { push @routes, ""; } else { push @routes, ""; }; }; $data{'routing-setting'} = <<"EOT";
     
EOT } else { $data{'routing-setting'} = $circuits{$data{'route'}}; }; # Seite aufbauen print<<"EOT";
 IMonC  Routing            

EOT print_styles(); print_infoline(); print<<"EOT";

$text{'routing_droute'}
$data{'routing-setting'}

$text{'routing_circuits'}

$data{'circuit-table'}

$text{'routing_timetable'}

$data{'times'}

EOT &footer('/','index'); }; # sub do_main imonc/index.cgi~0100640000000000000000000005067007452672577012704 0ustar rootroot#!/usr/bin/perl # Abhngigkeiten ################################################################################ do '../web-lib.pl'; do 'common.pl' || die "cannot do common.pl"; do 'common_main_windows.pl' || die "cannot do common_main_windows.pl"; use strict; use IMonC; use POSIX; use IO::Socket; # Initialisieren ################################################################################ our (%config, %in, %access, %text); my (%data, $module_config_directory, %circuits, $count, $mname); $mname="./index.cgi"; &init_config(); &ReadParse(); %access=&get_module_acl(); # Aufrufparameter und Hauptteil ################################################################################ # Verbindung herstellen imonc_init(); $data{'circuits'}=imonc_command('circuits'); wrong('IMonC','',"no circuits defined on router") if ( (! defined $data{'circuits'}) || (1>$data{'circuits'})); for ($count = 1; $count <= $data{'circuits'}; $count++) { $circuits{$count}=imonc_command('device', $count); }; # for if ($in{'function'}) { do_params(); } else { do_main(); }; imonc_disconnect() || wrong(undef, undef, "Cannot close connection to router."); exit 0; # Funktionen (aufgerufen ueber Parameter) ################################################################################ sub do_params { my ($command, $output, $stat, $closewindow); $closewindow=0; SWITCH: { ($in{'function'} eq 'FUNCTIONLINE') && do { SWITCHSUB: { if ($in{'dial'}) { unless ((imonc_command('is-allowed','dial') == 1) && ($access{'dial-hangup'} eq 'yes')) { wrong('IMonC', '', 'You are not allowed to dial.'); } else { $command='dial'; }; last SWITCHSUB; }; if ($in{'hangup'}) { unless ((imonc_command('is-allowed','hangup') == 1) && ($access{'dial-hangup'} eq 'yes')) { wrong('IMonC', '', 'You are not allowed to hangup.'); } else { $command='hangup'; }; last SWITCHSUB; }; if ($in{'dialmode'}) { unless ((imonc_command('is-allowed','dialmode') == 1) && ($access{'dialmode'} eq 'yes')) { wrong('IMonC', '', 'You are not allowed to change the dialmode setting.'); } else { if ($in{'dialmode'} eq $text{'sub_functionline_dialmode-off'}) { $_ = 'off'; } elsif ($in{'dialmode'} eq $text{'sub_functionline_dialmode-auto'}) { $_ = 'auto'; } elsif ($in{'dialmode'} eq $text{'sub_functionline_dialmode-manual'}) { $_ = 'manual'; } else { wrong('IMonC', '', 'You must use the form to work. The following is not a correct dialmode: '. $in{'dialmode'}.'.'); }; $command='dialmode '. $_; }; last SWITCHSUB; }; if ($in{'reboot'}) { unless ((imonc_command('is-allowed','reboot') == 1) && ($access{'halt-reboot'} eq 'yes')) { wrong('IMonC', '', $text{'main_reboot_notallowed'}); } else { unless ($in{'ack'}) { print "Content-Type: text/html\n\n"; print "$text{'main_reboot_confirmation-title'}"; print "
"; print "

$text{'main_reboot_confirmation-question'}

\n"; print "\n"; print "\n"; print "\n"; print ""; return; } else { $closewindow=1; if ($in{'ack'} eq 'YES') { $command='reboot'; } else { $command=''; }; }; }; last SWITCHSUB; }; if ($in{'halt'}) { unless ((imonc_command('is-allowed','halt') == 1) && ($access{'halt-reboot'} eq 'yes')) { wrong('IMonC', '', $text{'main_halt_notallowed'}); } else { unless ($in{'ack'}) { print "Content-Type: text/html\n\n"; print "$text{'main_halt_confirmation-title'}"; print "
"; print "

$text{'main_halt_confirmation-question'}

\n"; print "
". "$text{'yes'}$text{'no'}
\n"; print "\n"; print "\n"; print ""; return; } else { $closewindow=1; if ($in{'ack'} eq 'YES') { $command='halt'; } else { $command=''; }; }; }; last SWITCHSUB; }; last SWITCHSUB; }; if ($command ne '') { $output=imonc_command($command); } else { $command = 'Bitte schliessen sie dieses Fenster!'; }; last SWITCH; }; ($in{'function'} eq 'ADDLINK') && do { if (($access{'admin'} eq 'yes') && ($access{'bundling-commands'} eq 'yes')) { $command='addlink '.imonc_command('route'); } else { wrong('IMonC', '', 'Cannot execute ADDLINK command due to missing access rights.'); }; }; ($in{'function'} eq 'REMOVELINK') && do { if (($access{'admin'} eq 'yes') && ($access{'bundling-commands'} eq 'yes')) { $command='remove '.imonc_command('route'); } else { wrong('IMonC', '', 'Cannot execute REMOVE command due to missing access rights.'); }; }; $command = ''; } $stat='FAILED'; $stat='SUCCESS' if (defined $output); if ($closewindow) { $closewindow=""; } else { $closewindow=''; }; # Information an Benutzer print <<"EOT"; Content-type: text/html $closewindow executing command:
$command
$stat
EOT print <<"EOT" if ($output ne ''); command output was:
$output
EOT print<<"EOT"; EOT }; # sub do_params # Hauptprogramm ################################################################################ # Die Fuktionsleiste ausgeben sub print_functionline { my ($dialmode, @dialmodes, $dial, $hangup, $dialmode, $reboot, $halt); print ""; $dial = ' '; ($dial = '') if ((imonc_command('is-allowed','dial') == 1) && ($access{'dial-hangup'} eq 'yes')); $hangup = ' '; ($hangup='') if ((imonc_command('is-allowed','hangup') == 1) && ($access{'dial-hangup'} eq 'yes')); $reboot = ' '; ($reboot='') if ((imonc_command('is-allowed','reboot') == 1) && ($access{'halt-reboot'} eq 'yes')); $halt = ' '; ($halt='') if ((imonc_command('is-allowed','halt') == 1) && ($access{'halt-reboot'} eq 'yes')); if ((imonc_command('is-allowed','dialmode') == 1) && ($access{'dialmode'} eq 'yes')) { $dialmode = imonc_command('dialmode'); foreach (('auto', 'manual', 'off')) { if ($_ eq $dialmode) { push @dialmodes, ''; } else { push @dialmodes, ''; }; }; # foreach dialmode $dialmode = $text{'sub_functionline_dialmode'}.':   '. ''. ''; }; print<<"EOT";
". "$text{'yes'}$text{'no'}
$dial   $hangup   $dialmode   $reboot   $halt   $text{'sub_functionline_open-cpu-usage'}
EOT }; # Einen Channel ausgeben sub print_channel { my ($channel) = @_; my ($isonline, $onlinetime, $onlinetime_h, $onlinetime_m, $onlinetime_s, $chargetime, $chargetime_h, $chargetime_m, $chargetime_s, $online_color, $channel_name, $ip, $charge, $inout, $outphone, $bundling, $bundling_text); if ($channel eq 'head') { # HEADER print<<"EOT";
 
EOT } elsif ($channel eq 'foot') { # FOOTER print<<"EOT";
  $text{'main_channels_channel'} $text{'main_channels_circuit'} ($text{'main_channels_direction'}) $text{'main_channels_ip'} $text{'main_channels_onlinetime'} $text{'main_channels_chargetime'} $text{'main_channels_charge'} $text{'main_channels_other'}
EOT } elsif ($channel eq 'dist') { # EMPTY LINE IN BETWEEN print<<"EOT";   EOT } else { # CHANNEL if ($channel eq 'pppoe') { $channel_name='DSL ('.imonc_command('driverid',$channel).')'; } else { $channel_name=''.(POSIX::floor(($channel+1) / 2)).'|'.(($channel % 2) ? 'B1' : 'B2').' ('.(imonc_command('driverid', $channel)).')'; }; if (imonc_command('status',$channel) !~ /Online/i) { $isonline = 0; $online_color = '#FF0000'; $inout=' '; $ip=' '; $onlinetime=' '; } else { $isonline = 1; $online_color = '#009000'; $inout='('.imonc_command('inout', $channel).')'; $ip=imonc_command('ip', $channel); $onlinetime = imonc_command('online-time', $channel); $outphone = imonc_command('phone', $channel); ($onlinetime_h, $onlinetime_m, $onlinetime_s) = split ':', $onlinetime; ($onlinetime_h=0) unless (defined $onlinetime_h); ($onlinetime_m=0) unless (defined $onlinetime_m); ($onlinetime_s=0) unless (defined $onlinetime_s); $onlinetime=<<"EOT";
EOT $bundling_text=''; if (($access{'bundling-commands'} eq 'yes') && ($access{'admin'} eq 'yes')) { $bundling=imonc_command('links',$outphone); # wrong('','',$bundling); if ($bundling == 1) { $bundling_text=''. $text{'main_channels_addlink'}.''. '            '; } elsif ($bundling == 2) { $bundling_text=''. $text{'main_channels_removelink'}.''. '            '; }; }; }; $charge=imonc_command('charge', $channel); $chargetime = imonc_command('chargetime', $channel); ($chargetime_h, $chargetime_m, $chargetime_s) = split ':', $chargetime; ($chargetime_h=0) unless (defined $chargetime_h); ($chargetime_m=0) unless (defined $chargetime_m); ($chargetime_s=0) unless (defined $chargetime_s); $chargetime=<<"EOT";
EOT print<<"EOT" if ($isonline) ; EOT print<<"EOT";   $channel_name $outphone $inout $ip $onlinetime $chargetime $bundling_text $text{'main_channels_showdatarates'} EOT print<<"EOT" if ($isonline); EOT }}; # HAUPTTEIL sub do_main { my ($output, $i); $data{'modconf'}=$module_config_directory; # Header ausgeben &header('IMonC', "", undef, 1, 1); # Seite aufbauen print_styles(); print<<"EOT";
 $text{'tablets_main'}  $text{'tablets_routing'}            

EOT print_infoline(); print "
\n"; print_functionline(); print "
\n"; print_channel('head'); $data{'channels'} = imonc_command('channels'); for ($i=1; $i <= $data{'channels'}; $i++) { print_channel ($i); } if (imonc_command('pppoe')) { print_channel('pppoe'); }; print_channel ('dist'); print_channel('foot'); print<<"EOT";

EOT &footer('/','index'); }; # sub do_main