mIRC Home    About    Download    Register    News    Help

Print Thread
#227395 08/11/10 08:27 PM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
Hello all,

I was wondering, if anyone could help me create just the basics of a socket script that creates an SSL connection to an IRC server.

I am quiet confident with sockets, but not sure where to start with SSL sockets.

I just need enough to simply create an SSL connection to a server, and will work out the rest on my own.

Any help would be greatly appreciated.



Newbie
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Originally Posted By: /help /sockopen
The -e switch creates an SSL connection
smile


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Yeah, I'm pretty "confident" that the answer is in mIRC's help file under sockets. The default port for SSL socket is 443, compared to that of regular port 80:
Code:
sockopen -e $sockname www.YourWebsite.com 443
The rest is quite the same for scripting a non-SSL socket script.

Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
Hi there,

I have tried using the -e switch with no luck.

The socket does not even successfully open. I paste my code below.

Code:
alias test_ssl {
  if ($sock(test_ssl)) sockclose test_ssl
  sockopen -e test_ssl irc.hackthissite.org 7000
  echo 4 -s * /test_ssl: Opening ssl socket...
}
on *:sockopen:test_ssl: { echo 4 -s * /test_ssl: Socket $sockname now open }
on *:sockread:test_ssl: {
  var %tmpdata
  sockread %tmpdata
  tokenize 32 %tmpdata
  echo 4 -s * /test_ssl:  $1-
}


The script just echoes 'opening socket...'

Thanks in advance for any replies


Newbie
Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Quote:
mIRC supports secure server connections via SSL through the use of the OpenSSL libraries. mIRC loads the OpenSSL libraries automatically if they are available. The OpenSSL libraries are not distributed with mIRC, they must be downloaded separately.


//echo -sc info * SSL: $sslready

If $false, click here.


Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Quote:
I have tried using the -e switch with no luck.
The socket does not even successfully open
When the on sockopen triggers, you have to check for $sockerr, which will be different from 0 if an error occured and in this case, you're not connected.
In your case, $sockerr is probably 0 and you're connected.
I'm not sure what you're expecting but after being connected you need to communicate with the server, here it's an irc server so you need to send the appropriate command such as NICK and USER .
Try :

Code:
alias test_ssl {
  if ($sock(test_ssl)) sockclose test_ssl
  sockopen -e test_ssl irc.hackthissite.org 7000
  echo 4 -s * /test_ssl: Opening ssl socket...
}
on *:sockopen:test_ssl:{
if ($sockerr) echo 4 -s * /test_ssl An error occured : $sock(test_ssl).wsmsg
else {
echo 4 -s * /test_ssl: Connected.
sockwrite -n test_ssl NICK :test_ssl 
sockwrite -n test_ssl USER test_ssl test_ssl test_ssl :test_ssl
 }
}
on *:sockread:test_ssl: {
  var %tmpdata
  sockread %tmpdata
  tokenize 32 %tmpdata
  echo 4 -s * /test_ssl: $1-
  ;here is a basic line so you'll respond to PING command with PONG in order to stay connected
if ($1 == PING) sockwrite -n test_ssl PONG $remove($2,:)
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
Thank You for all replies. It turns out my SSL dll files were non-existent.


Newbie

Link Copied to Clipboard