Skip to main content

Volund's MudTelnet library for Python

CONTACT INFO

Name: Volund

Email: volundmush@gmail.com

PayPal: volundmush@gmail.com

Discord: Volund#1206

Discord Channel: https://discord.gg/Sxuz3QNU8U

Patreon: https://www.patreon.com/volund

Home Repository: https://github.com/volundmush/mudtelnet-python

TERMS AND CONDITIONS

MIT license. In short: go nuts, but give credit where credit is due.

Please see the included LICENSE.txt for the legalese.

INTRO

MUD (Multi-User Dungeon) games and their brethren like MUSH, MUX, MUCK, and MOO (look 'em up!) utilize a peculiar subset of telnet. At least, SOME do - there are servers and clients which don't bother with telnet negotiation. But, for those that do, the telnet features largely begin and end with using IAC WILL/WONT/DO/DONT Negotiation and IAC SB IAC SE to send arbitrary data. In a way, MUD Telnet has diverged to become its own dialect. Library support for MUD-specific features like MXP, MSSP, and MCCP2 can be hard to come by. This library attempts to provide a one-stop-shop for handling MUD Telnet.

This library isn't a MUD. It doesn't open any ports or send data. It's simply a tool for taking the bytes a program would receive from a client and turning it into a series of 'events' that user-given application logic can then utilize, and a way to encode 'outgoing events' into bytes to be sent back to a client.

FEATURES

  • MCCP2 (Mud Client Compression Protocol v2)
  • MTTS (Mud Terminal Type Standard, aka TTYPE)
  • NAWS (Negotiate About Window Size)
  • Suppress_GA
  • Linemode
  • MSSP (Mud Server Status Protocol)
  • MXP (Mud eXtension Protocol)

COMING SOON?

  • MCCP3 (Mud Client Compression Protocol v3)
  • MUD Prompt support
  • GMCP (Generic Mud Communication Protocol)
  • MSDP (Mud Server Data Protocol)
  • MNES (Mud New-Environ Standard)

OKAY, BUT HOW DO I USE IT?

Glad you asked.

Input from clients must be converted to TelnetFrame, first.

from mudtelnet import TelnetFrame
data = bytearray([255, 251, 31, 13])
frame, size = TelnetFrame.parse(data)

You'll notice that frame is a NEGOTIATION type. size is 3. data was read but not modified. in order to consume bytes, you would need to del data[:size] after verifying that a frame was parsed - if there wasn't enough bytes, then frame will be None.

Each client session needs an associated TelnetConnection object.

from mudtelnet import TelnetConnection

conn = TelnetConnection()

out_buffer = bytearray()
out_events = list()
changed = conn.process_frame(frame, out_buffer, out_events)

Once you have a frame, you feed it to TelnetConnection.process_frame(). This method accepts a bytearray to append outgoing bytes to (as certain input will result in immediate output, such as option negotiation) and also a list that protocol events (such as user commands) will be appended to. It returns a dictionary of what CHANGED, if anything - such as if MCCP2 was enabled or the client's name was identified via MTTS.

To send data...

from mudtelnet import TelnetOutMessage, TelnetOutMessageType

msg = TelnetOutMessage(TelnetOutMessageType.LINE, "Mud Telnet makes it easy!")

conn.process_out_message(msg, out_buffer)

The message will be encoded to bytes, which are then appended to out_buffer.

FAQ

Q: This is cool! How can I help?
A: Patreon support is always welcome. If you can code and have cool ideas or bug fixes, feel free to fork, edit, and pull request! Join our discord to really get cranking away though.

Q: I found a bug! What do I do?
A: Post it on this GitHub's Issues tracker. I'll see what I can do when I have time. ... or you can try to fix it yourself and submit a Pull Request. That's cool too.

Q: But... I want a MUD! Where do I start making a MUD?
A: Coming soon...

Q: Why not just feed data straight to TelnetConnection? Why manually create TelnetFrames first?
A: Eventually, I want to add MCCP3 support, which would call for decompressing incoming data. Since the client will send data to trigger the server understanding that all following data will be compressed, Frames must be parsed one at a time so that any remaining data can be optionally decompressed. It's easy to create a 'BufferedTelnetConnection' subclass that handles all of this for you, though.

Special Thanks

  • The Evennia Project.
  • All of my Patrons on Patreon.
  • Anyone who contributes to this project or my other ones.

Metadata

Release files for mudtelnet 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mudtelnet 0.8.0
File Size Uploaded Provenance
mudtelnet-0.8.0.tar.gz 11.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mudtelnet 0.8.0
File Interpreter ABI Platform
mudtelnet-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.6 kB

Release files / mudtelnet-0.8.0.tar.gz

Download URL mudtelnet-0.8.0.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0b52276fda733cf937f650ddfc4d0326fc688aac63a10b6f30249361f5db0fc1
BLAKE2b-256 checksum
How to use checksums
23ffbc5fb21f3731a09f77a9eaa8f13a6ffeb1d40367aae5260a2c62ff7d4f88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Release files / mudtelnet-0.8.0-py3-none-any.whl

Download URL mudtelnet-0.8.0-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9f94a89d42810a602787438c67d1a74ecc3d67f12ec2cc694399cf3b9cc2f18
BLAKE2b-256 checksum
How to use checksums
4d1bf5956c7ba2a4427ad5bf8d372e6267e4fb7234ead301a3cc076162c2e1db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Security for mudtelnet 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page