Free2Code
 
Time: 2008-11-21, 05:20pm
mIRC Socket...
Subject: mIRC Socket...  ·  Posted: 2006-05-21, 08:56am
Rank: ? (3)
Member #: 27586
Hey everyone I've been trying to work out this problem for a while but I can't seem to get it.

I'm writing a mIRC socket bot that connects to a URL, searches for certain text on the page, and upon finding the text, gives me the URL of the page it found the text on. However, the socket bot won't stay connected to the URL for the "on *:sockread..." code to take effect! Any help on why would be massively appreciated

Here's the code I've written so far. I haven't gotten round to writing the part that will search for text (not learned how to yet), but any help on that as well would be very helpful!!


Code:
  1. alias -l htmlfree {
  2.   var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp
  3.   return %x
  4. }
  5. alias ikat { 
  6.   window @Thief
  7.   set %ikat ikat $+ $r(1,100000)
  8.   sockopen %ikat http://www.ik02.de/ 80
  9. }
  10. on *:sockopen:%ikat:{ 
  11.   sockwrite -n $sockname GET /en/s_en.php?s= $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(1,9) $+ $r(a,z) $+ &p=main HTTP/1.1
  12.   sockwrite -n $sockname Host: ik02.de
  13. }
  14. on *:sockread:%ikat:{
  15.   if ($sockerr) {
  16.     echo @Thief Error.
  17.     halt
  18.   }
  19.   else {
  20.     var %temptext
  21.     sockread %temptext
  22.     if (*<h1>Overview</h1>* iswm %temptext) || *<td valign="*" width="*"><b>Buildings</b>* iswm %temptext) {
  23.       echo @Thief -
  24.       aline @Thief $htmlfree(%temptext)
  25.     }
  26.   }
  27. }
  28. on *:sockclose:%ikat:{
  29.   echo @Thief Socket connection lost to Inselkampf server.
  30. }


Thanks a lot guys and girls

» Post edited 2006-05-21, 12:00pm by troian.

 
  Reply to this ·  Post link ·  Top
Subject: hmmm  ·  Posted: 2006-10-07, 08:56pm
Rank: ? (4540)
Member #: 51
hmmm

 
  Reply to this ·  Post link ·  Top
Subject: Re: mIRC Socket...  ·  Posted: 2006-10-15, 05:54am
Rank: ? (2)
Member #: 28823
Well I'm not sure what you're trying to do here... but you're missing a couple of things.

First of all, don't include the "http" in the hostname:

Code:
  1. alias ikat { 
  2.   window @Thief
  3.   set %ikat ikat $+ $r(1,100000)
  4.   sockopen %ikat www.ik02.de 80
  5. }


Secondly, all GET requests end with a CRLF, like so:

Code:
  1. on *:sockopen:%ikat:{ 
  2.   sockwrite -n $sockname GET /en/s_en.php?s= $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(1,9) $+ $r(a,z) $+ &p=main HTTP/1.1
  3.   sockwrite -n $sockname Host: ik02.de
  4.   sockwrite -n $sockname $crlf
  5. }


And the third, but non-scripting related problem, is that either you're pointing at the wrong host, or the page you're pointing at is only avaliable once you've logged in. Either way, the page returned is a 302 redirect to www.inselkampf.co.uk, as you can see:

Code:
  1. HTTP/1.1 302 Found
  2. Date: Sun, 15 Oct 2006 17:39:44 GMT
  3. Server: Apache/1.3.20 (Linux/SuSE) PHP/4.3.9 mod_perl/1.26 FrontPage/4.0.4.3
  4. X-Powered-By: PHP/4.3.9
  5. Location: http://www.inselkampf.co.uk/
  6. Transfer-Encoding: chunked
  7. Content-Type: text/html
  8. 0


 
  Reply to this ·  Post link ·  Top

Pages: 1

Please login or register to post a reply.

icons