Jorman / Scripts

Some script, forked and not to make me crazy!
MIT License
226 stars 28 forks source link

Trackers injected in private torrent despite using only `-a option` #34

Closed soredake closed 2 months ago

soredake commented 2 months ago

Torrent is clearly marked as private: изображение

Using qbittorrent 4.6.5

Jorman commented 2 months ago

Hi, nice to meet you.

I'm not familiar with this screen, however I just tried and no problem here. Can you tel me if you're using the last version? Can you post some extra data to better understand where is the problem?

soredake commented 2 months ago

Can you tel me if you're using the last version?

Yes, I only recently cloned this repo.

I'm not familiar with this screen

It's screen from vuetorrent.

Can you post some extra data to better understand where is the problem?

I've used sudo docker -it radarr sh, then sh /data/AddqBittorrentTrackers.sh

ineednewpajamas commented 2 months ago

Share a screenshot of the trackers tab of the torrent that includes the DHT, LSD, and PeX parts

soredake commented 2 months ago

изображение

ineednewpajamas commented 2 months ago

If the message on DHT is actually as displayed, the script is behaving correctly. It looks for the word "private". You could try the curl command yourself and see what it returns or if it's just the language setting in like vuetorrent.

ineednewpajamas commented 2 months ago

try this from inside the radarr container, make sure to update the variables

# set values
qbt_host="qbittorrent"
qbt_port="8080"
qbt_username=""
qbt_password=""
hash="" # put in the infohash of the torrent

# login cookie
qbt_cookie=$(curl --silent --fail --show-error --header "Referer: ${qbt_host}:${qbt_port}" --cookie-jar - --data "username=${qbt_username}&password=${qbt_password}" ${qbt_host}:${qbt_port}/api/v2/auth/login)

echo "$qbt_cookie" | curl --silent --fail --show-error --cookie - --request GET "${qbt_host}:${qbt_port}/api/v2/torrents/trackers?hash=$hash" | jq --raw-output '.[0] | .msg'
soredake commented 2 months ago

@ineednewpajamas it says "this torrent is private" (in russian)

ineednewpajamas commented 2 months ago

screenshot the output please

soredake commented 2 months ago

изображение

Nothing interesting.

soredake commented 2 months ago

I think the problem is that script expect the answer in english, and in my case that anwser comes in russian language.

ineednewpajamas commented 2 months ago

The language is why. The script looks for the message to contain the word "private" in english, so working as expected. Although it might be a feature request to instead look for the private flag on the torrent itself.

soredake commented 2 months ago

Would be nice if this script can check if torrent is private not relying on language.

soredake commented 2 months ago

IIUC there is a way (in newer versions) to check if torrent is private in language-agnostic way https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)

изображение

Jorman commented 2 months ago

Hi, I think the problem is the sh interpreter, this script is made for bash, not for sh. Try to call it without any interpreter, so it will use the bash one that is specified

As I told you, I need to have more information to understand if there is and where is the problem, because this is too little, unfortunately I can't reproduce the problem, I ask you to clone the last script that is on the git, and that I will update shortly to stop the execution via sh, let's see if we find the problem.

Yes, the control is based on the word private, now I check if I can change, at the time when the script was born, it was the only way to know if the torrent was private or not, but as I told you, I will look for more info and see if it is possible to "untie" the language from this context, from memory I had asked the qBittorrent team to include other controls, but I never received a reply

Jorman commented 2 months ago

IIUC there is a way (in newer versions) to check if torrent is private in language-agnostic way https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)

изображение

Perfect, I can plan one fix to this!

soredake commented 2 months ago

Hi, I think the problem is the sh interpreter, this script is made for bash, not for sh. Try to call it without any interpreter, so it will use the bash one that is specified

Unfortunately, it's not helping, the problem is in language check, script expects word private, and in my case the response in russian so it thinks torrent is not private.

Jorman commented 2 months ago

@soredake I made a pull request for this, try and let me know if resolve this problem

Jorman commented 2 months ago

@ineednewpajamas One off-topic question, do you think it is possible to "transpose" the script and make a Python version? I saw you're pretty good with python

ineednewpajamas commented 2 months ago

Is it possible? Yes. I'm not that great with python but fluent enough to write basic scripts and contribute to others. I know there is qbittorrent-api or just using requests with the WebAPI you're already using.

I could take a look as I have time but that might take a while.

soredake commented 2 months ago

@Jorman now it's correctly recognized private torrent with this pr, thanks!

Jorman commented 2 months ago

@Jorman now it's correctly recognized private torrent with this pr, thanks!

Good to know, the new functionality from qBittorrent guy, is also pretty new, just in July they added this!

Jorman commented 2 months ago

Is it possible? Yes. I'm not that great with python but fluent enough to write basic scripts and contribute to others. I know there is qbittorrent-api or just using requests with the WebAPI you're already using.

I could take a look as I have time but that might take a while.

No hurry and no obligation, on the contrary, I thank you immensely if you can look at it, then if you need information about the script just ask, I didn't put comments in every single line, so maybe it may seem "hostile" in some places. I'm asking because I don't know how to do it, python I don't know much about it and still object-oriented programming doesn't get into my head, I have a hard time appreciating its value for these scripts, I mean, it seems to me that simple if else logic is more than enough to handle it, then maybe you'll be able to change my mind, basically I don't see the practical side, except to turn the script into a more "universal" version suitable for all machines, both windows and Linux. I saw that there is a dedicated library, I looked at it just a little bit, maybe I will try to play with it too, although I need an AI assistant to do it, because I know what I want to do but in python I don't know exactly how to do it

How do you see it?

ineednewpajamas commented 2 months ago

@Jorman Feel free to open a generic issue here and we can use it to discuss stuff without cluttering this issue: https://github.com/ineednewpajamas/Jorman_Scripts/issues