From: Malte Bublitz Date: Tue, 2 May 2023 13:15:59 +0000 (+0200) Subject: 🚧 Currently deployed version as of 2023-05-02 X-Git-Url: https://git.rt3x.de/?a=commitdiff_plain;h=refs%2Fheads%2Fmain;p=bbs.git 🚧 Currently deployed version as of 2023-05-02 This is the version currently running on my Raspberry Pi. The branches torchwood and mcp should get merged back into this branch after cleaning them up; so there will be only the version in the main branch which has all the latest additions, and runs publicly available on rt3x.de. --- diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4c8092a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,42 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[*.{vim,sh,zsh}] +#indent_style = space +indent_style = tab +indent_size = 4 +insert_final_newline = true +#trim_trailing_whitespace = true +#max_line_length = 80 +max_line_length = 140 + +[*.{yaml,yml}] +indent_style = space +indent_size = 2 + +[*.{bat,cmd,vbs,ps1}] +end_of_line = CRLF + +[*.{php,html}] +insert_final_newline = false + +[LICENSE] +insert_final_newline = false + +[Makefile] +indent_size = 8 +indent_style = tab diff --git a/Makefile b/Makefile index f5604fe..278b077 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,90 @@ -WGET = wget -EXCUSES_URL = http://pages.cs.wisc.edu/~ballard/bofh/excuses +# +# malte70/bbs Makefile +# +# Programs +WGET = wget +INSTALL = install +PYTHON = python3 -all: excuses +# Excuses file +#EXCUSES = excuses +EXCUSES = bbs/excuses +EXCUSES_URL = http://pages.cs.wisc.edu/~ballard/bofh/excuses + +# Install: Destination directories and files +SYSTEMD_DEST = /etc/systemd/system +MFINGERD_UNIT = mfingerd.service + +# Virtual Environment +VENV = ./.venv + + + +######################################################################## +# Common make targets +# + +all: build + @#echo " [ MAKE ] [ install_systemd ] " + +# build: Set up everything needed to run malte70/bbs +.PHONY: build +build: $(EXCUSES) venv requirements + @echo " [ MAKE ] [ build ] Target \"build\" done." + +# install: Install systemd services +.PHONY: install +install: install_inetd install_systemd + @echo " [ MAKE ] [ install ] Target \"install\" done." + +.PHONY: install_inetd +install_inetd: + @echo " [ MAKE ] [ install_inetd ] ERROR: Not implemented yet!" >&2 + +.PHONY: install_systemd +install_systemd: $(MFINGERD_UNIT) + @echo " [ MAKE ] [ install_systemd ] Installing systemd units ..." + $(INSTALL) -m644 $(MFINGERD_UNIT) $(SYSTEMD_DEST) + +.PHONY: clean +clean: + @echo " [ MAKE ] [ clean ] Removing Python __pycache__ folders ..." + find . -maxdepth 2 -name __pycache__ -exec rm -r '{}' ';' + +.PHONY: clean-all +clean-all: clean + @echo " [ MAKE ] [ clean-all ] Removing virtual environment ..." + $(RM) -r $(VENV) + @echo " [ MAKE ] [ clean-all ] Removing BOFH excuses database ..." + $(RM) $(EXCUSES) + + + +######################################################################## +# Required files, virtual environment & Python packages +# + +# BOFH Excuses: Download database file "bbs/excuses" +$(EXCUSES): + @echo " [ MAKE ] [ bbs/excuses ] Downloading BOFH excuses database file ..." + $(WGET) -O $(EXCUSES) $(EXCUSES_URL) + +# venv: Fake-target to set up a virtual environment +.PHONY: venv +venv: $(VENV) -excuses: - $(WGET) $(EXCUSES_URL) +# $(VENV): Set up a virtual environment +$(VENV): + @echo " [ MAKE ] [ venv ] Setting up virtual environment in \"$(VENV)\" ..." + $(PYTHON) -m venv $(VENV) + @# Moved to target "requirements" + @#source $(VENV)/bin/activate && pip install -r requirements.txt +# requirements: Install required packages inside the virtual environment +.PHONY: requirements +requirements: requirements.txt venv + @echo " [ MAKE ] [ requirements ] Installing packages from requirements.txt" + source $(VENV)/bin/activate && pip install -r $< + + + diff --git a/README.md b/README.md index 305b7bb..167eb19 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,75 @@ # Malte's BBS -# Installation +## Installation + +Although not necessary, you should copy all files to a directory. +The default is `/opt/bbs` (following the Filesystem Hierarchy Standard). + +Start by downloading required 3rd party files using the Makefile: + +``` +make all +``` + +## Install the BBS itself (Telnet) + +- Configure *inetd* in `/etc/inetd.conf`: +``` +telnet stream tcp4 nowait nobody /usr/sbin/tcpd /usr/sbin/telnetd --no-hostinfo --exec-login=/opt/bbs/bin/minishell-telnet +``` + +## Quote of the Day + +Add the following line to `/etc/inetd.conf`: + + +``` +qotd stream tcp nowait nobody /opt/bbs/qotd +``` + -- Copy all files to `/opt/bbs` -- Configure xinetd: ``` -telnet stream tcp nowait nobody /usr/sbin/tcpd /usr/sbin/telnetd --no-hostinfo --exec-login=/opt/bbs/minishell +#qotd dgram udp4 wait nobody /opt/bbs/bin/qotd +qotd stream tcp4 nowait nobody /opt/bbs/bin/qotd ``` +## mFingerd + +mFingerd is started using it's own systemd unit file, and not by inetd. +You can install the `.service` unit using *make*: + +``` +make install_systemd +``` + +> Currently you need to manually change the install location in +> `mfingerd.service` if it differs from `/opt/bbs` (option +> `WorkingDirectory in the section `[Service]`) + +### Launch mFingerd using inetd + +You can also launch mFingerd using inetd, instead of running it's own systemd service: + +``` +finger stream tcp4 nowait nobody /opt/bbs/bin/finger-inetd +``` + +## Files + +- **Common files** + - `README.md` + - `LICENSE` + - `Makefile` + - `excuses` *(Downloaded by Makefile target)* +- **mFingerd** + - `mfingerd.service` + - `mfingerd.py` + - `bofh.py` + - `logo.txt` +- **QOTD** + - `qotd` *(Just a wrapper for fortune)* +- *BBS* + - `minishell` + - `bbs\_env.py + - `bofh.py` + diff --git a/bbs/__init__.py b/bbs/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/bbs/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/bbs/__main__.py b/bbs/__main__.py new file mode 100644 index 0000000..860d1ea --- /dev/null +++ b/bbs/__main__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- + +from bbs.minishell import minishell + +if __name__ == "__main__": + minishell() + \ No newline at end of file diff --git a/bbs/bofh.py b/bbs/bofh.py new file mode 100644 index 0000000..122e6e0 --- /dev/null +++ b/bbs/bofh.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +import os +import random + +def get_excuse(): + f = open(os.path.join(os.path.dirname(__file__), "excuses"), "r") + excuses = f.read().split("\n") + f.close() + n = len(excuses) + i = random.randint(0, n-1) + return excuses[i] + +if __name__ == "__main__": + print(get_excuse()) + diff --git a/bbs/daemon2.py b/bbs/daemon2.py new file mode 100644 index 0000000..bfe3019 --- /dev/null +++ b/bbs/daemon2.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python + +import sys, os, time, atexit +from signal import SIGTERM + +class Daemon: + """ + A generic daemon class. + + Usage: subclass the Daemon class and override the run() method + """ + def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): + self.stdin = stdin + self.stdout = stdout + self.stderr = stderr + self.pidfile = pidfile + + def daemonize(self): + """ + do the UNIX double-fork magic, see Stevens' "Advanced + Programming in the UNIX Environment" for details (ISBN 0201563177) + http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 + """ + try: + pid = os.fork() + if pid > 0: + # exit first parent + sys.exit(0) + except OSError, e: + sys.stderr.write("fork #1 failed: %d (%s)\n" % (e.errno, e.strerror)) + sys.exit(1) + + # decouple from parent environment + os.chdir("/") + os.setsid() + os.umask(0) + + # do second fork + try: + pid = os.fork() + if pid > 0: + # exit from second parent + sys.exit(0) + except OSError, e: + sys.stderr.write("fork #2 failed: %d (%s)\n" % (e.errno, e.strerror)) + sys.exit(1) + + # redirect standard file descriptors + sys.stdout.flush() + sys.stderr.flush() + si = file(self.stdin, 'r') + so = file(self.stdout, 'a+') + se = file(self.stderr, 'a+', 0) + os.dup2(si.fileno(), sys.stdin.fileno()) + os.dup2(so.fileno(), sys.stdout.fileno()) + os.dup2(se.fileno(), sys.stderr.fileno()) + + # write pidfile + atexit.register(self.delpid) + pid = str(os.getpid()) + file(self.pidfile,'w+').write("%s\n" % pid) + + def delpid(self): + os.remove(self.pidfile) + + def start(self): + """ + Start the daemon + """ + # Check for a pidfile to see if the daemon already runs + try: + pf = file(self.pidfile,'r') + pid = int(pf.read().strip()) + pf.close() + except IOError: + pid = None + + if pid: + message = "pidfile %s already exist. Daemon already running?\n" + sys.stderr.write(message % self.pidfile) + sys.exit(1) + + # Start the daemon + self.daemonize() + self.run() + + def stop(self): + """ + Stop the daemon + """ + # Get the pid from the pidfile + try: + pf = file(self.pidfile,'r') + pid = int(pf.read().strip()) + pf.close() + except IOError: + pid = None + + if not pid: + message = "pidfile %s does not exist. Daemon not running?\n" + sys.stderr.write(message % self.pidfile) + return # not an error in a restart + + # Try killing the daemon process + try: + while 1: + os.kill(pid, SIGTERM) + time.sleep(0.1) + except OSError, err: + err = str(err) + if err.find("No such process") > 0: + if os.path.exists(self.pidfile): + os.remove(self.pidfile) + else: + print str(err) + sys.exit(1) + + def restart(self): + """ + Restart the daemon + """ + self.stop() + self.start() + + def run(self): + """ + You should override this method when you subclass Daemon. It will be called after the process has been + daemonized by start() or restart(). + """ \ No newline at end of file diff --git a/bbs/env.py b/bbs/env.py new file mode 100644 index 0000000..d21c8ae --- /dev/null +++ b/bbs/env.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- + +import platform + +class BBSFakeUserEnv(object): + _user = "" + _node = "" + _name = "" + _hideRealUname = False + _runningInsideLXC = False + _pwd = "C:" + _fileSystem = { + "A:": { + "BOFH.TXT": "Easter Egg:\n\nRun `bofh` or `sry` to get an random BOFH excuse", + "DOCTOR.TXT": "Easter Egg 2:\n\nTry logging in as `doctor` or `doctorwho`, and run `hostname`...", + }, + "C:": { + "HELLO.TXT": "Hello World!", + "ROLLTREPPE3.URL": "https://rolltreppe3.de", + }, + } + + def setUser(self, _user): + self._user = _user + + def getUser(self): + return self._user + + def setNode(self, _node): + self._node = _node + + def getNode(self): + return self._node + + def getName(self): + return self._name + + def setHideRealUname(self, _hideRealUname): + self._hideRealUname = _hideRealUname + + def setRunningInsideLXC(self, _isInsideLXC): + self._runningInsideLXC = _isInsideLXC + + def getRunningInsideLXC(self): + return self._runningInsideLXC + + def getHome(self): + #return "/usr/home/" + self.getUser() + _user = self.getUser().upper() + if len(_user) > 10: + _user = _user[:8] + "~1" + return "C:\\DATA\\" + _user + "\\" + + def getCurrentDir(self, realPwd = False): + if not realPwd and self._pwd == "C:": + return self.getHome() + else: + return self._pwd + "\\" + + def setCurrentDir(self, new_pwd): + self._pwd = new_pwd + + def getDirListing(self): + return self._fileSystem[self._pwd].keys() + + def getFileContents(self, filename): + return self._fileSystem[self._pwd][filename] + + def getPrompt(self, ps1="%w>"): + return ps1.replace("%w", self.getCurrentDir(True)) + + def getUName(self): + if not self._hideRealUname: + return platform.uname()[0]+" "+platform.uname()[1]+" "+platform.uname()[2] + else: + return "BBS-UX "+self.getNode()+" r42" + + def __init__(self): + self._user = "doctor_who" + self._node = platform.node() + #self._node = platform.uname()[1] + self._name = "I am the Doctor!" + diff --git a/bbs/excuses b/bbs/excuses new file mode 100644 index 0000000..ca5c311 --- /dev/null +++ b/bbs/excuses @@ -0,0 +1,466 @@ +clock speed +solar flares +electromagnetic radiation from satellite debris +static from nylon underwear +static from plastic slide rules +global warming +poor power conditioning +static buildup +doppler effect +hardware stress fractures +magnetic interference from money/credit cards +dry joints on cable plug +we're waiting for [the phone company] to fix that line +sounds like a Windows problem, try calling Microsoft support +temporary routing anomaly +somebody was calculating pi on the server +fat electrons in the lines +excess surge protection +floating point processor overflow +divide-by-zero error +POSIX compliance problem +monitor resolution too high +improperly oriented keyboard +network packets travelling uphill (use a carrier pigeon) +Decreasing electron flux +first Saturday after first full moon in Winter +radiosity depletion +CPU radiator broken +It works the way the Wang did, what's the problem +positron router malfunction +cellular telephone interference +techtonic stress +piezo-electric interference +(l)user error +working as designed +dynamic software linking table corrupted +heavy gravity fluctuation, move computer to floor rapidly +secretary plugged hairdryer into UPS +terrorist activities +not enough memory, go get system upgrade +interrupt configuration error +spaghetti cable cause packet failure +boss forgot system password +bank holiday - system operating credits not recharged +virus attack, luser responsible +waste water tank overflowed onto computer +Complete Transient Lockout +bad ether in the cables +Bogon emissions +Change in Earth's rotational speed +Cosmic ray particles crashed through the hard disk platter +Smell from unhygienic janitorial staff wrecked the tape heads +Little hamster in running wheel had coronary; waiting for replacement to be Fedexed from Wyoming +Evil dogs hypnotised the night shift +Plumber mistook routing panel for decorative wall fixture +Electricians made popcorn in the power supply +Groundskeepers stole the root password +high pressure system failure +failed trials, system needs redesigned +system has been recalled +not approved by the FCC +need to wrap system in aluminum foil to fix problem +not properly grounded, please bury computer +CPU needs recalibration +system needs to be rebooted +bit bucket overflow +descramble code needed from software company +only available on a need to know basis +knot in cables caused data stream to become twisted and kinked +nesting roaches shorted out the ether cable +The file system is full of it +Satan did it +Daemons did it +You're out of memory +There isn't any problem +Unoptimized hard drive +Typo in the code +Yes, yes, its called a design limitation +Look, buddy: Windows 3.1 IS A General Protection Fault. +That's a great computer you have there; have you considered how it would work as a BSD machine? +Please excuse me, I have to circuit an AC line through my head to get this database working. +Yeah, yo mama dresses you funny and you need a mouse to delete files. +Support staff hung over, send aspirin and come back LATER. +Someone is standing on the ethernet cable, causing a kink in the cable +Windows 95 undocumented "feature" +Runt packets +Password is too complex to decrypt +Boss' kid fucked up the machine +Electromagnetic energy loss +Budget cuts +Mouse chewed through power cable +Stale file handle (next time use Tupperware(tm)!) +Feature not yet implemented +Internet outage +Pentium FDIV bug +Vendor no longer supports the product +Small animal kamikaze attack on power supplies +The vendor put the bug there. +SIMM crosstalk. +IRQ dropout +Collapsed Backbone +Power company testing new voltage spike (creation) equipment +operators on strike due to broken coffee machine +backup tape overwritten with copy of system manager's favourite CD +UPS interrupted the server's power +The electrician didn't know what the yellow cable was so he yanked the ethernet out. +The keyboard isn't plugged in +The air conditioning water supply pipe ruptured over the machine room +The electricity substation in the car park blew up. +The rolling stones concert down the road caused a brown out +The salesman drove over the CPU board. +The monitor is plugged into the serial port +Root nameservers are out of sync +electro-magnetic pulses from French above ground nuke testing. +your keyboard's space bar is generating spurious keycodes. +the real ttys became pseudo ttys and vice-versa. +the printer thinks its a router. +the router thinks its a printer. +evil hackers from Serbia. +we just switched to FDDI. +halon system went off and killed the operators. +because Bill Gates is a Jehovah's witness and so nothing can work on St. Swithin's day. +user to computer ratio too high. +user to computer ration too low. +we just switched to Sprint. +it has Intel Inside +Sticky bits on disk. +Power Company having EMP problems with their reactor +The ring needs another token +new management +telnet: Unable to connect to remote host: Connection refused +SCSI Chain overterminated +It's not plugged in. +because of network lag due to too many people playing deathmatch +You put the disk in upside down. +Daemons loose in system. +User was distributing pornography on server; system seized by FBI. +BNC (brain not connected) +UBNC (user brain not connected) +LBNC (luser brain not connected) +disks spinning backwards - toggle the hemisphere jumper. +new guy cross-connected phone lines with ac power bus. +had to use hammer to free stuck disk drive heads. +Too few computrons available. +Flat tire on station wagon with tapes. ("Never underestimate the bandwidth of a station wagon full of tapes hurling down the highway" Andrew S. Tannenbaum) +Communications satellite used by the military for star wars. +Party-bug in the Aloha protocol. +Insert coin for new game +Dew on the telephone lines. +Arcserve crashed the server again. +Some one needed the powerstrip, so they pulled the switch plug. +My pony-tail hit the on/off switch on the power strip. +Big to little endian conversion error +You can tune a file system, but you can't tune a fish (from most tunefs man pages) +Dumb terminal +Zombie processes haunting the computer +Incorrect time synchronization +Defunct processes +Stubborn processes +non-redundant fan failure +monitor VLF leakage +bugs in the RAID +no "any" key on keyboard +root rot +Backbone Scoliosis +/pub/lunch +excessive collisions & not enough packet ambulances +le0: no carrier: transceiver cable problem? +broadcast packets on wrong frequency +popper unable to process jumbo kernel +NOTICE: alloc: /dev/null: filesystem full +pseudo-user on a pseudo-terminal +Recursive traversal of loopback mount points +Backbone adjustment +OS swapped to disk +vapors from evaporating sticky-note adhesives +sticktion +short leg on process table +multicasts on broken packets +ether leak +Atilla the Hub +endothermal recalibration +filesystem not big enough for Jumbo Kernel Patch +loop found in loop in redundant loopback +system consumed all the paper for paging +permission denied +Reformatting Page. Wait... +..disk or the processor is on fire. +SCSI's too wide. +Proprietary Information. +Just type 'mv * /dev/null'. +runaway cat on system. +Did you pay the new Support Fee? +We only support a 1200 bps connection. +We only support a 28000 bps connection. +Me no internet, only janitor, me just wax floors. +I'm sorry a pentium won't do, you need an SGI to connect with us. +Post-it Note Sludge leaked into the monitor. +the curls in your keyboard cord are losing electricity. +The monitor needs another box of pixels. +RPC_PMAP_FAILURE +kernel panic: write-only-memory (/dev/wom0) capacity exceeded. +Write-only-memory subsystem too slow for this machine. Contact your local dealer. +Just pick up the phone and give modem connect sounds. "Well you said we should get more lines so we don't have voice lines." +Quantum dynamics are affecting the transistors +Police are examining all internet packets in the search for a narco-net-trafficker +We are currently trying a new concept of using a live mouse. Unfortunately, one has yet to survive being hooked up to the computer.....please bear with us. +Your mail is being routed through Germany ... and they're censoring us. +Only people with names beginning with 'A' are getting mail this week (a la Microsoft) +We didn't pay the Internet bill and it's been cut off. +Lightning strikes. +Of course it doesn't work. We've performed a software upgrade. +Change your language to Finnish. +Fluorescent lights are generating negative ions. If turning them off doesn't work, take them out and put tin foil on the ends. +High nuclear activity in your area. +What office are you in? Oh, that one. Did you know that your building was built over the universities first nuclear research site? And wow, aren't you the lucky one, your office is right over where the core is buried! +The MGs ran out of gas. +The UPS doesn't have a battery backup. +Recursivity. Call back if it happens again. +Someone thought The Big Red Button was a light switch. +The mainframe needs to rest. It's getting old, you know. +I'm not sure. Try calling the Internet's head office -- it's in the book. +The lines are all busy (busied out, that is -- why let them in to begin with?). +Jan 9 16:41:27 huber su: 'su root' succeeded for .... on /dev/pts/1 +It's those computer people in X {city of world}. They keep stuffing things up. +A star wars satellite accidently blew up the WAN. +Fatal error right in front of screen +That function is not currently supported, but Bill Gates assures us it will be featured in the next upgrade. +wrong polarity of neutron flow +Lusers learning curve appears to be fractal +We had to turn off that service to comply with the CDA Bill. +Ionization from the air-conditioning +TCP/IP UDP alarm threshold is set too low. +Someone is broadcasting pygmy packets and the router doesn't know how to deal with them. +The new frame relay network hasn't bedded down the software loop transmitter yet. +Fanout dropping voltage too much, try cutting some of those little traces +Plate voltage too low on demodulator tube +You did wha... oh _dear_.... +CPU needs bearings repacked +Too many little pins on CPU confusing it, bend back and forth until 10-20% are neatly removed. Do _not_ leave metal bits visible! +_Rosin_ core solder? But... +Software uses US measurements, but the OS is in metric... +The computer fleetly, mouse and all. +Your cat tried to eat the mouse. +The Borg tried to assimilate your system. Resistance is futile. +It must have been the lightning storm we had (yesterday) (last week) (last month) +Due to Federal Budget problems we have been forced to cut back on the number of users able to access the system at one time. (namely none allowed....) +Too much radiation coming from the soil. +Unfortunately we have run out of bits/bytes/whatever. Don't worry, the next supply will be coming next week. +Program load too heavy for processor to lift. +Processes running slowly due to weak power supply +Our ISP is having {switching,routing,SMDS,frame relay} problems +We've run out of licenses +Interference from lunar radiation +Standing room only on the bus. +You need to install an RTFM interface. +That would be because the software doesn't work. +That's easy to fix, but I can't be bothered. +Someone's tie is caught in the printer, and if anything else gets printed, he'll be in it too. +We're upgrading /dev/null +The Usenet news is out of date +Our POP server was kidnapped by a weasel. +It's stuck in the Web. +Your modem doesn't speak English. +The mouse escaped. +All of the packets are empty. +The UPS is on strike. +Neutrino overload on the nameserver +Melting hard drives +Someone has messed up the kernel pointers +The kernel license has expired +Netscape has crashed +The cord jumped over and hit the power switch. +It was OK before you touched it. +Bit rot +U.S. Postal Service +Your Flux Capacitor has gone bad. +The Dilithium Crystals need to be rotated. +The static electricity routing is acting up... +Traceroute says that there is a routing problem in the backbone. It's not our problem. +The co-locator cannot verify the frame-relay gateway to the ISDN server. +High altitude condensation from U.S.A.F prototype aircraft has contaminated the primary subnet mask. Turn off your computer for 9 days to avoid damaging it. +Lawn mower blade in your fan need sharpening +Electrons on a bender +Telecommunications is upgrading. +Telecommunications is downgrading. +Telecommunications is downshifting. +Hard drive sleeping. Let it wake up on it's own... +Interference between the keyboard and the chair. +The CPU has shifted, and become decentralized. +Due to the CDA, we no longer have a root account. +We ran out of dial tone and we're and waiting for the phone company to deliver another bottle. +You must've hit the wrong any key. +PCMCIA slave driver +The Token fell out of the ring. Call us when you find it. +The hardware bus needs a new token. +Too many interrupts +Not enough interrupts +The data on your hard drive is out of balance. +Digital Manipulator exceeding velocity parameters +appears to be a Slow/Narrow SCSI-0 Interface problem +microelectronic Riemannian curved-space fault in write-only file system +fractal radiation jamming the backbone +routing problems on the neural net +IRQ-problems with the Un-Interruptible-Power-Supply +CPU-angle has to be adjusted because of vibrations coming from the nearby road +emissions from GSM-phones +CD-ROM server needs recalibration +firewall needs cooling +asynchronous inode failure +transient bus protocol violation +incompatible bit-registration operators +your process is not ISO 9000 compliant +You need to upgrade your VESA local bus to a MasterCard local bus. +The recent proliferation of Nuclear Testing +Elves on strike. (Why do they call EMAG Elf Magic) +Internet exceeded Luser level, please wait until a luser logs off before attempting to log back on. +Your EMAIL is now being delivered by the USPS. +Your computer hasn't been returning all the bits it gets from the Internet. +You've been infected by the Telescoping Hubble virus. +Scheduled global CPU outage +Your Pentium has a heating problem - try cooling it with ice cold water.(Do not turn off your computer, you do not want to cool down the Pentium Chip while he isn't working, do you?) +Your processor has processed too many instructions. Turn it off immediately, do not type any commands!! +Your packets were eaten by the terminator +Your processor does not develop enough heat. +We need a licensed electrician to replace the light bulbs in the computer room. +The POP server is out of Coke +Fiber optics caused gas main leak +Server depressed, needs Prozac +quantum decoherence +those damn raccoons! +suboptimal routing experience +A plumber is needed, the network drain is clogged +50% of the manual is in .pdf readme files +the AA battery in the wallclock sends magnetic interference +the xy axis in the trackball is coordinated with the summer solstice +the butane lighter causes the pincushioning +old inkjet cartridges emanate barium-based fumes +manager in the cable duct +We'll fix that in the next (upgrade, update, patch release, service pack). +HTTPD Error 666 : BOFH was here +HTTPD Error 4004 : very old Intel cpu - insufficient processing power +The ATM board has run out of 10 pound notes. We are having a whip round to refill it, care to contribute ? +Network failure - call NBC +Having to manually track the satellite. +Your/our computer(s) had suffered a memory leak, and we are waiting for them to be topped up. +The rubber band broke +We're on Token Ring, and it looks like the token got loose. +Stray Alpha Particles from memory packaging caused Hard Memory Error on Server. +paradigm shift...without a clutch +PEBKAC (Problem Exists Between Keyboard And Chair) +The cables are not the same length. +Second-system effect. +Chewing gum on /dev/sd3c +Boredom in the Kernel. +the daemons! the daemons! the terrible daemons! +I'd love to help you -- it's just that the Boss won't let me near the computer. +struck by the Good Times virus +YOU HAVE AN I/O ERROR -> Incompetent Operator error +Your parity check is overdrawn and you're out of cache. +Communist revolutionaries taking over the server room and demanding all the computers in the building or they shoot the sysadmin. Poor misguided fools. +Plasma conduit breach +Out of cards on drive D: +Sand fleas eating the Internet cables +parallel processors running perpendicular today +ATM cell has no roaming feature turned on, notebooks can't connect +Webmasters kidnapped by evil cult. +Failure to adjust for daylight savings time. +Virus transmitted from computer to sysadmins. +Virus due to computers having unsafe sex. +Incorrectly configured static routes on the corerouters. +Forced to support NT servers; sysadmins quit. +Suspicious pointer corrupted virtual machine +It's the InterNIC's fault. +Root name servers corrupted. +Budget cuts forced us to sell all the power cords for the servers. +Someone hooked the twisted pair wires into the answering machine. +Operators killed by year 2000 bug bite. +We've picked COBOL as the language of choice. +Operators killed when huge stack of backup tapes fell over. +Robotic tape changer mistook operator's tie for a backup tape. +Someone was smoking in the computer room and set off the halon systems. +Your processor has taken a ride to Heaven's Gate on the UFO behind Hale-Bopp's comet. +it's an ID-10-T error +Dyslexics retyping hosts file on servers +The Internet is being scanned for viruses. +Your computer's union contract is set to expire at midnight. +Bad user karma. +/dev/clue was linked to /dev/null +Increased sunspot activity. +We already sent around a notice about that. +It's union rules. There's nothing we can do about it. Sorry. +Interference from the Van Allen Belt. +Jupiter is aligned with Mars. +Redundant ACLs. +Mail server hit by UniSpammer. +T-1's congested due to porn traffic to the news server. +Data for intranet got routed through the extranet and landed on the internet. +We are a 100% Microsoft Shop. +We are Microsoft. What you are experiencing is not a problem; it is an undocumented feature. +Sales staff sold a product we don't offer. +Secretary sent chain letter to all 5000 employees. +Sysadmin didn't hear pager go off due to loud music from bar-room speakers. +Sysadmin accidentally destroyed pager with a large hammer. +Sysadmins unavailable because they are in a meeting talking about why they are unavailable so much. +Bad cafeteria food landed all the sysadmins in the hospital. +Route flapping at the NAP. +Computers under water due to SYN flooding. +The vulcan-death-grip ping has been applied. +Electrical conduits in machine room are melting. +Traffic jam on the Information Superhighway. +Radial Telemetry Infiltration +Cow-tippers tipped a cow onto the server. +tachyon emissions overloading the system +Maintenance window broken +We're out of slots on the server +Computer room being moved. Our systems are down for the weekend. +Sysadmins busy fighting SPAM. +Repeated reboots of the system failed to solve problem +Feature was not beta tested +Domain controller not responding +Someone else stole your IP address, call the Internet detectives! +It's not RFC-822 compliant. +operation failed because: there is no message for this error (#1014) +stop bit received +internet is needed to catch the etherbunny +network down, IP packets delivered via UPS +Firmware update in the coffee machine +Temporal anomaly +Mouse has out-of-cheese-error +Borg implants are failing +Borg nanites have infested the server +error: one bad user found in front of screen +Please state the nature of the technical emergency +Internet shut down due to maintenance +Daemon escaped from pentagram +crop circles in the corn shell +sticky bit has come loose +Hot Java has gone cold +Cache miss - please take better aim next time +Hash table has woodworm +Trojan horse ran out of hay +Zombie processes detected, machine is haunted. +overflow error in /dev/null +Browser's cookie is corrupted -- someone's been nibbling on it. +Mailer-daemon is busy burning your message in hell. +According to Microsoft, it's by design +vi needs to be upgraded to vii +greenpeace free'd the mallocs +Terrorists crashed an airplane into the server room, have to remove /bin/laden. (rm -rf /bin/laden) +astropneumatic oscillations in the water-cooling +Somebody ran the operating system through a spelling checker. +Rhythmic variations in the voltage reaching the power supply. +Keyboard Actuator Failure. Order and Replace. +Packet held up at customs. +Propagation delay. +High line impedance. +Someone set us up the bomb. +Power surges on the Underground. +Don't worry; it's been deprecated. The new one is worse. +Excess condensation in cloud network +It is a layer 8 problem +The math co-processor had an overflow error that leaked out and shorted the RAM +Leap second overloaded RHEL6 servers +DNS server drank too much and had a hiccup +Your machine had the fuses in backwards. diff --git a/bbs/mfingerd.py b/bbs/mfingerd.py new file mode 100644 index 0000000..fd585a5 --- /dev/null +++ b/bbs/mfingerd.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright (c) 2012,2013,2016,2020-2022 Malte Bublitz + +__doc__ = """mFingerd + +Copyright © 2012-2022 Malte Bublitz. All rights reserved. +""" + +class AppInfo(object): + Name = "mFingerd" + Version = "0.2" + Vendor = "rolltreppe3" + WebsiteURL = "https://rolltreppe3.de" + #DBFile = "fingerinfo.db" + DBFile = "/opt/bbs/fingerinfo.db" + +import sys, os +try: + import SocketServer as socketserver # Python 2.7 +except ImportError: + import socketserver # Python 3.x +import string +from socket import getfqdn +import signal + +import pickledb + +import bbs.bofh + + +db = pickledb.load(AppInfo.DBFile, False) + +def fingerinfo(username, client=None): + def replace_placeholders(info, client): + "Replace placeholders in the info text." + assert type(info) is str + if "%%IP%%" in info and client is not None: + info = info.replace("%%IP%%", client) + # elif "%%FQDN%%" in info is not None: + if "%%FQDN%%" in info and client is not None: + info = info.replace("%%FQDN%%", getfqdn(client)) + if "%%BOFH%%" in info: + info = info.replace("%%BOFH%%", bbs.bofh.get_excuse()) + return info + + global db + if not db: + db = pickledb.load(AppInfo.DBFile, False) + # print(repr(db)) + # sys.exit(42) + + # send the requested username. + if username == '' and db.exists("@"): + info = db.get("@") + + elif username == '': + info = db.get("404") + + elif db.exists(username): + info = db.get(username) + + else: + info = db.get("404") + + # Replace placeholders like %%IP%% or %%BOFH%%. + info = replace_placeholders(info, client) + + print(info) + + +class FingerHandler(socketserver.StreamRequestHandler): + def handle(self): + self._db = pickledb.load(AppInfo.DBFile, False) + + # read a line (limited to 512 bytes to avoid megabytes + # of data to process) + # Catch UnicodeDecodeError, raised for example when scanning + # with `nmap -A -sS -p finger rt3x.de` + #username = self.rfile.readline(512) + try: + username = self.rfile.readline(512) + except UnicodeDecodeError: + self.wfile.write(b"UnicodeDecodeError\n") + return False + + # strip the username string + if "strip" in dir(string): + username = string.strip(username) + else: + username = username.strip() + + info = fingerinfo( + username, + self.client_address[0] + ) + """ + # DEBUG + #self.wfile.write(str(type(self.client_address)).encode("utf-8") + b"\n") + self.wfile.write(str(self.client_address).encode("utf-8") + b"\n") + """ + self.wfile.write(info.encode("utf-8") + b"\n") + + +def stop_server(signum = 0, frame = 0): + global server + + # https://www.generacodice.com/en/articolo/4343888/python-2-does-not-handle-signals-if-tcpserver-is-running-in-another-thread + server.running = False + #print "stop_server(",signum,",",repr(frame),") :: server.shutdown()" + # + server.shutdown() + + #print "stop_server(",signum,",",repr(frame),") :: server.server_close()" + server.server_close() + + #print "stop_server(",signum,",",repr(frame),") :: sys.exit(0)" + sys.exit(0) + + +def main(): + # Get UID + uid = os.getuid() + + # Port to listen on + # If running as root/uid=0, use default port 79; if not, + # use 7079 as a fallback. + if uid == 0: + PORT = 79 + else: + PORT = 7079 + #PORT = 7182 + + # IP + port to listen on + listen_on = ("", PORT) + + # + # Create an server instance + # + global server + try: + server = socketserver.TCPServer( + listen_on, + FingerHandler + ) + except OSError: + print("Failed to bind to TCP socket " + str(listen_on), file=sys.stderr) + sys.exit(2) + + # + # Allow terminating via SIGINT, SIGTERM or SIGUSR1 + # + signal.signal(signal.SIGINT, stop_server) + signal.signal(signal.SIGTERM, stop_server) + signal.signal(signal.SIGUSR2, stop_server) + + # + # Run the server + # + try: + print(AppInfo.Name + " " + AppInfo.Version + " :: Listening on " + str(listen_on[0])+":"+str(listen_on[1])) + print("Press Ctrl+C at any time (or send SIGTERM/SIGUSR2) to exit...") + + server.serve_forever() + + except KeyboardInterrupt: + print("\nCtr+C pressed.\nAborting...") + #stop_server() + server.shutdown() + server.server_close() + #sys.exit(0) + +if __name__=='__main__': + main() + diff --git a/bbs/mfingerd_daemon.py b/bbs/mfingerd_daemon.py new file mode 100755 index 0000000..4b668f3 --- /dev/null +++ b/bbs/mfingerd_daemon.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +import sys +import os +import time + +from daemon2 import Daemon +import mfingerd + + +class MFingerDDaemon(Daemon): + def run(self): + mfingerd.main() + #while True: + # time.sleep(1) + + +def usage(file=sys.stdout): + print(f"""Usage: {sys.argv[0]} [options] + +ACTIONS: + start + stop + restart + +""", file=file) + + +if __name__ == "__main__": + pid_file = os.getenv("MFINGERD_PID", "/tmp/mfingerd.pid") + daemon = MFingerDDaemon(pid_file) + if len(sys.argv) == 2: + if 'start' == sys.argv[1]: + daemon.start() + elif 'stop' == sys.argv[1]: + daemon.stop() + elif 'restart' == sys.argv[1]: + daemon.restart() + elif sys.argv[1] in ("help", "--help"): + usage() + else: + print(f"{sys.argv[0]}: Unknown command/option \"{sys.argv[1]}\"") + sys.exit(2) + sys.exit(0) + else: + usage(sys.stderr) + sys.exit(2) + diff --git a/bbs/minishell.py b/bbs/minishell.py new file mode 100644 index 0000000..782c275 --- /dev/null +++ b/bbs/minishell.py @@ -0,0 +1,229 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Minimal Shell +# Use whenever a user should be able to launch a shell, +# but not to execute commands. +# +# Copyright (c) 2013-2015 Malte Bublitz. +# All rights reserved. +# +# Licensed under the terms of the 2-clause BSD license. +# See LICENSE for details. +# + +import platform +import os +import sys +import getpass +#TODO: import readline + +os.chdir(os.path.dirname(sys.argv[0])) + +import bbs.env +import bbs.bofh + +def getuser(): + return "doctorwho" + +def issue(): + # Escape codes for clearing the screen: + # ansi/vt100/vt220 + # \e[H\e[J + # xterm-256color + # \e[3J\e[H\e[2J + # + os.system("clear") + #print("") + #os.system("figlet -f slant T.A.R.D.I.S.") + #print("") + #print(chr(27)+"[H"+chr(27)+"[J", end="") + print(""" + ______ ___ ____ ____ ____ _____ + /_ __/ / | / __ \ / __ \ / _/ / ___/ + / / / /| | / /_/ / / / / / / / \__ \ + / / _ / ___ |_ / _, _/ / /_/ / _/ / _ ___/ / +/_/ (_)_/ |_(_)_/ |_(_)_____(_)___/(_)____(_) + +""") + +def login(prompt1="login: ", prompt2="Password: ", clear_before = True): + if clear_before: + #os.system("clear") + pass + + login_data = ["", ""] + while len(login_data[0]) < 2: + try: + login_data[0] = input(prompt1) + except EOFError: + print("^D") + + login_data[1] = getpass.getpass(prompt2) + + return login_data + +def minishell(ps1="%w> "): + """ + ps1 is used as the prompt, and %w will be replaced by the current working directory + """ + env = bbs.env.BBSFakeUserEnv() + commands_allowed = ( + "", + "exit", + "logout", + "help", + "whoami", + "id", + "hostname", + "pwd", + "ls", "dir", + "cat", "type", + "uname", + "clear", + "sry", "bofh", + ) + command = "" + + # /etc/issue + issue() + + # Log in + try: + env.setUser(login(clear_before=False)[0]) + except KeyboardInterrupt: + #sys.exit(0) + env.setUser("john.doe") + + env.setHideRealUname(True) + env.setNode("bbs.malte70.de") + if env.getUser() in ["doctor", "doctorwho", "doctor_who"]: + #env.setNode("torchwood.tardis.malte70.de") + env.setNode("bbs.torchwood-cardiff.torchwood.gov.uk") + + if "--lxc" in sys.argv[1:]: + env.setRunningInsideLXC(True) + + print("\nWelcome on "+env.getNode()+", "+env.getUser()+"!\n") + + if env.getRunningInsideLXC(): + # Show an unneccessary cryptic message if running inside LXC + print(" [SYS$LOG] Installing BBS-UX LXC services...\n") + + try: + while command != "exit": + #print(ps1, end="") + print(env.getPrompt(ps1), end="") + try: + command = input().lower() + + except KeyboardInterrupt: + print("") + continue + + # Split command from command_args + command_args = " ".join(command.split(" ")[1:]) + command = command.split(" ")[0] + + if command == "logout" or command == "exit": + command = "exit" + + elif command == "help" and len(command_args) < 1: + print("""Help +Commands: + whoami + id + hostname + pwd + ls + cat + uname + clear + help + logout/exit +""") + + elif command == "help" and len(command_args) > 1: + help_topic = command_args.split(" ")[0] + if help_topic == "sry": + print("SRY\n\tEaster Egg. Just try it!") + elif help_topic == "two": + print("TWO\n\tTime Wasting Option") + print("\tDon't conflate TWO with TSO in the OS/360") + print("\tfamily of mainframe systems!") + elif help_topic in ("shutdown", "poweroff", "halt"): + print("shutdown/poweroff/halt") + print("\tRunning them is interpreted as an act of violence") + print("\tagainst the Dalek!") + else: + print(help_topic) + print("\tFAKENEWS!") + + elif command == "whoami": + if not env.getUser() in ["doctor", "doctorwho", "doctor_who"]: + print(env.getUser()) + else: + #print("I am the Doctor!") + print(env.getName()) + print("") + print("I should behave politely, so maybe excuse for") + print("future mistakes with \"sry\" (Yes, an easter egg!)") + print("") + + elif command == "shutdown" or command == "poweroff" or command == "halt": + print("Exterminate!") + print("Exterminate!".upper()) + sys.exit(0) + + elif command == "id": + print("uid=42(" + env.getUser() + ") gid=100(users) groups=42(" + env.getUser() + "),9999(telnet)") + + elif command == "hostname": + print(env.getNode()) + + elif command == "pwd": + #print("/usr/home/"+getuser()) + print(env.getCurrentDir(True)) + + elif command == "ls" or command == "dir": + #print("A: TARDIS ZIP : DALEK EXE") + #print("A: CLARA DOC : ASHILDR GIF") + _dir = env.getDirListing() + for _entry in _dir: + print(" " + env.getCurrentDir()[:2] + " " + _entry) + + elif command == "cat" or command == "type": + # DEBUG: + #print("CMD = \"" + command + "\"") + #print("ARGS = \"" + command_args + "\"") + + filename = command_args.upper() + print(env.getFileContents(filename)) + + elif command == "uname": + print(env.getUName()) + + elif command == "clear": + # clear screen + ret_code = os.system("clear") + + elif command == "sry" or command == "bofh": + # BOFH excuse + print(" "+bbs.bofh.get_excuse()) + + elif len(command) == 2 and command[1] == ":": + # Change drive/working directory + env.setCurrentDir(command.upper()) + + #elif not command in commands_allowed: + # print("-minishell: "+command.split(" ")[0]+": Command not found.") + elif len(command) > 0: + print("TWO: "+command.split(" ")[0]+": Command not found.") + + except EOFError: + print("") + + print("Good bye.") + +if __name__ == "__main__": + minishell(ps1='%w> ') diff --git a/bbs_env.py b/bbs_env.py deleted file mode 100644 index 2b6e1fb..0000000 --- a/bbs_env.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -import platform - -class BBSFakeUserEnv(object): - _user = "" - _node = "" - _name = "" - _hideRealUname = False - - def setUser(self, _user): - self._user = _user - - def getUser(self): - return self._user - - def getNode(self): - return self._node - - def getName(self): - return self._name - - def setHideRealUname(self, _hideRealUname): - self._hideRealUname = _hideRealUname - - def getHome(self): - return "/usr/home/" + self.getUser() - - def getUName(self): - if not self._hideRealUname: - return platform.uname()[0]+" "+platform.uname()[1]+" "+platform.uname()[2] - else: - return "Linux "+self.getNode()+" 0.13.37-42" - - def __init__(self): - self._user = "doctor_who" - self._node = platform.node() - #self._node = platform.uname()[1] - self._name = "I am the Doctor!" - diff --git a/bin/finger-inetd b/bin/finger-inetd new file mode 100755 index 0000000..c37c603 --- /dev/null +++ b/bin/finger-inetd @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# +# finger-inetd +# Run mfingerd using inetutils-inetd(8). The socket is connected +# to stdin and stdout. +# Only disadvantage: It's not possible to easily get the remote +# host's address in Python ... :-( +# + +import os +import sys + +BBS = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) +sys.path.insert(0, BBS) +os.chdir(BBS) + +import bbs.mfingerd + +try: + username = sys.stdin.readline().strip() +except UnicodeDecodeError: + #print("UnicodeDecodeError") + print("???") + sys.exit(0) + +remote_ip = os.getenv("TCPREMOTEIP", None) + + +"""# DEBUG {{{ +for env in sorted(list(os.environ.keys())): + val = os.environ.get(env) + if len(val) > 64: + val = val[:60] + " ..." + print("" + env + " = \"" + val + "\"") +# }}}""" + + +bbs.mfingerd.fingerinfo(username, remote_ip) + diff --git a/bin/fingerinfo-admin b/bin/fingerinfo-admin new file mode 100755 index 0000000..1a0187b --- /dev/null +++ b/bin/fingerinfo-admin @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 + +import os +import sys + +BBS = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) +sys.path.insert(0, BBS) +os.chdir(BBS) + +import pickledb +import bbs.mfingerd + + +# """Use a custom database file for tests.""" +# bbs.mfingerd.AppInfo.DBFile = "/tmp/fingerinfo.db" +# bbs.mfingerd.AppInfo.DBFile = "/opt/bbs/backup/fingerinfo.old.db" +# print("DEBUG: DBFile = " + bbs.mfingerd.AppInfo.DBFile, file=sys.stderr) + + +def action_help(args): + print("""Usage: + fingerinfo-admin [help|list] + fingerinfo-admin [get|set|delete] + +NOTE: fingerinfo-admin strictly uses a pipe interface, e.g. all input is + read from stdin, and all output is written to stdout. +""") + + +def action_list(args): + db = pickledb.load(bbs.mfingerd.AppInfo.DBFile, False) + all_keys = db.getall() + all_keys = sorted(list(all_keys)) + # print("Users found in fingerinfo.db:") + if len(all_keys) < 1: + # print("\t(none)") + print("Error: No users defined!", file=sys.stderr) + else: + for k in all_keys: + # print(f" - {k}") + print(k) + + +def action_get(args): + db = pickledb.load(bbs.mfingerd.AppInfo.DBFile, False) + entry = db.get(args[0]) + print(entry, end="") + + +def action_set(args): + db = pickledb.load(bbs.mfingerd.AppInfo.DBFile, False) + key = args[0] + value = sys.stdin.read() + db.set(key, value) + db.dump() + + +def action_delete(args): + db = pickledb.load(bbs.mfingerd.AppInfo.DBFile, False) + key = args[0] + if db.exists(key): + db.rem(key) + db.dump() + else: + print(f"Error: Key \"{key}\" does not exist.", file=sys.stderr) + + +def main(argv): + # We don't need the executable name... + argv.pop(0) + if len(argv) == 0: + action = "help" + args = [] + else: + action = argv.pop(0) + args = argv + + if action == "help": + action_help(args) + + elif action == "list": + action_list(args) + + elif action == "get": + action_get(args) + + elif action == "set": + action_set(args) + + elif action == "delete" or action == "del": + action_delete(args) + + else: + print(f"Unknown action: {action}", file=sys.stderr) + sys.exit(1) + + +if __name__ == "__main__": + main(sys.argv) + diff --git a/bin/lxc-launcher b/bin/lxc-launcher new file mode 100755 index 0000000..08a978e --- /dev/null +++ b/bin/lxc-launcher @@ -0,0 +1,11 @@ +#!/bin/bash +# +# Usage: +# /lxc-fs-path/bin/lxc-launcher /lxc-fs-path +# + +cd "$1" + +pwd +python -m bbs.minishell + diff --git a/bin/mfingerd b/bin/mfingerd new file mode 100755 index 0000000..711ee93 --- /dev/null +++ b/bin/mfingerd @@ -0,0 +1,5 @@ +#!/bin/bash + +cd "$(dirname $0)/.." + +exec python -m bbs.mfingerd $@ diff --git a/bin/minishell-telnet b/bin/minishell-telnet new file mode 100755 index 0000000..9e4e84b --- /dev/null +++ b/bin/minishell-telnet @@ -0,0 +1,52 @@ +#!/bin/bash +# +# BBS Minishell (for telnet) +# +# Intended to be executed by telnetd instead +# of login(1) +# + + + +# +# Configuration +# +USE_VENV=0 +VENV="./.venv/" +#MAX_SESSIONS=5 +MAX_SESSIONS=25 + + + +# +# Limit number of concurrent sessions +# +RUNNING_TELNET_SESSIONS=$(pidof -d' +' telnetd | wc -l) +if [[ $RUNNING_TELNET_SESSIONS -gt $MAX_SESSIONS ]]; then + echo 'Error: Please buy more M$ Terminal Server licenses!!!' >&2 + exit +fi + + + +# +# Change to root folder of malte70/bbs +# +cd $(realpath $(dirname $0)/..) + + + +# +# Execute Python module bbs.minishell +# (Try to use virtual environment $VENV) +# +if [[ $USE_VENV -eq 1 && -f $VENV/bin/activate ]]; then + echo "Loading virtual environment \"$VENV\" ..." >&2 + source "$VENV/bin/activate" +fi + +python3 -m bbs.minishell + + + diff --git a/bin/qotd b/bin/qotd new file mode 100755 index 0000000..140aaef --- /dev/null +++ b/bin/qotd @@ -0,0 +1,47 @@ +#!/bin/bash +# +# See also: +# RFC 865 - Quote of the Day Protocol +# + +PATH=/usr/games:$PATH + +fortune \ + letzteworte \ + ms \ + murphy \ + namen \ + quiz \ + regeln \ + sicherheitshinweise \ + sprueche \ + stilblueten \ + tips \ + translations \ + unfug \ + vornamen \ + witze \ + woerterbuch \ + wusstensie \ + zitate \ + | sed \ + -e's/Ä/Ae/g' \ + -e's/Ö/Oe/g' \ + -e's/Ü/Ue/g' \ + -e's/ä/ae/g' \ + -e's/ö/oe/g' \ + -e's/ü/ue/g' \ + -e's/ß/ss/g' \ + | iconv -f UTF-8 -t US-ASCII + +# | uni2ascii \ +# -c -d -e -f -x \ +# -S U+00E4:ae \ +# -S U+00C4:Ae \ +# -S U+00F6:oe \ +# -S U+00D6:Oe \ +# -S U+00FC:ue \ +# -S U+00DC:Ue \ +# -S U+00DF:ss \ +# -q + diff --git a/bin/tardis-minishell b/bin/tardis-minishell new file mode 100755 index 0000000..f0e1f88 --- /dev/null +++ b/bin/tardis-minishell @@ -0,0 +1,12 @@ +#!/bin/bash + +pwd + +#cd $(basename $0)/.. + + +python -m bbs.minishell + + +echo -n 'Press ... '; read + diff --git a/bofh.py b/bofh.py deleted file mode 100644 index ef698ea..0000000 --- a/bofh.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- - -from random import randint - -def get_excuse(): - f = open("excuses", "r") - excuses = f.read().split("\n") - f.close() - n = len(excuses) - i = randint(0, n-1) - return excuses[i] - -if __name__ == "__main__": - print(get_excuse()) - diff --git a/doc/fingerinfo.md b/doc/fingerinfo.md new file mode 100644 index 0000000..9b720fc --- /dev/null +++ b/doc/fingerinfo.md @@ -0,0 +1,48 @@ +# `bbs.mfingerd` — fingerinfo database + +*mFingerd* uses a [pickleDB](https://pypi.org/project/pickleDB/) database to store it's data. +The Python module `bbs.mfingerd` contains a class named `AppInfo`, which sets the database +filename to a hardcoded path. + +## Python snippet + +```python +# Import requirements +import pickledb # Import pickleDB module +from bbs.mfingerd import AppInfo # Contains the database's filename + +# Load the database +db = pickledb.load(AppInfo.DBFile, False) + +# Ensure the required special user "404" exists +if not db.exists("404"): + db.set("404", "INVALID USER") + +# Get an entry +db.get("bofh") + +# Create or update an entry +db.set("john.doe", "Real name: John Doe\nEMail: johndoe@example.com") + +# List all usernames and the length of the corresponding entry +for user in db.getall(): + user_len = len(db.get(user)) + print("→ \"{}\" (length: {})".format(user, user_len)) + +# Remove an entry +db.rem("jane.doe") + + +# Save all changes +db.dump() +``` + +## Special usernames + +`"@"` +: Since a Python `dict`'s key cannot be empty, the information returned for an empty query +: is stored as the user `"@"`. + +`"404"` *required* +: The error message returned for invalid user names + diff --git a/doc/inetd-conf.md b/doc/inetd-conf.md new file mode 100644 index 0000000..505d513 --- /dev/null +++ b/doc/inetd-conf.md @@ -0,0 +1,70 @@ +# Configuring inetutils-inetd: `/etc/inetd.conf` + +[bbs][bbs] provides three services (Telnet, QOTD & Finger); and all of +them have to be executed by a inetd superserver (part of the [GNU inetuils][inetutils]). + +> **Note:** The inetd superserver is a relic from the early days of the internet[^1], +> and will be replaced by a modern invocation method like [systemd socket activation][systemd-socket] +> before the first Beta release of [bbs][bbs]. +> +> Some distributions, like [ArchLinux](https://archlinux.org) don't even provide +> packages for inetd anymore. + +The QOTD and Finger services are just simple regular *inetd* IPv4 TCP services; but +the Telnet service is actually executed by *telnetd* instead of `/bin/login`. + +## `/etc/inetd.conf` + +Below you find excerpt from `/etc/inetd.conf` which configures Telnet, QOTD and Finger +as TCPv4 services. + +```conf +# [...] +#:STANDARD: These are standard services. +telnet stream tcp4 nowait nobody /usr/sbin/tcpd /usr/sbin/telnetd --no-hostinfo --exec-login=/opt/bbs/bin/minishell-telnet + +# [...] +#:INFO: Info services +#qotd dgram udp4 wait nobody /opt/bbs/bin/qotd +qotd stream tcp4 nowait nobody /opt/bbs/bin/qotd + +# Running mfingerd using inetd is recommended until some bugs +# get fixed... +finger stream tcp4 nowait nobody /opt/bbs/bin/finger-inetd + +# [...] +``` + +## `/etc/default/inetutils-inetd` + +The finger service supports a few placeholders for [fingerinfo.db][fingerinfo.md], including +`%%IP%%` and `%%FQDN%%`. This requires to run *inetd* with the `--environment` option. + +On Debian systems, this is done by changing `/etc/default/inetutils-inetd`: + +```sh +# +# inetutils inetd defaults +# + +INETD_OPTS="--environment" +``` + +## Links & additional ressources + +- Man pages + - [inetutils-inetd(8)](https://manpages.debian.org/testing/inetutils-inetd/inetutils-inetd.8.en.html) + - [telnetd(8)](https://manpages.debian.org/bullseye/inetutils-telnetd/telnetd.8.en.html) +- [Inetd Environment (GNU Inetutils)](https://www.gnu.org/software/inetutils/manual/html_node/Inetd-Environment.html) +- [Tricks with tcpd issue 15](https://linuxgazette.net/issue15/tcpd.html) +- [inetd « Network « Python Tutorial](http://www.java2s.com/Tutorial/Python/0420__Network/0140__inetd.htm) + + +[^1]: Back in the year 1986, the first inetd was released as part of *4.3BSD*, + to save the limited system ressources of VAX microcomputers by running the server + only when a client connects. + +[bbs]: https://github.com/malte70/bbs +[inetutils]: https://www.gnu.org/software/inetutils/ +[systemd-socket]: http://0pointer.de/blog/projects/socket-activation.html + diff --git a/fingerinfo.db b/fingerinfo.db new file mode 100644 index 0000000..f5888c1 --- /dev/null +++ b/fingerinfo.db @@ -0,0 +1 @@ +{"@": "This is deepthought.rolltreppe3.de.\nTry:\n\tfinger ip@deepthought.rolltreppe3.de\n\tfinger myip@deepthought.rolltreppe3.de\n\tfinger malte70@deepthought.rolltreppe3.de\n", "ip": "%%IP%%", "myip": "Your IP: %%IP%%\nYour Hostname: %%FQDN%%", "404": "The requested user does not exist.", "malte70": "Full name: Malte Bublitz\nMastodon: @malte70@ruhr.social\nEMail: malte@rolltreppe3.de\nOpenPGP key: B214 8955 F6A6 6A8B 8FA3 F59B 605D A5C7 29F9 C184\nWeb: https://malte70.de\nWork: https://rolltreppe3.de\nGithub: https://github.com/malte70\n\nYou can get my OpenPGP key using finger, too:\n finger malte70.openpgp-key@rolltreppe3.de\n", "bofh": "%%BOFH%%", "rolltreppe3": " \n \n .&&&&&&&&&&&&&&&&&&* \n &%#((((((((((((((((%%%&% \n &%#((%%%%%%%%%%%%%%((((%%& \n &%#((%&* &&%(((%%% /################### \n &%#((%&* /&%(((%& #////////////////////## \n &%#((%&* #&%(((%& #///,,///////////////## \n &%#((%&* &&%(((%%% #///,//(############# \n &%#((%&&&&&&&&&%%%%(((#%&& #///,//## \n &%#((((((((((((((((%%%&% #///,//## \n &%#((%&&&&&&%#((%%%( ###############///,//## \n &%#((%&* &%%(((%%& ##/////////////////,,//## \n &%#((%&* (&%(((%%& #(//,,,////////////////## \n &%#((%&* &%%(((%&% #(//,///###############* \n &%#((%&* #&%(((%%& #(//,///# \n &%#((%&* %%%(((%&& #(//,///# %%%######%%%* \n &%#((%&* ##############(//,///# %%##(///////////##%/ \n ,&&&& #/////////////////,,///# %#(/////######/////##% \n #//*,,,////////////////# %%###%%, %##////#%, \n #//*,///############### %%#////#%, \n #//*///# %%%%%%###////##% \n #//*///# %#(////////###% \n #//*///# %#(//////////##%# \n ##/////////////////,///# ,(%%%%%##////##% \n #///****************///# /%#////#%/ \n #(//////////////////(## %%###%% %%#////#%* \n %##////####%%###/////##% \n %%##//////////////##%( \n %%%##########%%% \n \n \n", "malte70.openpgp-key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQGNBFpGK2UBDAC4cm+WmRAgAWZ0B5dyNcfgRa5l5QxRLt0x46ybrZBVqP9T58fR\nTuxpndFwIfuDZwT2aItgFOkTEE4vGCacdG9t0p9v9fb1Eieu4k6AIYJJ3CMW3rg+\ndFNiZnqhQiqUJCwOPrliAxc7r8Sho+203LTm1m6lsUNmK6NXdudM3TlzZNZuktO/\n80guO9BFjre0P2i4DOa7nUsT/fLCkc7fU8EAOMaHdtZ2pKMM0NpXBSRXdpckejwM\nSAk1V6UrjeZp03Hg4L+MER0s/RaYtKYamyg+b9Dc2byqYUCHe8RbctYc15cqV8Xq\nW+dTv6as2zg/WY17r82oAlUXosqKtds2inXjrIBpZnp275UyFp3fmlUmPCqj33q9\n+zqgrHBQGM+LYA7+ASH5j1Ri0S2fUnEtnr6YHQkH+AgDTRsvJY9VuuUkuyWystGb\n8y6s97JzWZ5JHPrPFOJ5h6YJ1jXeYyQgjMFej6liHb5ukHU6vKIHuPpGTWpi3Pva\nitetsVEbWEtz1ZEAEQEAAbQkTWFsdGUgQnVibGl0eiA8bWFsdGVAcm9sbHRyZXBw\nZTMuZGU+iQHRBBMBCAA7AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAFiEEshSJ\nVfamaouPo/WbYF2lxyn5wYQFAmG1mhMCGQEACgkQYF2lxyn5wYTf8wwAlJRNT98h\notxEfcrUH+QrGZ3V2xHyn+XbclcZZOSeFe6svHSL3Mx3o5nUGLH3JCMz/Uocph8y\nn01FfJSgxX+Zf9Bb2a5n37S8Oqw4D6DpS4jpqmbv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hByXpBBiKUtqrnD32\nSetZB1Ej1nctvGH5lyBA9t8wpkJAAZwJ0FNeIvUk7cs+0imxZHLymm0pb01/mY7e\nJlcoM20xuQR8jCz8UrMAiVVUz2218M9NlBkQ4DmZK+HdKx3SsxZmF1iMrIc4HQwX\nqEH3Y+bMwN5M03HmBuZ58aWQ8Ew=\n=/VZc\n-----END PGP PUBLIC KEY BLOCK-----\n"} \ No newline at end of file diff --git a/logo.txt b/logo.txt new file mode 100644 index 0000000..37d94a4 --- /dev/null +++ b/logo.txt @@ -0,0 +1,32 @@ + + + .&&&&&&&&&&&&&&&&&&* + &%#((((((((((((((((%%%&% + &%#((%%%%%%%%%%%%%%((((%%& + &%#((%&* &&%(((%%% /################### + &%#((%&* /&%(((%& #////////////////////## + &%#((%&* #&%(((%& #///,,///////////////## + &%#((%&* &&%(((%%% #///,//(############# + &%#((%&&&&&&&&&%%%%(((#%&& #///,//## + &%#((((((((((((((((%%%&% #///,//## + &%#((%&&&&&&%#((%%%( ###############///,//## + &%#((%&* &%%(((%%& ##/////////////////,,//## + &%#((%&* (&%(((%%& #(//,,,////////////////## + &%#((%&* &%%(((%&% #(//,///###############* + &%#((%&* #&%(((%%& #(//,///# + &%#((%&* %%%(((%&& #(//,///# %%%######%%%* + &%#((%&* ##############(//,///# %%##(///////////##%/ + ,&&&& #/////////////////,,///# %#(/////######/////##% + #//*,,,////////////////# %%###%%, %##////#%, + #//*,///############### %%#////#%, + #//*///# %%%%%%###////##% + #//*///# %#(////////###% + #//*///# %#(//////////##%# + ##/////////////////,///# ,(%%%%%##////##% + #///****************///# /%#////#%/ + #(//////////////////(## %%###%% %%#////#%* + %##////####%%###/////##% + %%##//////////////##%( + %%%##########%%% + + diff --git a/mfingerd.service b/mfingerd.service new file mode 100644 index 0000000..1d624b9 --- /dev/null +++ b/mfingerd.service @@ -0,0 +1,17 @@ +# vim:set ft=systemd: + +[Unit] +Description=Malte's Finger Daemon +Requires=network.target +After=network.target + +[Service] +Type=simple +#ExecStart=/usr/bin/env python2 /opt/bbs/mfingerd.py +#ExecStart=/usr/bin/env python2 mfingerd.py +ExecStart=/opt/bbs/bin/mfingerd +WorkingDirectory=/opt/bbs + +[Install] +WantedBy=multi-user.target + diff --git a/minishell b/minishell deleted file mode 100755 index 930416b..0000000 --- a/minishell +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Minimal Shell -# Use whenever a user should be able to launch a shell, -# but not to execute commands. -# -# Copyright (c) 2013-2015 Malte Bublitz. -# All rights reserved. -# -# Licensed under the terms of the 2-clause BSD license. -# See LICENSE for details. -# - -import platform -import os -import sys -import getpass - -os.chdir(os.path.dirname(sys.argv[0])) - -import bbs_env -import bofh - -def getuser(): - return "doctorwho" - -def login(prompt1="login: ", prompt2="Password: "): - login_data = ["", ""] - while len(login_data[0]) < 2: - login_data[0] = input(prompt1) - - login_data[1] = getpass.getpass(prompt2) - - return login_data - -def main(): - env = bbs_env.BBSFakeUserEnv() - commands_allowed = ( - "", - "exit", - "logout", - "help", - "whoami", - "id", - "hostname", - "pwd", - "uname", - "clear", - "sry" - ) - command = "" - - # Log in - env._user = login()[0] - env.setHideRealUname(True) - - print("\nWelcome on "+env.getNode()+", "+env.getUser()+"!\n") - - try: - while command != "exit": - print("$ ",end="") - try: - command = input() - - except KeyboardInterrupt: - print("") - continue - - if command == "logout" or command == "exit": - command = "exit" - - elif command == "help": - print("""Minimal Shell Help -Commands: - whoami - id - hostname - pwd - uname - clear - help - logout/exit -""") - elif command == "whoami": - if not env.getUser() in ["doctor", "doctorwho", "doctor_who"]: - print(env.getUser()) - else: - #print("I am the Doctor!") - print(env.getName()) - print("") - print("I should behave politely, so maybe excuse for") - print("future mistakes with \"sry\" (Yes, an easter egg!)") - print("") - - elif command == "id": - print("uid=42(" + env.getUser() + ") gid=100(users) groups=42(" + env.getUser() + "),9999(telnet)") - - elif command == "hostname": - print(env.getNode()) - - elif command == "pwd": - # print("/usr/home/"+getuser()) - print(env.getHome()) - - elif command == "uname": - print(env.getUName()) - - elif command == "clear": - ret_code = os.system("clear") - - elif command == "sry" or command == "bofh": - print(" "+bofh.get_excuse()) - - #elif not command in commands_allowed: - # print("-minishell: "+command.split(" ")[0]+": Command not found.") - elif len(command) > 0: - print("-minishell: "+command.split(" ")[0]+": Command not found.") - - except EOFError: - print("") - - print("Good bye.") - -if __name__ == "__main__": - main() - diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6d2a675 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +# requirements.txt + +# bbs.mfingerd +pickleDB