mIRC Homepage
Posted By: Abuser__ Get proxy list - 01/08/05 01:04 PM
I am a little new with socks. Let's start with the script i want:

When someone writes !proxylist the bot gets the list of proxys from http://www.proxycn.net/proxy_irc/page1.htm and msgs it into the channel. I think that it would be great, if there would be a 1500 delay between lines, so the bot wouldn't flood of the server...

Can someone help me? smile
Posted By: FiberOPtics Re: Get proxy list - 01/08/05 02:09 PM
Here's a small example.

Note that it will write the proxies to a .txt file called proxylist.txt which is located in your main mIRC folder. Note that once you've retrieved the list, you shouldn't use the sockets all the time to message the proxies to a person, just read it from the file, and update the file with the code every once in a while.

Code:
alias getproxies {
  var %e = echo -ac info * /getproxies:
  if ($fopen(proxylist)) .fclose proxylist
 .fopen -o proxylist proxylist.txt
  if ($ferr) { %e error opening proxylist.txt | return }
  sockclose gprox
  sockopen gprox proxycn.net 80
  %e retrieving proxy list
}
 [color:red]  [/color] 
on *:sockopen:gprox:{
  if ($sockerr) { echo -ac info * /getproxies: error opening socket | return }
  var %s = sockwrite -n gprox
  %s GET /proxy_irc/page1.htm HTTP/1.1
  %s Host: www.proxycn.net $str($crlf,2)
}
 [color:red]  [/color] 
on *:sockread:gprox:{
  if ($sockerr) return
  var %a, %token
  sockread %a
  while ($sockbr) {
    %token = $remove($gettok(%a,1,32),</td>)
    if (*.*.*.* iswm %token) sockmark gprox %token
    elseif (%token isnum) && ($sock(gprox).mark) {
      sockmark gprox $ifmatch %token
    }
    elseif (%token isalpha) && ($isupper(%token)) {
      .fwrite -n proxylist $sock(gprox).mark %token
      sockmark gprox
    }
    sockread %a
  }
}
 [color:red]  [/color] 
on *:sockclose:gprox:{
  .fclose proxylist
  echo -ac info * /getproxies: finished retrieving proxies
}


After doing /getproxies, you will be notified when the process is finished. From this point on, you can use the /play command to message the contents of a file to a person/channel with a specified interval.

In its simplest form, this would look something like: /play <channel> proxylist.txt 1500
For more information about /play, type /help /play in mIRC and take a look at the flags and such.

Mod note: Code edited as per author's request
Posted By: yah Re: Get proxy list - 11/10/05 08:10 PM
when i type /getproxies, i get this msg:
FOPEN Unknown command
-
FWRITE Unknown command
-
FWRITE Unknown command
-
FWRITE Unknown command
-
FCLOSE Unknown command
-
i use mirc client
Posted By: FiberOPtics Re: Get proxy list - 11/10/05 08:14 PM
Then you must be using a really old mIRC version, where these commands don't exist yet.

The file handling commands were introduced in mIRC v6.1.

Any version beneath that won't work.

You can find out your version by typing this in mIRC: //echo -a $version

You'll need to update your client in order for the script to work, or I could modify it to use another approach instead of the file handling commands.
Posted By: yah Re: Get proxy list - 12/10/05 02:08 AM
sorry! i am using version 6.03. can you modify it to use another approach instead of the file handling commands?
Posted By: FiberOPtics Re: Get proxy list - 12/10/05 02:15 AM
Code:
alias getproxies {
  window -h @gprox
  clear @gprox
  sockclose gprox
  sockopen gprox proxycn.net 80
  echo $color(info) -a * Retrieving proxy list...
}
 [color:red]  [/color] 
on *:sockopen:gprox:{
  if ($sockerr) { 
    echo $color(info) -a * /getproxies: error opening socket 
    window -c @gprox
    return 
  }
  var %s = sockwrite -n gprox
  %s GET /proxy_irc/page1.htm HTTP/1.1
  %s Host: www.proxycn.net $str($crlf,2)
}
 [color:red]  [/color] 
on *:sockread:gprox:{
  if ($sockerr) return
  var %a, %token
  sockread %a
  while ($sockbr) {
    %token = $remove($gettok(%a,1,32),&lt;/td&gt;)
    if (*.*.*.* iswm %token) sockmark gprox %token
    elseif (%token isnum) &amp;&amp; ($sock(gprox).mark) {
      sockmark gprox $ifmatch %token
    }
    elseif (%token isalpha) &amp;&amp; ($isupper(%token)) {
      aline @gprox $sock(gprox).mark %token
      sockmark gprox
    }
    sockread %a
  }
}
 [color:red]  [/color] 
on *:sockclose:gprox:{
  savebuf @gprox proxylist.txt
  window -c @gprox
  echo $color(info) -a * /getproxies: finished retrieving proxies
}
© mIRC Discussion Forums