![]() |
Electronic Bondage Safe for Emlalock - Software | ![]() |
I finally got around to writing the software for my hacked up safe.
One requirement I had was to let it be usable with sites like Emlalock. Another requirement was to allow the password to be set by my Lady, remotely.
This second requirement kinda meant it'd be easiest to do as a web site, with internet connections forwarded via the router.
In case other people also want to use this software, I decided to write it in Go; now Linux, Windows, Mac and other users could run it on their machines.
So, here it is. That zip file is 7Mb in size and contains the source, plus binaries, and the web site.
Note that at least once Windows Defender false alerted on the windows binary. If you don't trust my compilation then read the source and compile it yourself.
Running the code may be as simple as running the binary. With no additional configuration it will run the web server on port 5000 and try to find the safe on a default serial port (/dev/ttyUSB0 or COM1:).
$ ./safe.linux.amd64
Using configuration file /home/bdsm/.safe.cfg
Serial Port = /dev/ttyUSB0
Listen Port = 5000
HTML static = /tmp/safe/src/safe/static
Lock image loaded
Could not open serial port: open /dev/ttyUSB0: no such file or directory
The first line lets you know what configuration file can be used to
override the defaults.
On Windows it will look for
%HOMEDIR%%HOMEPATH% or %USERPROFILE. On Linux/MacOS it
will look in $HOME. Examples may be:
C:\Documents and Settings\bdsm\.safe.cfg
C:\Users\bdsm\.safe.cfg
/Users/bdsm/.safe.cfg
/home/bdsm/.safe.cfg
This file is a JSON format file.
{
"ListenPort":12345,
"SerialPort":"COM3",
"AuthUser":"username",
"AuthPass":"password",
"HTMLDir":"/path/to/static"
}
Each line is optional. The smallest file might be
{
"SerialPort":"COM3"
}
If you have multiple lines then separate them with a ,
| ListenPort | Defaults to 5000. What port to run the webserver on |
| SerialPort | Defaults to COM1 or /dev/ttyUSB0. Where the safe is |
| AuthUser | If set, require this username/password for the website |
| AuthPass | See AuthUser |
| HTMLDir | If the code can not find the static directory, you can set it here |
On Linux, if you have multiple USB serial ports then it may make sense to use the /dev/serial/by-id/... path to the serial port, rather then /dev/ttyUSB... values to ensure that the right serial port is picked up (just in case the order changes on next reboot).
Using configuration file /home/bdsm/.safe.cfg
Serial Port = /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0
Listen Port = 12345
HTML static = /tmp/safe/src/safe/static
Lock image loaded
Successfully connected to Safe
OK Safe is unlocked
The "Successfully connected" means it was able to talk to the safe. The
last line is the current state of the safe.
You can now access the website. In this case, I'm running on port 12345
and so http://localhost:12345 would work.
You can see that web site design isn't my strong point. This could have
been written by somebody back in 1996... and will probably still work in
a browser from that time!
The controls are in the left frame, and the results on the right.
OK opening safe for 5 seconds
OK opening safe for 4 seconds
OK opening safe for 3 seconds
OK opening safe for 2 seconds
OK opening safe for 1 seconds
OK completed
If the safe is locked then you'll get an error instead
Note: there is no encryption of the password inside the file; it's just stored as a comment. You could look inside and file it. So after uploading to Emlalock, delete the image!
If you wish, a different JPEG file can be used. The code should strip out unnecessary sections. Make sure you test carefully if you do this. Yes, your unlock picture could be an anime cat, if you really wanted it to be!
It's strongly recommended to do a test session (eg 1 minute) to verify that this works as you expect. With the door closed and the safe locked (eg with a picture) then you can't open it again if there is a problem, without the backup key.