Menu

1 / 2

I Hid a Web Server on My Coworker's MacBook to Make It Talk. Eight Years Later, He Still Locks His Screen.

DEV Community·Alexander Mia·6 months ago
#fP5xhsLh
#programming#python#security#laptop#screen
Reading 0:00
15s threshold

Around 2018, I sat across from a coworker — let's call him D — who had a habit of stepping away for lunch with his screen wide open. I told him about it. Twice. He laughed both times and forgot the next day.

So I taught him with twelve lines of Python.

The setup

macOS ships with a command-line utility called say . You pipe text to it, and your laptop talks. Or, more accurately, your laptop talks to everyone in the office .

The plan was simple:

Sneak onto D's laptop while he was at lunch.

Run a tiny HTTP server in the background.

From my own desk, send GET requests with words I wanted his laptop to shout across the room.

Wait.

The whole thing

from subprocess import check_output from aiohttp import web

async def handle ( request ): name = request . match_info . get ( " name " , "" ) text = name check_output ( f " /usr/bin/say ' { text } '" , shell = True ) return web . Response ( text = text )

app = web . Application () app . add_routes ([ web . get ( " /{name} " , handle )])

web .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.