mIRC Home    About    Download    Register    News    Help

Print Thread
#9919 06/02/03 09:39 AM
Joined: Dec 2002
Posts: 6
I
ikke Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Dec 2002
Posts: 6
after having mastered the sockets method used in mirc, i wanted to make an tcl script for eggdrop, so my bot can be online 24/7.

I found alot of very short tutorials for creating socket connections toward sites, but none for how to handle the information that you get returned.

Anyone here into eggdrop that can give me a good tutorial/info site?

#9920 06/02/03 10:31 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
If you understand the HTTP Protocol, I don't think it matters which language you use... the information you send and receive is same. Here's a tutorial on making HTTP requests using mIRC sockets, I hope it will help you.

Searching google for 'tcl tutorial' or 'tcl guide' may result some helpful sites.

#9921 07/02/03 06:24 AM
Joined: Dec 2002
Posts: 27
B
Ameglian cow
Offline
Ameglian cow
B
Joined: Dec 2002
Posts: 27
depending of your tcl version, it may include an http package either you'll need to get the library.
there is also a library of html. procs name start with ::http:: and ::html::
there a piece of code I used to fill abuse report form at geocities about webpage spreading rol.vbs exploit. usage : geosite url then the bot check for presence of rol.vbs string on the page. if found, fill the report form :
Code:
 
package require http

proc httpCallback {token} {
  global geosite_state geosite_url blah
  upvar #0 $token state

  set blah "$state(http) $geosite_state($token)"

  if { [string match "HTTP/1.1 200 OK*" "$state(http)"] } {
    switch -exact $geosite_state($token) {
    0 {
      set geosite_state($token) 2
      set query [::http::formatQuery email example_email@yahoo.com text_input20 $geosite_url($token) select30 opt306 textarea40 "is spammed on irc" from_url "" send "Send"]
      catch [ ::http::geturl http://add.yahoo.com/fast/help/us/geo/cgi_abuse -command httpCallback -query $query -blocksize 4096]
      }
    1 {
      set geosite_state($token) 2
      set query [::http::formatQuery email example_email@yahoo.com text_input20 $geosite_url($token) select30 opt302 textarea40 "contains js.exception exploit" from_url "" send "Send"]
      catch [ ::http::geturl http://add.yahoo.com/fast/help/us/geo/cgi_abuse -command httpCallback -query $query -blocksize 4096]
      }
    2 {
      putlog "!checkweb! geosite_url($token) report ok"
      unset geosite_state($token) geosite_url($token)
      }
    default {

      unset geosite_state($token) geosite_url($token)
      }

  } {
    putlog "!checkweb! problem reporting geosite_url($token) : $blah"
    unset geosite_state($token) geosite_url($token)
  }
}

proc httpHandlerCallback {socket token} {
  global geosite_state

  set data [read $socket 4096]
  set nbbytes [string length $data]

  if { [string match "*rol.vbs*" $data] } {
    set geosite_state($socket) 1
  }

  return $nbbytes
}

proc geocheck { url } {
  global geosite_state geosite_url blah
  if { "[string index $url end]" == "/" } { set urll "$url" } { set urll "$url/" }

  set sock [::http::geturl "$urll" -command httpCallback -handler httpHandlerCallback -blocksize 4096]
  set geosite_state($sock) 0
  set geosite_url($sock) $urll
}
 


note that not all tcl version of the http package will allow you to have the callback and handler specified at same time in ::http::geturl

sorry to have posted so long tcl code here laugh

#9922 09/02/03 02:13 PM
Joined: Dec 2002
Posts: 6
I
ikke Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Dec 2002
Posts: 6
Thanks alot, i learn most from just source code cool


Link Copied to Clipboard