Git Product home page Git Product logo

net_telnet's People

Contributors

jnorell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

net_telnet's Issues

PHP 8 support

While sorting out WNPP at Debian I found yours: https://bugs.debian.org/706404

I am not sure if I should close it or not. Are you using this software or should you archive it ?

On PHP 7.2 it performs without any issues, but on PHP 8 I get warnings

PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /tmp/Net_Telnet-master/Net/Telnet.php on line 1535

Telnet Auto Negotiation Failure

On certain devices (Fortinet) I experienced telnet auto negation failures for the telnet session.

Sample from this script:
attempting connection to 127.0.0.1:12123
connected to 127.0.0.1:12123

DO ECHO
DO SUPPRESS GO AHEAD
login: waiting for login prompt: login:
expect: watching for login:
< DO TERMINAL TYPE
WONT TERMINAL TYPE
< DO TSPEED
WONT TSPEED
< DO XDISPLOC
WONT XDISPLOC
< DO NEW-ENVIRON
WONT NEW-ENVIRON
< WILL ECHO
Enabling Remote Echo
< WILL SUPPRESS GO AHEAD
Enabling Suppress Go Ahead (SGA) on Receive
Enabling Suppress Go Ahead (SGA) on Transmit
WILL SUPPRESS GO AHEAD
< DO SUPPRESS GO AHEAD
< DO ECHO
Disabling Remote Echo to prevent Echo loop
DONT ECHO
Enabling Local Network Echo
WILL ECHO

< DO NAWS
WONT NAWS
< WILL STATUS
< DO LFLOW
WONT LFLOW

Sample from PuttyTel which works properly:
2016-03-09 14:02:35 Looking up host "127.0.0.1"
2016-03-09 14:02:35 Connecting to 127.0.0.1 port 12123
2016-03-09 14:02:35 client: WILL NAWS
2016-03-09 14:02:35 client: WILL TSPEED
2016-03-09 14:02:35 client: WILL TTYPE
2016-03-09 14:02:35 client: WILL NEW_ENVIRON
2016-03-09 14:02:35 client: DO ECHO
2016-03-09 14:02:35 client: WILL SGA
2016-03-09 14:02:35 client: DO SGA
2016-03-09 14:02:36 server: DO TTYPE
2016-03-09 14:02:36 server: DO TSPEED
2016-03-09 14:02:36 server: DO XDISPLOC
2016-03-09 14:02:36 client: WONT XDISPLOC
2016-03-09 14:02:36 server: DO NEW_ENVIRON
2016-03-09 14:02:36 server: DO NAWS
2016-03-09 14:02:36 client: SB NAWS 80,24
2016-03-09 14:02:36 server: WILL ECHO
2016-03-09 14:02:36 server: DO SGA
2016-03-09 14:02:36 server: WILL SGA
2016-03-09 14:02:36 server: SB TSPEED SEND
2016-03-09 14:02:36 client: SB TSPEED IS 38400,38400
2016-03-09 14:02:36 server: SB NEW_ENVIRON SEND
2016-03-09 14:02:36 client: SB NEW_ENVIRON IS
2016-03-09 14:02:36 server: SB TTYPE SEND
2016-03-09 14:02:36 client: SB TTYPE IS XTERM
2016-03-09 14:02:36 server: DO ECHO
2016-03-09 14:02:36 client: WONT ECHO

2016-03-09 14:02:36 server: WILL STATUS
2016-03-09 14:02:36 client: DONT STATUS
2016-03-09 14:02:36 server: DO LFLOW
2016-03-09 14:02:36 client: WONT LFLOW

The workaround that @jnorell came up with is as follows:

Edit Net/Telnet.php, line 983
right now has this:

       if ($this->mode['echo_remote']) {
           $this->debug("Disabling Remote Echo to prevent Echo loop");
           $this->mode['echo_remote'] = false;
           $this->send_telcmd(TEL_DONT, $opt);
       }

Change that to:

       if ($this->mode['echo_remote']) {
           $this->debug("Refusing to Echo");
               $this->send_telcmd(TEL_WONT, $opt);
               break;

               $this->debug("Disabling Remote Echo to prevent Echo loop");
      $this->mode['echo_remote'] = false;
      $this->send_telcmd(TEL_DONT, $opt);
   }

Which essentially sends a "TEL_WONT" instead of a "TEL_DONT" on in response to the DO ECHO.

After you change the code above, valid debug output looks as follows and the code worked properly:

attempting connection to 127.0.0.1:12123
connected to 127.0.0.1:12123

DO ECHO
DO SUPPRESS GO AHEAD
login: waiting for login prompt: login:
expect: watching for login:
< DO TERMINAL TYPE
WONT TERMINAL TYPE
< DO TSPEED
WONT TSPEED
< DO XDISPLOC
WONT XDISPLOC
< DO NEW-ENVIRON
WONT NEW-ENVIRON
< WILL ECHO
Enabling Remote Echo
< WILL SUPPRESS GO AHEAD
Enabling Suppress Go Ahead (SGA) on Receive
Enabling Suppress Go Ahead (SGA) on Transmit
WILL SUPPRESS GO AHEAD
< DO SUPPRESS GO AHEAD
< DO ECHO
Refusing to Echo
WONT ECHO

< DO NAWS
WONT NAWS
< WILL STATUS
< DO LFLOW
WONT LFLOW

Opening a bug just to track it should anyone else encounter a similar issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.