Skies of Arcadia World Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

mIRC script title sniffer

 
Post new topic   Reply to topic    Skies of Arcadia World Forum Index -> General Discussion
View previous topic View next topic
Author Message
Spazz
S T E E L


Joined: 24 Mar 2005
Posts: 1265
Location: Chucktown, SC

PostPosted: Tue Nov 18, 2008 4:50 pm    Post subject: mIRC script title sniffer Reply with quote

It's been a while since I've done any real mIRC scripting, so I'm pretty rusty. Still, I figure I'd post this here for anyone interested.

Code:
on *:text:*http*:#: {
  %sniff.sentence = $1-
  %sniff.chan = #
  sniffloop
}
alias sniffloop {
  while ($regex(%sniff.sentence,http)) {
    %sniff.target = $iif($chr(32) isin %sniff.sentence,$left(%sniff.sentence,$pos(%sniff.sentence,$chr(32),1)),%sniff.sentence)
    %sniff.sentence = $right(%sniff.sentence,$calc($len(%sniff.sentence) - $len(%sniff.target) - 1))
    if ($regex(%sniff.target,http)) {
      sniffer %sniff.target
      return
    }
  }
}
alias sniffer {
  if ($sock(sniffer)) {
    sockclose sniffer
  }
  if ($right($1-,4) == .jpg) || ($right($1-,4) == .gif) || ($right($1-,4) == .png) {
    sniffloop
    return
  }
  %sniff.host = $iif($count($1,/) > 2,$remove($left($1,$pos($1,/,3)),http:,/),$remove($1,http:,/))
  %sniff.url = $iif($count($1,/) > 2,$right($1,$calc($len($1) - $pos($1,/,3) + 1)),/)
  sockopen sniffer %sniff.host 80
}
on *:sockopen:sniffer: {
  sockwrite -nt $sockname GET %sniff.url HTTP/1.1
  sockwrite -nt $sockname Host: %sniff.host
  sockwrite -n $sockname Referer: %sniff.host
  sockwrite -nt $sockname $crlf
}
on 1:sockread:sniffer:{
  if ($sockerr) {
    return
  }
  sockread %sniff.temp
  while ($sockbr) {
    if ($regex(%sniff.temp,<title>)) {
      echo %sniff.chan ***  $mid(%sniff.temp, $calc($pos(%sniff.temp,<title>,1) + 7) , $calc( $pos(%sniff.temp,</title>,1) - $pos(%sniff.temp,<title>,1) - 7) ) 
      sockclose sniffer
      sniffloop
      return
    }
    sockread %sniff.temp
  }
}



This script listens for any URL posted in chat, then displays the title of the document in an echo to you. It's able to discern multiple urls and figures them out sequentially.

Feel free to leave any comments.
_________________


Last edited by Spazz on Sun Nov 23, 2008 10:17 pm; edited 1 time in total
Back to top
View user's profile Send private message
ftr



Joined: 30 Mar 2005
Posts: 597

PostPosted: Sun Nov 23, 2008 12:57 pm    Post subject: Reply with quote

Interesting idea. Does this only work in mIRC?
Back to top
View user's profile Send private message
Spazz
S T E E L


Joined: 24 Mar 2005
Posts: 1265
Location: Chucktown, SC

PostPosted: Sun Nov 23, 2008 10:13 pm    Post subject: Reply with quote

Yes.
_________________
Back to top
View user's profile Send private message
ftr



Joined: 30 Mar 2005
Posts: 597

PostPosted: Mon Nov 24, 2008 4:31 pm    Post subject: Reply with quote

Well, shit. lol. I use Xchat2...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Skies of Arcadia World Forum Index -> General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group