linear-mcp-fast 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccl_chromium_reader/__init__.py +2 -0
- ccl_chromium_reader/ccl_chromium_cache.py +1335 -0
- ccl_chromium_reader/ccl_chromium_filesystem.py +302 -0
- ccl_chromium_reader/ccl_chromium_history.py +357 -0
- ccl_chromium_reader/ccl_chromium_indexeddb.py +1060 -0
- ccl_chromium_reader/ccl_chromium_localstorage.py +454 -0
- ccl_chromium_reader/ccl_chromium_notifications.py +268 -0
- ccl_chromium_reader/ccl_chromium_profile_folder.py +568 -0
- ccl_chromium_reader/ccl_chromium_sessionstorage.py +368 -0
- ccl_chromium_reader/ccl_chromium_snss2.py +332 -0
- ccl_chromium_reader/ccl_shared_proto_db_downloads.py +189 -0
- ccl_chromium_reader/common.py +19 -0
- ccl_chromium_reader/download_common.py +78 -0
- ccl_chromium_reader/profile_folder_protocols.py +276 -0
- ccl_chromium_reader/serialization_formats/__init__.py +0 -0
- ccl_chromium_reader/serialization_formats/ccl_blink_value_deserializer.py +401 -0
- ccl_chromium_reader/serialization_formats/ccl_easy_chromium_pickle.py +133 -0
- ccl_chromium_reader/serialization_formats/ccl_protobuff.py +276 -0
- ccl_chromium_reader/serialization_formats/ccl_v8_value_deserializer.py +627 -0
- ccl_chromium_reader/storage_formats/__init__.py +0 -0
- ccl_chromium_reader/storage_formats/ccl_leveldb.py +582 -0
- ccl_simplesnappy/__init__.py +1 -0
- ccl_simplesnappy/ccl_simplesnappy.py +306 -0
- linear_mcp_fast/__init__.py +8 -0
- linear_mcp_fast/__main__.py +6 -0
- linear_mcp_fast/reader.py +433 -0
- linear_mcp_fast/server.py +367 -0
- linear_mcp_fast/store_detector.py +117 -0
- linear_mcp_fast-0.1.0.dist-info/METADATA +160 -0
- linear_mcp_fast-0.1.0.dist-info/RECORD +39 -0
- linear_mcp_fast-0.1.0.dist-info/WHEEL +5 -0
- linear_mcp_fast-0.1.0.dist-info/entry_points.txt +2 -0
- linear_mcp_fast-0.1.0.dist-info/top_level.txt +4 -0
- tools_and_utilities/Chromium_dump_local_storage.py +111 -0
- tools_and_utilities/Chromium_dump_session_storage.py +92 -0
- tools_and_utilities/benchmark.py +35 -0
- tools_and_utilities/ccl_chrome_audit.py +651 -0
- tools_and_utilities/dump_indexeddb_details.py +59 -0
- tools_and_utilities/dump_leveldb.py +53 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright 2021, CCL Forensics
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
import sys
|
|
23
|
+
import pathlib
|
|
24
|
+
import datetime
|
|
25
|
+
import sqlite3
|
|
26
|
+
from ccl_chromium_reader import ccl_chromium_localstorage
|
|
27
|
+
|
|
28
|
+
__version__ = "0.1"
|
|
29
|
+
__description__ = "Dumps a Chromium localstorage leveldb to sqlite for review"
|
|
30
|
+
__contact__ = "Alex Caithness"
|
|
31
|
+
|
|
32
|
+
DB_SCHEMA = """
|
|
33
|
+
CREATE TABLE storage_keys ("_id" INTEGER PRIMARY KEY AUTOINCREMENT, "storage_key" TEXT);
|
|
34
|
+
CREATE TABLE batches ("start_ldbseq" INTEGER PRIMARY KEY,
|
|
35
|
+
"end_ldbseq" INTEGER,
|
|
36
|
+
"storage_key" INTEGER,
|
|
37
|
+
"timestamp" INTEGER);
|
|
38
|
+
CREATE TABLE records ("_id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
39
|
+
"storage_key" INTEGER,
|
|
40
|
+
"key" TEXT,
|
|
41
|
+
"value" TEXT,
|
|
42
|
+
"batch" INTEGER,
|
|
43
|
+
"ldbseq" INTEGER);
|
|
44
|
+
CREATE INDEX "storage_keys_storage_key" ON "storage_keys" ("storage_key");
|
|
45
|
+
|
|
46
|
+
CREATE VIEW "records_view" AS
|
|
47
|
+
SELECT
|
|
48
|
+
storage_keys.storage_key AS "storage_key",
|
|
49
|
+
records."key" AS "key",
|
|
50
|
+
records.value AS "value",
|
|
51
|
+
datetime(batches."timestamp", 'unixepoch') AS "batch_timestamp",
|
|
52
|
+
records.ldbseq AS "ldbseq"
|
|
53
|
+
FROM records
|
|
54
|
+
INNER JOIN storage_keys ON records.storage_key = storage_keys._id
|
|
55
|
+
INNER JOIN batches ON records.batch = batches.start_ldbseq
|
|
56
|
+
ORDER BY records.ldbseq;
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
INSERT_STORAGE_KEY_SQL = """INSERT INTO "storage_keys" ("storage_key") VALUES (?);"""
|
|
60
|
+
INSERT_BATCH_SQL = """INSERT INTO "batches" ("start_ldbseq", "end_ldbseq", "storage_key", "timestamp")
|
|
61
|
+
VALUES (?, ?, ?, ?);"""
|
|
62
|
+
INSERT_RECORD_SQL = """INSERT INTO "records" ("storage_key", "key", "value", "batch", "ldbseq")
|
|
63
|
+
VALUES (?, ?, ?, ?, ?);"""
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def main(args):
|
|
67
|
+
level_db_in_dir = pathlib.Path(args[0])
|
|
68
|
+
db_out_path = pathlib.Path(args[1])
|
|
69
|
+
|
|
70
|
+
if db_out_path.exists():
|
|
71
|
+
raise ValueError("output database already exists")
|
|
72
|
+
|
|
73
|
+
local_storage = ccl_chromium_localstorage.LocalStoreDb(level_db_in_dir)
|
|
74
|
+
out_db = sqlite3.connect(db_out_path)
|
|
75
|
+
out_db.executescript(DB_SCHEMA)
|
|
76
|
+
cur = out_db.cursor()
|
|
77
|
+
|
|
78
|
+
storage_keys_lookup = {}
|
|
79
|
+
for storage_key in local_storage.iter_storage_keys():
|
|
80
|
+
cur.execute(INSERT_STORAGE_KEY_SQL, (storage_key,))
|
|
81
|
+
cur.execute("SELECT last_insert_rowid();")
|
|
82
|
+
storage_key_id = cur.fetchone()[0]
|
|
83
|
+
storage_keys_lookup[storage_key] = storage_key_id
|
|
84
|
+
|
|
85
|
+
for batch in local_storage.iter_batches():
|
|
86
|
+
cur.execute(
|
|
87
|
+
INSERT_BATCH_SQL,
|
|
88
|
+
(batch.start, batch.end, storage_keys_lookup[batch.storage_key],
|
|
89
|
+
batch.timestamp.replace(tzinfo=datetime.timezone.utc).timestamp()))
|
|
90
|
+
|
|
91
|
+
for record in local_storage.iter_all_records():
|
|
92
|
+
batch = local_storage.find_batch(record.leveldb_seq_number)
|
|
93
|
+
batch_id = batch.start if batch is not None else None
|
|
94
|
+
cur.execute(
|
|
95
|
+
INSERT_RECORD_SQL,
|
|
96
|
+
(
|
|
97
|
+
storage_keys_lookup[record.storage_key], record.script_key, record.value,
|
|
98
|
+
batch_id, record.leveldb_seq_number
|
|
99
|
+
)
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
cur.close()
|
|
103
|
+
out_db.commit()
|
|
104
|
+
out_db.close()
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
if __name__ == '__main__':
|
|
108
|
+
if len(sys.argv) != 3:
|
|
109
|
+
print(f"{pathlib.Path(sys.argv[0]).name} <leveldb dir> <out.db>")
|
|
110
|
+
exit(1)
|
|
111
|
+
main(sys.argv[1:])
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright 2021, CCL Forensics
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
import sys
|
|
23
|
+
import pathlib
|
|
24
|
+
import sqlite3
|
|
25
|
+
from ccl_chromium_reader import ccl_chromium_sessionstorage
|
|
26
|
+
|
|
27
|
+
__version__ = "0.1"
|
|
28
|
+
__description__ = "Dumps a Chromium sessionstorage leveldb to sqlite for review"
|
|
29
|
+
__contact__ = "Alex Caithness"
|
|
30
|
+
|
|
31
|
+
DB_SCHEMA = """
|
|
32
|
+
CREATE TABLE "hosts" ("_id" INTEGER PRIMARY KEY AUTOINCREMENT, "host" TEXT);
|
|
33
|
+
CREATE TABLE "guids" ("_id" INTEGER PRIMARY KEY AUTOINCREMENT, "guid" TEXT);
|
|
34
|
+
CREATE TABLE "items" ("_id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
35
|
+
"host" INTEGER,
|
|
36
|
+
"guid" INTEGER,
|
|
37
|
+
"ldbseq" INTEGER,
|
|
38
|
+
"key" TEXT,
|
|
39
|
+
"value" TEXT);
|
|
40
|
+
CREATE INDEX "item_host" ON "items" ("host");
|
|
41
|
+
CREATE INDEX "item_ldbseq" ON "items" ("ldbseq");
|
|
42
|
+
|
|
43
|
+
CREATE VIEW items_view AS
|
|
44
|
+
SELECT "items"."ldbseq",
|
|
45
|
+
"hosts"."host",
|
|
46
|
+
"items"."key",
|
|
47
|
+
"items"."value",
|
|
48
|
+
"guids"."guid"
|
|
49
|
+
FROM "items"
|
|
50
|
+
LEFT JOIN "hosts" ON "items"."host" = "hosts"."_id"
|
|
51
|
+
LEFT JOIN "guids" ON "items"."guid" = "guids"."_id"
|
|
52
|
+
ORDER BY "items"."ldbseq";
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
INSERT_HOST_SQL = """INSERT INTO "hosts" ("host") VALUES (?);"""
|
|
56
|
+
INSERT_ITEM_SQL = """INSERT INTO "items" (host, guid, ldbseq, key, value) VALUES (?, ?, ?, ?, ?);"""
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def main(args):
|
|
60
|
+
level_db_in_dir = pathlib.Path(args[0])
|
|
61
|
+
db_out_path = pathlib.Path(args[1])
|
|
62
|
+
|
|
63
|
+
if db_out_path.exists():
|
|
64
|
+
raise ValueError("output database already exists")
|
|
65
|
+
|
|
66
|
+
session_storage = ccl_chromium_sessionstorage.SessionStoreDb(level_db_in_dir)
|
|
67
|
+
out_db = sqlite3.connect(db_out_path)
|
|
68
|
+
out_db.executescript(DB_SCHEMA)
|
|
69
|
+
cur = out_db.cursor()
|
|
70
|
+
for host in session_storage.iter_hosts():
|
|
71
|
+
cur.execute(INSERT_HOST_SQL, (host,))
|
|
72
|
+
cur.execute("SELECT last_insert_rowid();")
|
|
73
|
+
host_id = cur.fetchone()[0]
|
|
74
|
+
host_kvs = session_storage.get_all_for_host(host)
|
|
75
|
+
|
|
76
|
+
for key, values in host_kvs.items():
|
|
77
|
+
for value in values:
|
|
78
|
+
cur.execute(INSERT_ITEM_SQL, (host_id, None, value.leveldb_sequence_number, key, value.value))
|
|
79
|
+
|
|
80
|
+
for key, value in session_storage.iter_orphans():
|
|
81
|
+
cur.execute(INSERT_ITEM_SQL, (None, None, value.leveldb_sequence_number, key, value.value))
|
|
82
|
+
|
|
83
|
+
cur.close()
|
|
84
|
+
out_db.commit()
|
|
85
|
+
out_db.close()
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if __name__ == '__main__':
|
|
89
|
+
if len(sys.argv) != 3:
|
|
90
|
+
print(f"{pathlib.Path(sys.argv[0]).name} <leveldb dir> <out.db>")
|
|
91
|
+
exit(1)
|
|
92
|
+
main(sys.argv[1:])
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import pathlib
|
|
3
|
+
from ccl_chromium_reader import ccl_chromium_indexeddb
|
|
4
|
+
import time
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def main(args):
|
|
8
|
+
start = time.time()
|
|
9
|
+
ldb_path = pathlib.Path(args[0])
|
|
10
|
+
wrapper = ccl_chromium_indexeddb.WrappedIndexDB(ldb_path)
|
|
11
|
+
|
|
12
|
+
for db_info in wrapper.database_ids:
|
|
13
|
+
db = wrapper[db_info.dbid_no]
|
|
14
|
+
print("------Database------")
|
|
15
|
+
print(f"db_number={db.db_number}; name={db.name}; origin={db.origin}")
|
|
16
|
+
print()
|
|
17
|
+
print("\t---Object Stores---")
|
|
18
|
+
for obj_store_name in db.object_store_names:
|
|
19
|
+
obj_store = db[obj_store_name]
|
|
20
|
+
print(f"\tobject_store_id={obj_store.object_store_id}; name={obj_store.name}")
|
|
21
|
+
try:
|
|
22
|
+
one_record = next(obj_store.iterate_records())
|
|
23
|
+
except StopIteration:
|
|
24
|
+
one_record = None
|
|
25
|
+
print()
|
|
26
|
+
end = time.time()
|
|
27
|
+
print("Elapsed time: {} seconds.".format(int(end-start)))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if __name__ == '__main__':
|
|
31
|
+
if len(sys.argv) < 2:
|
|
32
|
+
print(f"USAGE: {pathlib.Path(sys.argv[0]).name} <ldb dir path>")
|
|
33
|
+
exit(1)
|
|
34
|
+
|
|
35
|
+
main(sys.argv[1:])
|