Downloading File
Filename: /tSock (Test-Socket)
; -------------------------------------- ; #### /tSock v1.0 - by Flobse #### ; -------------------------------------- ; ; ##### Description #### ; With this script you can check quickly if something specific is in the sourcecode. ; Ideal for socket scripting if you want to test an regex pattern quickly. ; But you can also use it as global socket for several scripts. ; You can specify an alias where you do your sockread. ; ; ; Have fun ;) ; -------------------------------------- ; ; ##### Syntax ##### ; /tsock <-ari> <URL> <alias | /regex/ | wildcardtext> ; ; You can close an open socket with: /tsock <URL> close ; ; Parameter -a means there is an alias specified which will be called on each line. ; Parameter -r means there is an regex pattern specified and give results into the status window. ; Parameter -i means there is an wildcard text specified, results also in the status window. ; ; -------------------------------------- ; ; ##### Examples ##### ; ; /tsock -r http://www.amazon.com/ /<title>(.+?)</i ; ; /tsock -r http://www.mircscripts.org/screenshots.php /siteMain">([^<>]+?)</td></i ; ; -------------------------------------- ; ## #Flobse @ Quakenet - [email protected] - UIN: 152759920 ## alias tsock { ;/tsock <<-ari> <URL> <aliasname|/pattern/|wildcardtext>|close> linesep -a if ($1 == close) { sockclose tsock | echo -s * TSock - Aborted by user. | return } if ($regex($1-,/-(a|r|i) (?:http://)?(?:www\.)?([^\/]+?)(/[^\s]*)? (.+)$/i)) { sockclose tsock sockopen tsock www. $+ $regml(2) 80 sockmark tsock $ticks $regml(1) $iif($regml(4),$regml(3),/ $regml(3)) $regml(4) } else { echo -sc info2 * /tsock invalid parameters. } } on *:sockopen:tsock: { tokenize 32 $sock($sockname).mark if ($sockerr) { echo -a * TSock Sockerr: $sockerr ( $+ $sock($sockname).addr $+ $3 $+ ) | return } sockwrite -n $sockname GET $3 HTTP/1.1 sockwrite -n $sockname Host: $sock($sockname).addr sockwrite -n $sockname Connection: close sockwrite -n $sockname } on *:sockread:tsock: { var %t | sockread %t | tokenize 32 $sock($sockname).mark if ($2 == a) && (%t) { $4- %t } elseif ($2 == r) && ($regex(%t,$4-)) { echo -sc info2 $regml(0) Regex-Hit $+ $iif($regml(0) != 1,s) in: %t var %x 1 while ($regml(%x)) { echo -sc info $!regml( $+ %x $+ ) == $v1 | inc %x } echo -sc info2 $chr(160) } elseif ($2 == i) && ($4- iswm %t) { echo -sc info2 $chr(160) | echo -sc info $4- isin: %t } } on *:sockclose:tsock: { tokenize 32 $sock($sockname).mark if ($2 != a) { echo -s Done in $calc($ticks - $1) $+ ms. $math($sock($sockname).rcvd) Bytes. } linesep -a }