mIRC Home    About    Download    Register    News    Help

Print Thread
#267368 18/06/20 04:06 AM
Joined: Jun 2020
Posts: 7
R
red_x Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2020
Posts: 7
Greetings dear members!
I have a script that autodownload torrent-files from torrent-tracker. The tracker has announce channel, all new torrents are published there. The tracker moved to https recently, instead of http. After that torrent-files are downloaded with such containment:
Code
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.18.0</center>
</body>
</html>

Could anyone give me some instructions how to update this script to https-version?
The listing is below
alias -l tt.loadconf {
; These are the categories you want
%tt.wanted = Singles - House, Singles - Techno
; And anything in the name you don't
%tt.unwanted = UKHx, TALiON, DWM, FMT, FLAC, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, WAV, LOSSLESS
; Get everything from an uploader
%tt.seeder =

; Directory to save .torrents
%tt.dir = C:\AA-uTorrent\Store\TT\
; Your TT passkey
%tt.passkey =
}

on *:TEXT:*:#TranceTraffic:{
if (($network == P2P-NET) && ($nick == TranceTraffic)) {
if ($1 == Name....:) { %tt.name = $2- }
if ($1 == Uploader:) { %tt.uploader = $2- }
if ($1 == Category:) { %tt.category = $2- }
if ($1 == URL.....:) {
%tt.url = $2-
tt.loadconf
if ((($tt.isin(%tt.wanted,%tt.category)) && (!$tt.isin(%tt.unwanted,%tt.name))) || ($tt.isin(%tt.seeder,%tt.uploader))) {
if ($regex(%tt.url,id=(\d+))) { %tt.id = $regml(1) }
%tt.file = $replace(%tt.name,$chr(32),_) $+ .torrent
sockopen tt www.trancetraffic.com 80
}
else { unset %tt.* }
}
}
}
alias -l tt.isin {
if ($2 isin $1) { return $true }
var %i = 1
while (%i <= $numtok($1,44)) {
if (($gettok($1,%i,44) isin $2) || ($gettok($1,%i,44) iswm $2)) { return $true }
inc %i
}
return $false
}

on *:sockopen:tt:{
if ($sockerr) { return }
sockwrite -n $sockname GET $+(/download.php/,%tt.id,/,%tt.file,?passkey=,%tt.passkey) HTTP/1.1
sockwrite -n $sockname Host: $+($sock($sockname).addr,:,$sock($sockname).port)
sockwrite -n $sockname Connection: Close
sockwrite -n $sockname $crlf
}
on *:sockread:tt:{
if ($sockerr) { return }
if (!$sock($sockname).mark) {
var %sockhead
sockread %sockhead
if (%sockhead == $null) { sockmark $sockname 1 }
}
else {
sockread &torrent
while ($sockbr != 0) {
bwrite $qt(%tt.dir $+ %tt.file) -1 -1 &torrent
sockread &torrent
}
}
}
on *:sockclose:tt:{
run $qt(%tt.dir $+ %tt.file)
unset %tt.*
}

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Change to this
Code
sockopen -e tt www.trancetraffic.com 443

Joined: Jun 2020
Posts: 7
R
red_x Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2020
Posts: 7
Thanks for the answer, changed this line and waiting to test!
One more question - do I have to do something with line listed below?
Code
sockwrite -n $sockname GET $+(/download.php/,%tt.id,/,%tt.file,?passkey=,%tt.passkey) HTTP/1.1

HTTP/1.1 is confusing me (now it's kind of https?)

Last edited by red_x; 18/06/20 07:05 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
HTTP is still correct there. HTTP/1.0 might be safer in general if you're not going to support chunked encoding. But if you don't have any problems, I wouldn't touch it.

Joined: Jun 2020
Posts: 7
R
red_x Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2020
Posts: 7
mIRC gives these messages on all of the recent torrents
Code
* /run: unable to open file 'C:\AA-uTorrent\Store\TT\Blister_13.0-Sequential_Love-(PTP113)-WEB-2020-AOV.torrent' (line 65, TT-IRC-autoDL.txt)

And I can't find the torrent-files in that directory (C:\AA-uTorrent\Store\TT\)
mIRC doesn't download them?
I'm running W10 with ESET Smart Security (mirc is added to firewall exceptions)

Line 65 is
Code
run $qt(%tt.dir $+ %tt.file)

Last edited by red_x; 19/06/20 03:00 AM.
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
instead of silently returning when there's a sock error, perhaps you could include a debug message to status window. something like:

if ($sockerr) { echo -a $sockerr in $nopath($script) line $scriptline : event: $event sockname: $sockname sockerr: $sockerr | return }

Joined: Jun 2020
Posts: 7
R
red_x Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2020
Posts: 7
Thanks, I'll do it and will be back with the results!

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
also see https://en.wikichip.org/wiki/mirc/identifiers/$sockerr for more detail on the errors

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
If the certificate is invalid mIRC will deny/allow/prompt action based on the setting here: Options > Connect > Options > SSL > Server Certificates

You may be able to change this to 'Prompt' to store the cert key then return back to the 'Skip' option if that's what you had selected. If it was already set to prompt, you need to hit the button at the time the connection is made.

Joined: Jun 2020
Posts: 7
R
red_x Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2020
Posts: 7
[img]https://ibb.co/VTVFHnG[/img]

That is my window with SSL preferences - SSL-button is unactive for some reason

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
What version of mIRC are you running, something 10+ years old? 6.17? 14 years old? Sorry, can't help you. That version's vulnerable to remote code exploits btw.

Last edited by Loki12583; 19/06/20 05:02 PM.
Joined: Jun 2020
Posts: 7
R
red_x Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2020
Posts: 7
Thanks for the help to all involved people, mirc update + port change fixed the situation!
If I can ask the last question as a part of this topic, could you tell me - is there any way to open downloaded torrent-file with certain program, for example, installed exactly in this folder: C:\Apps\uTorrent\utorrent.exe
I'm running two utorrents at the same time, so both them are associated with this file type. In windows in "Default application for file type" I set one program (C:\Apps\uTorrent\utorrent.exe) to deal with *.torrent-files, but these files is loading to that utorrent, which window activated last.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
It depends how you do it.

If you do the command: /run versions.txt
it launches whichever program windows itself has associated with *.txt

If *.txt belongs to another program besides notepad, notepad has syntax which allows sending a file directly to it:
/run notepad.exe versions.txt

Whether your other program has command line syntax which allows directing files to it, but that's beyond the scope of this forum, and i assume other places have program-specific details like that

Joined: Jun 2020
Posts: 7
R
red_x Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Jun 2020
Posts: 7
Ok, I'll try to find it out. The main goal of my post has been achieved, so thanks again for the help!


Link Copied to Clipboard