├── RPC └── OpenOS │ ├── README.md │ └── usr │ ├── bin │ ├── exportcomponent.lua │ └── importcomponent.lua │ ├── man │ └── rpc │ └── lib │ └── rpc.lua ├── WoLBeacon ├── OpenOS │ ├── README.md │ ├── usr │ │ └── man │ │ │ └── wolbeacon │ └── etc │ │ └── rc.d │ │ └── wolbeacon.lua └── README.md ├── _config.yml ├── vTunnel ├── README.md ├── pcap.lua ├── vtunnel-protocol.md ├── interminitel.lua ├── Wireshark │ ├── interminitel.lua │ └── imtdissector.lua ├── OpenOS │ ├── usr │ │ └── man │ │ │ └── vtunnel │ └── etc │ │ └── rc.d │ │ └── vtunnel.lua └── bridge.lua ├── OpenOS ├── usr │ ├── lib │ │ ├── net.lua │ │ └── minitel.lua │ └── man │ │ └── minitel ├── README.md └── etc │ └── rc.d │ └── minitel.lua ├── .gitignore ├── CODE_OF_CONDUCT.md ├── img ├── minitel-ad.jpg └── minitel-layers.svg ├── Embedded ├── ufs.lua.min ├── microtel │ ├── microtel-4.lua.min │ ├── microtel-5-listen.lua.min │ ├── microtel-5-open.lua.min │ ├── microtel-5-flisten.lua.min │ ├── microtel-4.lua │ ├── microtel-5-core.lua.min │ ├── microtel-5-listen.lua │ ├── microtel-5-flisten.lua │ ├── microtel-5-open.lua │ ├── microtel-3.lua.min │ ├── microtel-3.lua.min-old │ ├── microtel-5-core.lua │ ├── strip.lua │ ├── README.md │ ├── microtel-3.lua │ ├── old-microtel-3.lua │ └── minify.sh ├── nminiprompt.lua.min ├── fget.lua ├── miniprompt.lua.min ├── dlfs.lua.min ├── init-wrapper.lua ├── vt100.lua.min ├── common-termsetup.lua ├── miniprompt.lua ├── dlfs.lua ├── compress.lua ├── minify.lua ├── minify-all.sh ├── command.lua ├── vt100.lua ├── ufs.lua └── serialization.lua ├── .editorconfig ├── protocol-4.md ├── syslog ├── OpenOS │ ├── usr │ │ ├── lib │ │ │ └── syslog.lua │ │ └── man │ │ │ ├── syslog │ │ │ └── syslogd │ ├── README.md │ └── etc │ │ └── rc.d │ │ └── syslogd.lua └── syslog-protocol.md ├── realtime ├── OpenOS │ ├── usr │ │ ├── man │ │ │ ├── realtime │ │ │ ├── realtime-sync │ │ │ └── realtime-relay │ │ └── lib │ │ │ └── realtime.lua │ └── etc │ │ └── rc.d │ │ ├── realtime-relay.lua │ │ └── realtime-sync.lua └── README.md ├── util └── OpenOS │ └── usr │ └── bin │ ├── ping.lua │ └── mtcfg.lua ├── MMail ├── OpenOS │ ├── usr │ │ ├── man │ │ │ └── mmail-send │ │ └── bin │ │ │ └── mmail-send.lua │ └── etc │ │ └── rc.d │ │ └── mmail.lua └── MMail-protocol.md ├── MTFS ├── OpenOS │ └── usr │ │ ├── bin │ │ ├── exportfs.lua │ │ └── importfs.lua │ │ └── lib │ │ └── fsproxy.lua └── README.md ├── protocol-ext-multicast.md ├── FRequest ├── OpenOS │ ├── usr │ │ └── bin │ │ │ └── fget.lua │ ├── README.md │ └── etc │ │ └── rc.d │ │ └── fserv.lua ├── FRequest-protocol.md └── KittenOS │ └── apps │ └── app-frequest.lua ├── protocol-5.md ├── README.md ├── KittenOS ├── README.md ├── libs │ └── minitel.lua └── apps │ └── svc-minitel.lua ├── protocol-3.md ├── programs.cfg └── LICENSE /RPC/OpenOS/README.md: -------------------------------------------------------------------------------- 1 | usr/man/rpc -------------------------------------------------------------------------------- /WoLBeacon/OpenOS/README.md: -------------------------------------------------------------------------------- 1 | usr/man/wolbeacon -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-midnight -------------------------------------------------------------------------------- /vTunnel/README.md: -------------------------------------------------------------------------------- 1 | OpenOS/usr/man/vtunnel -------------------------------------------------------------------------------- /OpenOS/usr/lib/net.lua: -------------------------------------------------------------------------------- 1 | return require("minitel") 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *-mini.lua 2 | *.swp 3 | mini-*.lua 4 | nminiprompt.lua 5 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | Insult people for their work, not for who they are. 2 | -------------------------------------------------------------------------------- /img/minitel-ad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShadowKatStudios/OC-Minitel/HEAD/img/minitel-ad.jpg -------------------------------------------------------------------------------- /Embedded/ufs.lua.min: -------------------------------------------------------------------------------- 1 | { 2 | {"segments","S"}, 3 | {"path","P"}, 4 | {"fsi","F"}, 5 | {"length","L"}, 6 | } 7 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-4.lua.min: -------------------------------------------------------------------------------- 1 | { 2 | {"to","T"}, 3 | {"vport","P"}, 4 | {"ldata","L"}, 5 | {"tdata","D"}, 6 | } 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | insert_final_newline = true 6 | 7 | [*.lua] 8 | indent_style = space 9 | indent_size = 1 10 | -------------------------------------------------------------------------------- /Embedded/nminiprompt.lua.min: -------------------------------------------------------------------------------- 1 | { 2 | {"read,write,print=R,W,P","print,read,write=P,R,W\npcall(load(component.invoke(component.list(\"eeprom\")(),\"getData\")))"}, 3 | {"component","GC"}, 4 | {"computer","UC"}, 5 | {"vt100emu","VT"}, 6 | } 7 | -------------------------------------------------------------------------------- /Embedded/fget.lua: -------------------------------------------------------------------------------- 1 | function fget(A,P,V) 2 | local b,tb,s="","",net.open(A,V or 70) 3 | s:w("t"..P.."\n") 4 | repeat 5 | computer.pullSignal() 6 | tb=s:r(2048) 7 | b=b..tb 8 | until tb == "" and s.s == "c" 9 | return b:sub(2),b:sub(1,1) 10 | end 11 | -------------------------------------------------------------------------------- /Embedded/miniprompt.lua.min: -------------------------------------------------------------------------------- 1 | { 2 | {"write","W"}, 3 | {"print","P"}, 4 | {"read","R"}, 5 | {"tSignal","T"}, 6 | {"sBuffer","S"}, 7 | {"tResult","V"}, 8 | {"GPU","B"}, 9 | {"ga","N"}, 10 | {"sa","M"}, 11 | {"%-%-API","read,write,print=R,W,P"}, 12 | } 13 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-5-listen.lua.min: -------------------------------------------------------------------------------- 1 | { 2 | {"address","A"}, 3 | {"vport","V"}, 4 | {"sclose","S"}, 5 | {"port","P"}, 6 | {"conn.state","conn.s"}, 7 | {"conn.buffer","conn.b"}, 8 | {"conn","C"}, 9 | {"etype","E"}, 10 | {"from","F"}, 11 | {"data","D"}, 12 | } 13 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-5-open.lua.min: -------------------------------------------------------------------------------- 1 | { 2 | {"address","A"}, 3 | {"vport","V"}, 4 | {"sclose","S"}, 5 | {"port","P"}, 6 | {"conn.state","conn.s"}, 7 | {"conn.buffer","conn.b"}, 8 | {"conn","C"}, 9 | {"etype","E"}, 10 | {"from","F"}, 11 | {"data","D"}, 12 | } 13 | -------------------------------------------------------------------------------- /protocol-4.md: -------------------------------------------------------------------------------- 1 | # Minitel - Layer 4 2 | 3 | Minitel implements layer 4, however, it does not have a layer 4 protocol. 4 | 5 | Instead of having a protocol, ordered delivery of packets is accomplished by waiting for an acknowledgement of the previous packet before sending the next. 6 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-5-flisten.lua.min: -------------------------------------------------------------------------------- 1 | { 2 | {"address","A"}, 3 | {"vport","V"}, 4 | {"sclose","S"}, 5 | {"port","P"}, 6 | {"conn.state","conn.s"}, 7 | {"conn.buffer","conn.b"}, 8 | {"conn","C"}, 9 | {"etype","E"}, 10 | {"from","F"}, 11 | {"data","D"}, 12 | } 13 | -------------------------------------------------------------------------------- /Embedded/dlfs.lua.min: -------------------------------------------------------------------------------- 1 | { 2 | {"init","I"}, 3 | {"dirlist","DL"}, 4 | {"filelist","FL"}, 5 | {"host","H"}, 6 | {"port","P"}, 7 | {"line","L"}, 8 | {"ftype","F"}, 9 | {"content","K"}, 10 | {"filename","FN"}, 11 | {"table.remove","TR"}, 12 | {"dir","CD"}, 13 | {"file","CF"} 14 | ,} 15 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-4.lua: -------------------------------------------------------------------------------- 1 | net.mtu = 4096 2 | function net.lsend(to,vport,ldata) 3 | local tdata = {} 4 | for i = 1, ldata:len(), net.mtu do 5 | tdata[#tdata+1] = ldata:sub(1,net.mtu) 6 | ldata = ldata:sub(net.mtu+1) 7 | end 8 | for k,v in ipairs(tdata) do 9 | net.send(to,vport,v) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-5-core.lua.min: -------------------------------------------------------------------------------- 1 | { 2 | {"address","A"}, 3 | {"vport","V"}, 4 | {"sclose","S"}, 5 | {"port","P"}, 6 | {"conn.state","conn.s"}, 7 | {"conn.buffer","conn.b"}, 8 | {"self.buffer","self.b"}, 9 | {"self.state","self.s"}, 10 | {"self","s"}, 11 | {"conn","C"}, 12 | {"etype","E"}, 13 | {"from","F"}, 14 | {"data","D"}, 15 | } 16 | -------------------------------------------------------------------------------- /Embedded/init-wrapper.lua: -------------------------------------------------------------------------------- 1 | local c = "" 2 | do 3 | function net.hook.sender(to,vport,data,packetType,packetID) 4 | if et == "net_send" then 5 | net.send(to,vport,data,packetType,packetID) 6 | end 7 | end 8 | local fs = component.proxy(computer.getBootAddress()) 9 | local fh,b = fs.open("boot.lua"),"" 10 | repeat 11 | b=fs.read(fh,4096) or "" 12 | c=c..b 13 | until b == "" 14 | end 15 | load(c)() 16 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-5-listen.lua: -------------------------------------------------------------------------------- 1 | function net.listen(vport) 2 | local from,port,data 3 | repeat 4 | _, from, port, data = computer.pullSignal(0.5) 5 | until port == vport and data == "openstream" 6 | local nport,sclose = math.random(2^15,2^16),tostring(math.random(-2^16,2^16)) 7 | net.send(from,port,tostring(nport)) 8 | net.send(from,nport,sclose) 9 | return net.socket(from,nport,sclose) 10 | end 11 | -------------------------------------------------------------------------------- /WoLBeacon/README.md: -------------------------------------------------------------------------------- 1 | # WoLBeacon 2 | 3 | WoLBeacon is a piece of software written to wake other computers up, and keep them awake, like force-feeding your friends coffee. 4 | 5 | This is achieved by both setting the wake message for the local machine, and broadcasting wake-on-LAN messages at regular intervals. 6 | 7 | ## [WoLBeacon for OpenOS](OpenOS/) 8 | 9 | WoLBeacon is implemented as an rc daemon for OpenOS. 10 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-5-flisten.lua: -------------------------------------------------------------------------------- 1 | function net.flisten(vport,handler) 2 | local function h(etype,from,port,data) 3 | if port == vport and data == "openstream" then 4 | local nport,sclose = math.random(2^15,2^16),tostring(math.random(-2^16,2^16)) 5 | net.send(from,port,tostring(nport)) 6 | net.send(from,nport,sclose) 7 | handler(net.socket(from,nport,sclose)) 8 | end 9 | end 10 | net.hook[vport] = h 11 | end 12 | -------------------------------------------------------------------------------- /RPC/OpenOS/usr/bin/exportcomponent.lua: -------------------------------------------------------------------------------- 1 | local component = require "component" 2 | local rpc = require "rpc" 3 | local tA = {...} 4 | 5 | if #tA < 1 then 6 | print("Usage: exportcomponent [component address...]") 7 | end 8 | 9 | for k,v in ipairs(tA) do 10 | local px = component.proxy(component.get(v)) 11 | print(px.type.."_"..px.address) 12 | for l,m in pairs(px) do 13 | rpc.register(px.type.."_"..px.address.."_"..l,m) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /syslog/OpenOS/usr/lib/syslog.lua: -------------------------------------------------------------------------------- 1 | local process = require "process" 2 | local computer = require "computer" 3 | 4 | local syslog = {} 5 | syslog.emergency = 0 6 | syslog.alert = 1 7 | syslog.critical = 2 8 | syslog.error = 3 9 | syslog.warning = 4 10 | syslog.notice = 5 11 | syslog.info = 6 12 | syslog.debug = 7 13 | 14 | setmetatable(syslog,{__call = function(_,msg, level, service) 15 | level, service = level or syslog.info, service or process.info().path 16 | computer.pushSignal("syslog",msg, level, service) 17 | end}) 18 | 19 | return syslog 20 | -------------------------------------------------------------------------------- /realtime/OpenOS/usr/man/realtime: -------------------------------------------------------------------------------- 1 | # realtime 2 | 3 | realtime is a library for OpenOS providing a reasonably accurate current real-world time, given the right input (see realtime-sync and realtime-relay). 4 | 5 | ## API 6 | 7 | ### realtime.time(*utc*) 8 | 9 | Returns the current time, either respecting the current offset, or if *utc* is set, with no offset. 10 | 11 | ### realtime.update(*epoch*, *uptime*, *offset*) 12 | 13 | Updates the currently known real time, with the time as *epoch*, measured at *uptime*. Optionally, an offset can be provided. 14 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-5-open.lua: -------------------------------------------------------------------------------- 1 | net.timeout = 60 2 | function net.open(address,vport) 3 | local st,from,port,data=computer.uptime() 4 | net.send(address,vport,"openstream") 5 | repeat 6 | _, from, port, data = computer.pullSignal(0.5) 7 | if computer.uptime() > st+net.timeout then return false end 8 | until from == address and port == vport and tonumber(data) 9 | vport=tonumber(data) 10 | repeat 11 | _, from, port, data = computer.pullSignal(0.5) 12 | until from == address and port == vport 13 | return net.socket(address,vport,data) 14 | end 15 | -------------------------------------------------------------------------------- /syslog/OpenOS/usr/man/syslog: -------------------------------------------------------------------------------- 1 | # syslog Library for OpenOS 2 | 3 | The syslog library only provides one function, so the library can be called. In addition, the library provides a number of pre-configured event levels: 4 | 5 | - syslog.emergency 6 | - syslog.alert 7 | - syslog.critical 8 | - syslog.error 9 | - syslog.warning 10 | - syslog.notice 11 | - syslog.info 12 | - syslog.debug 13 | 14 | An example using syslog as both a function and a table: 15 | 16 | ```lua 17 | local syslog = require "syslog" 18 | syslog("message", syslog.emergency, "service name") 19 | ``` 20 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-3.lua.min: -------------------------------------------------------------------------------- 1 | { 2 | {"eventTab","Z"}, 3 | {"modems","M"}, 4 | {"qPacket","A"}, 5 | {"packetID","B"}, 6 | {"packetType","E"}, 7 | {"to","T"}, 8 | {"vport","F"}, 9 | {"data","D"}, 10 | {"rawSendPacket","G"}, 11 | {"sendPacket","I"}, 12 | {"genPacketID","J"}, 13 | {"packetCache","L"}, 14 | {"checkCache","N"}, 15 | {"routeCache","O"}, 16 | {"realComputerPullSignal","X"}, 17 | {"packetQueue","P"}, 18 | {"computer","C"}, 19 | {"C.uptime","U"}, 20 | {"table.unpack","Y"}, 21 | {"COMPUTER","computer"}, 22 | {"UPTIME","C.uptime"}, 23 | {"UNPACK","table.unpack"}, 24 | } 25 | -------------------------------------------------------------------------------- /Embedded/vt100.lua.min: -------------------------------------------------------------------------------- 1 | { 2 | {"local cx, cy = 1, 1.+local sx, sy = 1,1",""}, 3 | {"string.byte","B"}, 4 | {"0xFFFFFF","F"}, 5 | {"gpu.setForeground","SF"}, 6 | {"gpu.setBackground","SB"}, 7 | {'local cs %= ""','local cx, cy, pc, lc, mode, lw, sx, sy, cs, B, F, SF, SB = 1, 1, " ", "", "n", true, 1, 1, "", string.byte, 0xFFFFFF, gpu.setForeground, gpu.setBackground'}, 8 | {"gpu","G"}, 9 | {"dcursor","DC"}, 10 | {"termwrite","TW"}, 11 | {"cc","C"}, 12 | {"cs","S"}, 13 | {"cx","X"}, 14 | {"cy","Y"}, 15 | {"mx","W"}, 16 | {"my","H"}, 17 | {"sx","T"}, 18 | {"sy","U"}, 19 | {"mode","M"}, 20 | } 21 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-3.lua.min-old: -------------------------------------------------------------------------------- 1 | { 2 | {"eventTab","Z"}, 3 | {"modems","M"}, 4 | {"qPacket","qP"}, 5 | {"packetID","pID"}, 6 | {"packetType","pT"}, 7 | {"to","T"}, 8 | {"vport","vP"}, 9 | {"data","D"}, 10 | {"rawSendPacket","rS"}, 11 | {"sendPacket","sP"}, 12 | {"genPacketID","gP"}, 13 | {"packetCache","pC"}, 14 | {"checkCache","cC"}, 15 | {"routeCache","rC"}, 16 | {"realComputerPullSignal","rCPE"}, 17 | {"packetQueue","pQ"}, 18 | {"computer","C"}, 19 | {"C.uptime","U"}, 20 | {"table.unpack","Y"}, 21 | {"COMPUTER","computer"}, 22 | {"UPTIME","C.uptime"}, 23 | {"UNPACK","table.unpack"}, 24 | } 25 | -------------------------------------------------------------------------------- /realtime/README.md: -------------------------------------------------------------------------------- 1 | # realtime for OpenComputers 2 | 3 | Given the lack of a good way to get the real-world time from an OpenComputers machine, the *realtime* library and protocol were created. 4 | 5 | ## OpenOS 6 | The realtime package for OpenOS includes: 7 | 8 | - The [realtime library](OpenOS/usr/lib/realtime.lua) itself, for OpenOS 9 | - [realtime-sync](OpenOS/etc/rc.d/realtime-sync.lua), for synchronising with the real world 10 | - [realtime-relay](OpenOS/etc/rc.d/realtime-relay.lua), for synchronising with another OpenComputers machine 11 | 12 | These can be installed as oppm packages, and documentation can be found [here](OpenOS/usr/man) 13 | -------------------------------------------------------------------------------- /util/OpenOS/usr/bin/ping.lua: -------------------------------------------------------------------------------- 1 | local net = require "minitel" 2 | local computer = require "computer" 3 | local event = require "event" 4 | 5 | local tArgs = {...} 6 | local addr = tArgs[1] 7 | local times = tonumber(tArgs[2]) or 5 8 | local wait = tonumber(tArgs[3]) or 30 9 | 10 | for i = 1, times do 11 | local ipt = computer.uptime() 12 | local pid = net.genPacketID() 13 | computer.pushSignal("net_send",1,tArgs[1],0,"ping",pid) 14 | local t,a = event.pull(wait,"net_ack",pid) 15 | if t == "net_ack" and a == pid then 16 | print("Ping reply: "..tostring(computer.uptime()-ipt).." seconds.") 17 | else 18 | print("Timed out.") 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /realtime/OpenOS/usr/lib/realtime.lua: -------------------------------------------------------------------------------- 1 | local computer = require "computer" 2 | local realtime = {} 3 | realtime.epoch, realtime.uptime, realtime.offset = 0, computer.uptime(), 0 4 | 5 | function realtime.update(epoch,uptime,offset) 6 | if type(epoch) ~= "number" or type(uptime) ~= "number" then 7 | return false 8 | end 9 | realtime.epoch, realtime.uptime, realtime.offset = epoch, uptime, offset or realtime.offset 10 | return true 11 | end 12 | 13 | function realtime.time(utc) 14 | local ofs = realtime.offset 15 | if utc then 16 | ofs = 0 17 | end 18 | local ut = computer.uptime() 19 | return (realtime.epoch+(ut-realtime.uptime))+ofs 20 | end 21 | 22 | return realtime 23 | -------------------------------------------------------------------------------- /MMail/OpenOS/usr/man/mmail-send: -------------------------------------------------------------------------------- 1 | NAME 2 | mmail-send - send mmail-compatible messages from the command line 3 | 4 | SYNOPSIS 5 | mmail-send [TO] [FROM] [SUBJECT] [PATH] 6 | 7 | DESCRIPTION 8 | `mmail-send` sends mail over the Minitel network to MMail-compatible mail servers. 9 | 10 | EXAMPLES 11 | mmail-send alice@host bob "Example message" /usr/man/mmail-send 12 | Sends the user alice a message addressed from bob, with subject 'Example message', containing the contents of this manual page. 13 | 14 | mmail-send alice@host 15 | Sends the user alice a message, and prompts for all the other information. 16 | 17 | mmail-send 18 | Prompts for all required information (to, from, subject, message) 19 | -------------------------------------------------------------------------------- /syslog/OpenOS/usr/man/syslogd: -------------------------------------------------------------------------------- 1 | # syslog Daemon for OpenOS 2 | 3 | The syslog daemon lives in */etc/rc.d/syslogd.lua*, and as such is managed as an rc program: 4 | 5 | ``` 6 | rc syslogd enable 7 | rc syslogd start 8 | rc syslogd reload 9 | ``` 10 | 11 | In addition, the daemon keeps a configuration file in */etc/syslogd.cfg*. This is stored as a Lua table and may be edited in whatever way you see fit. It has the following fields and default values: 12 | 13 | |Field | Default value | 14 | | --- | --- | 15 | |port | 514 | 16 | |relay | false | 17 | |relayhost | "" | 18 | |receive | false | 19 | |write | true | 20 | |destination | "/dev/null" | 21 | |minlevel | 6 | 22 | |beeplevel | -1 | 23 | |displevel | 2 | 24 | |filter | {} | 25 | -------------------------------------------------------------------------------- /Embedded/microtel/microtel-5-core.lua: -------------------------------------------------------------------------------- 1 | function net.socket(address, port, sclose) 2 | local conn, rb = {}, "" 3 | conn.state, conn.buffer, conn.port, conn.address = "o", "", tonumber(port), address 4 | function conn.r(self,l) 5 | rb=self.buffer:sub(1,l) 6 | self.buffer=self.buffer:sub(l+1) 7 | return rb 8 | end 9 | function conn.w(self,data) 10 | net.lsend(self.address,self.port,data) 11 | end 12 | function conn.c(s) 13 | net.send(conn.address,conn.port,sclose) 14 | end 15 | function h(etype, from, port, data) 16 | if from == conn.address and port == conn.port then 17 | if data == sclose then 18 | net.hook[sclose] = nil 19 | conn.state = "c" 20 | return 21 | end 22 | conn.buffer = conn.buffer..data 23 | end 24 | end 25 | net.hook[sclose] = h 26 | return conn 27 | end 28 | -------------------------------------------------------------------------------- /Embedded/microtel/strip.lua: -------------------------------------------------------------------------------- 1 | tA={...} 2 | f=io.open(tA[1]) 3 | ss=f:read("*a") 4 | f:close() 5 | print("Optimising source") 6 | sl=tostring(ss:len()) 7 | no=0 8 | replacements={ 9 | {" "," "}, 10 | {"\n ","\n"}, 11 | {"\n\n","\n"}, 12 | {" == ","=="}, 13 | {" ~= ","~="}, 14 | {" >= ",">="}, 15 | {" <= ","<="}, 16 | {" > ",">"}, 17 | {" < ","<"}, 18 | {" = ","="}, 19 | {", ",","}, 20 | {" %+ ","+"}, 21 | {" %- ","-"}, 22 | {" %/ ","/"}, 23 | {" %* ","*"}, 24 | {" \n","\n"}, 25 | {"%-%-.-\n",""}, 26 | } 27 | for k,v in ipairs(replacements) do 28 | while ss:find(v[1]) ~= nil do 29 | ss=ss:gsub(v[1],v[2]) 30 | io.write(".") 31 | no=no+1 32 | end 33 | end 34 | print("\nBefore: "..sl.."\nAfter: "..tostring(ss:len()).."\nDelta: "..tostring(sl-ss:len())) 35 | 36 | f=io.open(tA[2],"wb") 37 | f:write(ss) 38 | f:close() 39 | -------------------------------------------------------------------------------- /Embedded/common-termsetup.lua: -------------------------------------------------------------------------------- 1 | local ga,sa = component.list("gpu")(),component.list("screen")() 2 | GPU = component.proxy(ga) 3 | GPU.bind(sa) 4 | 5 | write = vt100emu(GPU) 6 | function print(...) 7 | for k,v in pairs({...}) do 8 | write(tostring(v).."\n") 9 | end 10 | end 11 | function read() 12 | local sBuffer = "" 13 | repeat 14 | local tSignal = {computer.pullSignal()} 15 | if tSignal[1] == "key_down" then 16 | if tSignal[3] > 31 and tSignal[3] < 127 then 17 | write(string.char(tSignal[3])) 18 | sBuffer = sBuffer .. string.char(tSignal[3]) 19 | elseif tSignal[3] == 8 and tSignal[4] == 14 and sBuffer:len() > 0 then 20 | write("\8 \8") 21 | sBuffer = sBuffer:sub(1,-2) 22 | end 23 | end 24 | until tSignal[1] == "key_down" and tSignal[3] == 13 and tSignal[4] == 28 25 | write("\n") 26 | return sBuffer 27 | end 28 | -------------------------------------------------------------------------------- /RPC/OpenOS/usr/bin/importcomponent.lua: -------------------------------------------------------------------------------- 1 | local vcomponent = require "vcomponent" 2 | local rpc = require "rpc" 3 | local tA = {...} 4 | local host, ctype, addr = tA[1], tA[2], tA[3] 5 | 6 | if #tA < 3 then 7 | print("Usage: importcomponent ") 8 | return 9 | end 10 | 11 | local saddr = addr:gsub("%-","%%-") 12 | 13 | if addr:len() < 36 then 14 | local flist = rpc.call(host,"list") 15 | for k,v in pairs(flist) do 16 | faddr = v:match(ctype.."_("..saddr..".*)_") or faddr 17 | end 18 | end 19 | print(faddr) 20 | saddr = (faddr or addr):gsub("%-","%%-") 21 | local px = rpc.proxy(host,ctype.."_"..saddr..".*_") 22 | local mc = 0 23 | for k,v in pairs(px) do 24 | mc = mc + 1 25 | end 26 | if mc < 1 then 27 | error("no such remote component: "..addr) 28 | end 29 | vcomponent.register(faddr or addr, ctype, px) 30 | -------------------------------------------------------------------------------- /vTunnel/pcap.lua: -------------------------------------------------------------------------------- 1 | local pcap = {} 2 | local function uint32(n) 3 | s = "" 4 | for i = 3, 0, -1 do 5 | s=s..string.char((n>>(8*i))%256) 6 | end 7 | return s 8 | end 9 | local function uint16(n) 10 | s = "" 11 | for i = 1, 0, -1 do 12 | s=s..string.char((n>>(8*i))%256) 13 | end 14 | return s 15 | end 16 | 17 | function pcap.header(type) 18 | local s=uint32(0xa1b2c3d4) -- magic number 19 | s=s..uint16(2) -- major version 20 | s=s..uint16(4) -- minor version 21 | s=s..uint32(0) -- timezone 22 | s=s..uint32(0) -- accuracy 23 | s=s..uint32(2^16) -- snaplen 24 | s=s..uint32(type or 147) 25 | return s 26 | end 27 | function pcap.packet(d) 28 | local s = uint32(os.time()) -- timestamp 29 | s=s..uint32(0) -- usec 30 | s=s..uint32(d:len()) -- included length 31 | s=s..uint32(d:len()) -- actual length 32 | return s..d 33 | end 34 | 35 | return pcap 36 | -------------------------------------------------------------------------------- /WoLBeacon/OpenOS/usr/man/wolbeacon: -------------------------------------------------------------------------------- 1 | # WoLBeacon for OpenOS 2 | 3 | WoLBeacon is an OpenOS rc daemon to wake other machines up, and make sure yours can be woken up. 4 | 5 | ## Usage 6 | 7 | WoLBeacon can be managed as an rc service: 8 | 9 | ``` 10 | rc wolbeacon start 11 | rc wolbeacon stop 12 | rc wolbeacon reload 13 | rc wolbeacon enable 14 | rc wolbeacon disable 15 | ``` 16 | 17 | You will most likely want to start and enable the service. 18 | 19 | ## Configuration 20 | 21 | WoLBeacon's configuration file can be found in */etc/wolbeacon.cfg*, containing a number of fields: 22 | 23 | - **broadcast**: Whether to broadcast Wake-on-LAN packets. 24 | - **receive**: Whether to configure the local network interfaces to receive Wake-on-LAN messages. 25 | - **message**: The Wake-on-LAN message to listen for and broadcast. 26 | - **port**: The port to broadcast Wake-on-LAN messages on. 27 | - **delay**: The interval between sending Wake-on-LAN messages. 28 | -------------------------------------------------------------------------------- /MMail/MMail-protocol.md: -------------------------------------------------------------------------------- 1 | # MMail - simple mail protocol 2 | 3 | MMail, or Minitel Mail, is a simple electronic mail protocol for Minitel networks, using port 25. 4 | 5 | ## Messages 6 | 7 | A message must contain: 8 | 9 | - A line with `From: ` and an address, specifying where this mail came from, in the form of `user@host` 10 | - A line with `To: ` and an address, specifying to whom this mail is addressed to, in the form of `user@host` 11 | - A line with `Subject: ` and a subject line, specifying the subject of the message. 12 | 13 | The entire exchange will be written to the file, but those lines are required. 14 | 15 | ## Sending 16 | 17 | Sending a MMail message is simple: 18 | 19 | 1. The client opens a connection to the server on the MMail port. 20 | 2. The client sends the header, with To, From and Subject lines. 21 | 3. The client sends the message contents. 22 | 4. The client closes the connection. 23 | 24 | The server can then decide what to do with the message. 25 | -------------------------------------------------------------------------------- /Embedded/miniprompt.lua: -------------------------------------------------------------------------------- 1 | local ga,sa = component.list("gpu")(),component.list("screen")() 2 | GPU = component.proxy(ga) 3 | GPU.bind(sa) 4 | 5 | write = vt100emu(GPU) 6 | function print(...) 7 | for k,v in pairs({...}) do 8 | write(tostring(v).."\n") 9 | end 10 | end 11 | function read() 12 | local sBuffer = "" 13 | repeat 14 | local tSignal = {computer.pullSignal()} 15 | if tSignal[1] == "key_down" then 16 | if tSignal[3] > 31 and tSignal[3] < 127 then 17 | write(string.char(tSignal[3])) 18 | sBuffer = sBuffer .. string.char(tSignal[3]) 19 | elseif tSignal[3] == 8 and tSignal[4] == 14 and sBuffer:len() > 0 then 20 | write("\8 \8") 21 | sBuffer = sBuffer:sub(1,-2) 22 | end 23 | end 24 | until tSignal[1] == "key_down" and tSignal[3] == 13 and tSignal[4] == 28 25 | write("\n") 26 | return sBuffer 27 | end 28 | --API 29 | while true do 30 | write(_VERSION.."> ") 31 | tResult = {pcall(load(read()))} 32 | for k,v in pairs(tResult) do 33 | print(v) 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /MTFS/OpenOS/usr/bin/exportfs.lua: -------------------------------------------------------------------------------- 1 | local fsproxy = require "fsproxy" 2 | local fs = require "filesystem" 3 | local shell = require "shell" 4 | local rpc = require "rpc" 5 | 6 | local tA, tO = shell.parse(...) 7 | if #tA < 1 then 8 | print("Usage: exportfs [-d] [--rw] [--name=] [--allow=hostname[,hostname,...]] [--deny=hostname[,hostname,...]]") 9 | return 10 | end 11 | 12 | local allow, deny = {}, {} 13 | for host in (tO.allow or ""):gmatch("[^,]+") do 14 | allow[#allow+1] = host 15 | end 16 | for host in (tO.deny or ""):gmatch("[^,]+") do 17 | deny[#deny+1] = host 18 | end 19 | 20 | local px = fsproxy.new(tA[1], not tO.rw) 21 | local name = tO.name or tA[1] 22 | for l,m in pairs(px) do 23 | m = not tO.d and m or nil 24 | rpc.register("fs_"..name.."_"..l,m) 25 | for k,v in pairs(allow) do 26 | rpc.allow("fs_"..name.."_"..l,v) 27 | end 28 | for k,v in pairs(deny) do 29 | rpc.deny("fs_"..name.."_"..l,v) 30 | end 31 | end 32 | print(string.format("%s (%s)", name, (tO.rw and "rw") or "ro")) 33 | -------------------------------------------------------------------------------- /Embedded/dlfs.lua: -------------------------------------------------------------------------------- 1 | c="" 2 | do 3 | local host,port,FD=component.invoke(component.list("eeprom")(),"getData"):match("(.+)\n(.+)\n(.+)") 4 | port=tonumber(port) 5 | local fs,dirlist,filelist=component.proxy(computer.tmpAddress()),{FD},{} 6 | for _,dir in pairs(dirlist) do 7 | local content,ftype = fget(host,dir,port) 8 | if ftype == "d" then 9 | for line in content:gmatch("[^\n]+") do 10 | if line:sub(-1) == "/" then 11 | dirlist[#dirlist+1] = dir..line 12 | else 13 | filelist[#filelist+1] = dir..line 14 | end 15 | end 16 | end 17 | end 18 | for _,dir in pairs(dirlist) do 19 | dir=dir:sub(#dirlist[1]) 20 | fs.makeDirectory(dir) 21 | end 22 | for _,file in pairs(filelist) do 23 | local filename=file:sub(#dirlist[1]+1) 24 | local content,ftype = fget(host,file,port) 25 | f=fs.open(filename,"wb") 26 | fs.write(f,content) 27 | fs.close(f) 28 | end 29 | local fh,b = fs.open("boot.lua"),"" 30 | repeat 31 | b=fs.read(fh,4096) or "" 32 | c=c..b 33 | until b == "" 34 | end 35 | computer.getBootAddress = computer.tmpAddress 36 | load(c)() 37 | -------------------------------------------------------------------------------- /realtime/OpenOS/usr/man/realtime-sync: -------------------------------------------------------------------------------- 1 | # realtime-sync 2 | 3 | realtime synchronisation daemon for OpenOS 4 | 5 | realtime-sync uses the Date: header in HTTP responses, using the Internet card, to ascertain the current real time in UTC, and updates the realtime library with this information. 6 | 7 | ## Usage 8 | 9 | realtime-sync is implemented as an rc service, and as such, to start it one can use the usual rc commands: 10 | 11 | rc realtime-sync start 12 | rc realtime-sync stop 13 | rc realtime-sync enable 14 | rc realtime-sync disable 15 | 16 | Additionally, realtime-sync includes 17 | 18 | rc realtime-sync sync 19 | 20 | to force a re-synchronisation. 21 | 22 | ## Configuration 23 | 24 | realtime-sync includes a configuration file at */etc/realtime-sync.cfg*; as a Lua table. It contains the following fields: 25 | 26 | - **url**: The URL to request to get the time. Pick one that returns UTC dates in the headers, or leave the default. 27 | - **offset**: The timezone offset, in hours. For example, for AEDT, use 11. 28 | - **frequency**: The time between automatic time synchronisations. 29 | -------------------------------------------------------------------------------- /syslog/syslog-protocol.md: -------------------------------------------------------------------------------- 1 | # Syslog - Simple, network-capable event logging. 2 | 3 | Logging is an important part of monitoring and maintaining a computer system. In the Unix world, you have [syslog](https://en.wikipedia.org/wiki/Syslog), which is, indeed, the inspiration of the Minitel syslog protocol. 4 | 5 | Syslog for Minitel is a simple protocol designed for ease of implementation and filtering, and uses port 514 by default. 6 | 7 | ## Packet format 8 | 9 | A syslog packet may be reliable or unreliable, and may not be larger than 4096 bytes. Each packet consists of 3 sections, separated by tabs: 10 | 11 | - The *service* field, containing the name of the service or other software that generated the event. 12 | - The *level* field, a number indicating the severity of the event, as specified in [RFC 5424, section 6.2.1, table 2.](https://tools.ietf.org/html/rfc5424#section-6.2.1) 13 | - The *message* field, containing information about the event. 14 | 15 | ## Behavior of syslog servers 16 | 17 | Once an event is received over the network, the server may choose to save, relay, filter or drop an event as it chooses. 18 | -------------------------------------------------------------------------------- /protocol-ext-multicast.md: -------------------------------------------------------------------------------- 1 | ### Optional: Multicast 2 | A multicast packet has a specially formatted address part. 3 | The address must be a list of valid addresses, beginning with `~` seperated by the tilde character, `~`, ASCII 126. 4 | For example, to send to nodes `a` and `b`, the address in the packet would be `~a~b`. 5 | 6 | Each node should send multicasts as layer 2 broadcasts, unless it is known (using the address cache) that all layer 3 destination addresses have to be sent to or forwarded by one layer 2 address. 7 | 8 | When a multicast packet is forwarded, the addresses already seen SHOULD be removed from the packet when possible, using the address cache as a guide. 9 | 10 | The same address MUST NOT be repeated in a multicast destination, but the duplicate MAY be ignored and just considered one, but also MAY br dropped as an invalid packet. A duplicate address MUST NOT be considered as two packets with the same contents to the same address. 11 | 12 | A multicast packet SHOULD also be able to be broken up into multiple packets with the same contents (but they need different packet IDs!) with different addresses. 13 | 14 | -------------------------------------------------------------------------------- /MMail/OpenOS/usr/bin/mmail-send.lua: -------------------------------------------------------------------------------- 1 | local net = require "minitel" 2 | 3 | local tArgs = {...} 4 | local hostname = io.open("/etc/hostname","rb"):read() 5 | 6 | if not tArgs[1] then 7 | io.write("To: ") 8 | tArgs[1] = io.read() 9 | end 10 | 11 | if not tArgs[2] then 12 | io.write("From: ") 13 | tArgs[2] = io.read() 14 | print("\n") 15 | end 16 | 17 | if not tArgs[3] then 18 | io.write("Subject: ") 19 | tArgs[3] = io.read() 20 | end 21 | 22 | local user,host = tArgs[1]:match("(.+)@(.+)") 23 | local from = tArgs[2] .. "@" .. hostname 24 | subject = tArgs[3] 25 | 26 | print("To: "..user.."@"..host) 27 | print("From: "..from) 28 | print("Subject: "..subject) 29 | 30 | local fileID = tArgs[4] 31 | if not fileID then 32 | fileID = "/tmp/mail-"..tostring(math.random(1000000,9999999)) 33 | os.execute("edit "..fileID) 34 | end 35 | 36 | local f = io.open(fileID,"rb") 37 | local message = f:read("*a") 38 | f:close() 39 | 40 | socket = net.open(host,25) 41 | socket:write("To: "..user.."@"..host.."\n") 42 | socket:write("From: "..from.."\n") 43 | socket:write("Subject: "..subject.."\n") 44 | socket:write(message) 45 | socket:close() 46 | -------------------------------------------------------------------------------- /FRequest/OpenOS/usr/bin/fget.lua: -------------------------------------------------------------------------------- 1 | local net = require "minitel" 2 | local event = require "event" 3 | local shell = require "shell" 4 | 5 | local function parseURL(url) 6 | local proto,addr = url:match("(.-)://(.+)") 7 | addr = addr or url 8 | local hp, path = addr:match("(.-)(/.*)") 9 | hp, path = hp or addr, path or "/" 10 | local host, port = hp:match("(.+):(.+)") 11 | host = host or hp 12 | return proto, host, port, path 13 | end 14 | 15 | local tArgs, tFlags = shell.parse(...) 16 | local proto, host, port, path = parseURL(tArgs[1]) 17 | port = tonumber(port) or 70 18 | 19 | local socket = net.open(host,port) 20 | if tFlags.s then 21 | socket:write("s"..path.."\n") 22 | else 23 | socket:write("t"..path.."\n") 24 | end 25 | local c = socket:read(1) 26 | repeat 27 | c = socket:read(1) 28 | os.sleep(0.5) 29 | until c ~= "" 30 | if c == "n" then 31 | print(path..": Not found.") 32 | elseif c == "f" then 33 | print("Failure: ") 34 | elseif c == "d" then 35 | print("Directory listing for "..path) 36 | end 37 | repeat 38 | l = socket:read(1024) 39 | io.write(l) 40 | os.sleep(0.5) 41 | until socket.state == "closed" and l == "" 42 | -------------------------------------------------------------------------------- /realtime/OpenOS/usr/man/realtime-relay: -------------------------------------------------------------------------------- 1 | # realtime-relay 2 | 3 | realtime relay daemon for OpenOS 4 | 5 | realtime-relay is both a Minitel realtime server and client; allowing both synchronisation with another machine, and other machines to synchronise with the local machine's clock. 6 | 7 | ## Usage 8 | 9 | realtime-relay is implemented as an rc service, and as such, to start it one can use the usual rc commands: 10 | 11 | rc realtime-relay start 12 | rc realtime-relay stop 13 | rc realtime-relay enable 14 | rc realtime-relay disable 15 | 16 | ## Configuration 17 | 18 | realtime-relay includes a configuration file at */etc/realtime-relay.cfg*; as a Lua table. It contains the following fields: 19 | 20 | - **host**: The host to synchronise the local real-time clock with. 21 | - **port**: The port to communicate with *host* on. 22 | - **sync**: Whether to synchronise clocks with *host*. 23 | - **frequency**: The time between automatic time synchronisations. 24 | - **offset**: The offset time, in hours. 25 | 26 | By default, realtime-relay will only act as a server, as using it as a client requires both a *host* being set, and *sync* being enabled. 27 | -------------------------------------------------------------------------------- /MTFS/README.md: -------------------------------------------------------------------------------- 1 | # MTFS 2 | 3 | MTFS is, in effect, a standardised set of names for function endpoints implementing the [API of an OpenComputers filesystem component](https://ocdoc.cil.li/component:filesystem), over Minitel RPC. 4 | 5 | ## Function names 6 | 7 | Names for filesystem "component" functions should follow the form `fs__`, so, for example, `fs_/usr_isDirectory`. 8 | 9 | ## Functions 10 | 11 | Unless otherwise specified, functions should be inherited from, or implemented to emulate, an [OpenComputers filesystem component](https://ocdoc.cil.li/component:filesystem). More specifically: 12 | 13 | - spaceUsed 14 | - seek 15 | - makeDirectory 16 | - exists 17 | - isReadOnly 18 | - write 19 | - spaceTotal 20 | - isDirectory 21 | - rename 22 | - list 23 | - lastModified 24 | - getLabel 25 | - setLabel 26 | - remove 27 | - size 28 | - open 29 | - read 30 | - write 31 | - close 32 | 33 | ### Optional extensions 34 | 35 | #### dirstat 36 | 37 | An optional extra function, `dirstat`, may be implemented on the server side to allow clients to access directory listings with less RPC calls; it should return data in a Lua table of the following structure: 38 | 39 | ``` 40 | { 41 | [filename: string] = {isDirectory: boolean, size: boolean, lastModified: number}, 42 | ... 43 | } 44 | ``` 45 | -------------------------------------------------------------------------------- /FRequest/OpenOS/README.md: -------------------------------------------------------------------------------- 1 | # FRequest for OpenOS 2 | 3 | This package includes the FRequest daemon, in etc/rc.d/frequest.lua, and the fget FRequest client, in usr/bin/fget.lua. 4 | 5 | ## fget client 6 | 7 | ### Installation 8 | 9 | #### With OPPM 10 | 11 | 1. Run `oppm install fget` 12 | 13 | #### Manual 14 | 15 | 1. Place fget.lua into /usr/bin 16 | 17 | ### Invocation 18 | 19 | fget can be used to get both directory listings and files, provided the server allows it. 20 | 21 | To use fget, run: 22 | 23 | ``` 24 | fget / 25 | ``` 26 | 27 | So, for example: 28 | 29 | ``` 30 | fget sks-srv:70/OpenOS 31 | ``` 32 | 33 | ## fserv daemon 34 | 35 | fserv is the FRequest server. It provides directory listing and file transfer. 36 | 37 | ### Installation 38 | 39 | #### With OPPM 40 | 41 | 1. Run `oppm install frequestd` 42 | 43 | #### Manual 44 | 45 | 1. Place fserv.lua into /etc/rc.d 46 | 2. Run rc frequestd enable; rc minitel start 47 | 48 | ### Configuration 49 | 50 | The fserv daemon does not keep a configuration file, so settings have to be set every boot. 51 | 52 | To change a setting, one invokes: 53 | 54 | `rc fserv set_