
05.02.2018, 06:14
|
 |
LMD-DML
|
|
Регистрация: 12.07.2009
Адрес: Богородское
Сообщения: 3,025
Версия Delphi: D7E
Репутация: 1834
|
|
Код:
procedure rbt(adr, log, pas, cmd: string);
var
i: integer;
begin
with TIdTelnet.Create(Application) do
begin
Host:= adr;
if not Connected then
begin
Connect;
for i := 1 to length(log) do SendCh(log[i]);
Application.ProcessMessages;
for i := 1 to length(pas) do SendCh(pas[i]);
Application.ProcessMessages;
for i := 1 to length(cmd) do SendCh(cmd[i]);
Application.ProcessMessages;
if Connected then Disconnect;
end;
Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// IP роутера: Логин: Пароль: Действие:
rbt('192.168.1.1', 'admin' + #13, 'admin' + #13, 'reboot' + #13);
end;
|