Web Site Advisor

By FordLawnmower on Oct 19, 2010

This Script uses McAfee SiteAdvisor to check posted links for problems. Script was designed for a bot.
Links will Return:

  • Safe = No Problems found.
  • Warning = Security risks have been reported by trusted users.
  • Danger = Suspicious behavior has been reported by trusted users.

Setup:

  • Paste this code in a new remote and save with a unique file name.
  • Type +advisor in each channel you want to run advisor.(Must have Ops)(-advisor to turn it back off)
  • Script will check for links and display results automatically

Screen:
Image

;WebSiteAdvisor by Ford_Lawnmower irc.geekshed.net #Script-Help
alias -l Getadvisor {
  ;;Change %ShowSafe if you do/don't want to see Safe results. 1 = show , 0 = Don't show
  var %ShowSafe 1
  ;;Change %LogToWindow if you do/don't want logging. 1 = on 2 = off
  var %LogToWindow 1
  var %sockname $+(advisor,$network,$r(1,1000),$ticks)
  sockopen %sockname www.siteadvisor.com 80
  sockmark %sockname .msg $1 $+(/sites/,$2) %ShowSafe $iif(%LogToWindow,$3)
}
menu Channel,Status {
  .$iif($group(#advisor) == On,$style(1)) WebSite Advisor
  ..$iif($group(#advisor) == On,$style(2)) On: .enable #advisor
  ..$iif($group(#advisor) == Off,$style(2)) Off: .disable #advisor
}
#advisor On
On *:Quit: if ($regex($1-,/(www\.|http\x3A\x2F\x2F)([^\s]+)/giS)) MassAdvise $address($nick,5) $regsubex(advisor,$str(.,$calc($regml(0) / 2)),/./g,$+($chr(32),$regml($calc(\n * 2)))) 
On *:Part:#: if ($regex($1-,/(www\.|http\x3A\x2F\x2F)([^\s]+)/giS)) Advisor $chan $address($nick,5) $regsubex(advisor,$str(.,$calc($regml(0) / 2)),/./g,$+($chr(32),$regml($calc(\n * 2)))) 
On $*:Text:/^([\+-])advisor$|(www\.|http\x3A\x2F\x2F)([^\s]+)/giS:#: {
  if ($regml(1) isin +-) && ($regex(Opcheck,$nick($chan,$nick).pnick,/(!|~|&|@|%)/)) {
    if ($regml(1) == +) {
      if ($istok(%advisorChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the Website Advisor Script }
      else { 
        .enable #advisor
        Set %advisorChanList $addtok(%advisorChanList,$+($network,$chan),32)
        .msg $chan $nick has activated the Website Advisor Script for $chan .
      }
    }
    else {
      if (!$istok(%advisorChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the Website Advisor Script }
      else { 
        Set %advisorChanList $remtok(%advisorChanList,$+($network,$chan),1,32)
        .msg $chan $nick has deactivated the advisor script for $chan . 
      }
    }
  }
  elseif (!$timer($+(advisor,$network,$nick))) && ($istok(%advisorChanList,$+($network,$chan),32)) {
    .timer $+ $+(advisor,$network,$nick) 1 3 noop
    Advisor $chan $+($address($nick,5),!,$network) $regsubex(advisor,$str(.,$calc($regml(0) / 2)),/./g,$+($chr(32),$regml($calc(\n * 2))))
  }
}
#advisor end
alias -l Advisor {
  var %count 3, %string, %chan $1, %address $2
  while (%count <= $0) {
    var %token $($+($,%count),2)
    %string = $addtok(%string,%token,32)
    inc %count
  }
  tokenize 32 %string
  GetAddressResolution %chan %address $*
}
alias -l MassAdvise {
  advisor $regsubex($str(.,$comchan($nick,0)),/(.)/g,$iif($istok(%advisorChanList,$+($network,$comchan($nick,\n)),32),$+($comchan($nick,\n),$iif(\n != $regml(0),$chr(44))))) $1-
}
alias -l GetAddressResolution {
  var %sockname $+(AddressResolution,$network,$r(1,1000),$ticks)
  sockopen %sockname $gettok($3,1,47) 80
  sockmark %sockname $+(/,$gettok($3,2-,47)) $1 $3 $2
}
On *:sockopen:AddressResolution*: {
  if (!$sockerr) {
    sockwrite -nt $sockname GET $gettok($sock($sockname).mark,1,32) HTTP/1.0
    sockwrite -n $sockname Host: $sock($sockname).addr
    sockwrite -n $sockname User-Agent: Opera 9.6
    sockwrite -n $sockname $crlf
  }
  else { sockclose $sockname | return }
}
On *:sockread:AddressResolution*: {
  if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  else {
    var %AddressResolution | sockread %AddressResolution
    if ($regex(%AddressResolution,/http\/1\.[0-9]\s([0-9]{3})/i)) && ($regml(1) != 301) {
      GetAdvisor $gettok($sock($sockname).mark,2,32) $gettok($gettok($gettok($sock($sockname).mark,3,32),1,47),-2-,46) $gettok($sock($sockname).mark,4,32)
      sockclose $sockname
    }
    elseif ($regex(%AddressResolution,/Location:\s(.*)/i)) {
      GetAdvisor $gettok($sock($sockname).mark,2,32) $gettok($gettok($regml(1),2,47),-2-,46) $gettok($sock($sockname).mark,4,32)
      sockclose $sockname
    }
    elseif (<html isin %AddressResolution)  { 
      GetAdvisor $gettok($sock($sockname).mark,2,32) $gettok($gettok($gettok($sock($sockname).mark,3,32),1,47),-2-,46) $gettok($sock($sockname).mark,4,32)
      sockclose $sockname
    }
  }
}
On *:sockopen:advisor*: {
  if (!$sockerr) {
    sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
    sockwrite -n $sockname Host: $sock($sockname).addr
    sockwrite -n $sockname $crlf
  }
  else { sockclose $sockname | return }
}
On *:sockread:advisor*: {
  if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  else {
    var %advisor | sockread %advisor
    if (class="siteGreen" isin %advisor) && ($gettok($sock($sockname).mark,4,32)) {
      put $gettok($sock($sockname).mark,1-2,32) 00,03Safe No problems found with $nopath($gettok($sock($sockname).mark,3,32)) 00,03Safe
      sockclose $sockname
    }
    elseif (class="siteYellow" isin %advisor) { 
      put $gettok($sock($sockname).mark,1-2,32) 01,08Caution Found potential suspicious behavior on $nopath($gettok($sock($sockname).mark,3,32)) 01,08Caution
      if ($gettok($sock($sockname).mark,5,32)) {
        tokenize 32 $sock($sockname).mark
        if (!$window(@WebSiteAdvisor)) window -an @WebSiteAdvisor
        aline @WebSiteAdvisor $timestamp $2 $gettok($5,3,33) 01,08Caution $+($gettok($5,1,33),$chr(40),$gettok($5,2,33),$chr(41)) Posted a link to $nopath($3) 01,08Caution
      }
      sockclose $sockname
    }
    elseif (class="siteRed" isin %advisor) {
      put $gettok($sock($sockname).mark,1-2,32) 00,04Danger Found potential security risks with $nopath($gettok($sock($sockname).mark,3,32)) 00,04Danger
      if ($gettok($sock($sockname).mark,5,32)) {
        tokenize 32 $sock($sockname).mark
        if (!$window(@WebSiteAdvisor)) window -an @WebSiteAdvisor
        aline @WebSiteAdvisor $timestamp $2 $gettok($5,3,33) 00,04Danger $+($gettok($5,1,33),$chr(40),$gettok($5,2,33),$chr(41)) Posted a link to $nopath($3) 00,04Danger
      }
      sockclose $sockname
    }
    elseif (-- /siteVerdict -- isin %advisor) sockclose $sockname
  }
}
alias -l Put {
  if (!$regex($1,/(\.|^)(msg|notice|echo)$/Si)) || (!$3) { echo -st **Put error** Syntax /Put msg #channel text - or - /Put notice nickname text  | return }
  tokenize 32 $regsubex($1-,/([$\|%\[\]\}\{][^\s]*)/g,$+($chr(2),$chr(2),\t))
  var %tokens $0, %Tstart 3, %Dtimer 1500
  if ($timer($+(Put,$2,$network)).secs) { %Dtimer = $calc($v1 * 1000) }  
  while ($len($($+($,%Tstart,-,%tokens),2)) > 430) {
    dec %tokens
    if ($len($($+($,%Tstart,-,%tokens),2)) <= 430) {
      .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
      inc %Dtimer 1500
      %Tstart = $calc(%tokens + 1)
      %tokens = $0
    }
  }
  .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
  .timer $+ $+(Put,$2,$network) -m 1 $calc(%Dtimer + 1500) noop 
}

Comments

Sign in to comment.
dma   -  Oct 28, 2015

a Bit slow in 2015

 Respond  
^WeSt   -  May 11, 2014

So this addon does NOT working any more , probably the website scan direction has been moved.
Please update this addon is very helpful and good!

  • Thanks!
 Respond  
^WeSt   -  Oct 17, 2013

Very good add-on and working 100% to me, also add ON ACTION and ON NOTICE events :)

  • Thanks!
 Respond  
Fumph   -  Jun 23, 2013

Haven't tried it, but it looks good! Nice idea!

 Respond  
axelwai   -  Oct 02, 2012

Awesome job!

works for -www.google.com- but won't response to -www.google.com.*-, any idea?

 Respond  
FordLawnmower   -  Jul 19, 2011

I still have this script working fine.
What problem are you having Aha2Y ?

 Respond  
Jordyk19   -  Jul 19, 2011

oh wait.. this the script need mc caffee running? i use avg perhaps thats why its not working, nevermind

Think so, It doesn't work here either.

 Respond  
Pangaea   -  Jul 08, 2011

oh wait.. this the script need mc caffee running? i use avg perhaps thats why its not working, nevermind

 Respond  
Pangaea   -  Jul 08, 2011

is this still working?

  • Invalid format: $ (line 46,
    dosent for me
 Respond  
Lenooox   -  May 11, 2011

ill updated to 6.35 :D now its okey works good ^^ Thank you very much for help ;)

 Respond  
Jethro   -  May 11, 2011

Ok I missed the $regsubex(), but it's still alterable using $regsub()

Though I still concur with Ford about the upgrade, as there are security bugs that have been patched. 6.21 is deemed a stable, secure version.

 Respond  
Lenooox   -  May 11, 2011

ok ill updated to 6.21 I got the same error message as a Teen

  • Invalid format: $ (line 46, script3.mrc)
 Respond  
Lenooox   -  May 11, 2011

ahha i understand :P thank you FordLawnmower and Jethro_ ^^

 Respond  
FordLawnmower   -  May 11, 2011

If you fix the noop error, the script will still fail on the $regsubex use, as both noop and $regsubex were added with 6.17. I suggested 6.21 because $regsubex had some bugs in 6.17.
So in addition to changing the noop command, you also have to convert the $regsubex to $regsub or some other solution. You would also have to add a few equal (=) signs where vars are being set and need pre-evaluated.
Should be easier just to upgrade.

 Respond  
Jethro   -  May 11, 2011

Lenooox, you could locate > noop in the script and change it to

.xyzzy

or

.fnord

or

.echo -q

But as Ford recommends, you're encouraged to update your mIRC to the latest version.

 Respond  
FordLawnmower   -  May 11, 2011

@Lenooox You need to update your mIRC to at least 6.21

 Respond  
Lenooox   -  May 11, 2011

NOOP Unknown command

 Respond  
unitedsouls   -  May 06, 2011

^^ ooooo thanks. i didnt see it before O_O

 Respond  
Cheiron   -  May 06, 2011
;WebSiteAdvisor by Ford_Lawnmower irc.geekshed.net #Script-Help
alias -l Getadvisor {
  ;;Change %ShowSafe if you do/don't want to see Safe results. 1 = show , 0 = Don't show
  var %ShowSafe 1

change the var %ShowSafe 1 to 0 and its done

 Respond  
unitedsouls   -  May 06, 2011

Some ideas to make it less spammy:
-Let you make an exception list for safe websites that are posted often on your channel. e.g. youtube.com, imageshack.us

-Make it only display a msg if the website is Caution or Danger

It would be neat if you could make a lite version of this ^^

 Respond  
SoulMuncher   -  Mar 12, 2011

cool one lawn

 Respond  
toclafane   -  Mar 12, 2011

this script works perfectly and i one of ur best good work i tryed it with a site like youtube first and showed up safe then i tryed a site mcafee showed as red when i had mcafee site adviser one and showed up as danger so works perfectly

 Respond  
blackvenomm666   -  Dec 07, 2010

7.15 is kinda buggy ezprezo so no surprise there. downgrage to 7.14 and give em time to perfect 7.15

 Respond  
Ezprezo   -  Dec 07, 2010

Doesn't seem to work on 7.15. Anyone else have experience trying to run it on 7.15?

 Respond  
blackvenomm666   -  Nov 09, 2010

you could script it so that can be turned on and off by the user that way they can choose to have the error show or not.

 Respond  
FordLawnmower   -  Nov 09, 2010

All the feedback I've received an these automated scripts tells me the user would rather have no response than the error Jethro_. This only applies to automated scripts such as this one because they are triggered hundreds of times a day. I plan to post an update for this that will use use hinc and post a single error if there are X amount of errors in a given time frame but for now I've removed the initial error trap.
I will get to this a.s.a.p. but I am currently working on a .dll that is very much needed for some of my scripts to work in mIRC 7.
This script works fine , the advisor site has just been having a lot of trouble keeping up with the traffic.

 Respond  
Jethro   -  Nov 09, 2010

If the error check is removed, and the site happens to be down or too busy, how are you supposed to know if the script still functions? It will be unresponsive.

 Respond  
FordLawnmower   -  Nov 09, 2010

@Cheiron That error is actually caused when the socket never connects to the site. This is caused by the site being too busy or down. There is never anything in .wserr or .wsmsg in this case. I've removed it for now. Let me know if you still get an error.

 Respond  
Cheiron   -  Nov 09, 2010

i'm getting an awful lot of socket errors being returned on the bot for some reason for this script. no error codes. just large quantities of..

[03:32] Socket Error website advisor script by ford
[03:32] Socket Error website advisor script by ford
[03:40] Socket Error website advisor script by ford

 Respond  
bourneident   -  Nov 09, 2010
  • /echo: insufficient parameters (line 20
    any idea?
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.