mIRC Home    About    Download    Register    News    Help

Print Thread
Update http script to https #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.*
}

Re: Update http script to https [Re: red_x] #267369 18/06/20 02:02 PM
Joined: Jan 2004
Posts: 1,286
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,286
Change to this
Code
sockopen -e tt www.trancetraffic.com 443

Re: Update http script to https [Re: Loki12583] #267370 18/06/20 06:59 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 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.
Re: Update http script to https [Re: red_x] #267371 18/06/20 07:37 PM
Joined: Jan 2004
Posts: 1,286
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,286
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.

Re: Update http script to https [Re: Loki12583] #267372 19/06/20 02:58 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
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.
Re: Update http script to https [Re: red_x] #267373 19/06/20 05:15 AM
Joined: Jan 2004
Posts: 1,329
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,329
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 }

Re: Update http script to https [Re: maroon] #267374 19/06/20 08:19 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
Thanks, I'll do it and will be back with the results!

Re: Update http script to https [Re: red_x] #267375 19/06/20 02:16 PM
Joined: Jan 2004
Posts: 1,329
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,329
also see https://en.wikichip.org/wiki/mirc/identifiers/$sockerr for more detail on the errors

Re: Update http script to https [Re: maroon] #267376 19/06/20 02:30 PM
Joined: Jan 2004
Posts: 1,286
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,286
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.

Re: Update http script to https [Re: Loki12583] #267377 19/06/20 03:03 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
[img]https://ibb.co/VTVFHnG[/img]

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

Re: Update http script to https [Re: red_x] #267378 19/06/20 04:53 PM
Joined: Jan 2004
Posts: 1,286
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,286
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.
Re: Update http script to https [Re: Loki12583] #267386 21/06/20 07:40 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.

Re: Update http script to https [Re: red_x] #267387 21/06/20 08:01 PM
Joined: Jan 2004
Posts: 1,329
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,329
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

Re: Update http script to https [Re: maroon] #267390 22/06/20 02:50 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
Ok, I'll try to find it out. The main goal of my post has been achieved, so thanks again for the help!