I will describe the analysis that I wish to do and how I hope to do it and then maybe a suggested feature will arise from any forum discussion that follows. It all hinges on the following question...
Q1. Where can I find a log file for the "Blocked IPs" tab?
I know that (on windows) a logfile (and a 16-deep backup archive) can be found at
%userprofile%\AppData\Local\qBittorrent\logs
however, that logfile is for the "Execution Log" -> "General" tab only.
The analysis I am interested in...
If I can parse the list of blocked IPs with something like gawk then I imagine building an associative array indexed by IP address that would yield a frequency distribution histogram or, perhaps more simply, a two column list that may then be sorted by frequency of block occurrence.
If I also parse the qBittorrent.ini file and specifically the list of user-banned IPs at
Code: Select all
[Preferences]
IPFilter\BannedIPs=
Slightly more adventurous (or even pie in the sky dreaming!) ... if I also parse my user-created blocklist.p2p file (your filename may be different as specified at Options -> Connection -> IP Filtering) ; then I could add a bit in that third column that distinguishes an I address blocked due to an address specified via my filter list. These filter lists allow for a range of IP addresses to be specified on one line; so searching for a match is probably not going to be a trivial exercise!
Even more adventurous (and quite possibly useless in the long run but nonetheless of interest while getting comfortable with the various sources of filter lists and ultimately settling upon what filter list sources give me the best piece of mind) would be to parse each source of that user-concatenated blocklist.p2p file to show me which lists are giving me frequent blocks versus only rare blocks.
- To explain this last idea a little more clearly I need to describe for you how I periodically remake my ip filter list and the briefest way (and possibly helpful to forum readers) for me to describe this is to simply post my batch file...
Code: Select all
rem Update IP filter lists for qBittorrent
rem Make a sub-directory and work therein
cd "C:\Users\*USERNAME*\Downloads\00_ipfilter"
rem Backup old list
del blocklst.p2p.old
ren blocklst.p2p blocklst.p2p.old
rem Get the lists
set my_wget="C:\Program Files (x86)\GnuWin32\bin\wget"
%my_wget% http://list.iblocklist.com/?list=bt_bogon -O bog-z
%my_wget% http://list.iblocklist.com/?list=bt_level1 -O l1-z
%my_wget% http://list.iblocklist.com/?list=bt_level2 -O l2-z
%my_wget% http://list.iblocklist.com/?list=bt_level3 -O l3-z
%my_wget% http://list.iblocklist.com/?list=bt_rangetest -O rt-z
%my_wget% http://list.iblocklist.com/?list=bt_spyware -O spy-z
rem %my_wget% http://list.iblocklist.com/?list=bt_spider -O spi-z
%my_wget% http://list.iblocklist.com/?list=bt_ads -O ads-z
%my_wget% http://list.iblocklist.com/?list=bt_templist -O badp-z
%my_wget% http://list.iblocklist.com/?list=bt_hijacked -O hijack-z
%my_wget% http://list.iblocklist.com/?list=bt_dshield -O hack-z
%my_wget% http://list.iblocklist.com/?list=ijfqtofzixtwayqovmxn -O threat-z
%my_wget% http://list.iblocklist.com/?list=srzondksmjuwsvmgdbhi -O ainf-z
%my_wget% http://list.iblocklist.com/?list=lakuncfhfhgiqghqxjzi -O govt-z
%my_wget% http://list.iblocklist.com/?list=chykyvyiwrfszbqynhnd -O usgov-z
%my_wget% http://list.iblocklist.com/?list=xafnpguypyaewkmuugbd -O proxy-z
rem Merge the lists
type bog-z l1-z l2-z l3-z rt-z spy-z ads-z badp-z hijack-z hack-z threat-z ainf-z govt-z usgov-z proxy-z > blocklst.p2p.gz
rem Decompress
"C:\Program Files (x86)\GnuWin32\bin\gzip" -d -f blocklst.p2p.gz
rem Clean individual list files
rem del /f *-z
exit
- I don't necessarily recommend others use this script as is because I suspect that some of the source lists I am currently using are overkill. So use your own discretion (level of paranoia!) if you leverage this script.
- I also invite suggestions of other sources that are as easily accessible via wget.
So the third column of the abovementioned table/associative array might end up as either a single column with bit-wise meaning (per below) or perhaps one column per "source of ban"...
Code: Select all
0 = libtorrent auto-ban
1 = user ban list
2 = user filter list
4 = user source #1
8 = user source #2
16 = user source #3 ... etc.
So there you have it! I doubt the above analysis of blocked IPs is of interest to more than a few percent of qBt users but the key enabling feature that I have so far failed to locate is some method of piping the output found at "Execution Log" -> "Blocked IPs" to a text file.
- For obvious reasons specifying an upper limit file size for such a log output would be appropriate.
- A back up archive similar to that currently used for qbittorrent.log.bak would also be desirable.