|
From: Lukas G. <geb...@ml...> - 2005-12-30 14:51:54
|
> I have many app using Telnet clients of Indy. I know i must do threaded in
> the synapse way, but can see any demo with telnet.
> I need to fill a buffer and then read every char to decode and send data
> again trough telnet.
There are major difference between telnet implementations in Indy and in
Synapse. Synapse have 'telnet script client'. You can easy write scripts
what login to some remote telnet console (or SSH console by CryptLib)
wait to some input, send some output, like execute some remote command,
etc.
It is very similar to dial-up networking login scripts in windows, if you
know it.
See to little example:
var
telnet: TTelnetsend;
begin
memo1.Lines.Clear;
telnet:= TTelnetsend.Create;
try
telnet.TargetHost:='127.0.0.1';
telnet.Login;
telnet.WaitFor('name:');
telnet.Send('root'+#$0d+#$0a);
telnet.WaitFor('word:');
telnet.Send('mysecretpassword'+#$0d+#$0a);
telnet.WaitFor('>');
Memo1.Lines.Text:=telnet.sessionlog;
finally
telnet.Free;
end;
end;
This example connecting to some server, then read all what server sending
until it see question for username. Then it send your username and
reading all again until it see question for your password, and send your
secret password. Then it reading all until command promt is seen.
Now you can send some commands to your remote telnet system. ;-)
All communication is stored in SessionLog.
--
Lukas Gebauer.
E-mail: geb...@ml...
WEB: http://www.ararat.cz/synapse - Synapse Delphi and Kylix TCP/IP
Library
|