mIRC Home    About    Download    Register    News    Help

Topic Options
#135996 - 20/11/05 07:35 PM HTTPS?
kamicollo Offline
Ameglian cow

Registered: 20/11/05
Posts: 24
Loc: Lithuania
is it possible to create a https socket wih mirc? Or not only https, just a connection to secure pop3 (gmail) for example?

Top
#135997 - 21/11/05 03:52 PM Re: HTTPS?
Kelder Offline
Hoopy frood

Registered: 12/04/03
Posts: 701
Loc: Leuven, Belgium
A https socket is a plain socket connection, the problem is that the protocol is much more difficult since you'd have to implement the entire SSL yourself, on top of the actual HTTP protocol. So, is it possible? Theoretically yes. Has anyone actually succeeded in scripting it completely? I really doubt it, I'd be interested in seeing it done though.

My suggestion is using stunnel. You configure stunnel to forward a specific port on your computer to where you want to connect using SSL, and then in mIRC you connect to that port on localhost to have it forwarded to the host and encrypted. Then you should be able to speak unencrypted HTTP to the other side afaik.

Top
#135998 - 21/11/05 08:22 PM Re: HTTPS?
Online Offline
Hoopy frood

Registered: 09/12/02
Posts: 1922
Yes, stunnel worked for me in the past. It is probably the best way to go until mIRC extends SSL support to socket connections.

Top
#135999 - 28/11/05 12:26 AM Re: HTTPS?
FiberOPtics Offline
Hoopy frood

Registered: 05/02/04
Posts: 2019
Loc: Leuven, Belgium
If what you were looking for is a Gmail checker, then you can use this script I've whipped up:

/*

Usage: /checkgmail <email>

Example: /checkgmail johndoe@gmail.com

Requirements: mIRC 6.14 or higher


*/

Code:
 [color:red]  [/color] 
alias checkgmail {
  var %e = echo -ac info * Gmail checker:
  if (!$0) { %e you must specify an email address. | return }
  set %gmail.email $1
  if (!$($+(%,gmail_,$1,_cookie),2)) gmail_getcookie 
  else {
    if (!$window(@gmail)) window -h @gmail
    %e checking for unread emails on account $1...
    sockclose gmail
    sockopen gmail mail.google.com 80
  }
}
 [color:red]  [/color] 
on *:sockopen:gmail:{
  if ($sockerr) return
  var %s = sockwrite -tn gmail
  %s GET /mail/?&amp;ik=&amp;search=inbox&amp;view=tl HTTP/1.1
  %s Host: mail.google.com
  %s Cookie: $($+(%,gmail_,%gmail.email,_cookie),2)
  %s
}
 [color:red]  [/color] 
on *:sockread:gmail:{
  if ($sockerr) return
  var %a
  sockread %a
  while ($sockbr) {
    if (%a != $null) aline @gmail %a
    sockread %a 
  }
}
 [color:red]  [/color] 
on *:sockclose:gmail:{
  filter -wk @gmail parsegmail
  echo -ac info * Gmail checker: $iif(%gmail.total,$ifmatch,no) unread mails found.
  gmail_cleanup
}
 [color:red]  [/color] 
alias -l parsegmail {
  if ($regex(gmail,$1,/&lt;span id=\\"_user_(.+?)\\"&gt;&lt;b&gt;.+?&amp;nbsp;"\54"&lt;b&gt;(.+?)&lt;\/b&gt;"\54"(.+?)&amp;hellip;/)) {
    inc %gmail.total  
    echo -a From: $regml(gmail,1)
    echo -a Subject: $gmail_html($regml(gmail,2))
    echo -a Excerpt: $gmail_html($regml(gmail,3)) $+ ...
    echo -a 
  }
}
 [color:red]  [/color] 
alias -l gmail_html {
  var %result = $1
  while $regex(gm,%result,/(&amp;#(\d+?);)/) {
    %result = $replace(%result,$regml(gm,1),$chr($regml(gm,2)))
  }
  return %result
}
 [color:red]  [/color] 
; Code for retrieving cookie with COM
 [color:red]  [/color] 
alias -l gmail_getcookie {
  var %e =  echo -ac info * Gmail checker:
  set %gmail.pass $input(Enter your gmail password,po)
  if (%gmail.pass == $null) {
    %e you did not fill in the password... aborting.
    gmail_cleanup
    return
  }
  %e retrieving cookie, hold on...
  ie.navigate http://mail.google.com/mail/?logout
  gmail_timer
}
 [color:red]  [/color] 
alias -l gmail_check {
  if (!$timer(gmail_check).reps) gmail_error
  elseif ($ie.status == 4) {
    var %url = $ie.url
    if (!%gmail.login) {
      if (*ServiceLogin* iswm %url) { inc %gmail.login | gmail_login }
    }
    else {
      if (http://mail.google.com/mail/* iswm %url) {
        set $+(%,gmail_,%gmail.email,_cookie) $ie.cookie
        .timergmail_check off
        checkgmail %gmail.email
      }
      elseif (%url == https://www.google.com/accounts/ServiceLoginAuth) {
        echo -ac info * Gmail checker: you've supplied the wrong email/pass, try again.
        gmail_cleanup    
      }
    }
  }
}
 [color:red]  [/color] 
alias -l gmail_login {
  var %t
  %t = $com(ie.main,document,2,dispatch* ie.doc)
  .comclose ie.doc $com(ie.doc,getelementbyid,1,bstr*,gaia_loginform,dispatch* ie.form)
  if (!$com(ie.form)) { gmail_error | return }
  %t = $com(ie.form,email,2,dispatch* ie.form.email)
  .comclose ie.form.email $com(ie.form.email,value,4,bstr*,%gmail.email)
  %t = $com(ie.form,passwd,2,dispatch* ie.form.passwd)
  .comclose ie.form.passwd $com(ie.form.passwd,value,4,bstr*,%gmail.pass)
  %t = $com(ie.form,submit,1)
  .comclose ie.form
  gmail_timer
}
 [color:red]  [/color] 
alias -l gmail_error {
  echo -ac info * Gmail checker: unable to retrieve cookie, try again later.
  gmail_cleanup
}
 [color:red]  [/color] 
alias -l gmail_cleanup {
  .timergmail_check off
  if ($com(ie.main)) .comclose ie.main $com(ie.main,quit,1)
  if ($window(@gmail)) close -@ @gmail
  unset %gmail.*
}
 [color:red]  [/color] 
alias -l gmail_timer .timergmail_check -m 50 150 gmail_check
 [color:red]  [/color] 
alias -l ie.navigate {
  if (!$com(ie.main)) .comopen ie.main internetexplorer.application
  showmirc -s
  return $com(ie.main,navigate,1,bstr*,$1)
}
 [color:red]  [/color] 
alias -l ie.status {
  if ($com(ie.main)) return $(,,$com(ie.main,readystate,2)) $com(ie.main).result
}
 [color:red]  [/color] 
alias -l ie.url {
  if ($com(ie.main)) return $(,,$com(ie.main,locationurl,2)) $com(ie.main).result
}
 [color:red]  [/color] 
alias -l ie.cookie {
  var %t = $$com(ie.main)
  %t = $com(ie.main,document,2,dispatch* ie.doc)
  if ($com(ie.doc)) {
    %t = $com(ie.doc,cookie,2)
    %t = $com(ie.doc).result
    .comclose ie.doc
  }
  return %t
}
_________________________
Gone.

Top
#136000 - 11/12/05 12:45 PM Re: HTTPS?
FiberOPtics Offline
Hoopy frood

Registered: 05/02/04
Posts: 2019
Loc: Leuven, Belgium
Instead of using the above code, you should use my Gmail Checker here, which has more options, and updated code as Gmail has changed its output slightly, making the above code no longer functional.
_________________________
Gone.

Top