TORLOOKUP(1)

NAME
torlookup - tor exit node lookup for IP addresses

SYNOPSIS
torlookup [-H torDBfile] iplist
torlookup -d directory -w torDBfile

DESCRIPTION
torlookup is a tool to lookup tor exit node information and their valid time intervals. You need to create the nfdump specific lookup database first, before using torlookup.

torlookup is also used to create the nfdump formatted lookup database file from a bunch of tor archive files. There is no account required to download and build the nfdump tor database. See the section below for the building instructions.

torlookup accepts a list of IP addresses either on the command line, separated by spaces or on stdin line by line. The IP address on each line can be embedded in a string separated be spaces on the left and right, therefore it can read the piped output from other tools.

The options are as follows:

-d directory
    Use the tor archive files in directory to build the binary lookup database file. With this argument torlookup creates a new binary lookup database file.

-w torDBfile
    Name of the new lookup database file.

-H torDBfile
    Use the binary torDBfile as lookup database for the tor exit node lookups.

To specify the tor lookup database torlookup searches at the following places:
•   If the default nfdump(1) configuration file exists, it reads the tag tordb.path
•   If the environment variable NFTORDB is set, use this setting as lookup database.
•   The command line argument -H
If multiple locations are given, the environment variable NFTORDB overwrites the nfdump config file and the command line option -H overwrites the environment variable NFTORDB.

RETURN VALUES
torlookup returns 0 on success and 255 otherwise.

ENVIRONMENT
torlookup reads the environment variable NFTORDB

EXAMPLES
The easiest way for creating or updating the binary lookup database is the use of the script updateTorDB.sh provided with all other nfdump files. The script takes a single integer argument. The integer argument specifies for how many months back, you want to have the information available in the torDB. This means you need to update the torDB and a regular basis, to have up to date information. Do not forget to move the lookup database to the final location.

Lookup an IP with torlookup:

    % ./torlookup -H tordb_full.nf 178.218.144.18
    Node: 178.218.144.18, last published: 2024-07-31 11:53:12, intervals: 7
    0 first: 2022-10-25 20:16:03, last: 2022-11-21 20:55:32
    1 first: 2022-12-19 23:16:38, last: 2022-12-28 18:17:01
    2 first: 2023-01-08 02:04:07, last: 2023-03-25 07:13:15
    3 first: 2023-03-29 05:08:45, last: 2023-09-12 17:05:01
    4 first: 2023-09-18 13:11:30, last: 2023-12-05 21:19:41
    5 first: 2024-01-05 03:05:32, last: 2024-03-22 21:08:22
    6 first: 2024-04-24 04:47:28, last: 2024-08-01 04:09:14

torlookup returns the number of intervals, the IP was registered as exit node limited by first/last timestamps.

Pipe the output of an nfdump statistic to torlookup for tor exit node verification:
    % nfdump -r nfcapd.202408011200 -s ip | torlookup -H tordb_full.nf

IMPLEMENTATION NOTES
If you use the tordb with nfdump to list flows and mark them as tor exit nodes, the IP address as well as the flow start or flow end timestamp must fall into the approrpiate tor exit node interval. In the pipe example above, torlookup does not care about timestamps.

Use nfdump with the tordb:
    % nfdump -H tordb.nf -r nfcapd.2024081200 -o tor

SEE ALSO
nfdump has already builtin lookup options to decorate the text output with tor information. See tags %stor, %dtor

nfdump(1)