crypttrace 0.34.0__tar.gz → 0.36.0__tar.gz
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.
- {crypttrace-0.34.0 → crypttrace-0.36.0}/PKG-INFO +36 -8
- crypttrace-0.34.0/src/crypttrace.egg-info/PKG-INFO → crypttrace-0.36.0/README.md +32 -41
- {crypttrace-0.34.0 → crypttrace-0.36.0}/pyproject.toml +2 -1
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/__init__.py +1 -1
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/case.py +45 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/cli.py +30 -8
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/evidence.py +111 -0
- crypttrace-0.36.0/src/crypttrace/export.py +201 -0
- crypttrace-0.36.0/src/crypttrace/pdf.py +86 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/web/index.html +55 -6
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/webapp.py +28 -1
- crypttrace-0.34.0/README.md → crypttrace-0.36.0/src/crypttrace.egg-info/PKG-INFO +69 -7
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace.egg-info/SOURCES.txt +1 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace.egg-info/requires.txt +4 -0
- crypttrace-0.34.0/src/crypttrace/export.py +0 -94
- {crypttrace-0.34.0 → crypttrace-0.36.0}/LICENSE +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/setup.cfg +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/addresses.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/analysis.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/assess.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/assets.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/bridges.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/chains.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/config.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/drain.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/fetchers/__init__.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/fetchers/bitcoin.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/fetchers/etherscan.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/fetchers/http.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/fetchers/solana.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/fetchers/ton.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/fetchers/tron.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/freeze.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/funder.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/gascluster.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/investigate.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/labels/__init__.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/labels/audit.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/labels/bulk.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/labels/known.json +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/labels/labels.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/labels/names.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/labels/partial.json +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/labels/tonapi.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/labels/tronscan.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/offramp.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/poisoning.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/prices.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/render.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/report.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/spam.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/store.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/trace.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/verify.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace/watch.py +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace.egg-info/dependency_links.txt +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace.egg-info/entry_points.txt +0 -0
- {crypttrace-0.34.0 → crypttrace-0.36.0}/src/crypttrace.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crypttrace
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.36.0
|
|
4
4
|
Summary: OSINT toolkit for crypto investigations: trace stolen funds across Ethereum, Bitcoin, Tron, Solana and TON
|
|
5
5
|
Author: bobslayerX
|
|
6
6
|
License-Expression: MIT
|
|
@@ -30,6 +30,9 @@ Requires-Dist: rich>=13.0
|
|
|
30
30
|
Requires-Dist: requests>=2.31
|
|
31
31
|
Provides-Extra: web
|
|
32
32
|
Requires-Dist: flask>=3.0; extra == "web"
|
|
33
|
+
Requires-Dist: fpdf2>=2.7; extra == "web"
|
|
34
|
+
Provides-Extra: pdf
|
|
35
|
+
Requires-Dist: fpdf2>=2.7; extra == "pdf"
|
|
33
36
|
Dynamic: license-file
|
|
34
37
|
|
|
35
38
|
# crypttrace
|
|
@@ -67,8 +70,8 @@ USDC blacklisted by Tether and Circle, and the first funding of the wallet —
|
|
|
67
70
|
pipx install "crypttrace[web]" # or: pip install "crypttrace[web]"
|
|
68
71
|
```
|
|
69
72
|
|
|
70
|
-
`[web]` also installs Flask for the web UI
|
|
71
|
-
alone. Python 3.10 or newer. To work on the code instead:
|
|
73
|
+
`[web]` also installs Flask for the web UI and fpdf2 for PDF evidence packs; leave
|
|
74
|
+
it off for the terminal tool alone (`[pdf]` adds only the PDF part). Python 3.10 or newer. To work on the code instead:
|
|
72
75
|
|
|
73
76
|
```bash
|
|
74
77
|
git clone https://github.com/bobslayerX/crypttrace
|
|
@@ -188,8 +191,14 @@ deposit and its memo with the hash of each hop, a precise request to the
|
|
|
188
191
|
exchange (freeze the account behind the memo, preserve KYC, login and
|
|
189
192
|
withdrawal records) and to the police (request them through the exchange's
|
|
190
193
|
law-enforcement channel), and how it was established — so anyone can check it.
|
|
191
|
-
Name, contact and signature are left blank to fill in. Saved as
|
|
192
|
-
PDF
|
|
194
|
+
Name, contact and signature are left blank to fill in. Saved as a printable
|
|
195
|
+
**PDF** (A4, every transaction a clickable link), plus HTML, Markdown and JSON;
|
|
196
|
+
the **Was I drained?** tab has PDF and HTML downloads in both languages.
|
|
197
|
+
|
|
198
|
+
The PDF needs the `pdf` extra (part of `web`): `pip install "crypttrace[pdf]"`.
|
|
199
|
+
It uses a system font with Cyrillic — Arial or Segoe UI on Windows and macOS,
|
|
200
|
+
DejaVu, Liberation or Noto Sans on Linux — or the `.ttf` named by
|
|
201
|
+
`CRYPTTRACE_PDF_FONT`. Without them the pack is still saved, as HTML to print.
|
|
193
202
|
|
|
194
203
|
## Web UI
|
|
195
204
|
|
|
@@ -205,7 +214,8 @@ and whether USDT/USDC at the address is frozen. Tabs add the assessment, the
|
|
|
205
214
|
timeline, the list of who sent funds here, and address poisoning (look-alikes
|
|
206
215
|
planted in the wallet's history, and payments lured by this address). **Case
|
|
207
216
|
file** downloads the same one-page HTML report `crypttrace report` writes;
|
|
208
|
-
**GraphML** and **CSV** download the graph for Gephi
|
|
217
|
+
**Gephi**, **GraphML** and **CSV** download the graph for Gephi (with its
|
|
218
|
+
layout and colours), yEd or Cytoscape, and Maltego. The page's
|
|
209
219
|
address is a link to the investigation
|
|
210
220
|
(`/?address=…&chain=…&direction=…&depth=…&tab=check`), ready to bookmark or
|
|
211
221
|
send. Everything runs on your machine — nothing is uploaded anywhere.
|
|
@@ -270,10 +280,18 @@ crypttrace trace 0xADDRESS --direction in
|
|
|
270
280
|
# Trace a token rather than the native coin (most thefts are stablecoins)
|
|
271
281
|
crypttrace trace 0xADDRESS --asset usdt --depth 4
|
|
272
282
|
|
|
273
|
-
# Save the traced graph
|
|
283
|
+
# Save the traced graph: Gephi (with its layout and colours), yEd / Cytoscape, Maltego / Neo4j
|
|
284
|
+
crypttrace trace 0xADDRESS --depth 4 --export case.gexf
|
|
274
285
|
crypttrace trace 0xADDRESS --depth 4 --export case.graphml
|
|
275
286
|
crypttrace trace 0xADDRESS --depth 4 --export case.csv
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
In Gephi's import dialog untick **Auto-scale** (under *More options*): it
|
|
290
|
+
stretches the positions without the node sizes, and the addresses shrink to
|
|
291
|
+
dots under their own edges. Don't run a layout either — the file already has
|
|
292
|
+
one.
|
|
276
293
|
|
|
294
|
+
```bash
|
|
277
295
|
# Token holdings, valued in USD
|
|
278
296
|
crypttrace tokens 0xADDRESS
|
|
279
297
|
|
|
@@ -358,12 +376,21 @@ crypttrace case add ronin 0x098b…2f96 --chain eth --role suspect --note "explo
|
|
|
358
376
|
crypttrace case note ronin "asked Binance for KYC on the first-gas withdrawal"
|
|
359
377
|
crypttrace case refresh ronin # what moved since the last refresh
|
|
360
378
|
crypttrace case show ronin # addresses, current labels, last snapshot, the log
|
|
379
|
+
crypttrace case common-recipients ronin --chain eth
|
|
361
380
|
```
|
|
362
381
|
|
|
363
382
|
A case is one JSON file in `~/.crypttrace/cases/`. Every `case` command also
|
|
364
383
|
takes a path to a `.json` file, so handing a case to a colleague is sending the
|
|
365
384
|
file.
|
|
366
385
|
|
|
386
|
+
**Common recipients** compares all case addresses on the selected network, regardless of role.
|
|
387
|
+
It reads up to 200 recent native and 200 recent token transfer rows per wallet, subject to
|
|
388
|
+
provider limits. Each match shows the distinct senders, individual amounts and assets, UTC
|
|
389
|
+
times, explorer links and any known recipient label. A shared exchange wallet can receive
|
|
390
|
+
unrelated deposits. On UTXO networks, input shares are estimates and outputs can be change.
|
|
391
|
+
In the web app, open **Common recipients**, choose a saved case and network, and click
|
|
392
|
+
**Find common recipients**.
|
|
393
|
+
|
|
367
394
|
### Watch & alerts — catching the cash-out
|
|
368
395
|
|
|
369
396
|
The only window to freeze stolen funds is the moment they reach an exchange
|
|
@@ -769,7 +796,8 @@ src/crypttrace/
|
|
|
769
796
|
watch.py # watchlist + alerts
|
|
770
797
|
case.py # investigations as files: addresses, roles, notes, snapshots
|
|
771
798
|
report.py # Markdown + JSON reports
|
|
772
|
-
|
|
799
|
+
pdf.py # PDF page setup and font discovery (evidence packs)
|
|
800
|
+
export.py # traced graph as GEXF (Gephi), GraphML (yEd) and edge-list CSV (Maltego)
|
|
773
801
|
prices.py # USD valuation
|
|
774
802
|
render.py # rich terminal rendering
|
|
775
803
|
webapp.py # Flask backend for the web UI
|
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: crypttrace
|
|
3
|
-
Version: 0.34.0
|
|
4
|
-
Summary: OSINT toolkit for crypto investigations: trace stolen funds across Ethereum, Bitcoin, Tron, Solana and TON
|
|
5
|
-
Author: bobslayerX
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/bobslayerX/crypttrace
|
|
8
|
-
Project-URL: Issues, https://github.com/bobslayerX/crypttrace/issues
|
|
9
|
-
Project-URL: Changelog, https://github.com/bobslayerX/crypttrace/blob/main/CHANGELOG.md
|
|
10
|
-
Keywords: osint,blockchain,forensics,cryptocurrency,bitcoin,ethereum,tron,solana,ton,investigation
|
|
11
|
-
Classifier: Development Status :: 4 - Beta
|
|
12
|
-
Classifier: Environment :: Console
|
|
13
|
-
Classifier: Environment :: Web Environment
|
|
14
|
-
Classifier: Intended Audience :: Information Technology
|
|
15
|
-
Classifier: Intended Audience :: Legal Industry
|
|
16
|
-
Classifier: Operating System :: OS Independent
|
|
17
|
-
Classifier: Programming Language :: Python :: 3
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
-
Classifier: Topic :: Security
|
|
24
|
-
Classifier: Topic :: Utilities
|
|
25
|
-
Requires-Python: >=3.10
|
|
26
|
-
Description-Content-Type: text/markdown
|
|
27
|
-
License-File: LICENSE
|
|
28
|
-
Requires-Dist: typer>=0.12
|
|
29
|
-
Requires-Dist: rich>=13.0
|
|
30
|
-
Requires-Dist: requests>=2.31
|
|
31
|
-
Provides-Extra: web
|
|
32
|
-
Requires-Dist: flask>=3.0; extra == "web"
|
|
33
|
-
Dynamic: license-file
|
|
34
|
-
|
|
35
1
|
# crypttrace
|
|
36
2
|
|
|
37
3
|
[](https://github.com/bobslayerX/crypttrace/actions/workflows/selftest.yml)
|
|
@@ -67,8 +33,8 @@ USDC blacklisted by Tether and Circle, and the first funding of the wallet —
|
|
|
67
33
|
pipx install "crypttrace[web]" # or: pip install "crypttrace[web]"
|
|
68
34
|
```
|
|
69
35
|
|
|
70
|
-
`[web]` also installs Flask for the web UI
|
|
71
|
-
alone. Python 3.10 or newer. To work on the code instead:
|
|
36
|
+
`[web]` also installs Flask for the web UI and fpdf2 for PDF evidence packs; leave
|
|
37
|
+
it off for the terminal tool alone (`[pdf]` adds only the PDF part). Python 3.10 or newer. To work on the code instead:
|
|
72
38
|
|
|
73
39
|
```bash
|
|
74
40
|
git clone https://github.com/bobslayerX/crypttrace
|
|
@@ -188,8 +154,14 @@ deposit and its memo with the hash of each hop, a precise request to the
|
|
|
188
154
|
exchange (freeze the account behind the memo, preserve KYC, login and
|
|
189
155
|
withdrawal records) and to the police (request them through the exchange's
|
|
190
156
|
law-enforcement channel), and how it was established — so anyone can check it.
|
|
191
|
-
Name, contact and signature are left blank to fill in. Saved as
|
|
192
|
-
PDF
|
|
157
|
+
Name, contact and signature are left blank to fill in. Saved as a printable
|
|
158
|
+
**PDF** (A4, every transaction a clickable link), plus HTML, Markdown and JSON;
|
|
159
|
+
the **Was I drained?** tab has PDF and HTML downloads in both languages.
|
|
160
|
+
|
|
161
|
+
The PDF needs the `pdf` extra (part of `web`): `pip install "crypttrace[pdf]"`.
|
|
162
|
+
It uses a system font with Cyrillic — Arial or Segoe UI on Windows and macOS,
|
|
163
|
+
DejaVu, Liberation or Noto Sans on Linux — or the `.ttf` named by
|
|
164
|
+
`CRYPTTRACE_PDF_FONT`. Without them the pack is still saved, as HTML to print.
|
|
193
165
|
|
|
194
166
|
## Web UI
|
|
195
167
|
|
|
@@ -205,7 +177,8 @@ and whether USDT/USDC at the address is frozen. Tabs add the assessment, the
|
|
|
205
177
|
timeline, the list of who sent funds here, and address poisoning (look-alikes
|
|
206
178
|
planted in the wallet's history, and payments lured by this address). **Case
|
|
207
179
|
file** downloads the same one-page HTML report `crypttrace report` writes;
|
|
208
|
-
**GraphML** and **CSV** download the graph for Gephi
|
|
180
|
+
**Gephi**, **GraphML** and **CSV** download the graph for Gephi (with its
|
|
181
|
+
layout and colours), yEd or Cytoscape, and Maltego. The page's
|
|
209
182
|
address is a link to the investigation
|
|
210
183
|
(`/?address=…&chain=…&direction=…&depth=…&tab=check`), ready to bookmark or
|
|
211
184
|
send. Everything runs on your machine — nothing is uploaded anywhere.
|
|
@@ -270,10 +243,18 @@ crypttrace trace 0xADDRESS --direction in
|
|
|
270
243
|
# Trace a token rather than the native coin (most thefts are stablecoins)
|
|
271
244
|
crypttrace trace 0xADDRESS --asset usdt --depth 4
|
|
272
245
|
|
|
273
|
-
# Save the traced graph
|
|
246
|
+
# Save the traced graph: Gephi (with its layout and colours), yEd / Cytoscape, Maltego / Neo4j
|
|
247
|
+
crypttrace trace 0xADDRESS --depth 4 --export case.gexf
|
|
274
248
|
crypttrace trace 0xADDRESS --depth 4 --export case.graphml
|
|
275
249
|
crypttrace trace 0xADDRESS --depth 4 --export case.csv
|
|
250
|
+
```
|
|
276
251
|
|
|
252
|
+
In Gephi's import dialog untick **Auto-scale** (under *More options*): it
|
|
253
|
+
stretches the positions without the node sizes, and the addresses shrink to
|
|
254
|
+
dots under their own edges. Don't run a layout either — the file already has
|
|
255
|
+
one.
|
|
256
|
+
|
|
257
|
+
```bash
|
|
277
258
|
# Token holdings, valued in USD
|
|
278
259
|
crypttrace tokens 0xADDRESS
|
|
279
260
|
|
|
@@ -358,12 +339,21 @@ crypttrace case add ronin 0x098b…2f96 --chain eth --role suspect --note "explo
|
|
|
358
339
|
crypttrace case note ronin "asked Binance for KYC on the first-gas withdrawal"
|
|
359
340
|
crypttrace case refresh ronin # what moved since the last refresh
|
|
360
341
|
crypttrace case show ronin # addresses, current labels, last snapshot, the log
|
|
342
|
+
crypttrace case common-recipients ronin --chain eth
|
|
361
343
|
```
|
|
362
344
|
|
|
363
345
|
A case is one JSON file in `~/.crypttrace/cases/`. Every `case` command also
|
|
364
346
|
takes a path to a `.json` file, so handing a case to a colleague is sending the
|
|
365
347
|
file.
|
|
366
348
|
|
|
349
|
+
**Common recipients** compares all case addresses on the selected network, regardless of role.
|
|
350
|
+
It reads up to 200 recent native and 200 recent token transfer rows per wallet, subject to
|
|
351
|
+
provider limits. Each match shows the distinct senders, individual amounts and assets, UTC
|
|
352
|
+
times, explorer links and any known recipient label. A shared exchange wallet can receive
|
|
353
|
+
unrelated deposits. On UTXO networks, input shares are estimates and outputs can be change.
|
|
354
|
+
In the web app, open **Common recipients**, choose a saved case and network, and click
|
|
355
|
+
**Find common recipients**.
|
|
356
|
+
|
|
367
357
|
### Watch & alerts — catching the cash-out
|
|
368
358
|
|
|
369
359
|
The only window to freeze stolen funds is the moment they reach an exchange
|
|
@@ -769,7 +759,8 @@ src/crypttrace/
|
|
|
769
759
|
watch.py # watchlist + alerts
|
|
770
760
|
case.py # investigations as files: addresses, roles, notes, snapshots
|
|
771
761
|
report.py # Markdown + JSON reports
|
|
772
|
-
|
|
762
|
+
pdf.py # PDF page setup and font discovery (evidence packs)
|
|
763
|
+
export.py # traced graph as GEXF (Gephi), GraphML (yEd) and edge-list CSV (Maltego)
|
|
773
764
|
prices.py # USD valuation
|
|
774
765
|
render.py # rich terminal rendering
|
|
775
766
|
webapp.py # Flask backend for the web UI
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""crypttrace — OSINT crypto investigation CLI."""
|
|
2
|
-
__version__ = "0.
|
|
2
|
+
__version__ = "0.36.0"
|
|
@@ -17,9 +17,11 @@ import json
|
|
|
17
17
|
import re
|
|
18
18
|
import time
|
|
19
19
|
from pathlib import Path
|
|
20
|
+
from collections import defaultdict
|
|
20
21
|
from typing import Callable, List, Optional
|
|
21
22
|
|
|
22
23
|
from crypttrace import addresses, chains, config
|
|
24
|
+
from crypttrace.labels import labels
|
|
23
25
|
|
|
24
26
|
CASES_DIR = config.DATA_DIR / "cases"
|
|
25
27
|
ROLES = ("victim", "suspect", "intermediary", "exchange", "mixer", "bridge", "other")
|
|
@@ -136,6 +138,49 @@ def note(name: str, text: str) -> dict:
|
|
|
136
138
|
return entry
|
|
137
139
|
|
|
138
140
|
|
|
141
|
+
def common_recipients(name: str, chain: str, limit: int = 200) -> dict:
|
|
142
|
+
"""Compare recent outgoing transfers from distinct case addresses on one chain."""
|
|
143
|
+
chains.check(chain)
|
|
144
|
+
sources = sorted({chains.norm_addr(a["address"], chain) for a in load(name)["addresses"]
|
|
145
|
+
if a["chain"] == chain})
|
|
146
|
+
if len(sources) < 2:
|
|
147
|
+
raise CaseError(f"The case needs at least two addresses on {chain}.")
|
|
148
|
+
|
|
149
|
+
recipients = defaultdict(lambda: defaultdict(list))
|
|
150
|
+
warnings = []
|
|
151
|
+
if chains.is_utxo(chain):
|
|
152
|
+
warnings.append("UTXO amounts are proportional input shares. Multiple senders can "
|
|
153
|
+
"belong to one transaction, and an output can be change.")
|
|
154
|
+
for source in sources:
|
|
155
|
+
for asset in ([None] if chains.is_utxo(chain) else [None, _ALL_TOKENS]):
|
|
156
|
+
try:
|
|
157
|
+
rows = chains.transfers(source, chain, limit, asset=asset)
|
|
158
|
+
except chains.ChainError as e:
|
|
159
|
+
warnings.append(f"{source} ({'tokens' if asset else 'native'}): {e}")
|
|
160
|
+
continue
|
|
161
|
+
for row in rows[:limit]:
|
|
162
|
+
recipient = chains.norm_addr(row.get("to") or "", chain)
|
|
163
|
+
if (chains.norm_addr(row.get("from") or "", chain) != source or not recipient
|
|
164
|
+
or recipient == source or row["value"] <= 0 or not row.get("hash")):
|
|
165
|
+
continue
|
|
166
|
+
recipients[recipient][source].append({
|
|
167
|
+
**row, "from": source, "url": chains.tx_url(row["hash"], chain)})
|
|
168
|
+
|
|
169
|
+
matches = []
|
|
170
|
+
for recipient, senders in recipients.items():
|
|
171
|
+
if len(senders) < 2:
|
|
172
|
+
continue
|
|
173
|
+
transfers = sorted((row for rows in senders.values() for row in rows),
|
|
174
|
+
key=lambda row: (row["timestamp"], row["from"], row["hash"]))
|
|
175
|
+
tag = labels.lookup(recipient) or {}
|
|
176
|
+
if tag.get("chain") and tag["chain"] != chain:
|
|
177
|
+
tag = {}
|
|
178
|
+
matches.append({"address": recipient, "senders": len(senders), "label": tag.get("name", ""),
|
|
179
|
+
"type": tag.get("type", "unknown"), "transfers": transfers})
|
|
180
|
+
matches.sort(key=lambda match: (-match["senders"], match["address"]))
|
|
181
|
+
return {"matches": matches, "warnings": warnings}
|
|
182
|
+
|
|
183
|
+
|
|
139
184
|
def snapshot(address: str, chain: str) -> dict:
|
|
140
185
|
"""Native balance and the time of the latest transfer, read fresh."""
|
|
141
186
|
snap = {"at": _now(), "balance": None, "last_seen": None, "error": None}
|
|
@@ -208,8 +208,10 @@ def evidence(
|
|
|
208
208
|
console.print(f"[bold]Evidence pack saved[/bold] — exchange deposits: {memos}")
|
|
209
209
|
for p in paths:
|
|
210
210
|
console.print(f" {p}")
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
if doc.get("pdf_note"):
|
|
212
|
+
console.print(f"[yellow]No PDF:[/yellow] {doc['pdf_note']}. Open the .html in a browser and print it to PDF.")
|
|
213
|
+
console.print("[dim]Fill in your name and contact (on paper or in the PDF), then send it with your "
|
|
214
|
+
"report.[/dim]")
|
|
213
215
|
|
|
214
216
|
|
|
215
217
|
@app.command()
|
|
@@ -223,8 +225,8 @@ def trace(
|
|
|
223
225
|
direction: str = typer.Option("out", "--direction", "-D",
|
|
224
226
|
help="'out' = where funds went, 'in' = where they came from"),
|
|
225
227
|
export: Optional[Path] = typer.Option(None, "--export", "-o",
|
|
226
|
-
help="Also save the graph: .
|
|
227
|
-
"or .csv (Maltego, Neo4j, spreadsheets)"),
|
|
228
|
+
help="Also save the graph: .gexf (Gephi), .graphml (yEd, "
|
|
229
|
+
"Cytoscape) or .csv (Maltego, Neo4j, spreadsheets)"),
|
|
228
230
|
):
|
|
229
231
|
"""Trace where funds moved, hop by hop, as a coloured tree (ETH or a token)."""
|
|
230
232
|
try:
|
|
@@ -236,8 +238,8 @@ def trace(
|
|
|
236
238
|
console.print("[red]Error:[/red] --direction must be 'out' or 'in'")
|
|
237
239
|
raise typer.Exit(1)
|
|
238
240
|
fmt = export.suffix.lower().lstrip(".") if export else None
|
|
239
|
-
if export and fmt not in ("graphml", "csv"):
|
|
240
|
-
console.print("[red]Error:[/red] --export takes a .graphml or .csv file name")
|
|
241
|
+
if export and fmt not in ("gexf", "graphml", "csv"):
|
|
242
|
+
console.print("[red]Error:[/red] --export takes a .gexf, .graphml or .csv file name")
|
|
241
243
|
raise typer.Exit(1)
|
|
242
244
|
try:
|
|
243
245
|
tree = trace_mod.build_tree(address, chain, depth, branching, asset_desc, direction)
|
|
@@ -259,8 +261,10 @@ def trace(
|
|
|
259
261
|
export.write_text(export_mod.render(graph, chain, fmt), encoding="utf-8", newline="")
|
|
260
262
|
console.print(f"\n[green]Graph saved:[/green] {export} — {len(graph['nodes'])} addresses, "
|
|
261
263
|
f"{len(graph['edges'])} transfers"
|
|
262
|
-
+
|
|
263
|
-
|
|
264
|
+
+ {"csv": " [dim](Maltego: Import Graph from Table, map from/to to an address entity)[/dim]",
|
|
265
|
+
"gexf": " [dim](Gephi: File → Open, untick Auto-scale under More options; the layout "
|
|
266
|
+
"and colours come with it)[/dim]"}
|
|
267
|
+
.get(fmt, " [dim](yEd, Cytoscape)[/dim]"))
|
|
264
268
|
|
|
265
269
|
|
|
266
270
|
@app.command()
|
|
@@ -1134,6 +1138,24 @@ def case_show(name: str = CASE_ARG):
|
|
|
1134
1138
|
console.print(f" [dim]{render._ts(str(n['at']))}[/dim] {n['text']}")
|
|
1135
1139
|
|
|
1136
1140
|
|
|
1141
|
+
@case_app.command("common-recipients")
|
|
1142
|
+
def case_common_recipients(name: str = CASE_ARG, chain: str = CHAIN_OPT):
|
|
1143
|
+
"""Find direct recipients shared by case wallets (latest 200 native and 200 token rows per wallet)."""
|
|
1144
|
+
from crypttrace import case as case_mod
|
|
1145
|
+
result = _case_call(case_mod.common_recipients, name, chain)
|
|
1146
|
+
for warning in result["warnings"]:
|
|
1147
|
+
console.print(warning, style="yellow", markup=False)
|
|
1148
|
+
if not result["matches"]:
|
|
1149
|
+
console.print("No common recipients in the available transfers.")
|
|
1150
|
+
for match in result["matches"]:
|
|
1151
|
+
console.print(f"{match['address']} {match['label']} ({match['type']})"
|
|
1152
|
+
f" · {match['senders']} senders", style="bold", markup=False)
|
|
1153
|
+
for row in match["transfers"]:
|
|
1154
|
+
when = render._ts(str(row["timestamp"])) + " UTC" if row["timestamp"] else "unknown time"
|
|
1155
|
+
console.print(f" {when} {row['from']} {row['value']} {row['symbol']} "
|
|
1156
|
+
f"{row.get('contract') or ''}\n {row['url']}", markup=False, highlight=False)
|
|
1157
|
+
|
|
1158
|
+
|
|
1137
1159
|
@case_app.command("refresh")
|
|
1138
1160
|
def case_refresh(name: str = CASE_ARG):
|
|
1139
1161
|
"""Read every address again and say what changed since the last refresh."""
|
|
@@ -224,11 +224,122 @@ def render_html(doc: Dict, lang: str = "en") -> str:
|
|
|
224
224
|
return "".join(P)
|
|
225
225
|
|
|
226
226
|
|
|
227
|
+
def render_pdf(doc: Dict, lang: str = "en") -> bytes:
|
|
228
|
+
"""The pack as a printable A4 PDF: the same sections as the HTML, links kept."""
|
|
229
|
+
from crypttrace import pdf as pdf_mod
|
|
230
|
+
t, res, chain = T[lang], doc["check"], doc["chain"]
|
|
231
|
+
p = pdf_mod.document(t["title"]) # PdfError when fpdf2 or a font is missing
|
|
232
|
+
from fpdf.fonts import FontFace
|
|
233
|
+
W = p.epw
|
|
234
|
+
|
|
235
|
+
def body(size=10.5, bold=False):
|
|
236
|
+
p.set_font("body", "B" if bold else "", size)
|
|
237
|
+
|
|
238
|
+
def h2(s):
|
|
239
|
+
p.ln(3)
|
|
240
|
+
body(12.5, True)
|
|
241
|
+
p.multi_cell(W, 7, s, new_x="LMARGIN", new_y="NEXT")
|
|
242
|
+
p.set_draw_color(150)
|
|
243
|
+
p.line(p.l_margin, p.get_y(), p.l_margin + W, p.get_y())
|
|
244
|
+
p.ln(2)
|
|
245
|
+
body()
|
|
246
|
+
|
|
247
|
+
def para(s, bold=False, fill=False):
|
|
248
|
+
body(10.5, bold)
|
|
249
|
+
p.multi_cell(W, 5.4, s, fill=fill, new_x="LMARGIN", new_y="NEXT")
|
|
250
|
+
p.ln(1.5)
|
|
251
|
+
body()
|
|
252
|
+
|
|
253
|
+
def mono(s, link="", size=8):
|
|
254
|
+
p.set_font("Courier", "", size)
|
|
255
|
+
p.multi_cell(W, 4.2, s, link=link, new_x="LMARGIN", new_y="NEXT")
|
|
256
|
+
body()
|
|
257
|
+
|
|
258
|
+
body(16, True)
|
|
259
|
+
p.multi_cell(W, 8, t["title"], new_x="LMARGIN", new_y="NEXT")
|
|
260
|
+
body(8.5)
|
|
261
|
+
p.set_text_color(90)
|
|
262
|
+
p.multi_cell(W, 4.5, f"{doc['tool']} · {doc['generated']}", new_x="LMARGIN", new_y="NEXT")
|
|
263
|
+
p.set_text_color(0)
|
|
264
|
+
body()
|
|
265
|
+
if res["verdict"] == "no_drain":
|
|
266
|
+
p.ln(4)
|
|
267
|
+
para(t["nothing"])
|
|
268
|
+
return bytes(p.output())
|
|
269
|
+
f = _facts(doc, lang)
|
|
270
|
+
|
|
271
|
+
h2(t["victim"])
|
|
272
|
+
for k, v in ((t["name"], ""), (t["contact"], ""), (t["wallet"], f"{res['address']} ({chain.upper()})"),
|
|
273
|
+
(t["discovered"], "")):
|
|
274
|
+
body(10, True)
|
|
275
|
+
p.cell(W * 0.34, 8, k, border=1)
|
|
276
|
+
if v:
|
|
277
|
+
p.set_font("Courier", "", 8)
|
|
278
|
+
p.cell(W * 0.66, 8, v, border=1, new_x="LMARGIN", new_y="NEXT")
|
|
279
|
+
body()
|
|
280
|
+
|
|
281
|
+
h2(t["summary"])
|
|
282
|
+
for s in f["paras"]:
|
|
283
|
+
para(s)
|
|
284
|
+
|
|
285
|
+
h2(t["chronology"])
|
|
286
|
+
hashes = FontFace(family="Courier", size_pt=7)
|
|
287
|
+
body(9)
|
|
288
|
+
with p.table(col_widths=(36, 26, 76), text_align=("LEFT", "RIGHT", "LEFT"), line_height=5,
|
|
289
|
+
headings_style=FontFace(emphasis="BOLD", fill_color=(235, 235, 235))) as tbl:
|
|
290
|
+
head = tbl.row()
|
|
291
|
+
for c in t["cols"]:
|
|
292
|
+
head.cell(c)
|
|
293
|
+
for when, amount, h in f["rows"]:
|
|
294
|
+
row = tbl.row()
|
|
295
|
+
row.cell(when.replace(" UTC", "")) # the column heading says UTC
|
|
296
|
+
row.cell(amount)
|
|
297
|
+
row.cell(h, style=hashes, link=chains.tx_url(h, chain))
|
|
298
|
+
body()
|
|
299
|
+
|
|
300
|
+
h2(t["path"])
|
|
301
|
+
if f["deps"]:
|
|
302
|
+
p.set_fill_color(242, 242, 242)
|
|
303
|
+
for d in f["deps"]:
|
|
304
|
+
para(d["text"], bold=True, fill=True)
|
|
305
|
+
body(8.5)
|
|
306
|
+
p.multi_cell(W, 4.4, d["via"], new_x="LMARGIN", new_y="NEXT")
|
|
307
|
+
p.ln(1)
|
|
308
|
+
for h in d["links"]:
|
|
309
|
+
if h:
|
|
310
|
+
mono(h, link=chains.tx_url(h, chain))
|
|
311
|
+
p.ln(2)
|
|
312
|
+
h2(t["requests"])
|
|
313
|
+
n = 0
|
|
314
|
+
for d in f["deps"]:
|
|
315
|
+
for req in (d["req_exchange"], d["req_police"]):
|
|
316
|
+
n += 1
|
|
317
|
+
para(f"{n}. {req}")
|
|
318
|
+
else:
|
|
319
|
+
para(t["none"])
|
|
320
|
+
|
|
321
|
+
h2(t["method"])
|
|
322
|
+
para(f["method"])
|
|
323
|
+
p.ln(10)
|
|
324
|
+
body(10.5)
|
|
325
|
+
p.cell(0, 6, f"{t['sign']}: ________________________________", new_x="LMARGIN", new_y="NEXT")
|
|
326
|
+
return bytes(p.output())
|
|
327
|
+
|
|
328
|
+
|
|
227
329
|
def write(doc: Dict, out_dir: Path, lang: str = "en") -> List[Path]:
|
|
330
|
+
"""HTML, Markdown, JSON — and PDF when the pdf extra is installed and a font is found."""
|
|
228
331
|
out_dir.mkdir(parents=True, exist_ok=True)
|
|
229
332
|
stem = f"evidence_{doc['chain']}_{doc['check']['address'][:12]}_{lang}"
|
|
230
333
|
paths = [out_dir / f"{stem}.html", out_dir / f"{stem}.md", out_dir / f"{stem}.json"]
|
|
231
334
|
paths[0].write_text(render_html(doc, lang), encoding="utf-8")
|
|
232
335
|
paths[1].write_text(render_markdown(doc, lang), encoding="utf-8")
|
|
233
336
|
paths[2].write_text(json.dumps(doc, ensure_ascii=False, indent=1, default=str), encoding="utf-8")
|
|
337
|
+
from crypttrace import pdf as pdf_mod
|
|
338
|
+
try:
|
|
339
|
+
pdf_bytes = render_pdf(doc, lang)
|
|
340
|
+
except pdf_mod.PdfError as e:
|
|
341
|
+
doc["pdf_note"] = str(e)
|
|
342
|
+
else:
|
|
343
|
+
(out_dir / f"{stem}.pdf").write_bytes(pdf_bytes)
|
|
344
|
+
paths.insert(0, out_dir / f"{stem}.pdf")
|
|
234
345
|
return paths
|