2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-19 18:56:03 +00:00

feature: telnet login with no user/pass required

git-svn-id: https://svn.fhem.de/fhem/trunk@9250 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
hexenmeister 2015-09-14 18:54:15 +00:00
parent 5fd23489cd
commit aceb10b3df

View File

@ -135,7 +135,7 @@ SYSMON_Initialize($)
$hash->{AttrList} = "filesystems network-interfaces user-defined disable:0,1 nonblocking:0,1 ".
"telnet-time-out ".
"user-fn2 user-fn ".
"telnet-prompt-regx telnet-login-prompt-regx ".
"telnet-prompt-regx telnet-login-prompt-regx telnet-login-none:0,1 ".
"exclude ".
$readingFnAttributes;
}
@ -3814,7 +3814,9 @@ sub SYSMON_Open_Connection($)
# }
#}
if(!defined($pwd)) {
my $tlogin_none=AttrVal($name,'telnet-login-none','0');
if(!$tlogin_none && !defined($pwd)) {
$msg="Error: no passwort provided";
SYSMON_Log($hash, 3, $msg);
return $msg unless defined $pwd;
@ -3834,6 +3836,7 @@ sub SYSMON_Open_Connection($)
}
$hash->{".telnet"}=$telnet;
if(!$tlogin_none) {
SYSMON_Log($hash, 5, "Wait for user or password prompt.");
unless ( ($before,$match) = $telnet->waitfor('/(user|login|password): $/i') )
{
@ -3873,6 +3876,7 @@ sub SYSMON_Open_Connection($)
SYSMON_Log($hash, 5, "Entering password");
$telnet->print( $pwd );
}
SYSMON_Log($hash, 5, "Wait for command prompt");
my $tlogin_prompt=AttrVal($name,'telnet-login-prompt-regx','(#|\$|>)\s*$|Login failed.');
@ -5169,6 +5173,10 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
RegExp to detect login and command line prompt. (Only for access via Telnet.)
</li>
<br>
<li>telnet-login-none<br>
set it to 1 when no user and password are required
</li>
<br>
<li>exclude<br>
Allows to suppress reading certain information. <br>
supported values: user-defined (s. user-defined und user-fn), cpucount, uptime, fhemuptime,
@ -5838,6 +5846,10 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
RegExp zur Erkennung von Login- und Kommandozeile-Prompt. (Nur f&uuml;r Zugriffe &uuml;ber Telnet relevant.)
</li>
<br>
<li>telnet-login-none<br>
soll auf 1 gesetzt werden, wenn kein User und Passwort zum Login notwendig sind.
</li>
<br>
<li>exclude<br>
Erlaubt das Abfragen bestimmten Informationen zu unterbinden. <br>
Mögliche Werte: user-defined (s. user-defined und user-fn), cpucount, uptime, fhemuptime,