Hi, I'm Lex (they/them)
I made a very silly fax service.
In the video it is running on York Hackspace's internal phone system.
It also ran at EMFCamp 2024 on the copper telephone network.
Source code is here: github.com/lex...
Enjoy :)
--- Explanation of what's going on in this video ---
This is a regular fax machine sending a normal fax to fax service that I built. The service runs on a Raspberry Pi that has a fax modem attached to it. It appears to any other fax machine just like a normal fax machine. Both the Raspberry Pi and the fax machine in the video are connected to a PABX (a local telephone exchange) in York Hackspace. The phone exchange there is not connected to the public network at all (at the time of filming, at least), and so you can only make local calls.
The Hackspace PABX is very old, and only supports pulse dialing (it doesn't support the more modern DTMF dialing). As far as I can tell, the fax machine can only do DTMF, and can't do pulse. This is why there is a hamburger phone attached to the same phone line. The hamburger phone can do pulse dialing. At the start of the video, I put the printed source code on the fax scanner glass, and then pick up the hamburger phone and dial the number for the fax service running on the Raspberry Pi. The Pi is connected to extension 8, so I dial 8.
Once I hear that the Raspberry Pi has accepted the incoming call, I press the button on the fax machine to start sending a fax. The Raspberry Pi listens to the incoming fax and saves it to the SD card. The fax service running on the Pi then performs OCR on the incoming fax. The result of the OCR is saved as a C file. That C file is then compiled with GCC, and then the resulting binary is executed. Of course, compilation might fail, in which case the program will not run.
Regardless of the result of the compilation and execution, the fax service will generate a report and fax it back to the sender. (This can only happen if the sender included a reply number in the program. That's what the //REPLY=7# line is for. The fax machine is connected to extension 7. Unfortunately I couldn't figure out how to get caller ID working.) The report will contain any compiler errors or warnings, and any output from the program, if it ran.
--- FAQ ---
Q: What happens if you send a program that doesn't terminate? (An infinite loop)
A: At the time of filming, it would have waited forever for the program to complete, and thus it would not reply at all and would stop processing incoming faxes. I have since added some time limits. You get 20 seconds to compile, and 60 seconds to run. After that the program is terminated and the report is sent back with a message indicating that a timeout occured.
Q: What if you need more than one page to send all your code?
A: You can send a multi-page fax, but I'm not sure what will happen after it is received. Whatever happens it certainly won't work correctly. It will either: just ignore all pages after the first one, or try to OCR them all at once and fail to read the code. I would like to fix that though. Support for multipage sources would be nice.
Q: Is it sandboxed?
A: Yes.
Q: Is the sandbox actually secure?
A: I've done the best I can to secure it, but there might still be issues. Try and break it for yourself! The code is all on github: github.com/lex...
Q: Can you specify the compilation options? If so how?
A: No, unfortunately. I could maybe add in a way to do this, perhaps a special comment at the top of the file. For now though it will always compile with a fairly simple command: gcc -lm program.c -o program
Негізгі бет Ғылым және технология Call the compiler, fax it your code
Пікірлер: 341