Giter Site home page Giter Site logo

p6-net-telnet's People

Contributors

kaiepi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

p6-net-telnet's Issues

Net::Telnet::Chunk is insecure

Apart from Net::Telnet::Chunk not being very optimized, say a server sends a message like so: IAC WILL NAWS IAC SB 0 80 0 60 IAC IAC IAC IAC IAC IAC IAC IAC IAC IAC IAC IAC. Net::Telnet::Chunk will parse the IAC WILL NAWS and add the rest of the message to the parser buffer. If the server keeps sending messages, two things can happen:

  • the connection stays open forever
  • the server can keep sending messages until the client runs out of memory

Grammars probably aren't suitable for parsing Telnet messages for this reason. Net::Connection.parse should be refactored to use a more traditional method of parsing Telnet messages to prevent this from happening.

Abstract connection logic out to Net::Telnet::Socket

The client and server will otherwise end up repeating several hundred lines of virtually identical code otherwise. Since Telnet doesn't really have a concept of a client or a server, just peers, it might be best just to outright remove Net::Telnet::Client/Net::Telnet::Server and use Net::Telnet to provide the API to connect/listen

More documentation and example code are needed

Most of the documentation can't be thrown in the README since using the server and the client differ so much. Run perl6 --doc=Markdown on Net::Telnet::Client and Net::Telnet::Server and throw them in a doc/ directory, and add a third markdown file explaining how supported and preferred options work.

This package is also too complex for it to simply use the synopsis in the README. Make example code for using clients, servers, and using TRANSMIT-BINARY with the two of them.

There needs to be a binary that fetches supported/preferred options

Using it should look like this:

%bastille p6telnet-fetch-options telehack.com 43
Supported: ...
Preferred: ...

This will require using Net::Telnet::Client to connect to a server using a hostname and port passed via the command line and finding a way to determine when the server is done sending its initial list of options it wishes to use. You may need to subclass Net::Telnet::Client.

Implement ENVIRON and NEW-ENVIRON option support

Fairly straightforward, just write support for these two options according to their RFCs. The only addendum I'd add is USER, DISPLAY, PRINTER, and XAUTHORITY must be the only user environment variables sent (these are the ones sent by OpenBSD's TELNET implementation) by default, with the option to enable/disable which environment variables get sent on top of that, so this library stays as nice and unopinionated as possible.

Implement ECHO support

ECHO is a very common Telnet option, therefore being able to support it is required before this can be uploaded to CPAN.

This is the RFC that explains how it works: https://tools.ietf.org/html/rfc857

Net::Telnet::Connection and Net::Telnet::Chunk are where most of the work needed will be done.

Implement TERMINAL-TYPE support

Fairly straightforward, just implement it according to its RFC. The only addendum I'd add is this should get the value of the TERM environment variable on UNIX-like systems, rather than using the list of machines stated in the RFC, because it was written in the 80s and is completely irrelevant nowadays.

PSBot::Connection needs a send-text method

PSBot::Connection.send is meant for sending raw data, not individual lines. This would basically be the same method, just with "\r\n" appended to the message passed to it.

Make Net::Telnet::Connection thread-safe

Net::Telnet::Server will need to rely on being able to use Supply.tap, unlike Net::Telnet::Client. Specifically, options handling in Net::Telnet::Connection is what's not thread-safe.

"SGA is supported" my ass

Net::Telnet throws when you attempt to use SGA and the negotiation is accepted because of how it handles parsing. Fix this!

Handle TCP URGENT data properly

At the moment, if a Telnet peer chooses to send out-of-band data,it will be received out of order. Using setsockopt with SO_OOBINLINE fixes this, but requires using IO::Socket::INET for now since there's no way to get the file descriptor for async sockets. Using send with MSG_OOB would allow the library to support GA (even though it doesn't seem to be a popular feature). Both these issues would be better off handled through changes to Rakudo though

bin/p6telnet needs to be written

p6telnet should be a binary that uses Net::Telnet::Client to connect to Telnet servers. There should be a REPL using readline and/or linenoise that allows users to set the hostname and port, connect to/disconnect from the server, send messages, toggle supported and preferred options, etc.

What is the equivalent of getline()

In the perl Telnet library there is a getline method

$line = $obj->getline([Binmode    => $mode,]                      
[Errmode    => $errmode,]
[Input_record_separator => $chars,] 
[Rs         => $chars,]
[Telnetmode => $mode,]
[Timeout    => $secs,]);

What would be the equivalent in the raku library? I just need to connect to a server and then read a line when a server sends one. so basically getline in a while(1) loop.

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.