pobrn / mktorrent

A simple command line utility to create BitTorrent metainfo files
Other
472 stars 73 forks source link

Add the ability to read the announce URL from a file #20

Open ghost opened 6 years ago

ghost commented 6 years ago

Currently the announce URL only can be specified with a CLI argument. This is bad if the URL contains a passkey as it is standard under private trackers. In a shared environment this is highly insecure because under standard conditions everyone can see the CLI arguments from all running processes, so an attacker or an users who knows what he's doing can harvest passkeys from other users. But if the announce URL is read from a file instead nobody can see what the file contains.

Rudde commented 6 years ago

Great addition. I see it doesn't support multiple announce url's? Maybe an idea to add as some private trackers use up to (as I've seen) three unique announce URL's to prevent dependency on one.

The changes in main.c also seem irrelevant to your pull request. If they are. Please remove them.

Also it would be nice if you took the files size into consideration when you allocate memory and not always allocate the maximum you allow. It is a lightweight torrent creator.

ghost commented 6 years ago

@Rudde I've never heard of a private tracker that allows multiple announce URLs, but if you say that one like that exists then I'll add support for it.

Yeah, I'll use the filesize of the file now that's much better.

OK, I can revert the changes and you're right they have nothing to do with that PR, but it's still much more efficient probably to do it like that. Do you have anything against that? Would you accept it in a separate PR?

Rudde commented 6 years ago

Yes they exist, and it's also nice to keep it consistent with the original features of announce adding.

Super!

Yes, I can do that, but I would have to test it first. Don't really have anything against it.

ghost commented 6 years ago

OK, all done. But I've use newline as a separator in announce files as it is more natural and easier to read in files.

ghost commented 6 years ago

Any update on this?

Rudde commented 6 years ago

Hello, I tested this today, but I can't seem to get multipler announce files on new lines to work, it seems to only honor the first one.

ghost commented 6 years ago

Gotta look into it later.

ghost commented 6 years ago

Hello, I've tested it and it works for me. How are you creating the torrent? And what are you using as announce file? Can you show me both?

Rudde commented 6 years ago

@Hyleus I'm terrible sorry for the late respond, I have overseen the e-mail notification of your latest post.

Content of this: https://gist.github.com/Rudde/b0232e92288e7a3fbe6caf4e91c96786

I had as announce.txt file

use the following to create torrent file

$ ./mktorrent/mktorrent -A announce.txt -p -o from_file_three_announce.torrent file.tar.gz