2022-11-07 12:38:22 +01:00
|
|
|
# https://github.com/nusenu/noContactInfo_Exit_Excluder
|
|
|
|
# https://github.com/TheSmashy/TorExitRelayExclude
|
|
|
|
|
|
|
|
This extends nusenu's basic idea of using the stem library to
|
|
|
|
dynamically exclude nodes that are likely to be bad by putting them
|
|
|
|
on the ExcludeNodes or ExcludeExitNodes setting of a running Tor.
|
|
|
|
* https://github.com/nusenu/noContactInfo_Exit_Excluder
|
|
|
|
* https://github.com/TheSmashy/TorExitRelayExclude
|
|
|
|
|
|
|
|
The basic cut is to exclude Exit nodes that do not have a contact.
|
|
|
|
That can be extended to nodes that do not have an email in the contact etc.
|
|
|
|
|
|
|
|
But there's a problem, and your Tor notice.log will tell you about it:
|
|
|
|
you could exclude the nodes needed to access hidden services etc.
|
|
|
|
So we need to add to the process the concept of a whitelist.
|
|
|
|
In addition, we may have our own blacklist of nodes we want to exclude.
|
|
|
|
|
|
|
|
So we make two files that are structured in YAML:
|
|
|
|
```
|
|
|
|
/etc/tor/torrc-goodnodes.yaml
|
|
|
|
Nodes:
|
|
|
|
IntroductionPoints:
|
|
|
|
- $NODEFINGERPRINT
|
|
|
|
...
|
|
|
|
By default all sections of the goodnodes.yaml are used as a whitelist.
|
|
|
|
|
|
|
|
/etc/tor/torrc-badnodes.yaml
|
|
|
|
Nodes:
|
|
|
|
ExcludeExitNodes:
|
|
|
|
BadExit:
|
|
|
|
# $0000000000000000000000000000000000000007
|
|
|
|
```
|
|
|
|
That part requires [PyYAML](https://pyyaml.org/wiki/PyYAML)
|
|
|
|
https://github.com/yaml/pyyaml/
|
|
|
|
|
|
|
|
Right now only the ExcludeExitNodes section is used by we may add ExcludeNodes
|
|
|
|
later, and by default all sub-sections of the badnodes.yaml are used as a
|
|
|
|
ExcludeExitNodes but it can be customized with the lWanted commandline arg.
|
|
|
|
|
|
|
|
The original idea has also been extended to add different conditions for
|
|
|
|
exclusion: the ```--contact``` commandline arg is a comma sep list of conditions:
|
|
|
|
* Empty - no contact info
|
|
|
|
* NoEmail - no @ sign in the contact',
|
|
|
|
More may be added later.
|
|
|
|
|
|
|
|
Because you don't want to exclude the introduction points to any onion
|
|
|
|
you want to connect to, ```--white_onions``` should whitelist the
|
|
|
|
introduction points to a comma sep list of onions, but is
|
|
|
|
currently broken in stem 1.8.0: see:
|
|
|
|
* https://github.com/torproject/stem/issues/96
|
|
|
|
* https://gitlab.torproject.org/legacy/trac/-/issues/25417
|
|
|
|
|
|
|
|
```--bad_output``` will write the torrc configuration to a file.
|
|
|
|
|
|
|
|
```--details_output``` will write the lookup URLs of the excluded nodes to a file
|
|
|
|
|
|
|
|
For usage, do ```python3 exclude_badExits.py --help`
|
2022-11-07 06:35:14 +01:00
|
|
|
|