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.

21CTO
21CTO
21CTO
How to Use Python to Capture Chrome History and Email It Automatically

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.txt

Running 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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PythonData ExtractionScriptingemail automationChrome History
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.