mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Apr 2003
Posts: 16
C
cap00t Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Apr 2003
Posts: 16
hey,

is there a chance to write a script that will look up some info on a hyperboards forum and paste it in the IRC channel?

it should paste info like latest topic, number of guests and users online, latest member, total members.

i know it´s not easy but would be cool if someone could provide infos or links smile

tya, cap00t

Joined: Mar 2003
Posts: 437
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
i have a similar script, you may copy the basic idea from
http://mtech.ath.cx/zip/Usalertlevel.zip

My Site:

Last edited by MTech; 30/04/03 12:06 AM.
Joined: Apr 2003
Posts: 16
C
cap00t Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Apr 2003
Posts: 16
my AV pops up when extracting the zip:

Backdoor BDS/ZCrew.IRC.5

??

Joined: Mar 2003
Posts: 437
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
oh? hmmm
heres the code:::
i really need to check my files again... sprry dude
PC CILLIN 2002 says there isnt anything wrong...dunno dude...urs must be whacked...
Code:
 
;type /usalert to open!


dialog usalert {
  title "US Alert Level"
  size 580 -19 155 53
  option pixels
  icon 1, 0 -1 154 41,  %hls.jpg, 0
  link "close ", 2, 0 40 36 16
  link "refresh", 3, 115 40 44 16
}
on *:dialog:usalert:sclick:3:/dialog -x usalert usalert | usalert
on *:dialog:usalert:sclick:2:/dialog -x usalert usalert
alias usalert download www.whitehouse.gov /homeland/index.html
alias download {
  var %socket $+(dl,$chr(46),$nopath($2))
  if (!$sock(%socket)) {
    sockopen %socket $1 80
    sockmark %socket HEAD $1 $2
    ;echo $color(info) -s * Beginning download.
  }
  else { echo $color(info) -s * Socket already in use. }
}
alias percent return $+($round($calc((100 / $2) * $1),2),%)
on *:SOCKOPEN:dl.*:{
  if ($sockerr) { echo $color(info) -s * Error: $sock($sockname).wsmsg | return }
  hadd -m ticks $sockname $ticks
  var %file = $nopath($gettok($sock($sockname).mark,3,32)), %fullfile = $+(",$mircdir,%file,"), %sckr = sockwrite -n $sockname, %^ = $gettok($sock($sockname).mark,3,32)
  ;echo $color(info) -s * Creating file and contacting host...
  write -c %fullfile
  %sckr GET $iif(left(%^,1) != $chr(47),$chr(47) $+ %^,%^) HTTP/1.0
  %sckr HOST: $gettok($sock($sockname).mark,2,32)
  %sckr ACCEPT: *.*
  %sckr $crlf
}
on *:SOCKREAD:dl.*:{
  if ($sockerr) {
    echo $color(info) -s * Error: $sock($sockname).wsmsg
    return
  }
  var %a
  :begin
  if ($gettok($sock($sockname).mark,1,32) == head) { sockread %a }
  else { sockread &b }
  if ($sockbr) {
    tokenize 32 $sock($sockname).mark
    if ($1 == HEAD) {
      if (%a) {
        if ($gettok(%a,1,32) == Content-Length:) { var %totsize = $gettok(%a,2,32) }
      }
      else {
        ;echo $color(info) -s * Starting download... (Total size: $bytes(%totsize).suf $+ )
        sockmark $sockname GET $2- %totsize
      }
    }
    elseif ($1 == GET) {
      ; Downloading ...
      var %file = $+(",$mircdir,$nopath($3),"), %cursize = $file(%file).size
      var %totsize = $gettok($sock($sockname).mark,4,32)
      ;echo $color(info) -s * Downloaded ... $bytes(%cursize).suf ( $+ $percent(%cursize,%totsize) $+ )
      bwrite %file -1 &b
    }
    goto begin
  }
}
on *:SOCKCLOSE:dl.*:{
  var %ticks = $calc(($ticks - $hget(ticks,$sockname)) /1000)
  ;echo $color(info) -s * Download of $nopath($gettok($sock($sockname).mark,3,32)) completed in %ticks seconds.
  .timerhls 1 1 .rename index.html hls.txt
  .timerhls2 1 2 usal
}
alias usal {
  if ($read(hls.txt, w,  *severe.jpg*)) { /set %hls.jpg $scriptdirsevere.jpg | dialog -ma usalert usalert }
  elseif ($read(hls.txt, w,  *high.jpg*)) { /set %hls.jpg $scriptdirhigh.jpg | dialog -ma usalert usalert }
  elseif ($read(hls.txt, w,  *elevated.jpg*)) { /set %hls.jpg $scriptdirelevated.jpg | dialog -ma usalert usalert }
  elseif ($read(hls.txt, w,  *guarded.jpg*)) { /set %hls.jpg $scriptdirguarded.jpg | dialog -ma usalert usalert }
  elseif ($read(hls.txt, w,  *low.jpg*)) { /set %hls.jpg $scriptdirlow.jpg | dialog -ma usalert usalert }
  else { /echo nothing found! }
  .remove hls.txt
  .timerusal 1 5 unset %hls.jpg
}
on *:start:/usalert
 

Last edited by MTech; 30/04/03 12:26 AM.
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
The AV might recognize mirc files that include sockets. Most mirc trojans have some form of a socket script in them.


-KingTomato
Joined: Mar 2003
Posts: 437
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
oh... ok then....similar to pc cillin saying dragon zap's registry.dll is a trogan, cuz it edits registrys?

Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
most likely.. Figures it will add to the Run or RunOnce keys in the registry >:D


-KingTomato
Joined: Mar 2003
Posts: 437
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
hmmm... not likely....i wouldnt do that type of stuff...i enjoy scripting too much to be banned from atleast trying to submit it....

Joined: Apr 2003
Posts: 16
C
cap00t Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Apr 2003
Posts: 16
hmm, well i want to have a menue entry on channel rightclick which says FORUM-STATS. when i click it, it should be outputted to the channel like this:

<user01> FORUM-STATS Total Members: 689 Newest Member: user01 Total Topics: 3496 Total Posts: 31302 Online: 3 Guests/14 Users
<user01> Last Updated Topic: today is a good day because...(Today at 7:17pm)

but i dont know how to get the info that is on the site into mirc. if you dont know what i mean go here http://hyperboards.hyperboards.com/ and scroll down, at the bottom where it says info center / forum statistics all the info is provided.

thanks

Joined: Mar 2003
Posts: 437
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
well...i can do the whole script for you...just tell me all you need done...

Joined: Apr 2003
Posts: 16
C
cap00t Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Apr 2003
Posts: 16
wow that is a great offer MTech, thanks a lot.

well, about what i need: i think all is said in my last post. except colors:

FORUM-STATS <- bold, k9
Total Members: <- k14
689 <-k9
Newest Member: <-k14
user01 <-k9
Total Topics: <- k14
3496 <-k9
Total Posts: <-k14
31302 <-k9
Online: <-k14
3 Guests/14 Users <-k9
Last Updated Topic: <-k14
today is a good day because...(Today at 7:17pm) <-k9

----
once again thx 4 your offer, much appreciated. if you need more info i´m here smile

Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I'm trying my best at it also, but every query attempt made is trying to redirect me to the www.hyperboards.com.. I can't seem to get it to return the cgi page.. >:\


-KingTomato
Joined: Mar 2003
Posts: 437
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
god... i suxors more than i though.... this is all the further i can get man...sorry to hype you up...

Code:
 
;type /fstats to use

alias fstats download hyperboards.hyperboards.com /index.cgi
alias download {
  var %socket $+(dl,$chr(46),$nopath($2))
  if (!$sock(%socket)) {
    sockopen %socket $1 80
    sockmark %socket HEAD $1 $2
    ;echo $color(info) -s * Beginning download.
  }
  else { echo $color(info) -s * Socket already in use. }
}
alias percent return $+($round($calc((100 / $2) * $1),2),%)
on *:SOCKOPEN:dl.*:{
  if ($sockerr) { echo $color(info) -s * Error: $sock($sockname).wsmsg | return }
  hadd -m ticks $sockname $ticks
  var %file = $nopath($gettok($sock($sockname).mark,3,32)), %fullfile = $+(",$mircdir,%file,"), %sckr = sockwrite -n $sockname, %^ = $gettok($sock($sockname).mark,3,32)
  ;echo $color(info) -s * Creating file and contacting host...
  write -c %fullfile
  %sckr GET $iif(left(%^,1) != $chr(47),$chr(47) $+ %^,%^) HTTP/1.0
  %sckr HOST: $gettok($sock($sockname).mark,2,32)
  %sckr ACCEPT: *.*
  %sckr $crlf
}
on *:SOCKREAD:dl.*:{
  if ($sockerr) {
    echo $color(info) -s * Error: $sock($sockname).wsmsg
    return
  }
  var %a
  :begin
  if ($gettok($sock($sockname).mark,1,32) == head) { sockread %a }
  else { sockread &amp;b }
  if ($sockbr) {
    tokenize 32 $sock($sockname).mark
    if ($1 == HEAD) {
      if (%a) {
        if ($gettok(%a,1,32) == Content-Length:) { var %totsize = $gettok(%a,2,32) }
      }
      else {
        ;echo $color(info) -s * Starting download... (Total size: $bytes(%totsize).suf $+ )
        sockmark $sockname GET $2- %totsize
      }
    }
    elseif ($1 == GET) {
      ; Downloading ...
      var %file = $+(",$mircdir,$nopath($3),"), %cursize = $file(%file).size
      var %totsize = $gettok($sock($sockname).mark,4,32)
      ;echo $color(info) -s * Downloaded ... $bytes(%cursize).suf ( $+ $percent(%cursize,%totsize) $+ )
      bwrite %file -1 &amp;b
    }
    goto begin
  }
}
on *:SOCKCLOSE:dl.*:{
  var %ticks = $calc(($ticks - $hget(ticks,$sockname)) /1000)
  ;echo $color(info) -s * Download of $nopath($gettok($sock($sockname).mark,3,32)) completed in %ticks seconds.
  .timer 1 1 .rename index.cgi fstats.txt
  .timer 1 2 fstats2
}
alias fstats2 {
  if ($read(fstats.txt, w,  *Total Members:*)) { /set %tm  }
  elseif ($read(fstats.txt, w,  *Newest Member:*)) { /set %nm  }
  elseif ($read(fstats.txt, w,  *Total Topics:*)) { /set %tt  }
  elseif ($read(fstats.txt, w,  *Total Posts:*)) { /set %tp  }
  elseif ($read(fstats.txt, w,  *Online:*)) { /set %om  }
  elseif ($read(fstats.txt, w,  *Last Updated Topic:*)) { /set %lut  }
  else { /echo nothing found! }
  /msg $chan Total Members: %tm $+ , Newest member: %nm $+ , Total; Topics: %tt $+ , Total Posts: %tp $+ , Online: %om $+ .
  /msg $chan Last Updated Topic: %lut $+ .
  .remove fstats.txt
}
menu * {
Forum-Stats:fstats
}
 

Joined: Apr 2003
Posts: 16
C
cap00t Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Apr 2003
Posts: 16
hmm, too bad crazy

thx for your help, maybe someone else can finish it?? smile

Joined: Mar 2003
Posts: 437
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
hope so, ill try to finish, but its not looking too good ( im not good at sockets anyway)

Joined: Apr 2003
Posts: 16
C
cap00t Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Apr 2003
Posts: 16
i found a working code snippet by Andy Dufilie (^Andy) and modified it a bit. it downloads the index.cgi and renames it to fstats.txt.

Code:
alias download {
  if ($sock(socket_example)) {
    echo $colour(info text) @download *** already downloading; please wait.
    return
  }
  ; connect to server
  sockopen socket_example hyperboards.hyperboards.com 80
}
on *:sockopen:socket_example:{
  if ($sockerr) {
    echo $colour(info text) @download *** error $sockerr when downloading
    return
  }
  ; initialize variables/files
  write -c index.cgi
  unset %downloadlength %downloadready
  window -c @download
  ; request file
  sockwrite -n $sockname GET /index.cgi HTTP/1.0
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname Host: hyperboards.hyperboards.com
  sockwrite -n $sockname
}
on *:sockread:socket_example:{
  ; if we're not ready to start writing the file (didn't get header info yet)..
  if (%downloadready != 1) {
    ; begin reading header info
    var %header
    sockread %header
    while ($sockbr) {
      if (Content-length: * iswm %header) {
        ; got the length of the file
        %downloadlength = $gettok(%header,2,32)
        if (* !iswm $window(@download)) window @download
        echo $colour(info text) @download *** file size: %downloadlength bytes
      }
      elseif (* !iswm %header) {
        ; got the header info, ready..
        %downloadready = 1
        ; because we've received some bytes from the header.. we need to offset the progress thingy a bit.
        %downloadoffset = $sock($sockname).rcvd
        ; ready to download, got content length.. so break out of this header loop
        break
      }
      sockread %header
    }
  }
  ; begin binary download
  sockread 4096 &amp;d
  while ($sockbr) {
    if (* !iswm $window(@download)) window @download
    echo $colour(info text) @download *** received: $round( $calc(100 * ($sock($sockname).rcvd - %downloadoffset) / %downloadlength) ,1) $+ %
    ; write the data to the end of the file
    bwrite index.cgi -1 -1 &amp;d
    ; read the next bit
    sockread 4096 &amp;d
  }
}
on *:sockclose:socket_example:{
  echo $colour(info text) @download *** done downloading index.cgi
  ; rename the file.
  .timer 1 1 .rename index.cgi fstats.txt  
}  


i then added this part to see if it works:

Code:
alias fstats2 {
  if ($read(fstats.txt, w,  *Total Members:*)) { /set %tm  }
  elseif ($read(fstats.txt, w,  *Newest Member:*)) { /set %nm  }
  elseif ($read(fstats.txt, w,  *Total Topics:*)) { /set %tt  }
  elseif ($read(fstats.txt, w,  *Total Posts:*)) { /set %tp  }
  elseif ($read(fstats.txt, w,  *Online:*)) { /set %om  }
  elseif ($read(fstats.txt, w,  *Last Updated Topic:*)) { /set %lut  }
  else { /echo nothing found! }
  /msg $chan Total Members: %tm $+ , Newest member: %nm $+ , Total; Topics: %tt $+ , Total Posts: %tp $+ , Online: %om $+ .
  /msg $chan Last Updated Topic: %lut $+ .
  .remove fstats.txt}menu * {Forum-Stats:fstats}
}  


but it doesnt smirk

it outputs like this:

<user01> Total Members: , Newest member: , Total; Topics: , Total Posts: , Online: .
<user01> Last Updated Topic: .

Joined: Mar 2003
Posts: 437
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
if you notice in what yo've added its setting the vars as nothing...i coulndt find out how to get the var's...btw if you DO get this to work can i get a copy of it???

Joined: Mar 2003
Posts: 437
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
for the colors you want try this:
Code:
alias fstats2 {
  if ($read(fstats.txt, w,  *Total Members:*)) { /set %tm  }
  elseif ($read(fstats.txt, w,  *Newest Member:*)) { /set %nm  }
  elseif ($read(fstats.txt, w,  *Total Topics:*)) { /set %tt  }
  elseif ($read(fstats.txt, w,  *Total Posts:*)) { /set %tp  }
  elseif ($read(fstats.txt, w,  *Online:*)) { /set %om  }
  elseif ($read(fstats.txt, w,  *Last Updated Topic:*)) { /set %lut  }
  else { /echo nothing found! }
  /msg #MT 9FORUM-STATS 14Total Members: 9 $+ %tm $+  $+ , 14Newest member: 9 $+ %nm $+  $+ , 14Total Topics:  9 $+ %tt  $+  $+ , 14Total Posts: 9 $+ %tp $+  $+ , 14Online:  9 $+ %om $+  $+ .
  /msg #MT 14Last Updated Topic: 9 $+ %lut $+  $+ .
}
;MENU
menu * {
  Forum-Stats:fstats
}

Joined: Apr 2003
Posts: 16
C
cap00t Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Apr 2003
Posts: 16
this works for getting the total member count out of the txt file:
Code:
alias fstats {
  if ($read(fstats.txt,w,*&lt;a href="index.cgi?action=mlall"&gt;&lt;B&gt;*&lt;/B&gt;&lt;/a&gt;*)) {
  var %tm = $read(fstats.txt,$readn) 
  /msg #adasda Total Members: $gettok($mid(%tm,$calc($pos(%tm,mlall) + 10)),1,$asc(&lt;)) 
}  


so i thought this would work too:
Code:
alias fstats {
  if ($read(fstats.txt,w,*&lt;a href="index.cgi?action=mlall"&gt;&lt;B&gt;*&lt;/B&gt;&lt;/a&gt;*)) {
  var %tm = $read(fstats.txt,$readn) 
  elseif ($read(fstats.txt,w,*Newest Member: &lt;A HREF="index.cgi?action=viewprofile&amp;username=*"&gt;&lt;B&gt;*&lt;/B&gt;*)) {
  var %nm = $read(fstats.txt,$readn) 
  /msg #adasda Total Members: $gettok($mid(%tm,$calc($pos(%tm,mlall) + 10)),1,$asc(&lt;)) Newest Member: $gettok($mid(%nm,$calc($pos(%nm,viewprof) + 25)),1,$asc(&lt;))
}  


but it doesnt... confused

any suggestions?

Joined: May 2003
Posts: 2
T
Bowl of petunias
Offline
Bowl of petunias
T
Joined: May 2003
Posts: 2
This works for me

Code:
 
alias fstats {
  var %file = fstats.txt
  echo -a -
  echo -a FORUM-STATS
  if ($read(%file,w,*&lt;a href="index.cgi?action=mlall"&gt;&lt;B&gt;*&lt;/B&gt;&lt;/a&gt;*)) {
    var %tm = $read(%file,$readn)
    echo -a Total Members: $gettok($mid(%tm,$calc($pos(%tm,mlall) + 10)),1,$asc(&lt;))
  }
  if ($read(%file,w,*&lt;BR&gt;Newest Member: &lt;A HREF="index.cgi?action=viewprofile&amp;username=*"&gt;&lt;B&gt;*&lt;/B&gt;&lt;/A&gt;*)) {
    var %tm = $read(%file,$readn)
    echo -a Newest Member: $gettok($mid(%tm,$calc($pos(%tm,mlall) + 78)),1,$asc(&lt;))
  }
  if ($read(%file,w,*Total Topics: &lt;B&gt;*&lt;/B&gt;*)) {
    var %tm = $read(%file,$readn)
    echo -a Total Topics: $gettok($mid(%tm,$calc($pos(%tm,mlall) + 18)),1,$asc(&lt;))
  }
  if ($read(%file,w,*&lt;BR&gt;Last Updated Topic: &lt;B&gt;&lt;A HREF="index.cgi?action=display&amp;board=rateaboard&amp;num=*&amp;start=0"&gt;*&lt;/A&gt; (&lt;B&gt;*&lt;/B&gt;*)&lt;/B&gt;&lt;BR&gt;*)) {
    var %tm = $read(%file,$readn)
    echo -a Last Updated Topic: $gettok($mid(%tm,$calc($pos(%tm,mlall) + 103)),1,$asc(&lt;))
  }  
  if ($read(%file,w,*Total Posts: &lt;B&gt;*&lt;/B&gt;*)) {
    var %tm = $read(%file,$readn)
    echo -a Total Posts: $gettok($mid(%tm,$calc($pos(%tm,mlall) + 59)),1,$asc(&lt;))
  }
  if ($read(%file,w,*&lt;td valign="top" align="left"&gt;&lt;font size="1"&gt;*&lt;BR&gt;&lt;A HREF="index.cgi?action=viewprofile&amp;username=*"&gt;*)) {
    var %tm = $read(%file,$readn)
    echo -a Users Online: $gettok($mid(%tm,$calc($pos(%tm,mlall) + 46)),1,$asc(&lt;))
  }
  echo -a -
}
 


I got a little lazy copy/pasting the $pos's with the "mlall"s, but it still worked so i left it. *shrug*


MythicalNet IRC Network banix.ath.cx aegis18.ath.cx jarvis.ath.cx dragon5.ath.cx mtech.ath.cx
Page 1 of 2 1 2

Link Copied to Clipboard