Skip to content

About

RFC 854/855 compliant Telnet protocol implementation for .NET

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

NIS.Protocols.Telnet

RFC 854/855 compliant Telnet protocol implementation for .NET.

Installation

dotnet add package NIS.Protocols.Telnet --version 1.0.0

Quick Start

using NIS.Protocols.Telnet;

var client = new TelnetClient();
client.DataReceived += (sender, e) => Console.WriteLine(Encoding.ASCII.GetString(e.Data));
client.CommandReceived += (sender, e) => Console.WriteLine($"Command: {e.Command}");
await client.ConnectAsync("192.168.1.1", 23);
await client.SendLineAsync("username");
await client.SendLineAsync("password");

RFC Compliance

  • RFC 854: Telnet Protocol Specification (IAC escape, commands, subnegotiation)
  • RFC 855: Telnet Option Specification (subnegotiation format, IAC inside params)

RFC documents are included in the docs/ directory of this repository.

BaGetter Feed Configuration

To install from a private BaGetter feed:

# Add the BaGetter source
dotnet nuget add source https://your-bagetter-url/v3/index.json --name BaGetter

# Install the package
dotnet add package NIS.Protocols.Telnet --version 1.0.0 --source BaGetter

Or add to your NuGet.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="BaGetter" value="https://your-bagetter-url/v3/index.json" />
  </packageSources>
</configuration>

Public API

The public API surface is intentionally minimal:

  • TelnetClient - Main consumer API
    • ConnectAsync(string host, int port) - Connect to a Telnet server
    • DisconnectAsync() - Disconnect from the server
    • SendAsync(ReadOnlyMemory<byte> data) - Send raw bytes (IAC escaped automatically)
    • SendLineAsync(string text) - Send text with CRLF appended
    • ReadUntilAsync(string expected, TimeSpan timeout) - Read until a string is found
    • ReadLineAsync(TimeSpan timeout) - Read a single line
    • Events: DataReceived, CommandReceived, RawBytesReceived
  • TelnetCommand - Enum of Telnet commands (IAC, WILL, WONT, DO, DONT, SB, SE, etc.)
  • TelnetDataEventArgs - Event args for data received (byte[] Data)
  • TelnetCommandEventArgs - Event args for commands received (TelnetCommand Command, byte? Option, byte[]? SubnegotiationData)

Implementation classes (TelnetStreamParser, OptionNegotiator, NvtDataProcessor) are internal to allow future refactoring without breaking changes.

License

GPL v3 - see LICENSE

About

RFC 854/855 compliant Telnet protocol implementation for .NET

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages