Ever left your computer for a few minutes only to return and find your browser history mysteriously filled with "how to make the perfect sandwich" or your Slack status changed to "Professional Nap Taker"? 🤔
Well, my paranoid friends, today we're going to solve this mystery once and for all! I present to you: The Ultimate Computer Surveillance Script (or as I like to call it, "The Thief Catcher 3000").
The Problem: Trust Issues 🤷♂️
Picture this: You step away from your desk for a coffee break, and when you return, someone has clearly been messing with your computer. Your teammates deny everything with suspiciously innocent faces. Your roommate claims they were "just checking the time" (on YOUR computer, really?).
Time to go full CSI mode! 🔍
The Solution: Python Surveillance Magic ✨
Here's a delightfully sneaky Python script that will screenshot your computer every minute, automatically saving evidence to a folder I've cleverly named /thief (subtle, right?):
import time
import os
from datetime import datetime
import mss
from PIL import Image
# Define your custom folder path
folder_path = "/Users/binhnguyen/thief" # Change this to your desired folder
# Ensure the folder exists
os.makedirs(folder_path, exist_ok=True)
def take_screenshot():
# Create an mss instance for screen capture
with mss.mss() as sct:
# Capture the screen
screenshot = sct.grab(sct.monitors[1]) # Use the first monitor
# Convert to an Image object (Pillow)
img = Image.frombytes("RGB", screenshot.size, screenshot.bgra, "raw", "BGRX")
# Define filename with timestamp
filename = datetime.now().strftime("screenshot_%Y-%m-%d_%H-%M-%S.png")
file_path = os.path.join(folder_path, filename)
# Save the image
img.save(file_path)
print(f"Screenshot saved: {file_path}")
# Run every 60 seconds
while True:
take_screenshot()
time.sleep(60)
Breaking Down the "Thief Catcher 3000" 🔧
Let's dissect this beautiful piece of surveillance art:
1. The Imports: Our Spy Toolkit 🛠️
import time # For making our script wait (patience is key in espionage)
import os # For creating our secret evidence folder
from datetime import datetime # For timestamping our evidence (very CSI)
import mss # The real MVP - super fast screenshots
from PIL import Image # For handling our spy photos
2. The Evidence Folder 📁
folder_path = "/Users/binhnguyen/thief"
os.makedirs(folder_path, exist_ok=True)
I named the folder "thief" because subtlety is overrated. Every time someone opens this folder, they'll know EXACTLY what it's for. It's like putting up a "Smile, you're on camera!" sign, but funnier.
3. The Screenshot Function: Our Digital Camera 📸
def take_screenshot():
with mss.mss() as sct:
screenshot = sct.grab(sct.monitors[1]) # Gotcha!
The mss library is incredibly fast - faster than your coworker can close that "definitely work-related" YouTube video! It grabs screenshots so quickly, they won't even know what hit them.
4. The File Naming: Timestamp Evidence 🕐
filename = datetime.now().strftime("screenshot_%Y-%m-%d_%H-%M-%S.png")
Each screenshot gets a timestamp like screenshot_2024-12-22_14-30-45.png. This way, you'll know EXACTLY when someone was browsing your computer for cat videos at 2:30 PM on a Tuesday.
5. The Infinite Loop: Never-Ending Vigilance 🔄
while True:
take_screenshot()
time.sleep(60) # Screenshot every minute
This script runs FOREVER (or until you stop it). Every 60 seconds, SNAP! Another piece of evidence. It's like having a security guard that never gets tired, never asks for coffee breaks, and never judges you for your questionable browser history.
Installation & Setup 🚀
First, install the required packages:
pip install mss pillow
Then just run the script:
python thief_catcher.py
Pro tip: Run this in the background or as a startup script for maximum stealth! 🥷
Real-World Results 📊
After running this for a week, here's what I discovered:
- 3:42 PM Monday: Someone definitely used my computer to check their Instagram (busted!)
- 11:23 AM Wednesday: Caught my roommate ordering pizza on MY DoorDash account (the audacity!)
- 2:15 PM Friday: Evidence of someone playing online solitaire during "important meetings"
Customization Options 🎛️
Want to make this even more diabolical? Here are some modifications:
Change the Screenshot Interval
time.sleep(30) # Every 30 seconds (more paranoid)
time.sleep(300) # Every 5 minutes (less paranoid)
Add Email Alerts
# Send yourself an email every time someone uses your computer
# Because why not add some drama to your day?
Multiple Monitor Support
# Capture all monitors if you're running a multi-screen setup
for monitor in sct.monitors[1:]: # Skip the "All in One" monitor
screenshot = sct.grab(monitor)
Legal Disclaimer (The Boring But Important Part) ⚖️
Before you unleash your inner spy, remember:
- Only use this on YOUR OWN computer
- Be aware of privacy laws in your area
- Maybe warn people if this is a shared computer (or don't, I'm not your mom)
- Don't use this to stalk people (seriously, that's not cool)
Conclusion: Knowledge is Power 💪
Now you have the power to solve the mystery of "Who Used My Computer?" Will it be your sneaky coworker? Your curious roommate? Or will you discover it was just you, sleepwalking and ordering things online again?
Either way, you'll have photographic evidence! And isn't that what life is really about? Having proof that you were right all along? 😏
Remember: With great surveillance power comes great responsibility. Use this script wisely, and may your computer remain thief-free!
P.S. - If you catch someone using this script on their computer, maybe it's time to have "the talk" about boundaries. Or just smile and wave at the camera! 👋

