How to Use Python to Capture Chrome History and Email It Automatically
This tutorial shows how to extract a target computer's Chrome browsing history with Python, save it as a text file, and automatically send it via email using a QQ SMTP account, detailing the required environment, scripts, and common pitfalls.
Overview
This article demonstrates a Python‑based method to retrieve a target computer's Chrome browsing history, save it as a text file, and automatically email it using a QQ mail account. The process is fully automated after the script is placed on the target machine.
Environment
Chrome
Python 3.6
macOS Sierra
Sender QQ email address and authorization code
Recipient email address
SMTP server: smtp.qq.com
Implementation
First copy the Chrome History SQLite file, then run a Python script ( get_history.py) to extract URLs. Next, use another script ( send_mail.py) to attach the result file and send it via SMTP.
cp /Users/Marcel/Library/Application Support/Google/Chrome/Default/History /Users/Marcel/Desktop/tmp/code/chrome_history/
python /Users/Marcel/Desktop/tmp/code/chrome_history/get_history.py
python /Users/Marcel/Desktop/tmp/code/chrome_history/send_mail.py /Users/Marcel/Desktop/tmp/code/chrome_history/result.txtRunning the scripts produces a text file with visited URLs and an email with the file attached, as shown in the result screenshots.
Challenges
The target computer must be online for the monitoring to work, and adjustments may be needed for different operating systems or browsers (e.g., Chrome on macOS vs Windows). Additionally, proper QQ mail authorization and SMTP configuration are required.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
