mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#234971 18/11/11 03:44 PM
E
eawedat
eawedat
E
Code:
on *:sockopen:x:{ 
  sockwrite -n $sockname GET / HTTP/1.1 
  sockwrite -n $sockname Host: eawedat.zxq.net $+ $crlf
  ;I DO NOT KNOW IF CODE BELOW IS NECESSARY
  ;sockwrite -n $sockname Connection: Keep-Alive
}

on *:sockread:x:{
  if ($sockerr) {
    echo -a Error
    halt
  }
  else {
    sockread %temptext
    echo -a %temptext
  }
}


Code:
Usage:- /sockopen x eawedat.zxq.net 80


but I do not get desired results!
I get this:-

Code:
HTTP/1.1 400 Bad Request
Date: Fri, 18 Nov 2011 15:40:52 GMT
Server: Apache
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>


thanks a lot.

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Code:
on *:sockopen:x:{ 
  sockwrite -n $sockname GET / HTTP/1.1
  sockwrite -n $sockname Host: eawedat.zxq.net
  sockwrite -n $sockname
}

E
eawedat
eawedat
E
yeah thanks a lot it is working
but Riamus2 ,

Code:
sockwrite -n $sockname Host: eawedat.zxq.net $+ $crlf



Code:
sockwrite -n $sockname Host: eawedat.zxq.net
sockwrite -n $sockname


aren't the same?

because: $+ $crlf is also sending a newline

thanks.

Last edited by eawedat; 18/11/11 05:40 PM.
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
If you sent 2 $crlf's, it would probably work on yours. But it's considered better to use a single -n at the end instead of manually doing $crlf.

E
eawedat
eawedat
E
I see thanks a lot:))

E
eawedat
eawedat
E
Riamus2
by the way , when I run :
/sockopen x eawedat.zxq.net 80

it complains about 31 times that :
* /echo: insufficient parameters (line 16, remote.ini)

line 16 :
echo -a %temptext

why's that? & how can I avoid those messages?

thanks.

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
It's because your page has a lot of blank lines in the code. Just put a check to only echo if != $null.

E
eawedat
eawedat
E
Riamus2
Php Code:

sockread %temptext
	if (%temptext != $null) {
	  echo -a %temptext
	}
 


still getting
/echo: insufficient parameters

Joined: Jan 2004
Posts: 2,081
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jan 2004
Posts: 2,081
There are a few values that can still produce that error.

//var %x $chr(32) | echo -a %x

Change from
echo -a %temptext
to
echo -a $len(temptext) $asc(%temptext) %temptext
and see what happens

E
eawedat
eawedat
E
yea it works fine maroon but the thing is I do not like to show numbers beside lines which I think present length of line.

is there no another way?

Joined: Jan 2004
Posts: 2,081
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jan 2004
Posts: 2,081
well you could put the control-o colour-code in front, that guarantees an output.

echo -a $chr(15) $+ %temptext

if your output has colours that you don't want to destroy, then a pair of control-r's will do it.

echo -a $+($chr(22),$chr(22),%temptext)

E
eawedat
eawedat
E
yes that worked! 100% is okay:)
what does chr(15) present? is it an empty char or what?

what about those :
Php Code:

HTTP/1.1 200 OK
Date: Sat, 19 Nov 2011 19:53:24 GMT
Server: Apache
X-Powered-By: PHP/5.2.17
Content-Length: 4480
Connection: close
Content-Type: text/html
 


How can I avoid them?

thanks.

Last edited by eawedat; 19/11/11 07:58 PM.
Joined: Jan 2004
Posts: 2,081
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jan 2004
Posts: 2,081
15 is the ascii char sent with a control-o, you can put any of the control-b/u/r/k/o colour codes inside the parenthesis for
echo -a $asc()
and see what the receiver sees as the ascii value for that code

E
eawedat
eawedat
E
ah I see , so what you have done is that you put a "hidden" char
that guarantees the output so if there is an empty line it still outputs to avoid error message with echo...nice trick :-)
it is better than to ask with conditions if(...!=$null)....

C
CoLdFeAr
CoLdFeAr
C
ice tried all the above code an all i get is

HTTP/1.1 200 OK
Date: Sun, 20 Nov 2011 02:32:22 GMT
Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Last-Modified: Sat, 19 Nov 2011 14:31:59 GMT
ETag: "5e0219-c2-4b21750f3f5c0"
Accept-Ranges: bytes
Content-Length: 194
Content-Type: text/html


Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
Usage: /check
Code:
alias check {
  sockclose x
  sockopen x eawedat.zxq.net 80
}
on *:sockopen:x:{ 
  sockwrite -n x GET / HTTP/1.1 
  sockwrite -n x Host: eawedat.zxq.net
  sockwrite -n x
}
on *:sockread:x:{
  if ($sockerr) {
    echo -a Error
  }
  else {
    var %temptext
    sockread %temptext
    if ($regex(%temptext,/<title>(.+)<\/title>|$&
      $+ <a href="\S+">(.+)<\/a><\/font>|(.+\d{4} &copy;)/)) {
      echo -a $remove($replace($regml(1),&copy;,$chr(169)),$chr(9))
    }
  }
}
Output:
Quote:
Blog of Muhamad Eawedat - Wall
Info
CV
Works
Books
Story
Photos
Thanks
Blog's Birth
Contact Me
all rights reserved 2011 ©

E
eawedat
eawedat
E
Tomao , with your code -> in my situation it still outputs HTML Tags(All of Page's source)-I have already code to strip HTML tags but what we need to avoid those below

Php Code:

HTTP/1.1 200 OK
Server: Apache
Content-Length: 4480
Content-Type: text/html
 


thanks.

Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
Why not show people the current script you have? And yes, it's very possible to escape the header fields from being shown.

E
eawedat
eawedat
E
Tomao , I did not understand your question about not showing people my script.. which script? the first one which I pasted above is my script ,,the first Reply of this Thread is my script.

2)How to escape the header fields?

Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
My question was clear, unless I wrote a language other than English.

You mentioned you had the html tags stripped out, and that you'd like to avoid the header fields as I said in the last post. The example I showed you used regex, which matched the targeted strings you're after.

It's evident you want to keep the code the way you have, and I have nothing against that. Now, what you've posted in the original post is partial, not a complete code. I was basically asking you to show people what you have gotten so far, so it's easier to see is all.

Perhaps my English is still not understandable to you, so I'll see if someone who speaks perfect English can assist you further.

Page 1 of 2 1 2

Link Copied to Clipboard