This Script uses McAfee SiteAdvisor to check posted links for problems. Script was designed for a bot.
Links will Return:
Setup:
Screen:
;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
}
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.
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.