Deleting Data in Caido
DANGER
We do not recommend modifying the files directly as this might result in problems in the application and/or corruption of data. Proceed at your own risk.
Caido does not currently support a CLI argument or desktop application functionality for deleting data. However, although it is not recommended, data can be deleted manually using the SQLite CLI.
TIP
View the internal files reference to learn about the file system structure.
Finding a Project
- Decide which project you want to clean.
- Navigate to your Caido data path.
- Open the projects database using
sqlite3 projects.db
. - Run
select * from projects;
and keep the UUID of the project you want to modify.
08c09bfa-a9fd-41e5-909e-2338a28319f9
Preparing the Project Database
- If Caido is running, kill the application.
- Navigate to
projects/<project-uuid>/
. - Open the main data:
sqlite3 database.caido
- Switch to WAL mode:
PRAGMA main.journal_mode = WAL;
- Attach the raw database:
ATTACH DATABASE 'database_raw.caido' AS raw;
- Switch to WAL mode:
PRAGMA raw.journal_mode = WAL;
- Enable foreign keys:
PRAGMA foreign_keys = ON;
DANGER
Do NOT skip the foreign keys step!
Deleting Requests
DANGER
As traffic is stored in multiple tables, to avoid data corruption, ensure to follow the order of operations below.
Determining Requests & Responses to Delete
The first step is to find a list of requests we want to delete. We will keep that in a temporary table.
CREATE TEMP TABLE requests_to_delete AS
SELECT id, response_id, raw_id
FROM requests
WHERE <your_condition_here> -- Replace with your condition.
For example, the condition could be: host = "www.youtube.com"
.
CREATE TEMP TABLE responses_to_delete AS
WITH RECURSIVE recursive_responses AS (
SELECT r.id, r.parent_id, r.raw_id
FROM responses r
INNER JOIN requests_to_delete rd ON r.id = rd.response_id
UNION ALL
SELECT r.id, r.parent_id, r.raw_id
FROM responses r
INNER JOIN recursive_responses rr ON r.parent_id = rr.id
)
SELECT id FROM recursive_responses;
Cleaning Requests Raw
DELETE FROM requests_raw
WHERE id IN (
SELECT raw_id
FROM requests_to_delete
);
Cleaning Responses Raw
DELETE FROM responses_raw
WHERE id IN (
SELECT raw_id
FROM responses_to_delete
);
Cleaning Sitemap Entries
DELETE FROM sitemap_entries
WHERE request_id IN (
SELECT id
FROM requests_to_delete
);
Cleaning Requests
This will also clean scoped_requests
and requests_metadata
.
DELETE FROM requests
WHERE id IN (
SELECT id
FROM requests_to_delete
);
Cleaning Responses
DELETE FROM responses
WHERE id IN (
SELECT id
FROM responses_to_delete
);