r0c


Namer0c JSON
Version 1.6.1 PyPI version JSON
download
home_pagehttps://github.com/9001/r0c
Summaryretr0chat telnet/vt100 chat server
upload_time2024-04-27 23:07:50
maintainerNone
docs_urlNone
authored
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `r0c` telnet server

* retr0chat, irc-like chat service for superthin clients [(on PyPI)](https://pypi.org/project/r0c/)
* MIT-Licensed, 2018-01-07, ed @ irc.rizon.net
* **[windows telnet 360 noscope](https://ocv.me/r0c.webm)** <- good video

![screenshot of telnet connected to a r0c server](https://raw.githubusercontent.com/9001/r0c/master/docs/r0c.png)

* see [installation](#installation) or grab the latest release: **[r0c.py](https://github.com/9001/r0c/releases/latest/download/r0c.py)**

## summary

imagine being stuck on ancient gear, in the middle of nowhere, on a slow connection between machines that are even more archaic than the toaster you're trying to keep from falling apart

retr0chat is the lightweight, no-dependencies, runs-anywhere solution for when life gives you lemons

* tries to be irssi
* zero dependencies on python 2.6, 2.7, 3.x
* supports telnet, netcat, /dev/tcp, TLS clients
* is not an irc server, but can [bridge to/from irc servers](#irc)
* [modem-aware](https://ocv.me/r0c-2400.webm); comfortable at 1200 bps
* fallbacks for inhumane conditions
  * linemode
  * no vt100 / ansi escape codes

## endorsements

* the german federal office for information security [does not approve](https://ocv.me/stuff/r0c-bsi.png)

## compatibility

* 1980: [TVI 920C](https://a.ocv.me/pub/g/nerd-stuff/r0c-tvi-920c.jpg)
* 1987: [IBM 3151](https://a.ocv.me/pub/g/nerd-stuff/r0c-ibm-3151.jpg) (also [video](https://a.ocv.me/pub/g/nerd-stuff/r0c-ibm-3151.webm)), using gnu-screen to translate VT100 sequences
* 1993: [windows 3.11](https://a.ocv.me/pub/g/nerd-stuff/r0c-for-workgroups.png)

## features

irc-like:
* public channels with persistent history (pgup/pgdn)
* private messages (`/msg acidburn hey`)
* nick completion with `Tab ↹`
* notifications (bell/visual) on hilights and PMs
* command subset (`/nick`, `/join`, `/part`, `/names`, `/topic`, `/me`)
* inline message coloring, see `/help`

technical:
* client behavior detection (echo, colors, charset, newline)
* message input with readline-like editing (arrow-left/right, home/end, backspace)
  * history of sent messages (arrow-up/down)
* bandwidth-conservative (push/pop lines instead of full redraws; scroll-regions)
* fast enough; 600 clients @ 750 msgs/sec, or 1'000 cli @ 350 msg/s
* [bridge](#irc) several irc channels from several networks into one r0c channel

## windows clients

* use [putty](https://the.earth.li/~sgtatham/putty/latest/w32/putty.exe) in telnet mode
* or [the powershell client](https://github.com/9001/r0c/blob/master/clients/powershell.ps1)
* or enable `Telnet Client` in control panel `->` programs `->` programs and features `->` turn windows features on or off, then press WIN+R and run `telnet r0c.int`

putty is the best option;
* the powershell client is OK and no longer spammy as of windows 10.0.15063 (win10 1703 / LTSC)
* windows-telnet has a bug (since win7) where [non-ascii letters occasionally render but usually dont](https://ocv.me/stuff/win10-telnet.webm)
  * this is due to a buffer overflow in `telnet.exe`, so r0c will apply a rate-limit to avoid it
  * looks like messages larger than 512 bytes end up messing with the unicode glyphs area? or something

## linux clients

most to least recommended

| client | example |
| :---   | :---    |
| telnet | `telnet r0c.int` |
| socat  | `socat -,raw,echo=0 tcp:r0c.int:531` |
| bash   | [mostly internals](https://github.com/9001/r0c/blob/master/clients/bash.sh) |
| netcat | `nc r0c.int 531` |

you can even `exec 147<>/dev/tcp/r0c.int/531;cat<&147&while IFS= read -rn1 x;do [ -z "$x" ]&&x=$'\n';printf %s "$x">&147;done` (disconnect using `exec 147<&-; killall cat #sorry`)

## tls clients

if you enable TLS with `-tpt 2424` (telnet) and/or `-tpn 1515` (netcat) you can connect to r0c with TLS encryption using any of the following:

* `telnet-ssl -zssl -zsecure -zcacert=r0c.crt r0c.int 2424`
* `socat -,raw,echo=0 openssl:r0c.int:1515,cafile=cert.crt`
* `socat -,raw,echo=0 openssl:127.0.0.1:1515,verify=0`
* `stty -icanon; ncat --ssl --ssl-trustfile r0c.crt -v r0c.int 1515`
* `stty -icanon; openssl s_client -CAfile ~/.r0c/cert.crt -nbio -connect r0c.int:1515`
* windows: [powershell client](https://github.com/9001/r0c/blob/master/clients/powershell.ps1) with port `+1515` (the `+` enables TLS)
  * powershell does not verify certificate; the other clients do

the powershell client and bash client comes bundled with the server; see [protips](#protips)

## connecting from a web browser

![screenshot of chrome connecting to r0c through ttyd](https://github.com/9001/r0c/blob/master/docs/r0cc.png)

oh you betcha! see the [webtty readme](webtty/)


# installation

just run **[r0c.py](https://github.com/9001/r0c/releases/latest/download/r0c.py)** and that's it (usually)

* or install through pypi (python3 only): `python3 -m pip install --user -U r0c`

you can run it as a service so it autostarts on boot:

* on most linux distros: [systemd service](https://github.com/9001/r0c/blob/master/docs/systemd/r0c.service) (automatically does port-forwarding)
* on alpine / gentoo: [openrc service](https://github.com/9001/r0c/blob/master/docs/openrc/r0c)
* on windows: [nssm](https://nssm.cc/) probably

## irc

if you want to connect your r0c instance to an irc network and bridge channels between them, you can do that:

![screenshot of a r0c channel being bridged to an irc channel](https://github.com/9001/r0c/blob/master/docs/r0c-irc.png)

```bash
python3 r0c.py --ircn a,127.0.0.1,6667,r0c --ircb a,chat,g
```

run that command to start r0c with irc bridging enabled; r0c will then connect to an irc server (which we nicknamed `a`) on `127.0.0.1:6667` with the irc-nick `r0c` and bridge the irc-channel `#chat` with the r0c-channel `#g`

if you then start an irc server locally, for example [miniircd](https://github.com/jrosdahl/miniircd/blob/master/miniircd) by running `python3 miniircd --verbose` then you're all set, people can now join r0c by connecting via irc

to bridge additional channels on the same network, add more `--ircb` args, for example `--ircb a,tech,tech` like in the screenshot, and optionally add more networks with `--ircn`

## firewall rules

skip this section if:
* you are using the systemd service
* or you are running as root and do not have a firewall
* or you're on windows

if you're using firewalld, and just want to open up the high ports (not 23 and 531) then this is probably enough:

```bash
firewall-cmd --permanent --add-port={23,531,2323,1531,2424,1515,8023}/tcp
firewall-cmd --reload
```

but having to specify the port when connecting is lame so consider the folllowing --

telnet uses port 23 by default, so on the server you'll want to port-forward `23` to `2323` (and `531` to `1531` for plaintext):

```bash
iptables -A INPUT -p tcp --dport 23 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 531 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 2323 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 1531 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 2424 -m state --state NEW -j ACCEPT  # tls telnet
iptables -A INPUT -p tcp --dport 1515 -m state --state NEW -j ACCEPT  # tls netcat
iptables -A INPUT -p tcp --dport 8023 -m state --state NEW -j ACCEPT  # http/ttyd
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 23 -j REDIRECT --to-port 2323
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 531 -j REDIRECT --to-port 1531
```

(you'll have to do this on every reboot)



# documentation

not really but there is a [list of commands](https://github.com/9001/r0c/blob/master/docs/help-commands.md) and a [list of hotkeys](https://github.com/9001/r0c/blob/master/docs/help-hotkeys.md), and also [UI demystified](https://github.com/9001/r0c/blob/master/docs/help-ui.md)

## protips

try the following commands and hotkeys after connecting:

* `/cy` enables colored nicknames
* `/b3` (max cowbell) beeps on every message
* `/v` or `ctrl-n` hides names and makes wordwrap more obvious; good for viewing a wall of text that somebody pasted
* `CTRL-L` or `/r` if rendering breaks

## other surprises

* when running **[r0c.py](https://github.com/9001/r0c/releases/latest/download/r0c.py)** it will extract a few bundled clients for your convenience (powershell and bash); look for the `[SFX] sfxdir: /tmp/pe-r0c.1000` message during startup, they'll be in a `clients` subfolder over there

  * if you installed r0c through `pip` instead then the clients will be somewhere crazy like `C:\Users\ed\AppData\Roaming\Python\share\doc\r0c\clients\powershell.ps1` or `/home/ed/.local/share/doc/r0c/clients/powershell.ps1`, good luck!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/9001/r0c",
    "name": "r0c",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "ed",
    "author_email": "r0c@ocv.me",
    "download_url": "https://files.pythonhosted.org/packages/3c/09/ecf91aa324e6b95268a8c5a5d871528b373f951f5d8b839a710b3b92099b/r0c-1.6.1.tar.gz",
    "platform": null,
    "description": "# `r0c` telnet server\n\n* retr0chat, irc-like chat service for superthin clients [(on PyPI)](https://pypi.org/project/r0c/)\n* MIT-Licensed, 2018-01-07, ed @ irc.rizon.net\n* **[windows telnet 360 noscope](https://ocv.me/r0c.webm)** <- good video\n\n![screenshot of telnet connected to a r0c server](https://raw.githubusercontent.com/9001/r0c/master/docs/r0c.png)\n\n* see [installation](#installation) or grab the latest release: **[r0c.py](https://github.com/9001/r0c/releases/latest/download/r0c.py)**\n\n## summary\n\nimagine being stuck on ancient gear, in the middle of nowhere, on a slow connection between machines that are even more archaic than the toaster you're trying to keep from falling apart\n\nretr0chat is the lightweight, no-dependencies, runs-anywhere solution for when life gives you lemons\n\n* tries to be irssi\n* zero dependencies on python 2.6, 2.7, 3.x\n* supports telnet, netcat, /dev/tcp, TLS clients\n* is not an irc server, but can [bridge to/from irc servers](#irc)\n* [modem-aware](https://ocv.me/r0c-2400.webm); comfortable at 1200 bps\n* fallbacks for inhumane conditions\n  * linemode\n  * no vt100 / ansi escape codes\n\n## endorsements\n\n* the german federal office for information security [does not approve](https://ocv.me/stuff/r0c-bsi.png)\n\n## compatibility\n\n* 1980: [TVI 920C](https://a.ocv.me/pub/g/nerd-stuff/r0c-tvi-920c.jpg)\n* 1987: [IBM 3151](https://a.ocv.me/pub/g/nerd-stuff/r0c-ibm-3151.jpg) (also [video](https://a.ocv.me/pub/g/nerd-stuff/r0c-ibm-3151.webm)), using gnu-screen to translate VT100 sequences\n* 1993: [windows 3.11](https://a.ocv.me/pub/g/nerd-stuff/r0c-for-workgroups.png)\n\n## features\n\nirc-like:\n* public channels with persistent history (pgup/pgdn)\n* private messages (`/msg acidburn hey`)\n* nick completion with `Tab \u21b9`\n* notifications (bell/visual) on hilights and PMs\n* command subset (`/nick`, `/join`, `/part`, `/names`, `/topic`, `/me`)\n* inline message coloring, see `/help`\n\ntechnical:\n* client behavior detection (echo, colors, charset, newline)\n* message input with readline-like editing (arrow-left/right, home/end, backspace)\n  * history of sent messages (arrow-up/down)\n* bandwidth-conservative (push/pop lines instead of full redraws; scroll-regions)\n* fast enough; 600 clients @ 750 msgs/sec, or 1'000 cli @ 350 msg/s\n* [bridge](#irc) several irc channels from several networks into one r0c channel\n\n## windows clients\n\n* use [putty](https://the.earth.li/~sgtatham/putty/latest/w32/putty.exe) in telnet mode\n* or [the powershell client](https://github.com/9001/r0c/blob/master/clients/powershell.ps1)\n* or enable `Telnet Client` in control panel `->` programs `->` programs and features `->` turn windows features on or off, then press WIN+R and run `telnet r0c.int`\n\nputty is the best option;\n* the powershell client is OK and no longer spammy as of windows 10.0.15063 (win10 1703 / LTSC)\n* windows-telnet has a bug (since win7) where [non-ascii letters occasionally render but usually dont](https://ocv.me/stuff/win10-telnet.webm)\n  * this is due to a buffer overflow in `telnet.exe`, so r0c will apply a rate-limit to avoid it\n  * looks like messages larger than 512 bytes end up messing with the unicode glyphs area? or something\n\n## linux clients\n\nmost to least recommended\n\n| client | example |\n| :---   | :---    |\n| telnet | `telnet r0c.int` |\n| socat  | `socat -,raw,echo=0 tcp:r0c.int:531` |\n| bash   | [mostly internals](https://github.com/9001/r0c/blob/master/clients/bash.sh) |\n| netcat | `nc r0c.int 531` |\n\nyou can even `exec 147<>/dev/tcp/r0c.int/531;cat<&147&while IFS= read -rn1 x;do [ -z \"$x\" ]&&x=$'\\n';printf %s \"$x\">&147;done` (disconnect using `exec 147<&-; killall cat #sorry`)\n\n## tls clients\n\nif you enable TLS with `-tpt 2424` (telnet) and/or `-tpn 1515` (netcat) you can connect to r0c with TLS encryption using any of the following:\n\n* `telnet-ssl -zssl -zsecure -zcacert=r0c.crt r0c.int 2424`\n* `socat -,raw,echo=0 openssl:r0c.int:1515,cafile=cert.crt`\n* `socat -,raw,echo=0 openssl:127.0.0.1:1515,verify=0`\n* `stty -icanon; ncat --ssl --ssl-trustfile r0c.crt -v r0c.int 1515`\n* `stty -icanon; openssl s_client -CAfile ~/.r0c/cert.crt -nbio -connect r0c.int:1515`\n* windows: [powershell client](https://github.com/9001/r0c/blob/master/clients/powershell.ps1) with port `+1515` (the `+` enables TLS)\n  * powershell does not verify certificate; the other clients do\n\nthe powershell client and bash client comes bundled with the server; see [protips](#protips)\n\n## connecting from a web browser\n\n![screenshot of chrome connecting to r0c through ttyd](https://github.com/9001/r0c/blob/master/docs/r0cc.png)\n\noh you betcha! see the [webtty readme](webtty/)\n\n\n# installation\n\njust run **[r0c.py](https://github.com/9001/r0c/releases/latest/download/r0c.py)** and that's it (usually)\n\n* or install through pypi (python3 only): `python3 -m pip install --user -U r0c`\n\nyou can run it as a service so it autostarts on boot:\n\n* on most linux distros: [systemd service](https://github.com/9001/r0c/blob/master/docs/systemd/r0c.service) (automatically does port-forwarding)\n* on alpine / gentoo: [openrc service](https://github.com/9001/r0c/blob/master/docs/openrc/r0c)\n* on windows: [nssm](https://nssm.cc/) probably\n\n## irc\n\nif you want to connect your r0c instance to an irc network and bridge channels between them, you can do that:\n\n![screenshot of a r0c channel being bridged to an irc channel](https://github.com/9001/r0c/blob/master/docs/r0c-irc.png)\n\n```bash\npython3 r0c.py --ircn a,127.0.0.1,6667,r0c --ircb a,chat,g\n```\n\nrun that command to start r0c with irc bridging enabled; r0c will then connect to an irc server (which we nicknamed `a`) on `127.0.0.1:6667` with the irc-nick `r0c` and bridge the irc-channel `#chat` with the r0c-channel `#g`\n\nif you then start an irc server locally, for example [miniircd](https://github.com/jrosdahl/miniircd/blob/master/miniircd) by running `python3 miniircd --verbose` then you're all set, people can now join r0c by connecting via irc\n\nto bridge additional channels on the same network, add more `--ircb` args, for example `--ircb a,tech,tech` like in the screenshot, and optionally add more networks with `--ircn`\n\n## firewall rules\n\nskip this section if:\n* you are using the systemd service\n* or you are running as root and do not have a firewall\n* or you're on windows\n\nif you're using firewalld, and just want to open up the high ports (not 23 and 531) then this is probably enough:\n\n```bash\nfirewall-cmd --permanent --add-port={23,531,2323,1531,2424,1515,8023}/tcp\nfirewall-cmd --reload\n```\n\nbut having to specify the port when connecting is lame so consider the folllowing --\n\ntelnet uses port 23 by default, so on the server you'll want to port-forward `23` to `2323` (and `531` to `1531` for plaintext):\n\n```bash\niptables -A INPUT -p tcp --dport 23 -m state --state NEW -j ACCEPT\niptables -A INPUT -p tcp --dport 531 -m state --state NEW -j ACCEPT\niptables -A INPUT -p tcp --dport 2323 -m state --state NEW -j ACCEPT\niptables -A INPUT -p tcp --dport 1531 -m state --state NEW -j ACCEPT\niptables -A INPUT -p tcp --dport 2424 -m state --state NEW -j ACCEPT  # tls telnet\niptables -A INPUT -p tcp --dport 1515 -m state --state NEW -j ACCEPT  # tls netcat\niptables -A INPUT -p tcp --dport 8023 -m state --state NEW -j ACCEPT  # http/ttyd\niptables -t nat -A PREROUTING -i eth0 -p tcp --dport 23 -j REDIRECT --to-port 2323\niptables -t nat -A PREROUTING -i eth0 -p tcp --dport 531 -j REDIRECT --to-port 1531\n```\n\n(you'll have to do this on every reboot)\n\n\n\n# documentation\n\nnot really but there is a [list of commands](https://github.com/9001/r0c/blob/master/docs/help-commands.md) and a [list of hotkeys](https://github.com/9001/r0c/blob/master/docs/help-hotkeys.md), and also [UI demystified](https://github.com/9001/r0c/blob/master/docs/help-ui.md)\n\n## protips\n\ntry the following commands and hotkeys after connecting:\n\n* `/cy` enables colored nicknames\n* `/b3` (max cowbell) beeps on every message\n* `/v` or `ctrl-n` hides names and makes wordwrap more obvious; good for viewing a wall of text that somebody pasted\n* `CTRL-L` or `/r` if rendering breaks\n\n## other surprises\n\n* when running **[r0c.py](https://github.com/9001/r0c/releases/latest/download/r0c.py)** it will extract a few bundled clients for your convenience (powershell and bash); look for the `[SFX] sfxdir: /tmp/pe-r0c.1000` message during startup, they'll be in a `clients` subfolder over there\n\n  * if you installed r0c through `pip` instead then the clients will be somewhere crazy like `C:\\Users\\ed\\AppData\\Roaming\\Python\\share\\doc\\r0c\\clients\\powershell.ps1` or `/home/ed/.local/share/doc/r0c/clients/powershell.ps1`, good luck!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "retr0chat telnet/vt100 chat server",
    "version": "1.6.1",
    "project_urls": {
        "Homepage": "https://github.com/9001/r0c"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25ce45e2f277e270964d27b7007112d40b3be46fd6bdbad672604452ffc14e08",
                "md5": "0dbc6ac9519e59d615205319a2a339c0",
                "sha256": "2d385ccd828290c43999c6b63270ab562014896e996cef18ba4a83a35a27a82d"
            },
            "downloads": -1,
            "filename": "r0c-1.6.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0dbc6ac9519e59d615205319a2a339c0",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 83380,
            "upload_time": "2024-04-27T23:07:48",
            "upload_time_iso_8601": "2024-04-27T23:07:48.812416Z",
            "url": "https://files.pythonhosted.org/packages/25/ce/45e2f277e270964d27b7007112d40b3be46fd6bdbad672604452ffc14e08/r0c-1.6.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3c09ecf91aa324e6b95268a8c5a5d871528b373f951f5d8b839a710b3b92099b",
                "md5": "95ca009e0db20bb44d896035859e6769",
                "sha256": "a0bf52f6a7f319992d38b909de708a562ae87d6019954447c31beb297a4b05f7"
            },
            "downloads": -1,
            "filename": "r0c-1.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "95ca009e0db20bb44d896035859e6769",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 76083,
            "upload_time": "2024-04-27T23:07:50",
            "upload_time_iso_8601": "2024-04-27T23:07:50.441077Z",
            "url": "https://files.pythonhosted.org/packages/3c/09/ecf91aa324e6b95268a8c5a5d871528b373f951f5d8b839a710b3b92099b/r0c-1.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-27 23:07:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "9001",
    "github_project": "r0c",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "r0c"
}
        
ed
Elapsed time: 0.25509s