mIRC Homepage
Im trying to get the page from www.kingsofchaos.com in a file...but i cant getting it running (note in iexplore you cannot see the source code)

i have this:
alias finding {
sockopen search www.kingsofchaos.com 80
}

on *:sockopen:search:{
sockwrite -n $sockname GET / HTTP/1.1
sockwrite -n $sockname Host: www.kingsofchaos.com
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname User-Agent: Mozilla
sockwrite -n $sockname $crlf

on *:sockred:search: {
sockread %temp
write files\testing.txt %temp
}

on 1:TEXT:!find:#: {
write -c files\testing.txt
finding
}

my old script (in a previous round of the game)
on *:sockopen:search: {
notice %nick I am Loading...
sockwrite -n $sockname GET /battlefield.php?jump=&search_type=s&search= $+ %koclink HTTP/1.1
sockwrite -n $sockname Host: www.kingsofchaos.com
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname User-Agent: mIRC $version
sockwrite -n $sockname $crlf
}

on 1:sockread:search: {
if ($sockerr > 0) return
sockread %search.tmp
if ($sockbr == 0) return
write files\testing.txt %search.tmp
}

this work, but also not anymore
First off your sockread is mispelled to sockred also try to get /index.php instead of / also as a note for ease
on *:sockopen:search: {
var %a = sockwrite -n $sockname
%a GET /index.php HTTP/1.0
%a Host: $sock($sockname).ip
%a User-Agent: Mozilla
%a $crlf $+ $crlf
}
Hi, yes that mistype lol i changed so soften i looked blue :P

but i changed the to yours..and still doesnt work
alias finding {
sockopen search www.kingsofchaos.com 80
}

on *:sockopen:search: {
var %a = sockwrite -n $sockname
%a GET /index.php HTTP/1.0
%a Host: $sock($sockname).ip
%a User-Agent: Mozilla
%a $crlf $+ $crlf
}

on *:sockread:search: {
msg #superkoe test
sockread %temp
write files\testing.txt %temp
}

on 1:TEXT:!find:#: {
write -c files\testing.txt
finding
}

it doesnt execute sockread, because i dont het the msg test
i have the answer.

If you don't send ALL the right stuff to the server it ignores the request, so u will need to change it to:

on *:sockopen:search: {
var %a sockwrite -n $sockname
%a GET /index.php HTTP/1.1
%a Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1..
%a Content-Type: application/x-www-form-urlencoded
%a User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
%a Host: www.kingsofchaos.com
%a Accept-Language: en-us,en;q=0.50..
%a Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
%a Connection: Keep-Alive
%a Cache-Control: no-cache
%a $crlf
}

then it'll work.

[Edit] missed off the GET blush
Sorry but it still dont work frown

I added GET becasue you forgot it :P
but the rule: @sockread Accept, the forum deleted the last part?
try this cuz it works perfectly here:

alias finding {
sockopen search www.kingsofchaos.com 80
}
on *:sockopen:search: {
var %a sockwrite -n $sockname
%a GET /index.php HTTP/1.1
%a Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1..
%a Content-Type: application/x-www-form-urlencoded
%a User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
%a Host: www.kingsofchaos.com
%a Accept-Language: en-us,en;q=0.50..
%a Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
%a Connection: Keep-Alive
%a Cache-Control: no-cache
%a $crlf
}
on *:sockread:search: {
var %b
sockread %b
echo -s %b
}

It should flood the hell outta ur status window with html.
i still dont get it working
is this rule correct? :
%a Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1..
u must be doing somethin wrong cuz like i said, it works perfectly for me. I've even tried it on a clean 6.16 and it works.

And yes its correct. its a line that browsers, in this case IE, sends to the server telling it what it is able to display..i think.
Correct, and it works here
Yes i got it working....i did something stupid.

Thank you so much for your time and patience
The script works perfectly, but i have a next questen :

is it possble to login? i have tryed with authorisatie..but doesnt work.

Kingsofchaos need 3 thing, login name, email adress and password

this is the source from the page:
<td align="center"><input class="login_input" type="text" name="usrname" value=""></td>
</tr>
<tr>

<td align="center"><font color="black">Email:</font></td>
</tr>
<tr>
<td align="center"><input class="login_input" type="text" name="uemail" value=""></td>
</tr>
<tr>
<td align="center"><font color="black">Password:</font></td>
</tr>

<tr>
<td align="center"><input class="login_input" type="password" name="psword"></td>

"usrname"
"uemail"
"psword"
those 3 must have a value, and then submit them?
u need to use POST instead of GET and post with this data:

username=&pword=&usrname=test&uemail=test@test.com&psword=testing&hash=4de01e72701cf8757bdbf0e5e8039bad

However, since its using cookies etc etc thats as far as i can help. That hash= is different every time and i have no clue how its generated either.
the has might be the php session which is imposible to "guess" its usually assigned
If you speak French, you can try this (I guess the site uses a POST instead of a GET to log on, right?) : How to use cookies with mIRC?
It would have to use POST to login
Tnx alot..i could use a translater smile
ive gotten very far, i can log in now.
and i extract the cookie

But when i sent the cookie and i see in the sourcecode the wrong cookie is there:
CODE:
on *:sockopen:koclogin: {
notice %nick I am Loading...
var %a sockwrite -n $sockname
var %koc.login = $+(usrname=USERNAME,$chr(38),uemail=EMAIL@MAIL.COM,$chr(38),psword=PASSWORD,$chr(38),login=Login)
%a POST /login.php HTTP/1.1
%a Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1..
%a Content-Type: application/x-www-form-urlencoded
%a User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
%a Host: www.kingsofchaos.com
%a Accept-Language: en-us,en;q=0.50..
%a Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
%a Content-length: $calc($len(%sdb.login) +1)
sockwrite -n $sockname
%a %koc.login
}
on *:sockread:koclogin: {
if ($sockerr > 0) return
sockread %koclogin.tmp
if ($sockbr == 0) return
write files\koclogin.txt %koclogin.tmp
}
Then i write the results in a file:

HTTP/1.1 302 Found
Date: Sun, 07 Nov 2004 21:54:59 GMT
Server: Apache/1.3.29 (Unix) (Gentoo/Linux)
Set-Cookie: koc_session=12345678; path=/; domain=www.kingsofchaos.com
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: security_hash=abcdef; expires=Tue, 07-Dec-2004 21:54:59 GMT; path=/; domain=.kingsofchaos.com
Set-Cookie: cookie_hash=qwerty; path=/
Location: login.php
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
0

then i do next:
on *:sockopen:search: {
var %a sockwrite -n $sockname
%a GET /battlefield.php?jump=&search_type=s&search= $+ %koclink HTTP/1.1
%a Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1..
%a Content-Type: application/x-www-form-urlencoded
%a Cookie: %koc_session; %security_hash; %cookie_hash
%a User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
%a Host: www.kingsofchaos.com
%a Accept-Language: en-us,en;q=0.50..
%a Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
%a Connection: Keep-Alive
%a Cache-Control: no-cache
sockwrite -n $sockname
%a $crlf
}

But if i check the pagecode then...i will see diffirent koc_session and cookie_hash. security_hash stays the same

anyone has a clue?
If the cookie change, so change it. On some web sites (such as cservice.undernet.org) I coded an addon based on, I had to reset the cookie every time I loaded the page. So maybe you have to send the newest value you have, try it out, maybe it'll work.
every time i tigger the script..it reloads the cookie. i post the script:
those $extract alias removes the junk from the pagesource..so that clen number stay left. I tested that and its fine. I get 3 hashs from koclogin.


alias koclogin {
sockclose koclogin
sockopen koclogin www.kingsofchaos.com 80
}

on *:sockopen:koclogin: {
notice %nick I am Loading...
var %a sockwrite -n $sockname
var %koc.login = $+(usrname=USERNAME,$chr(38),uemail=USEREMAIL,$chr(38),psword=PASSWORD,$chr(38),login=Login)
%a POST /login.php HTTP/1.1
%a Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1..
%a Content-Type: application/x-www-form-urlencoded
%a User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
%a Host: www.kingsofchaos.com
%a Accept-Language: en-us,en;q=0.50..
%a Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
%a Content-length: $calc($len(%sdb.login) +1)
sockwrite -n $sockname
%a %koc.login
}

on *:sockread:koclogin: {
if ($sockerr > 0) return
sockread %koclogin.tmp
if ($sockbr == 0) return
write files\koclogin.txt %koclogin.tmp
}

This is written in koclogin.txt
HTTP/1.1 302 Found
Date: Sun, 07 Nov 2004 21:56:35 GMT
Server: Apache/1.3.29 (Unix) (Gentoo/Linux)
Set-Cookie: koc_session=7f67e1ac804y3y593e1c981941d326ad; path=/; domain=www.kingsofchaos.com
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: security_hash=323468475345; expires=Tue, 07-Dec-2004 21:56:35 GMT; path=/; domain=.kingsofchaos.com
Set-Cookie: cookie_hash=558e543e361f79e48a8553db204bbcddb; path=/
Location: login.php
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
0

on *:sockclose:koclogin: {
var %something = $read(files\koclogin.txt, w, *koc_session*)
var %readline = $readn
var %KOCSESSION = $read(files\koclogin.txt, %readline)
var %readline = $readn +4
var %SECUTITY.RAW = $read(files\koclogin.txt, %readline)
var %readline = $readn + 1
var %COOKIE.RAW = $read(files\koclogin.txt, %readline)
set %koc_session $extractsession(%KOCSESSION)
set %security_hash $extractsecurity(%SECUTITY.RAW)
set %cookie_hash $extractcookie(%COOKIE.RAW)
search
}

i remove the junk from the koclogin.txt file and:
%koc_session = 7f67e1ac804y3y593e1c981941d326ad
%security_hash = 323468475345
%cookie_hash = 558e543e361f79e48a8553db204bbcddb
I have tested this and its 100% correct

alias search {
sockclose search
sockopen search www.kingsofchaos.com 80
}

on *:sockopen:search: {
var %a sockwrite -n $sockname
%a GET /battlefield.php?jump=&search_type=s&search= $+ %koclink HTTP/1.1
%a Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1..
%a Content-Type: application/x-www-form-urlencoded
%a Cookie: %koc_session; %security_hash; %cookie_hash
%a User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
%a Host: www.kingsofchaos.com
%a Accept-Language: en-us,en;q=0.50..
%a Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
%a Connection: Keep-Alive
%a Cache-Control: no-cache
sockwrite -n $sockname
%a $crlf
}

on *:sockread:search: {
if ($sockerr > 0) return
sockread %search.tmp
if ($sockbr == 0) return
write files\testing.txt %search.tmp
}

Here i dump the page that should be logged in..but the hash's are different
Yeah, when you reload the main page, reset the hashes, and look in the page you just loaded if you're logged in... I think so.
© mIRC Discussion Forums