Down for everyone or just me?

By Kirby on Jul 24, 2009

I haven't scripted anything in a while, so I decided to make something simple with some regex, also so that I don't lose my familiarity with mIRC scripting.

This snippet is a website checker. Simply put, it checks to see if the site is "up" or "down".

[size=16]Syntax: /check [/size]

For example:

/check www.hawkee.com

Here's a picture:
Image

Enjoy! :D

alias check {
  if ($sock(sitecheck)) { sockclose sitecheck }
  sockopen sitecheck www.downforeveryoneorjustme.com 80
  sockmark sitecheck $$1
}
on *:sockopen:sitecheck: {
  sockwrite -n $sockname GET $+(/,$sock(sitecheck).mark) HTTP/1.1
  sockwrite -n $sockname Host: www.downforeveryoneorjustme.com
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}
on *:sockread:sitecheck: {
  var %x | sockread %x
  if ($regex(%x,(.+)<a href="(.+)"\sclass="domain">.+<\/a>(.+))) {
    echo -a $regsubex($+($regml(1),,$regml(2),,$regml(3)),/(<[^>]*>)/g,)
  }
}

Comments

Sign in to comment.
dma   -  Feb 05, 2016

I had this script for a while now i lost it in my bot. by mistake ,, but can you tell the command line for the trigger

 Respond  
dma   -  Feb 05, 2016

I had this running ... but now i cant remember the trigger HALP

 Respond  
sagargulati   -  Feb 09, 2015

: It's just you. http://g.co is up.
Comes like: http: & # x 2 F ; & # x 2 F ;g.co
Make url decode???

 Respond  
hxck   -  Mar 29, 2013

Just a suggestion, you can save some bytes by changing the url to www.isup.me
Nice snippet bud :)

 Respond  
MixXeduP   -  Dec 21, 2010

Lovely i searched a long time for this script!

 Respond  
Weapon-X   -  Sep 12, 2009

Fantastic script, Kirby. Tested the trigger version on one of my bots, and now I've got the perfect answer for n00bs who constantly ask "Is the site down?"

 Respond  
fire_wizard1   -  Aug 03, 2009

O_O wtfh its been almost half a year since i've seriously thought about script work. and im like 0_0 i need to get back into it

 Respond  
VinX   -  Jul 30, 2009

@cherion

awesome , thanks man

 Respond  
Spanky   -  Jul 25, 2009

Image

 Respond  
FordLawnmower   -  Jul 25, 2009

This isn't a challenge Grant- . Here we try to make scripts that will work 100% of the time. Everyone knows that short code breaks easily ;/

 Respond  
Grant-   -  Jul 25, 2009

actually, what I'm saying is there are tons of "challenges" people host, and you have to have the least amount of bytes to win. :p

 Respond  
knoeki   -  Jul 25, 2009

less bytes is all i'm saying x.X

yes, because those aproxmiately 10 bytes really save your ass when you have several hundreds of megabytes of RAM/diskspace ;_)

 Respond  
Grant-   -  Jul 24, 2009

less bytes is all i'm saying x.X

 Respond  
Kirby   -  Jul 24, 2009

@Grant-:

Must correct (Grammar nazi mode on)
Code:
if ($sock(sitecheck)) { sockclose sitecheck }

if ($sock(sitecheck)) sockclose sitecheck
That actually slows the script down. ^_^

Using brackets speeds up processing. If an alias uses too few brackets then the statement might be ambiguous and the alias will take longer to parse, might be parsed incorrectly, or might not be parsed at all.
In retrospect, what I'm saying is true.

@Cheiron:

oh crap i know what i did forget to ask .. for the bot version .. how do i restrict it to ops only to use it and if a non op tried to use it.. it will message the user they need ops to use it
Just add:

if ($nick(#,$nick,o)) {
 Respond  
Cheiron   -  Jul 24, 2009

awesome Kirby :)
that does me perfect for what i needed. got both personal and the bot one loaded and all looking sweet as .. bumping this to a 8
thankies

oh crap i know what i did forget to ask .. for the bot version .. how do i restrict it to ops only to use it and if a non op tried to use it.. it will message the user they need ops to use it
i tried editing the first line to on @*:text: and it wouldnt work heh

 Respond  
FordLawnmower   -  Jul 24, 2009

I've been looking at this screen for several moments trying to figure out what the hell you're talking about Grant-. So I'll just ask ;/
What??

 Respond  
Grant-   -  Jul 24, 2009

Must correct (Grammar nazi mode on)

  if ($sock(sitecheck)) { sockclose sitecheck }

  if ($sock(sitecheck)) sockclose sitecheck
 Respond  
Kirby   -  Jul 24, 2009

Something like this Cheiron?

on $*:text:/^[.!@]check*/Si:#: {
  if ($sock(check)) { sockclose check }
  sockopen check www.downforeveryoneorjustme.com 80
  sockmark check $$2 # $nick
}
on *:sockopen:check: {
  sockwrite -n $sockname GET $+(/,$gettok($sock(check).mark,1,32)) HTTP/1.1
  sockwrite -n $sockname Host: www.downforeveryoneorjustme.com
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}
on *:sockread:check: {
  var %x | sockread %x
  if ($regex(%x,(.+)<a href="(.+)"\sclass="domain">.+<\/a>(.+))) {
    tokenize 32 $sock(check).mark
    msg $2 $+($3,:) $regsubex($+($regml(1),,$regml(2),,$regml(3)),/(<[^>]*>)/g,)
  }
}

[size=14]Syntax: .check [/size]

Intended for a bot...renamed the sock name...

..and thank you.

I wanted this to be simple, for personal use, rather than bot use. Otherwise, use the code above.

 Respond  
Cheiron   -  Jul 24, 2009

works nicely Kirby. good job. a few ideas for an update for you.. instead of the echo .. possibly get it to msg channel or notice the nick .. other than that .. turn it to a bot use. running off of a trigger for users :)

as it is .. i like it.. it gets a like and 6. will up that if any of the updates are done

 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.