Tài liệu này giúp quản trị viên kiểm tra xem các endpoint trong tổ chức có truy cập vào các URL liên quan đến các nền tảng AI như ChatGPT, Claude, Copilot, Midjourney, v.v. hay không. Việc kiểm tra được thực hiện dựa trên log truy cập web (web transaction) được ghi nhận bởi tính năng Web Journaling của Sophos, cho phép phát hiện các hành vi truy cập vào các dịch vụ AI một cách chi tiết và theo thời gian thực.
Script sử dụng một file .csv chứa danh sách các domain thuộc các nền tảng AI phổ biến. File này được tải về trực tiếp trong quá trình thực thi truy vấn (query) thông qua lệnh curl. Sau đó, các domain trong file sẽ được so khớp với các URL mà các endpoint đã truy cập (dựa vào log web transaction). Nếu phát hiện có truy cập trùng khớp, script sẽ hiển thị các thông tin chi tiết bao gồm: tên người dùng (user), tiến trình thực thi (process), thời gian truy cập, URL đầy đủ, cùng với domain AI được phát hiện và mô tả tương ứng.
– Đảm bảo các endpoint đã bật tính năng Web Control và Web Journaling (có thể kiểm tra trong Sophos Central).
– File CSV chứa danh sách domain AI:
https://raw.githubusercontent.com/soniravi06/FileUpload/refs/heads/main/top_100_ai_sites.csv
Cấu trúc file:
domain,note
openai.com,ChatGPT
claude.ai,Claude
copilot.microsoft.com,Copilot
1. Đăng nhập Sophos Central Admin.
2. Vào mục ‘Endpoint Protection’ → ‘Policies’.
3. Chọn policy ‘Web Control’, hoặc tạo mới.
4. Trong tab ‘Settings’, bật trạng thái ‘Web control’ và “Log web control event”. Nhấn save để hoàn tất.

1. Truy cập vào “Threat Analysic Center” → “Live Discover”.
2. Bật trạng thái “Designer Mode” → “Create new query”.

– Category: Chọn All queries
– Source: Chọn Live Endpoint và Click vào tất cả OS
Khi tạo query trong Sophos Central → Live Discover, cần tạo 3 biến như sau:
– URL for ai_sites.csv file (kiểu: STRING) → Đường dẫn đến file CSV chứa domain AI (https://raw.githubusercontent.com/soniravi06/FileUpload/refs/heads/main/top_100_ai_sites.csv)
– start_time (kiểu: DATE) → Thời gian bắt đầu truy vấn
– end_time (kiểu: DATE) → Thời gian kết thúc truy vấn

/* DECLARE VARIABLE */
-- start_time DATE
-- end_time DATE
-- URL for ai_sites.csv file STRING (sample URL - https://raw.githubusercontent.com/soniravi06/FileUpload/refs/heads/main/top_100_ai_sites.csv)
/* 1. Download the CSV file containing AI domains */
WITH raw_csv(line, rest) AS (
SELECT '', (SELECT result FROM curl WHERE url = '$$URL for ai_sites.csv file$$') || char(10)
UNION ALL
SELECT substr(rest, 0, instr(rest, char(10))),
substr(rest, instr(rest, char(10)) + 1)
FROM raw_csv
WHERE rest != ''
),
/* 2. Parse the CSV into domain and note columns */
ai_sites(domain, note) AS (
SELECT
lower(trim(substr(line, 1, instr(line, ',')-1))) AS domain,
trim(substr(line, instr(line, ',')+1)) AS note
FROM raw_csv
WHERE line != '' AND line NOT LIKE 'domain%' -- skip headers
)
/* 3. Match AI domain with the Web Transactions */
SELECT DISTINCT
STRFTIME('%Y-%m-%dT%H:%M:%SZ', DATETIME(swtj.time, 'unixepoch')) AS date_time,
(SELECT username FROM users WHERE uuid = swfj.owner) AS user,
(SELECT process_name FROM sophos_process_journal AS spj WHERE spj.sophos_pid = swfj.sophos_pid) AS process_name,
swfj.sophos_pid,
swtj.url,
swtj.referrer,
swtj.origin,
s.domain,
s.note
FROM
sophos_web_transaction_journal AS swtj
LEFT JOIN
sophos_web_flow_journal AS swfj ON (
swfj.time = (CAST(SPLIT(swtj.flow_id, '-', 0) AS INT) - 11644473600)
AND swfj.flow_id = swtj.flow_id)
JOIN ai_sites s ON swtj.url LIKE '%' || s.domain || '%'
WHERE
swtj.time >= $$start_time$$
AND swtj.time <= $$end_time$$

Nhấn save để lưu.
Truy cập vào “Threat Analysic Center” → “Live Discover”.
Chọn mục “Search” → “Nhập tên truy vấn đã tạo”.

Chọn danh sách các thiết bị cần truy vấn → “Update selected devices list”.
Chọn lại biến thời gian để truy vấn.
Nhấn chọn “Run Query”

Bảng truy vấn sẽ xuất hiện sau khi ấn Run Query
Có thể Export ra file Excel.

– Tính năng Web Control phải được bật trước thời điểm cần truy xuất log.
– Có thể thay đổi URL chứa file domain AI theo nhu cầu riêng.
– Một số app AI có thể dùng subdomain khác (ví dụ chat.openai.com), nên nên liệt kê domain dạng tổng quát trong file .csv

