Martin Leja <[EMAIL PROTECTED]> writes:
> here another example of how sslcat can be used (you can include it in the
> next release of your Net::SSLeay module if youl like)
>
> --begin--sslcat
> #!/usr/bin/perl
>
> use Net::SSLeay qw{ sslcat };
>
> $desc= "Usage: sslcat <host> <port>\n" .
> "The characters read from stdin are send to the specified host and
> port,\n" .
> "e.g. '\$bash printf \"GET / HTTP/1.0\\r\\n\\r\\n\" | sslcat
> www.bacus.pt 443'\n";
>
> do { print( $desc ); exit() } if( $#ARGV+1 != 2 );
> $host= $ARGV[0];
> $port= $ARGV[1];
> $reqest= "";
>
> while( read( STDIN, $buf, 1024 ) ) { $request.= $buf }
> print( sslcat( $host, $port, $request ) );
> --end--sslcat
>
> --begin-example--of--how--to--use--the--above--script
> #!/bin/sh
>
> PATH=/bin:/usr/bin:~/bin # include the path to sslcat here
> host="www.ebay.de"
> port="443"
> cgi="/servlet/MYConnector"
> login="<your [EMAIL PROTECTED]>"
> passwd="<your [EMAIL PROTECTED]>"
> postdata="page=tempLogin&link=startseite&ID=&benutzer=$login&passwort=$passw
> d&B1=+++++++++Anmelden+++++++++"
> len="${#postdata}"
>
> printf "\
> POST $cgi HTTP/1.0\r\n\
> Content-length: $len\r\n\
> \r\n\
> $postdata\
> " | sslcat $host $port # the same can be used to retrieve web pages with
> netcat (nc) via http
> --end-example--of--how--to--use--the--above--script
I believe your script must have had great utility, but it suffers from
bug in case of SSL3 renegotiation. You should either use
get/post_https or https_cat. sslcat is still great for non https type
stuff (the reason I wrote all this stuff in the first place).
Consider the following:
perl -MNet::SSLeay -e 'print Net::SSLeay::post_https("www.ebay.de", 443,
"/servlet/MYConnector", "", join("",<STDIN>))'
page=tempLogin&link=startseite&ID=&benutzer=foo&passwort=bar&B1=+++++++++Anmelden+++++++++
EOF
or even
perl -MNet::SSLeay -e 'print Net::SSLeay::post_https("www.ebay.de", 443,
"/servlet/MYConnector", "",
"page=tempLogin&link=startseite&ID=&benutzer=$ARGV[0]&passwort=$ARGV[1]&B1=+++++++++Anmelden+++++++++")'
[EMAIL PROTECTED] [EMAIL PROTECTED]
> I'm glad that i found your module with which i can retrieve web page as i
> used to do it with netcat and normal web pages (http protocol).
> I'm not familiar with this ssl stuff but perhaps you can tell me if I can
> do the same (the above shell script) with the command openssl (provided by
> openssl-0.9.3a) or another ssl tool?
openssl s_client in principle should work, though I'm not sure how it
handles EOF and connection renegotiation. You sure have to spend more
effor manually writing headers.
--Sampo
>
> right now i'm quite content with the above solution to do
> https-web-page-retrieving-and-parsing.
>
> --
> Regards, [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]