2017 © Pedro Peláez
 

library telnet-commander

Send packets of commands to your telnet devices

image

avin/telnet-commander

Send packets of commands to your telnet devices

  • Thursday, November 20, 2014
  • by avin
  • Repository
  • 1 Watchers
  • 0 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Telnet-Commander

Library to easy send packets of commands to your telnet based devices and recieve answers for processing, (*1)

  • Send commands to device
  • Setup needful promt regexp
  • Read answers

Example

In this example we login to DLink DES-3200, change time-zone and check results, (*2)


$host = "192.168.1.10"; $host = 23; $username = 'john'; $password = 'secretpass' $commands = [ ['command' => $username, 'promt' => '/username:$/i'], ['command' => $password, 'promt' => '/password:$/i'], ['command' => "enable admin", 'promt' => '/#$/i'], ['command' => "mysecretpass", 'promt' => '/PassWord:$|#$/i'], ['command' => "config time_zone operator + hour 3 min 0", 'promt' => '/#$/i'], ['command' => "show time", 'promt' => '/#$/i'], ['command' => "", 'promt' => '/#$/i'], ]; try { //Setup connection $commander = new TelnetCommander($host, $port); $commander->setHasAuth(false); $commander->connect(); //Set commands $commander->setCommands($commands); //Execute commands $data = $commander->processCommands(); /* Process $data if you need... */ } catch (Exception $e) { echo $e->getMessage(); }

The Versions

20/11 2014

dev-master

9999999-dev

Send packets of commands to your telnet devices

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Avin Grape

telnet