Re: Parsing a email attachment over SSL

2013-07-29 Thread John SJ Anderson
(a) Your subject line doesn't seem to have anything to do with the
question in your message.

(b) The documentation for Mail::IMAPClient says that the search()
method arguments are appended to an IMAP SEARCH command. I think if
you look at the relevent section of the IMAP RFC
(https://tools.ietf.org/html/rfc3501#section-6.4.4) you'll find some
examples similar to what you're doing.

You probably also want to heed the note in the Mail::IMAPClient
documentation about how to distinguish a legit search that returns
zero hits versus a search that fails.

chrs,
john.


On Mon, Jul 29, 2013 at 1:56 PM, Chris Datfung  wrote:
>
> I get a daily email attachment to my Gmail account which I want to
> automatically download. I found the following Perl script which does just
> that:
>
> http://stackoverflow.com/questions/2453548/how-can-i-download-imap-mail-attachments-over-ssl-and-save-them-locally-using-pe
>
> The above script uses the following syntax to search the messages via IMAP:
>
> my @messages = $imap->search(SUBJECT => $today);
>
> In my case, I want to search on two criteria, subject and date. I tried
> various ways such as:
>
> my @messages = $imap->search(SUBJECT => $subject, ON => $today);
>
> my @messages = $imap->search({SUBJECT => $subject, ON => $today});
>
> my @messages = $imap->search("SUBJECT => $subject, ON => $today");
>
> but none of these worked. How can I search on multiple criteria using
> Mail::IMAPClient?
>
> Thanks,
> Chris

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Parsing a email attachment over SSL

2013-07-29 Thread Chris Datfung
I get a daily email attachment to my Gmail account which I want to
automatically download. I found the following Perl script which does just
that:

http://stackoverflow.com/questions/2453548/how-can-i-download-imap-mail-attachments-over-ssl-and-save-them-locally-using-pe

The above script uses the following syntax to search the messages via IMAP:

my @messages = $imap->search(SUBJECT => $today);

In my case, I want to search on two criteria, subject and date. I tried
various ways such as:

my @messages = $imap->search(SUBJECT => $subject, ON => $today);

my @messages = $imap->search({SUBJECT => $subject, ON => $today});

my @messages = $imap->search("SUBJECT => $subject, ON => $today");

but none of these worked. How can I search on multiple criteria using
Mail::IMAPClient?

Thanks,
Chris


IO::Socket::SSL replacement for IO::Socket::INET

2013-04-08 Thread Chris Knipe
Hi All,

I've successfully written quite an big perl server using IO::Socket::INET -
it seems to be working pretty darn good and so far I'm happy.

I'm attempting now to do the same but by using SSL.  I've read up on
IO::Socket::SSL, and I know that there are minor changes required in terms
of how the socket is created.  I've made those changes, my socket is
successfully created, but when I connect, the server is unable to fork...
The error is blank as well - which is of course helping me allot to
determine what is going wrong...

Can someone possibly shed some light for me on this?

Here's the socket and forking code:
# Open socket and listen for new connections
my $Port563 = IO::Socket::SSL->new(LocalAddr   => "198.19.255.11",
   LocalPort   => "563", 
   Proto   => "TCP", 
   Reuse   => 1,
   Listen  => 128,
   SSL_cert_file   =>
"/srv/nntp/etc/cert.pem",
   SSL_key_file=>
"/srv/nntp/etc/key.pem",
   SSL_verify_mode => 0x01);
if (!$Port563) {
  SysLog('err', 'Server failed to start: ' . $@);
  die "Failed to create listening socket: " . $@ . "\n";
} else {
  binmode $Port563 => ":encoding(utf8)";
  SysLog('info', 'Server started: ' . $Port563->sockhost() . ':' .
$Port563->sockport());
}

# Drop privileges to normal user
drop_privileges('news');

# Wait for client connection and spawn new child
while (my $ClientSocket = $Port563->accept()) {
  my $Child;
  SysLog('err', 'Server failed to fork: ' . $!);
  die "Can't fork: $!" unless defined ($Child = fork());# Script errors
here.  $! contains empty string
  if ($Child == 0) {
$Port563->close;
&ClientConnection($ClientSocket);
undef $Childs{$Child};
exit 0;
  } else {
$Childs{$Child} = 1;
$ClientSocket->close();
  }
}


--
Chris.



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Mail::Sender with SSL

2012-08-16 Thread Jenda Krynicky
From: Chris Nehren 
> On Thu, Aug 16, 2012 at 00:05:56 +0200 , Jenda Krynicky wrote:
> > From: Chris Nehren 
> > > On Tue, Aug 07, 2012 at 17:38:57 + , Thomas Dean wrote:
> > > > Hi there,
> > > > 
> > > > I have succeeded in sending mail to my SMTP server with Mail::Sender
> > > > without SSL. But now I'm wondering how to do that with SSL, for example,
> > > > GMail. After reading the doc, I set TLS_required to 1 when I'm calling
> > > > Mail::Sender->new, but nohing works. I tried to debug the program but
> > > > found nothing different whether I turn TLS_required on or not.
> > > 
> > > You should look at Email::Sender::SMTP::TLS instead--it's the de facto,
> > > mature way of sending email through TLS SMTP servers with perl, and is
> > > actively supported. Mail::Sender reinvents a lot of wheels, poorly, as
> > > you are finding.
> > 
> > It reinvented a lot of wheels that were not available at the time it 
> > was written. The fact that there is a specific module now doesn't 
> > mean it had been available or working under the target operating 
> > systems always.
> 
> Email::Sender is still the right tool to use, and actually works. It
> probably sends more mail in a day than you ever will*. 

Having been the basis of the Hotmail service Mail::Sender sent more 
mail you ever will. By order of several magnitudes. Not sure what 
they use now, but they had been using Mail::Sender for several years 
as could have be seen in the mail headers. Several other similar 
services used or use the same module.

> As for
> your spurious "working under the target operating system always" claim,
> Email::Sender::Transport::SMTP::TLS has a flawless CPAN testers report
> card, visible here:
> http://www.cpantesters.org/distro/E/Email-Sender-Transport-SMTP-TLS.html#Email-Sender-Transport-SMTP-TLS-0.10

I can uninvent the wheels I had to invent back in the day because no 
wheels had been available back then or those that were available did 
not work under operating systems I had to support.

The first version of Email::Sender was released 2008-12-10, the first 
version of Mail::Sender was released sometime in 1998! That's ten 
years of CPAN growth!

> The SYNOPSIS provides all (or very nearly all) the code Thomas needs,
> with very little tweaking besides configuration. How can it possibly be
> easier?
> 
> This "use the old, bad tool because it's what the OP started with"
> approach leads only to pain and suffering.
> 
> 
> * having put it into production at a large ESP that handles thousands of
> per day, I'm pretty sure this is the case.

I'm incredibly impressed ...

Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Mail::Sender with SSL

2012-08-15 Thread Chris Nehren
On Thu, Aug 16, 2012 at 00:05:56 +0200 , Jenda Krynicky wrote:
> From: Chris Nehren 
> > On Tue, Aug 07, 2012 at 17:38:57 + , Thomas Dean wrote:
> > > Hi there,
> > > 
> > > I have succeeded in sending mail to my SMTP server with Mail::Sender
> > > without SSL. But now I'm wondering how to do that with SSL, for example,
> > > GMail. After reading the doc, I set TLS_required to 1 when I'm calling
> > > Mail::Sender->new, but nohing works. I tried to debug the program but
> > > found nothing different whether I turn TLS_required on or not.
> > 
> > You should look at Email::Sender::SMTP::TLS instead--it's the de facto,
> > mature way of sending email through TLS SMTP servers with perl, and is
> > actively supported. Mail::Sender reinvents a lot of wheels, poorly, as
> > you are finding.
> 
> It reinvented a lot of wheels that were not available at the time it 
> was written. The fact that there is a specific module now doesn't 
> mean it had been available or working under the target operating 
> systems always.

Email::Sender is still the right tool to use, and actually works. It
probably sends more mail in a day than you ever will*. As for
your spurious "working under the target operating system always" claim,
Email::Sender::Transport::SMTP::TLS has a flawless CPAN testers report
card, visible here:
http://www.cpantesters.org/distro/E/Email-Sender-Transport-SMTP-TLS.html#Email-Sender-Transport-SMTP-TLS-0.10
The SYNOPSIS provides all (or very nearly all) the code Thomas needs,
with very little tweaking besides configuration. How can it possibly be
easier?

This "use the old, bad tool because it's what the OP started with"
approach leads only to pain and suffering.


* having put it into production at a large ESP that handles thousands of
per day, I'm pretty sure this is the case.

-- 
Chris Nehren   | Coder, Sysadmin, Masochist
Shadowcat Systems Ltd. | http://shadowcat.co.uk/


pgpuC9o648JLO.pgp
Description: PGP signature


Re: Mail::Sender with SSL

2012-08-15 Thread Jenda Krynicky
From: Chris Nehren 
> On Tue, Aug 07, 2012 at 17:38:57 + , Thomas Dean wrote:
> > Hi there,
> > 
> > I have succeeded in sending mail to my SMTP server with Mail::Sender
> > without SSL. But now I'm wondering how to do that with SSL, for example,
> > GMail. After reading the doc, I set TLS_required to 1 when I'm calling
> > Mail::Sender->new, but nohing works. I tried to debug the program but
> > found nothing different whether I turn TLS_required on or not.
> 
> You should look at Email::Sender::SMTP::TLS instead--it's the de facto,
> mature way of sending email through TLS SMTP servers with perl, and is
> actively supported. Mail::Sender reinvents a lot of wheels, poorly, as
> you are finding.

It reinvented a lot of wheels that were not available at the time it 
was written. The fact that there is a specific module now doesn't 
mean it had been available or working under the target operating 
systems always.

Enough plesantries, Tom, what exactly did you try an how exactly did 
it fail?

Jenda


= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Mail::Sender with SSL

2012-08-07 Thread Jeff Pang



Also avoid the MIME::Lite suggestion posted, as that module is
deprecated and not recommended for new code due to the vagaries and odd
bugs in it--also due to the fact that it's not actively maintained or
developed any more and just receives an occasional bug fix.


what's the better module to handle MIME in today time? thanks.

--
http://liren188.taobao.com/

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Mail::Sender with SSL

2012-08-07 Thread Thomas Dean
On Tue, 2012-08-07 at 10:05 -0400, Chris Nehren wrote:
> On Tue, Aug 07, 2012 at 17:38:57 + , Thomas Dean wrote:
> > Hi there,
> > 
> > I have succeeded in sending mail to my SMTP server with Mail::Sender
> > without SSL. But now I'm wondering how to do that with SSL, for example,
> > GMail. After reading the doc, I set TLS_required to 1 when I'm calling
> > Mail::Sender->new, but nohing works. I tried to debug the program but
> > found nothing different whether I turn TLS_required on or not.
> 
> You should look at Email::Sender::SMTP::TLS instead--it's the de facto,
> mature way of sending email through TLS SMTP servers with perl, and is
> actively supported. Mail::Sender reinvents a lot of wheels, poorly, as
> you are finding.
> 
> Also avoid the MIME::Lite suggestion posted, as that module is
> deprecated and not recommended for new code due to the vagaries and odd
> bugs in it--also due to the fact that it's not actively maintained or
> developed any more and just receives an occasional bug fix.
> 

Great, thanks.

Thomas



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Mail::Sender with SSL

2012-08-07 Thread Chris Nehren
On Tue, Aug 07, 2012 at 17:38:57 + , Thomas Dean wrote:
> Hi there,
> 
> I have succeeded in sending mail to my SMTP server with Mail::Sender
> without SSL. But now I'm wondering how to do that with SSL, for example,
> GMail. After reading the doc, I set TLS_required to 1 when I'm calling
> Mail::Sender->new, but nohing works. I tried to debug the program but
> found nothing different whether I turn TLS_required on or not.

You should look at Email::Sender::SMTP::TLS instead--it's the de facto,
mature way of sending email through TLS SMTP servers with perl, and is
actively supported. Mail::Sender reinvents a lot of wheels, poorly, as
you are finding.

Also avoid the MIME::Lite suggestion posted, as that module is
deprecated and not recommended for new code due to the vagaries and odd
bugs in it--also due to the fact that it's not actively maintained or
developed any more and just receives an occasional bug fix.

-- 
Chris Nehren   | Coder, Sysadmin, Masochist
Shadowcat Systems Ltd. | http://shadowcat.co.uk/


pgpPiAnIglL4G.pgp
Description: PGP signature


Re: Mail::Sender with SSL

2012-08-07 Thread Jeff Pang



I have succeeded in sending mail to my SMTP server with Mail::Sender
without SSL. But now I'm wondering how to do that with SSL, for example,
GMail. After reading the doc, I set TLS_required to 1 when I'm calling
Mail::Sender->new, but nohing works. I tried to debug the program but
found nothing different whether I turn TLS_required on or not.

So how can I send mail with SSL?

BTW, I cannot sill tell SSL from TLS.


use MIME::Lite;
use MIME::Words qw(encode_mimewords);
use Net::SMTP::SSL;
BEGIN { @MIME::Lite::SMTP::ISA = qw(Net::SMTP::SSL); }

The others are almost the same as MIME::Lite.

--
http://liren188.taobao.com/

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Mail::Sender with SSL

2012-08-07 Thread Thomas Dean
Hi there,

I have succeeded in sending mail to my SMTP server with Mail::Sender
without SSL. But now I'm wondering how to do that with SSL, for example,
GMail. After reading the doc, I set TLS_required to 1 when I'm calling
Mail::Sender->new, but nohing works. I tried to debug the program but
found nothing different whether I turn TLS_required on or not.

So how can I send mail with SSL?

BTW, I cannot sill tell SSL from TLS.

Thomas


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: IO::Socket::SSL and SSL_verify_mode

2012-03-21 Thread ml
my error in my server script is 
Can't use an undefined value as a symbol reference at server.pl ligne
412

ligne 412 is
$flags = fcntl($socket, F_GETFL, 0)or die "Can't get flags for socket:
$!\n";

Please explain me clearly

Le jeudi 22 mars 2012 à 01:45 +0100, ml a écrit :
> and though I can walk to my client and server with 0x00
> when i put another value of 0x02 0x03 0x04 my script fails at the
> function
> #-
> # nonblock($socket) puts socket into nonblocking mode
> sub nonblock {
> my $socket = shift;
> my $flags;
> 
> 
> $flags = fcntl($socket, F_GETFL, 0)
> or die "Can't get flags for socket: $!\n";
> fcntl($socket, F_SETFL, $flags | O_NONBLOCK)
> or die "Can't make socket nonblocking: $!\n";
> }
> 
> 
> what my client server product that works only with 0x00
> 
> Le mercredi 21 mars 2012 à 17:33 -0700, Bob goolsby a écrit :
> > What was wrong with the answer you received on Perl Monks?
> > 
> > 
> > 
> > 
> > 2012/3/21 ml :
> > > hello list
> > > hello guru of perl
> > > hello all
> > >
> > >
> > > I seek to understand how to position the value SSL_verify_mode => 0x00.
> > >
> > >can you explain how to properly use this parameter in
> > >IO::Socket::SSL
> > >
> > > thank for reply
> > >
> > > sincerely
> > >
> > > --
> > > http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC2626742
> > >  gpg --keyserver pgp.mit.edu --recv-key C2626742
> > >
> > >  http://urlshort.eu fakessh @
> > >  http://gplus.to/sshfake
> > >  http://gplus.to/sshswilting
> > >  http://gplus.to/john.swilting
> > >  https://lists.fakessh.eu/mailman/
> > >  This list is moderated by me, but all applications will be accepted
> > >  provided they receive a note of presentation
> > 
> > 
> > 
> > -- 
> > 
> > Bob Goolsby
> > bob.gool...@gmail.com
> > 
> 

-- 
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC2626742
 gpg --keyserver pgp.mit.edu --recv-key C2626742

 http://urlshort.eu fakessh @
 http://gplus.to/sshfake
 http://gplus.to/sshswilting
 http://gplus.to/john.swilting
 https://lists.fakessh.eu/mailman/
 This list is moderated by me, but all applications will be accepted
 provided they receive a note of presentation


signature.asc
Description: Ceci est une partie de message numériquement signée


Re: IO::Socket::SSL and SSL_verify_mode

2012-03-21 Thread ml
and though I can walk to my client and server with 0x00
when i put another value of 0x02 0x03 0x04 my script fails at the
function
#-
# nonblock($socket) puts socket into nonblocking mode
sub nonblock {
my $socket = shift;
my $flags;


$flags = fcntl($socket, F_GETFL, 0)
or die "Can't get flags for socket: $!\n";
fcntl($socket, F_SETFL, $flags | O_NONBLOCK)
or die "Can't make socket nonblocking: $!\n";
}


what my client server product that works only with 0x00

Le mercredi 21 mars 2012 à 17:33 -0700, Bob goolsby a écrit :
> What was wrong with the answer you received on Perl Monks?
> 
> 
> 
> 
> 2012/3/21 ml :
> > hello list
> > hello guru of perl
> > hello all
> >
> >
> > I seek to understand how to position the value SSL_verify_mode => 0x00.
> >
> >can you explain how to properly use this parameter in
> >IO::Socket::SSL
> >
> > thank for reply
> >
> > sincerely
> >
> > --
> > http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC2626742
> >  gpg --keyserver pgp.mit.edu --recv-key C2626742
> >
> >  http://urlshort.eu fakessh @
> >  http://gplus.to/sshfake
> >  http://gplus.to/sshswilting
> >  http://gplus.to/john.swilting
> >  https://lists.fakessh.eu/mailman/
> >  This list is moderated by me, but all applications will be accepted
> >  provided they receive a note of presentation
> 
> 
> 
> -- 
> 
> Bob Goolsby
> bob.gool...@gmail.com
> 

-- 
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC2626742
 gpg --keyserver pgp.mit.edu --recv-key C2626742

 http://urlshort.eu fakessh @
 http://gplus.to/sshfake
 http://gplus.to/sshswilting
 http://gplus.to/john.swilting
 https://lists.fakessh.eu/mailman/
 This list is moderated by me, but all applications will be accepted
 provided they receive a note of presentation


signature.asc
Description: Ceci est une partie de message numériquement signée


Re: IO::Socket::SSL and SSL_verify_mode

2012-03-21 Thread Bob goolsby
What was wrong with the answer you received on Perl Monks?




2012/3/21 ml :
> hello list
> hello guru of perl
> hello all
>
>
> I seek to understand how to position the value SSL_verify_mode => 0x00.
>
>        can you explain how to properly use this parameter in
>        IO::Socket::SSL
>
> thank for reply
>
> sincerely
>
> --
> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC2626742
>  gpg --keyserver pgp.mit.edu --recv-key C2626742
>
>  http://urlshort.eu fakessh @
>  http://gplus.to/sshfake
>  http://gplus.to/sshswilting
>  http://gplus.to/john.swilting
>  https://lists.fakessh.eu/mailman/
>  This list is moderated by me, but all applications will be accepted
>  provided they receive a note of presentation



-- 

Bob Goolsby
bob.gool...@gmail.com

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




IO::Socket::SSL and SSL_verify_mode

2012-03-21 Thread ml
hello list
hello guru of perl
hello all


I seek to understand how to position the value SSL_verify_mode => 0x00. 

can you explain how to properly use this parameter in
IO::Socket::SSL

thank for reply

sincerely

-- 
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC2626742
 gpg --keyserver pgp.mit.edu --recv-key C2626742

 http://urlshort.eu fakessh @
 http://gplus.to/sshfake
 http://gplus.to/sshswilting
 http://gplus.to/john.swilting
 https://lists.fakessh.eu/mailman/
 This list is moderated by me, but all applications will be accepted
 provided they receive a note of presentation


signature.asc
Description: Ceci est une partie de message numériquement signée


Re: research for secure tchat client server use IO::Socket::SSL

2012-02-15 Thread ml

forgiveness for the bad presentation perl code see my post on PerlMonks

http://www.perlmonks.org/?node_id=954050


Le 2012-02-15 20:51, ml a écrit :

hi guys hi master of "Fu" any update

I am doing some research on the server and client for the chat. I 
have

long taken the trouble to consult the documentation that is different
and both PerlMonks different pages that deal with this vast subject. 
I
try to find a minimal example because I want to turn into non 
securise

securise. here is the status of my research

#!/usr/bin/perl
use warnings;
use strict;
use IO::Socket::SSL 'inet4';
use threads; use threads::shared; $|++;
print "$$ Server started\n";
# do a "top -p -H $$" to monitor server ++ threads
our @clients : shared; @clients = ();
my $server = new IO::Socket::SSL( Timeout   => 7200, Proto => 
"tcp",
LocalPort => 42000, Reuse => 1, Listen=> 3, SSL_use_cert => 
1,

SSL_verify_mode => 0x00, SSL_key_file=>
'/home/swilting/perltest/private/localhost.key' +, SSL_cert_file   =>
'/home/swilting/perltest/certs/localhost.cert', SSL_passwd_cb => sub
{ return "" },
);
my $num_of_client = -1;
while (1) { my $client;
do { $client = $server->accept; } until ( defined($client) );
my $peerhost = $client->peerhost();
print "accepted a client $client, $peerhost, id = ", 
++$num_of_client,

"\n";
my $fileno = fileno $client;
push (@clients, $fileno);
#spawn  a thread here for each client
my $thr = threads->new( \&processit, $client, $fileno, $peerhost )
+->detach(); }
# end of main thread
sub processit {
my ($lclient,$lfileno,$lpeer) = @_;
#local client
if($lclient->connected){
# Here you can do your stuff # I use have the server talk to the 
client

# via print $client and while(<$lclient>)
print $lclient "$lpeer->Welcome to server\n";
while(<$lclient>){
# print $lclient "$lpeer->$_\n";
print "clients-> @clients\n";
foreach my $fn (@clients) {
open my $fh, ">&=$fn" or warn $! and die;
print $fh  "$lpeer->$_"  } } }
#close filehandle before detached thread dies out
close( $lclient);
#remove multi-echo-clients from echo list
@clients = grep {$_ !~ $lfileno} @clients; }
__END__

#!/usr/bin/perl
use warnings; use strict; use Tk; use IO::Socket::SSL 'inet4';
require Tk::ROText;
#get id
my $name = shift || 'anon';
# create the socket
my $host = 'localhost'; my $port = 42000;
my $socket = IO::Socket::SSL->new( PeerAddr => $host, PeerPort => 
$port,

Proto=> 'tcp', SSL_use_cert => 1, SSL_verify_mode => 0x00,
SSL_key_file=> '/home/swilting/perltest/private/localhost.k +ey',
SSL_cert_file   => '/home/swilting/perltest/certs/localhost.cer +t',
SSL_passwd_cb => sub { return "" }, ); defined $socket or die "ERROR:
Can't connect to port $port on $host: $ +!\n";
print STDERR "Connected to server ...\n";
my $mw  = new MainWindow; my $log = $mw->Scrolled('ROText',
-scrollbars=>'ose', -height=> 5, -width=>45, -background =>
'lightyellow', )->pack;
my $txt = $mw->Entry( -background=>'white', )->pack(-fill=> 'x', 
-pady=>

5);
$mw ->bind('' => sub { $txt->Tk::focus });
$txt->bind('' => [\&broadcast, $socket]);
$mw ->fileevent($socket, readable => sub {
my $line = <$socket>; unless (defined $line) { $mw->fileevent($socket 
=>

readable => ''); return; } $log->insert(end => $line);
$log->see('end'); });
MainLoop;
sub broadcast { my ($ent, $sock) = @_;
my $text = $ent->get;
$ent->delete(qw/0 end/);
print $sock $name.'->'. $text, "\n"; }
__END__

#Server.pl
#!/usr/local/bin/perl
use strict; use warnings; use IO::Socket::SSL 'inet4';
my $server = IO::Socket::SSL->new( LocalPort=> 42000,
##   Type=>SOCK_STREAM,
Reuse=>1, Listen=>5, Proto=> 'tcp', SSL_use_cert => 1,
SSL_verify_mode => 0x00, SSL_key_file=>
'/home/swilting/perltest/private/localhost.key', SSL_cert_file   =>
'/home/swilting/perltest/certs/localhost.cert', SSL_passwd_cb => sub
{ return "" }, )or die ("Could not create server");
while(my $client=$server->accept()){ my $child_pid; unless(defined
($child_pid=fork())){die"can not fork\n";} if(defined($child_pid)){
while(my $line = <$client>){
print "CLIENT says:$line\n"; } }
else{ while(my $line = <>){
print $client "$line\n"; } } }
redo; close($server); <>;

the server running the threads fails with a segmentation fault and my
client fails after two requests I do not know why and characters
displayed on the client encodes are poorly I do not know either why


--
 http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC2626742
 gpg --keyserver pgp.mit.edu --recv-key C2626742

 http://urlshort.eu fakessh @
 http://gplus.to/sshfake
 http://gplus.to/sshswilting
 http://gplus.to/john.swilting
 https://lists.fakessh.eu/mailman/
 This list is moderated by me, but all applications will be accepted
 provided they receive a note of presentation

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




research for secure tchat client server use IO::Socket::SSL

2012-02-15 Thread ml

hi guys hi master of "Fu" any update

I am doing some research on the server and client for the chat. I have
long taken the trouble to consult the documentation that is different
and both PerlMonks different pages that deal with this vast subject. I
try to find a minimal example because I want to turn into non securise
securise. here is the status of my research

#!/usr/bin/perl 
use warnings; 
use strict; 
use IO::Socket::SSL 'inet4'; 
use threads; use threads::shared; $|++; 
print "$$ Server started\n";  
# do a "top -p -H $$" to monitor server ++ threads 
our @clients : shared; @clients = (); 
my $server = new IO::Socket::SSL( Timeout   => 7200, Proto => "tcp",
LocalPort => 42000, Reuse => 1, Listen=> 3, SSL_use_cert => 1,
SSL_verify_mode => 0x00, SSL_key_file=>
'/home/swilting/perltest/private/localhost.key' +, SSL_cert_file   =>
'/home/swilting/perltest/certs/localhost.cert', SSL_passwd_cb => sub
{ return "" }, 
); 
my $num_of_client = -1; 
while (1) { my $client; 
do { $client = $server->accept; } until ( defined($client) ); 
my $peerhost = $client->peerhost(); 
print "accepted a client $client, $peerhost, id = ", ++$num_of_client,
"\n"; 
my $fileno = fileno $client; 
push (@clients, $fileno); 
#spawn  a thread here for each client 
my $thr = threads->new( \&processit, $client, $fileno, $peerhost )
+->detach(); } 
# end of main thread 
sub processit { 
my ($lclient,$lfileno,$lpeer) = @_; 
#local client 
if($lclient->connected){ 
# Here you can do your stuff # I use have the server talk to the client
# via print $client and while(<$lclient>) 
print $lclient "$lpeer->Welcome to server\n";  
while(<$lclient>){ 
# print $lclient "$lpeer->$_\n"; 
print "clients-> @clients\n";   
foreach my $fn (@clients) { 
open my $fh, ">&=$fn" or warn $! and die; 
print $fh  "$lpeer->$_"  } } } 
#close filehandle before detached thread dies out 
close( $lclient); 
#remove multi-echo-clients from echo list 
@clients = grep {$_ !~ $lfileno} @clients; } 
__END__ 

#!/usr/bin/perl 
use warnings; use strict; use Tk; use IO::Socket::SSL 'inet4'; 
require Tk::ROText; 
#get id 
my $name = shift || 'anon'; 
# create the socket 
my $host = 'localhost'; my $port = 42000; 
my $socket = IO::Socket::SSL->new( PeerAddr => $host, PeerPort => $port,
Proto=> 'tcp', SSL_use_cert => 1, SSL_verify_mode => 0x00,
SSL_key_file=> '/home/swilting/perltest/private/localhost.k +ey',
SSL_cert_file   => '/home/swilting/perltest/certs/localhost.cer +t',
SSL_passwd_cb => sub { return "" }, ); defined $socket or die "ERROR:
Can't connect to port $port on $host: $ +!\n"; 
print STDERR "Connected to server ...\n"; 
my $mw  = new MainWindow; my $log = $mw->Scrolled('ROText',
-scrollbars=>'ose', -height=> 5, -width=>45, -background =>
'lightyellow', )->pack; 
my $txt = $mw->Entry( -background=>'white', )->pack(-fill=> 'x', -pady=>
5); 
$mw ->bind('' => sub { $txt->Tk::focus });
$txt->bind('' => [\&broadcast, $socket]); 
$mw ->fileevent($socket, readable => sub { 
my $line = <$socket>; unless (defined $line) { $mw->fileevent($socket =>
readable => ''); return; } $log->insert(end => $line);
$log->see('end'); }); 
MainLoop; 
sub broadcast { my ($ent, $sock) = @_; 
my $text = $ent->get; 
$ent->delete(qw/0 end/); 
print $sock $name.'->'. $text, "\n"; } 
__END__ 

#Server.pl 
#!/usr/local/bin/perl 
use strict; use warnings; use IO::Socket::SSL 'inet4'; 
my $server = IO::Socket::SSL->new( LocalPort=> 42000, 
##   Type=>SOCK_STREAM, 
Reuse=>1, Listen=>5, Proto=> 'tcp', SSL_use_cert => 1,
SSL_verify_mode => 0x00, SSL_key_file=>
'/home/swilting/perltest/private/localhost.key', SSL_cert_file   =>
'/home/swilting/perltest/certs/localhost.cert', SSL_passwd_cb => sub
{ return "" }, )or die ("Could not create server"); 
while(my $client=$server->accept()){ my $child_pid; unless(defined
($child_pid=fork())){die"can not fork\n";} if(defined($child_pid)){ 
while(my $line = <$client>){ 
print "CLIENT says:$line\n"; } }
else{ while(my $line = <>){ 
print $client "$line\n"; } } } 
redo; close($server); <>; 

the server running the threads fails with a segmentation fault and my
client fails after two requests I do not know why and characters
displayed on the client encodes are poorly I do not know either why



-- 
 http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC2626742
 gpg --keyserver pgp.mit.edu --recv-key C2626742

 http://urlshort.eu fakessh @
 http://gplus.to/sshfake
 http://gplus.to/sshswilting
 http://gplus.to/john.swilting
 https://lists.fakessh.eu/mailman/
 This list is moderated by me, but all applications will be accepted
 provided they receive a note of presentation


signature.asc
Description: Ceci est une partie de message	numériquement signée


using WWW::Mechanize thru proxy to https(SSL) with website/form authentication, proxy error!!

2011-11-22 Thread Rajeev Prasad
Here is the prob description in short:


1.    post your url in browser: https://myrel/files/file.doc
2.    you get a logon page (URL still looking same)
3.    enter field names:  username/password
4.    press 'ok' button (name = bsubmit)

    after successful login:
5.    you get new page:    https://myurl/pagSuccess/
6.    you have to click 'ok'  ( field name = successbtn ) on this page now to 
go back to where you wanted to go...
7.    then you get a firefox dialog: 
        where you have to select (radio button) 'Save File'
        press ok
8.    you are done!!! (saves the file to default location)



here is the script so far:


#!/usr/bin/perl

use strict;
use warnings;
use WWW::Mechanize;

#print "Content-type: text/html\n\n";

my $username = "myid";
my $password = "mypass";
my $outfile = "testout.doc";
$ENV{HTTPS_PROXY} = 'http://myproxy:8080';

my $mech = WWW::Mechanize->new(noproxy =>'0');

my $url = 'https://myurl/files/file.doc';

$mech->get($url);
$mech->form_name('frmLogin');
$mech->field(username => "$username");
$mech->field(password => "$password");
$mech->click('bsubmit');

$mech->click('successbtn');    # here i am hoping this will click the 'ok' 
button the next page

my $response = $mech->content();

open(OUTFILE, ">$outfile");
print OUTFILE "$response";
close(OUTFILE);


error i am getting:

Error GETing https://myurl/files/file.doc: proxy connect failed: PROXY ERROR 
HEADER, could be non-SSL URL:
HTTP/1.0 504 Gateway Time-out
Server: squid/
Date: 
Content-Type: text/html
Content-Length: 1117
X-Squid-Error: ERR_CONNECT_FAIL 238
...
...





but the following works thru SAME proxy(it fails to do any form based 
authentication i guess)???

#!/usr/bin/perl
use strict;
use warnings;
use LWP;

my $ua = LWP::UserAgent->new;
my $agent = "my-lwp agent";
$ua->agent($agent);
$ENV{HTTPS_PROXY} = 'http://myproxy:8080';
$ENV{HTTP_PROXY} = 'http://myproxy:8080';

my $req = HTTP::Request->new(GET => 'https://mail.yahoo.com');
$req->content_type('text/html');
$req->protocol('HTTP/1.0');

my $response = $ua->request($req);
 if ($response->is_success) {
 print "1 success\n";
 }
 else {
    print "1 error\n";
 }
print $response->status_line;


Re: Net::SSLeay with Socket or IO::Socket::SSL

2011-08-02 Thread m...@smtp.fakessh.eu
Le mercredi 3 août 2011 02:12, Uri Guttman a écrit :
> >>>>> "mfe" == ml@smtp fakessh eu  writes:
>
>   mfe> in the examples of Net::SSLeay, it shows various examples that
>   mfe> use low-level functions use Socket. what are the differences if
>   mfe> we re writing the examples with IO::Socket::SSL
>
>
> just use IO::Socket::SSL. then all the code is almost the same as when
> using IO::Socket. the only differences are adding in the cert info and
> minor other differences. there is plenty of stuff on how to code with
> plain sockets which also usually works well with IO::Socket. using low
> level Socket.pm calls is almost never needed and is clunky. a simple
> connect is just:
>
>   my $sock = IO::Socket::INET->new( 'host:port' ) ;
>
> with the Socket.pm api you would need a whole section of code for
> that. if you need more, the key/value api is easy to use and it easily
> modified to be IO::Socket::SSL.
>
> uri


I'm not much can be in perl Fu. but I can not run this example
that are present in the bundle IO::Socket::SSL

the server starts well but the client not starts well
The only changes I have made on the certificate and the key
key file and cert file are well present in the folder
# eg modification for exemple

if(!($sock = IO::Socket::SSL->new( PeerAddr => 'localhost',
   PeerPort => '8000',
   Proto=> 'tcp',
   SSL_use_cert => 1,
   SSL_verify_mode => 0x01,
   SSL_key_file=> 'key.txt',
   SSL_cert_file   => 'cert.txt',
   SSL_passwd_cb => sub { return "" },
 )))

I get the following error after starting the client
~]$ perl Desktop/IO-Socket-SSL-1.44/example/ssl_client.pl
unable to create socket: IO::Socket::INET6 configuration 
failederror::lib(0):func(0):reason(0)

all testimonials are welcome


-- 
 http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x092164A7
 gpg --keyserver pgp.mit.edu --recv-key 092164A7


pgpFP0RwKGota.pgp
Description: PGP signature


Re: Net::SSLeay with Socket or IO::Socket::SSL

2011-08-02 Thread Uri Guttman
>>>>> "mfe" == ml@smtp fakessh eu  writes:

  mfe> in the examples of Net::SSLeay, it shows various examples that
  mfe> use low-level functions use Socket. what are the differences if
  mfe> we re writing the examples with IO::Socket::SSL


just use IO::Socket::SSL. then all the code is almost the same as when
using IO::Socket. the only differences are adding in the cert info and
minor other differences. there is plenty of stuff on how to code with
plain sockets which also usually works well with IO::Socket. using low
level Socket.pm calls is almost never needed and is clunky. a simple
connect is just:

my $sock = IO::Socket::INET->new( 'host:port' ) ;

with the Socket.pm api you would need a whole section of code for
that. if you need more, the key/value api is easy to use and it easily
modified to be IO::Socket::SSL.

uri

-- 
Uri Guttman  --  uri AT perlhunter DOT com  ---  http://www.perlhunter.com --
  Perl Developer Recruiting and Placement Services  -
-  Perl Code Review, Architecture, Development, Training, Support ---

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Net::SSLeay with Socket or IO::Socket::SSL

2011-08-02 Thread m...@smtp.fakessh.eu
hi folks
hi guru of perl

in the examples of Net::SSLeay, it shows various examples that use low-level 
functions use Socket. what are the differences if we re writing the examples 
with IO::Socket::SSL

all testimonials are welcome

-- 
 http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x092164A7
 gpg --keyserver pgp.mit.edu --recv-key 092164A7


pgpDNt4qWRP4w.pgp
Description: PGP signature


RE: Get result of a https page with SSL after login.

2010-03-30 Thread Bob McConnell
From: chew23

> To automate my work i have to get a html page by my company site after
a 
> login in an secure area.
> After a long googling job, I decided to use WWW:Selenium to do this.
> It seems to be bugged and i would ask to you if there is e clear
method 
> to do this.

I believe the first step is to go to the Selenium home site and get an
updated copy of Selenium.pm. (Last I checked they hadn't posted recent
updates to CPAN.)

You might also want to look over my wiki page about SeRC and Perl at
. You are
welcome to modify or add to it.

The other option is their Google group at
.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Get result of a https page with SSL after login.

2010-03-30 Thread chew23

Hi all,
 just my first technical post on this list.
To automate my work i have to get a html page by my company site after a 
login in an secure area.

After a long googling job, I decided to use WWW:Selenium to do this.
It seems to be bugged and i would ask to you if there is e clear method 
to do this.


Many thanks in advance.

There is my code:

 CODE 

#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;

#system ('/usr/bin/selenium-server &');

my $line = '';
my $users_file = "config_user.cfg" ;

open ( USERS , "$users_file" ) or die "Unable to open file: 
$users_file\n $!\n";



my $string = "";
## Perl trim function to remove whitespace from the start and end of the 
string

sub trim($) {
$string = shift;
$string =~ s/.*\>(.*?)\<.*/$1/ ;
return $string;
}

my $sel = Test::WWW::Selenium->new( host => "localhost",
port => ,
browser => "*firefox",
browser_url => 
"http://webmail.sorint.it/"; );


$sel->open_ok("http://x";);
$sel->title_is("Sun Java System Access Manager (Login)");
$sel->type_ok("IDToken1", "x");
$sel->type_ok("IDToken2", "x");
$sel->click_ok("Login.Submit");
$sel->wait_for_page_to_load_ok("3");
$sel->title_is("");
$sel->open_ok('https://x/http://its-cslpsr-01.sorint.it/nextstage/jsp/index.jsp');

my $i = "";

while ($i = ) {
my $field1 = "";
my $field2 = "";
my $field3 = "";
my $line = "$i";
($field1,$field2,$field3) = split ';', $line;
print "$field1\t"."$field2\t"."$field3\n";

my $compurl0 = 
'https://x/http://its-cslpsr-01.xx.it/nextstage/contratti/resoconto/RiepilogoOre.jsp?matricola='."$field2".'&mese_m=mar&anno_a=2010&tipo=';
my $compurl1 = 
'https://x/http://its-cslpsr-01.xx.it/nextstage/contratti/resoconto/RiepilogoOreCommercio.jsp?matricola='."$field2".'&mese_m=mar&anno_a=2010&tipo=';


if ( $field1 == 0 ) {
print "Il campo di controllo è 0 e quindi uso la stringa:\n 
$compurl0";

$sel->open_ok("$compurl0");
$sel->wait_for_page_to_load_ok("3");
sleep 30;
} else {
print "Il campo di controllo è 1 e quindi uso la stringai:\n 
$compurl1";

$sel->open_ok("$compurl1");
$sel->wait_for_page_to_load_ok("3");
sleep 30;
}

my $outfile = "out-$field2.htm";
my $output_page = $sel->get_html_source;
open(OUTFILE, ">$outfile");
print OUTFILE "$output_page";
close(OUTFILE);

open ( FILE , "$outfile" ) or die "Cannot open file: $outfile - $! \n";
open ( LINES , ">data-$field2.txt" ) or die "Cannot open file: 
data-$field2.txt - $! \n";
open ( PIPPO , ">original-$field2.txt" ) or die "Cannot open file 
original-$field2.txt: $! \n";

my $counter = 0;
my $row = "";
while ($row = ) {
$counter++;
if ($row =~ /$line/) {
$a = trim($row);
open ( LINES , ">>data-$field2.txt" ) or die "Cannot 
open file data-$field2.txt: $! \n";
open ( PIPPO , ">>original-$field2.txt" ) or die 
"Cannot open file original-$field2.txt: $! \n";

print PIPPO "$row";
print LINES "$a";
close LINES;
close PIPPO;
}
}
close FILE;
close LINES;
}
close USERS;
exit;


--
go ahead... be a heretic!

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Send mail using SSL

2010-01-12 Thread Gurunandan R. Bhat

Look up the documentation for Email::Sender::Manual::QuickStart. It has
a nice example for a MIME::Entity with an attachment.

Regards


On Tue, 2010-01-12 at 16:11 +0800, Thomas Yan wrote: 
> Thanks. But I can't find how to send attachment using Email::Sender on CPAN. 
> Or maybe I am not careful enough to find it.
> 
> Is there any module easy to send attachments over ssl?
> 
> -Original Message-
> From: Gurunandan R. Bhat [mailto:g...@dygnos.com] 
> Sent: Tuesday, January 12, 2010 2:52 PM
> To: Thomas Yan
> Cc: beginners@perl.org
> Subject: Re: Send mail using SSL
> 
> 
> Use Email::Sender::Transport::SMTP 
> 
> 
> > a
> > I want to send mail using ssl with smtp server. Does Mail::Sender support
> > SSL? Or must I use Net::Smtp::SSL ?
> > 
> > Regards,
> > Thomas.
> > 
> > 
> 
> 
> 




-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Send mail using SSL

2010-01-12 Thread Thomas Yan
Thanks. But I can't find how to send attachment using Email::Sender on CPAN. Or 
maybe I am not careful enough to find it.

Is there any module easy to send attachments over ssl?

-Original Message-
From: Gurunandan R. Bhat [mailto:g...@dygnos.com] 
Sent: Tuesday, January 12, 2010 2:52 PM
To: Thomas Yan
Cc: beginners@perl.org
Subject: Re: Send mail using SSL


Use Email::Sender::Transport::SMTP 


> a
> I want to send mail using ssl with smtp server. Does Mail::Sender support
> SSL? Or must I use Net::Smtp::SSL ?
> 
> Regards,
> Thomas.
> 
> 




-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Send mail using SSL

2010-01-11 Thread Gurunandan R. Bhat

Use Email::Sender::Transport::SMTP 


> a
> I want to send mail using ssl with smtp server. Does Mail::Sender support
> SSL? Or must I use Net::Smtp::SSL ?
> 
> Regards,
> Thomas.
> 
> 




Send mail using SSL

2010-01-11 Thread Thomas Yan
Hi,

I want to send mail using ssl with smtp server. Does Mail::Sender support
SSL? Or must I use Net::Smtp::SSL ?

Regards,
Thomas.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




SSL decrypt

2009-04-14 Thread Luis Daniel Lucio Quiroz
Hi Camels,

I wonder to know if there is a perl module that let me to decrypt ssl traffic 
(if I have already private key), like ssldump or tshark does.

Best regards,

LD

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: What SSL version does LWP use?

2009-02-18 Thread Jim Gibson
On 2/18/09 Wed  Feb 18, 2009  12:06 PM, "David Shere"
 scribbled:

> Either I'm blind or the LWP package documentation at
> http://search.cpan.org/~gaas/libwww-perl-5.825/lib/LWP.pm doesn't say
> what SSL standard it uses, or if it can use more than one.
> 
> I recently received notice that I must "update any applications or
> integrations that may be using the SSL 2.0 protocol to support the more
> current SSL 3.0/TLS 1.0 protocols" and I can't figure out if I'm using
> 2.0 now, or 3.0 now, or if I even need to worry about this.
> 

This might help:

<http://cpansearch.perl.org/src/GAAS/libwww-perl-5.825/README.SSL>:

SSL SUPPORT
---

The libwww-perl package has support for using SSL/TLSv1 with its HTTP
client and server classes. This support makes it possible to access
https schemed URLs with LWP. Because of the problematic status of
encryption software in general and certain encryption algorithms in
particular, in several countries, libwww-perl package doesn't include
SSL functionality out-of-the-box.

Encryption support is obtained through the use of Crypt::SSLeay or
IO::Socket::SSL, which can both be found from CPAN. While libwww-perl
has "plug-and-play" support for both of these modules (as of v5.45),
the recommended module to use is Crypt::SSLeay. In addition to
bringing SSL support to the LWP package, IO::Socket::SSL can be used
as an object oriented interface to SSL encrypted network sockets.

There is yet another SSL interface for perl called Net::SSLeay. It has
a more complete SSL interface and can be used for web client
programming among other things but doesn't directly support LWP.

The underlying SSL support in all of these modules is based on OpenSSL
<http://www.openssl.org/> (formerly SSLeay). For WWW-server side SSL
support (e.g. CGI/FCGI scripts) in Apache see <http://www.modssl.org/>.



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




What SSL version does LWP use?

2009-02-18 Thread David Shere
Either I'm blind or the LWP package documentation at
http://search.cpan.org/~gaas/libwww-perl-5.825/lib/LWP.pm doesn't say
what SSL standard it uses, or if it can use more than one.

I recently received notice that I must "update any applications or
integrations that may be using the SSL 2.0 protocol to support the more
current SSL 3.0/TLS 1.0 protocols" and I can't figure out if I'm using
2.0 now, or 3.0 now, or if I even need to worry about this.  


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




How to get the SSL cert from a IMAP-Server?

2008-07-01 Thread Michelle Konzack

*   Do not Cc: me, because I READ THIS LIST, if I write here   *
*Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe*


Hello,

I am using Debian GNU/Linux (Stable/Etch) and I  have  a  small  program
which has a config option to retrive a SSL certificate of a IMAP server.

The question is, HOW should I ask the IMAP server from a script to send
me the certificate?

And of course, which module do I need?

In Debian I have following Packages:

[ command 'apt-cache search imap |grep perl' ]--
libimap-admin-perl - Administer IMAP servers
libmail-imapclient-perl - Perl library for manipulating IMAP mail stores
libnet-imap-perl - A client interface to IMAP (Internet Message Access Protocol)
libnet-imap-simple-perl - Perl extension for simple IMAP account handling
libnet-imap-simple-ssl-perl - Subclass of Net::IMAP::Simple with SSL support


I asume that I need "libnet-imap-perl" or "libnet-imap-simple-ssl-perl".

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
+49/177/935194750, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


LWP useragent and SSL

2007-05-09 Thread Tom Allison
I recently started using LWP::UserAgent to access some HTTPS sites  
and ran into a problem that doesn't easily present a solution.


I have one site that I can connect to and use with great success  
using HTTPS.
I have another where the site owner gave me a certificate on file to  
use for authentication and encryption to that site.

I can't get it to work.

It appears that the SSL layer just balks at the use of the certificate.

Right now I'm wondering if there is anyone who has experience with  
this or knows someplace that I can try.

I'm using Crypt::SSLeay as the SSL part.

help?

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




LWP w/ ssl post problem

2005-12-09 Thread BJ
I am trying to get data from a webpage that I need to log into  via a 
ssl html form. When I try, all I get is the login page html.  I have 
Crypt:SSLeay (I forget the exact module) installed. Am I doing something 
fundamentally wrong here? I would appreciate any help I could get. Thank 
you very much! ~Erithid


Snippit from html form:






my perl code:

use LWP 5.64;
use HTTP::Cookies;
my $browser = LWP::UserAgent->new(agent =>
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461)' ,
'cookie_jar' => {file => "lwpcookies.txt", autosave => 1,ignore_discard 
=> 1}
);

my $id = 'user';
my $pass= 'pass';
 
 my $url = 'https://site.com/login.aspx';

 my $response = $browser->post( $url,
   [ 'txtLoginName' =>$id, 
 'txtPassword'=>$pass,

 'cmdLogin'=>'Login',
   ]
 );
my $mystring = $response->content;
open(OUT,">webtest.txt");
print OUT $mystring;
close OUT;






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Net::POP3 & SSL?

2005-04-06 Thread David Garamond
How do I use Net::POP3 (or is there an alternative to Net::POP3) to talk 
to an SSL POP3 server (like gmail's)?

Regards,
dave
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Net::FTP::SSL ?

2004-12-06 Thread JupiterHost.Net

Kelvin Wu wrote:
Hello Perl,
Hello,
Perl is busy right now, I'm Lee ;p
I am looking for a Perl module which is used to access FTPd via SSL,
Auth TLS. Is there something called Net::FTP::SSL or others?
A quick search on search.cpan.org brought this up:
 http://search.cpan.org/~drolsky/Net-SFTP-0.08/lib/Net/SFTP.pm
HTH :)
Lee.M - JupiterHost.Net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Net::FTP::SSL ?

2004-12-06 Thread Kelvin Wu
Hello Perl,

I am looking for a Perl module which is used to access FTPd via SSL,
Auth TLS. Is there something called Net::FTP::SSL or others?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: using SSL unable to write file

2003-12-29 Thread Dan Muey
> Hi everyone,

Howdy

> 
> I'm trying to send info with (https) SSL and my program comes 
> to a halt when 
> writing a file and sending an email.
> 
> SSL was set up by my hosting service with an unauthenticated 
> certificate that 
> I had them set up for demo purposes.  Does this have 
> something to do with it? 
> Or is it a security problem unrelated to the fact that it's 
> in demo mode?  

Well since there's lots going on it will help you to find out where it's failing.
Try doing it in steps:
Via https try:
1) Printing a simple hello world type script
2) add the file writing part
3) add the emailing part

And use strict, warnings and perhaps  
use CGI::Carp qw(fatalsToBrowser);

Also any logs may be very helpful for you.

HTH
DMuey
> 
> I'm trying to learn more about SSL.  Does anyone have some good leads?
> 
> Thanks!
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




using SSL unable to write file

2003-12-26 Thread Motherofperls
Hi everyone,

I'm trying to send info with (https) SSL and my program comes to a halt when 
writing a file and sending an email.

SSL was set up by my hosting service with an unauthenticated certificate that 
I had them set up for demo purposes.  Does this have something to do with it? 
Or is it a security problem unrelated to the fact that it's in demo mode?  

I'm trying to learn more about SSL.  Does anyone have some good leads?

Thanks!


Re: opening SSL, security, (authorize.net)

2003-07-14 Thread Wiggins d'Anconia
mario kulka wrote:
Did enyone have to create a script to process credit cards using the AIM 
method through the AuthorizeNet gateway? I'm a little bit lost. There 
are few things I must do and never done before:
[e.g. open a SSL connection between my hosting server and their gateway 
and then post the data (credit card number, name, etc..) using a script.]

I used HTML forms to post data but never a script. Also, what about the 
safety concern of the following scenario:
1. My site displays a form to gather credit card info
2. Then posts to my script
3. My script sends that data and the transaction key (password) to their 
file for processing.

Q: What if someone just looks up the source of my form and submits their 
own data to step 2 ? My script would still process everything and send 
it all to step 3?
I know I could create a digest through MD5 based on let's say 
amount+secret_word and pass it as hidden to the form. Then my script in 
step 2 could verify if the data is valid or if someone tried to send 
their own stuff, but in that case what's the use of the transaction key 
as the security parameter?

Haven't used the service personally, but you might want to have a look at:

http://search.cpan.org/author/IVAN/Business-OnlinePayment-AuthorizeNet-3.12/AuthorizeNet.pm

Might help answer your questions and provide code that you then wouldn't 
need to write. Always nice when there is already a wheel...

http://danconia.org

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


opening SSL, security, (authorize.net)

2003-07-14 Thread mario kulka
Did enyone have to create a script to process credit cards using the AIM 
method through the AuthorizeNet gateway? I'm a little bit lost. There are 
few things I must do and never done before:
[e.g. open a SSL connection between my hosting server and their gateway and 
then post the data (credit card number, name, etc..) using a script.]

I used HTML forms to post data but never a script. Also, what about the 
safety concern of the following scenario:
1. My site displays a form to gather credit card info
2. Then posts to my script
3. My script sends that data and the transaction key (password) to their 
file for processing.

Q: What if someone just looks up the source of my form and submits their own 
data to step 2 ? My script would still process everything and send it all to 
step 3?
I know I could create a digest through MD5 based on let's say 
amount+secret_word and pass it as hidden to the form. Then my script in step 
2 could verify if the data is valid or if someone tried to send their own 
stuff, but in that case what's the use of the transaction key as the 
security parameter?

Mariusz

_
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: SSL

2003-02-20 Thread Rob Dixon
Randal L. Schwartz wrote:
> > > > > > "Hytham" == Hytham Shehab <[EMAIL PROTECTED]> writes:
>
> Hytham> hi guys,
> Hytham> If someone want some interaction with the web, he might
> use LWP and Hytham> WWW::Mechanize, thats good, but thats not good if
> he wants to work with SSL. Hytham> how can i integrate my script with
> SSL?
>
> https works just fine with LWP.

LWP needs Net::SSL in addition before it can support https. It can be
found in the Crypt-SSLeay package.

HTH,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: SSL

2003-02-19 Thread Randal L. Schwartz
>>>>> "Hytham" == Hytham Shehab <[EMAIL PROTECTED]> writes:

Hytham> hi guys,
Hytham> If someone want some interaction with the web, he might use LWP and
Hytham> WWW::Mechanize, thats good, but thats not good if he wants to work with SSL.
Hytham> how can i integrate my script with SSL?

https works just fine with LWP.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




SSL

2003-02-19 Thread Hytham Shehab
hi guys,
If someone want some interaction with the web, he might use LWP and
WWW::Mechanize, thats good, but thats not good if he wants to work with SSL.
how can i integrate my script with SSL?

thx.
--
Hytham Shehab



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Mail::IMAPClient with SSL

2003-01-18 Thread Rob Dixon
Hi Pete.

Pete Emerson wrote:
> I'm trying to get Mail::IMAPClient working with SSL. I can get it
> working
> fine without SSL. Here's my attempt:
>
> # assume $server, $port, $username, $password are defined correctly
> my $ssl = IO::Socket::SSL->new(Proto=>'tcp',
>SSL_verify_mod=>0x00,
>PeerAddr=>$server,
>PeerPort=>$port);
> my $imap = Mail::IMAPClient->new(Socket=>$ssl,User=>$username,
> Password =>$password);

I think that if you do this (presumably you've already made your SSL
connection) you have to change the client's state yourself to Connected
with the State method. Try

$imap->State ($imap->Connected);

> $imap->login();
> foreach ($imap->subscribed()) {
> print $imap->message_count($_), " messages in ", $_, "\n";
> }
> $imap->close();
>
> and it moans that I'm not connected on the $imap->login() line.
> Can anyone help me make it go? Thanks in advance.

I hope this helps. It's an age since I used IMAP.

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Mail::IMAPClient with SSL

2003-01-18 Thread Pete Emerson
I'm trying to get Mail::IMAPClient working with SSL. I can get it working 
fine without SSL. Here's my attempt:

# assume $server, $port, $username, $password are defined correctly
my $ssl = IO::Socket::SSL->new(Proto=>'tcp',
   SSL_verify_mod=>0x00,
   PeerAddr=>$server,
   PeerPort=>$port);
my $imap = Mail::IMAPClient->new(Socket=>$ssl,User=>$username, Password =>$password);
$imap->login();
foreach ($imap->subscribed()) {
print $imap->message_count($_), " messages in ", $_, "\n";
}
$imap->close();

and it moans that I'm not connected on the $imap->login() line.
Can anyone help me make it go? Thanks in advance.

Pete


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Perl with SSL

2002-11-21 Thread Pankaj
Any idea if we can use perl /perlldap with SSL. 





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




How to get SSL enabled pages using https?

2002-04-19 Thread Sane, Jayant


Newbie question.

I am having trouble getting ssl enabled pages/uri using the
user-agent/request object. I checked the documentation and it says it is
supposed to work w/o requiring to do anything special/more (just as http).
Here is excerpt of the test code I am trying:

use LWP::UserAgent;
use URI::URL;
use HTTP::Headers;
use HTTP::Request;
use Time::gmtime;
#use Time::HiRes qw(gettimeofday);
use HTTP::Request::Common;
use HTTP::Cookies;

# Create the user agent that will act as the browser
$ua = LWP::UserAgent->new;
$ua->cookie_jar(HTTP::Cookies->new());

my $request = GET( "https://Server-Dns-Name/SSLTest/default.htm"; );
my $response = $ua->request($request);

if ( $response->code() != 200 )
# error
#elsif 
#success.

The above get request fails with an http status code of 501 - I took a
network sniff and it does'nt even attempt sending out the request or
anything at all on the wire. That apart, if I am reading the documentation
correctly, the above request should succeed unless you set the
"If-SSL-Cert-Subject" header to something and expect only that certificate
which I am not setting. Meaning if I was to think that it do not like the
certificate because it is un-trusted etc..
At one pt I thought it was perhaps a bug in ActivePerl impl (5.6.1) that I
have on my box but it fails with one other perl implementation also.

The above thing works fine when I get plain http urls. 

Any ideas what I am missing? 

TIA,
-Jayant


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




SSL and IMAP

2002-03-28 Thread Pete Emerson

I'm using Mail::IMAPClient to write a mail filter via IMAP.
I'd like to connect to the server using SSL.
The instructions in the man page don't help me:

$imap=Mail::IMAPClient->new(User => $user, Password => $pass, Server =>
$host);
# blah blah blah (doc's blah blah blah, not mine!)
$imap->Socket($ssl);

Can someone give me a pointer in the right direction? I assume I need to
also use an SSL module (IO-Socket-SSL?), but some pointers to fill in
that # blah blah blah would be terrific.

Also, if there's a better module than Mail::IMAPClient to do IMAP and
SSL, that would be great, too.

Pete

-- 
Those responsible for the signature have been sacked.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: SSL and HTTPS

2002-01-29 Thread Jon Molin

You have the best(tm) webserver out there: www.apache.org, you can add
mod_ssl to it and there you go. 
An alternative could be http://www.apache-ssl.org/ (not the same as
apache with mod_ssl)

/Jon




Gary Hawkins wrote:
> 
> CommerceSQL uses Perl and needs https, secure server.  I already asked this on
> their list with no reply.  I don't know the first thing about secure servers.
> Can somebody point me in the general direction of how to set one up on NT4?
> Thx,
> 
> /g
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




SSL and HTTPS

2002-01-28 Thread Gary Hawkins

CommerceSQL uses Perl and needs https, secure server.  I already asked this on
their list with no reply.  I don't know the first thing about secure servers.
Can somebody point me in the general direction of how to set one up on NT4?
Thx,

/g



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




IMAP via SSL

2002-01-09 Thread Pete Emerson

I'm using Mail::IMAPClient to get at my mailbox:

my $imap = Mail::IMAPClient->new(Server=>'my.mail.server', User=>'username', Password 
=> 'password');
my $messages=$imap->unseen_count('INBOX');
print "$messages\n";

Does anybody have tips as to how to get this to work via SSL?
I'm guessing I need to use Mail::IMAPClient's Socket() function,
but I think maybe I need a different module (IO-Socket-SSL???) to
help me out. Any pointers would be appreciated. Maybe there's a module
to do IMAP via SSL?
Pete

--
Mynd you, møøse bites Kan be pretty nasti...




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




SSL script troubles

2001-06-22 Thread K Old

Hello,

I cannot get the following script using Net::SSLeay and OpenSSL to work 
correctly.

I would really like to print what post_https is sending to the screen before 
it is sent to the SSL server.

Any ideas?

#!/usr/local/bin/perl
#
# CHANGE THE ABOVE TO POINT TO PERL 5.004 ON YOUR SERVER.
# Usually either /usr/local/bin or /usr/bin/perl
# Ask your hosting service or
# via telenet enter: whereis perl

# Flush Perl buffers so output is sent directly to browser.
#
  $| = 1;

# Tell the browser what is coming.
#
print "Content-type: text/html\n\n";

#
# Net_SSLeay-to-AuthorizeNet_v3.0_transact_dll_interface.cgi.
#
# NOTE: This script is written to be run via http not telenet!
# Example: Via a web browser enter:
# http://www.your-domain.com/cgi-bin/this-files-name.cgi
#
# Copyright 08.07.1999 by Doc Webb, [EMAIL PROTECTED]
# All rights reserved.
#
# This is ONLY a SAMPLE script to show how to send data to
# AuthorizeNet, receive a reply back and parse the results.
# What you do with the parsed results is up to you. This is NOT
# meant to be a an entire transaction processing script!
#
# Before attempting to use this check ALL your setting at AuthorizeNet
# to make sure you have no conflicting setting. Also do NOT set any
# fields as required in your AuthorizeNet setting. Instead do that
# via your own scripting. Also you do need to set your AuthorizeNet
# account to test mode while running this script. This script has
# a form field to set your account to test mode when it runs.
# Your account then swithes back to live mode automatically
# for all other transactions not processed by this test script.
#
# This version varies only slightly from authrequest.asp version.
# It directs the data to;
# $host = "secure.authorize.net";
# $script = "/gateway/transact.dll
# instead of
# $host = "www.authorize.net";
# $script = "/scripts/authnet25/AuthRequest.asp";
#
# It also uses transact.dll v3.0 form field names in stead of
# authrequest.asp field names.
#
# I also used a slighlty different method of stuffing the data to sent
# but it does exactlty the same thing.
#
# SOME help is available via e-mail SOMETIMES from [EMAIL PROTECTED]
#
# This script has been tested on a UNIX box running OpenBSD/i386 2.5
#
# Prerequisites:
#
# Hosting server must have installed;
#a- Perl v5.004
#b- SSLeay v0.9.0 or OpenSSL v0.9.1c, http://www.openssl.org,
#   nothing earlier works and no gurantee anything later works either.
#c- Net::SSLeay v1.03, 4.1.1999, Sampo Kellomaki <[EMAIL PROTECTED]>
#
# Sorry I can't guarantee this will work with anything except the above!
# Use at your own risk!
#
# If your hosting service doesn't have the above installed or is unwilling
# to install it come see us at www.e-business-hosting.com where we already
# have all the above installed AND we provide you with a working copy of
# this script already installed so all you have to do is add your products
# via the manager.cgi and start selling.
#
###

## EDIT THESE LINES ##

$login = "testdrive";
# No password required by v3.0 transact.dll.

# Set these to your specific needs.
# See AuthorizeNet's v3.0 transact.dll documentation!
#
$adc_delim_data = "TRUE";
$adc_url= "FALSE";
$authorization_type = "AUTH_CAPTURE";
$an_version = "3.0";

# Simulate the basic required form data.
#
# Your form field name  Form field value entered by client.
#
$form_data{'first_name'} = "John";
$form_data{'last_name'}  = "Doe";
$form_data{'payment_method'} = "CC";
$form_data{'card_num'}   = "400700027";
$form_data{'expiration_date'}= "1101";
$form_data{'charge_amount'}  = "49.95";

# NOTE: There are various test card numbers available.
# By using a specific card number and a specific amount
# while in test mode you can force v3.0 transact.dll to return
# various error messages to your script for testing purposes.
# If you get an error message while in test mode make sure you
# did not inadvertently use a test card and amount that was
# intended to produce an error message.

# If Net::SSLeay is installed as a local module uncomment the following
# line and edit it to point to the directory just above your Net 
directory.
# In this example line Net::SSLeay was installed locally and the 
SSLeay.PM
# file in my "/usr/local/lib/perl5/site_perl/Net" directory.
#
use lib '/usr/local/lib/perl5/site_perl';

## DO NOT CHANGE ANYTHING BELOW HERE UNLESS YOU KNOW WHAT YOUR 

RE: problems following a refresh meta tag using LWP and open SSL (2ed request)

2001-06-05 Thread Hill, Ronald

[snipped]
> URL=https://mn1-gx6-ib.banking.wellsfargo.com/cgi-bin/session.
> cgi?sessargs=e
> 
> I think your answer is here.
> The refresh data is passed as headers.
> Just parse the URL field out of the header and do a new request.
> 
> Hope this is what you meant.
> 
> Maarten.

Hi Maarten,

Thanks for the reply, I have tried that using:

if ( my $refresh = $req->header("Refresh") ) {

( undef, $final_req ) = split ( /=/, $req->header("Refresh") );

$req =
  $ua->request( POST $final_req,
  { userid =>$ARGV[0], password =>$ARGV[1], 'Account Summary' =>
'ACCT_SUMMARY'  } 
  );
 
}

and I receive a web page that states: unable to process the request, what
should have been displayed is the account information. It seems that I am
unable to form a proper request. During the execution of the script I will
see many redirects. I have no idea what to respond with. 
However, If there was a way to have the useragent handle the refresh (
automatically do the refresh) then the request would be correct. 
Any Ideas?

thanks

Ron



Re: problems following a refresh meta tag using LWP and open SSL (2ed request)

2001-06-05 Thread M.W. Koskamp


- Original Message -
From: Hill, Ronald <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 05, 2001 7:07 PM
Subject: problems following a refresh meta tag using LWP and open SSL (2ed
request)


> Hello All,
>
> I am trying to connect to the Wells Fargo online bank using the LWP and
open
> SSL modules and am having trouble getting past the  Authenticating User
> screen. I was hopeing for a way to have the LWP useragent  follow  the
> refreash meta tag the same way it does for a redirect. Does anyone know of
a
> way to accomplish this? Can anyone help me with this?
>
> Thanks
>
> Ron
(...)
> HTTP/1.1 200 OK
> Date: Fri, 01 Jun 2001 13:52:48 GMT
> Pragma: no-cache
> Server: Netscape-Enterprise/3.6 SP2
(...)

> Refresh: 1;
>
URL=https://mn1-gx6-ib.banking.wellsfargo.com/cgi-bin/session.cgi?sessargs=e

I think your answer is here.
The refresh data is passed as headers.
Just parse the URL field out of the header and do a new request.

Hope this is what you meant.

Maarten.

(...)




problems following a refresh meta tag using LWP and open SSL (2ed request)

2001-06-05 Thread Hill, Ronald

Hello All,

I am trying to connect to the Wells Fargo online bank using the LWP and open
SSL modules and am having trouble getting past the  Authenticating User
screen. I was hopeing for a way to have the LWP useragent  follow  the
refreash meta tag the same way it does for a redirect. Does anyone know of a
way to accomplish this? Can anyone help me with this?

Thanks

Ron

here is the script:
 #!/usr/bin/perl -w
use HTTP::Request::Common;
use HTML::Form;
use LWP::UserAgent;
use HTTP::Response;
#use LWP::Debug qw(+);
BEGIN {
local $^W = 0;
*LWP::UserAgent::redirect_ok = sub {1}
}
use HTTP::Cookies;
use strict;

my $ua = LWP::UserAgent->new;

$ua->cookie_jar(
  HTTP::Cookies->new(
autosave => 1 )
);
my $savefile = 'c:/temp/checkingpage.txt';
$ua->agent('Mozilla/4.73');

my $req  = $ua->request( POST 'https://banking.wellsfargo.com' );
my $form = HTML::Form->parse( $req->content, $req->base());
$form->value( 'userid',   "$ARGV[0]" );
$form->value( 'password', "$ARGV[1]" );

$req = $ua->request( $form->click('Account Summary') );

print $req->as_string;

here is the output of the script:

HTTP/1.1 200 OK
Date: Fri, 01 Jun 2001 13:52:48 GMT
Pragma: no-cache
Server: Netscape-Enterprise/3.6 SP2
Content-Type: text/html
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Client-Date: Fri, 01 Jun 2001 13:54:17 GMT
Client-Peer: 159.37.31.144:443
Client-SSL-Cert-Issuer: /O=VeriSign Trust Network/OU=VeriSign,
Inc./OU=VeriSign International Server CA - Class 3/OU=www
.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
Client-SSL-Cert-Subject: /C=US/ST=California/L=San Francisco/O=Wells Fargo
and Company/OU=ISG/CN=mn1-gx6-ib.banking.well
sfargo.com
Client-SSL-Cipher: RC4-MD5
Client-SSL-Warning: Peer certificate not verified
Refresh: 1;
URL=https://mn1-gx6-ib.banking.wellsfargo.com/cgi-bin/session.cgi?sessargs=e
352150ca8c828ab136853e921c6cb9cf
84ede2a096bdeaa435e2fc9a99168d2
Title: Authenticating User




 Authenticating User 

[snipped]



problems following a refresh meta tag using LWP and open SSL

2001-06-01 Thread Hill, Ronald

Hello All,

I am trying to connect to the Wells Fargo online bank using the LWP and open
SSL modules and am having trouble getting past the  Authenticating User
screen. I was hopeing for a way to have the LWP useragent  follow  the
refreash meta tag the same way it does for a redirect. Does anyone know of a
way to accomplish this?

Thanks

Ron

here is the script:
 #!/usr/bin/perl -w
use HTTP::Request::Common;
use HTML::Form;
use LWP::UserAgent;
use HTTP::Response;
#use LWP::Debug qw(+);
BEGIN {
local $^W = 0;
*LWP::UserAgent::redirect_ok = sub {1}
}
use HTTP::Cookies;
use strict;

my $ua = LWP::UserAgent->new;

$ua->cookie_jar(
  HTTP::Cookies->new(
autosave => 1 )
);
my $savefile = 'c:/temp/checkingpage.txt';
$ua->agent('Mozilla/4.73');

my $req  = $ua->request( POST 'https://banking.wellsfargo.com' );
my $form = HTML::Form->parse( $req->content, $req->base());
$form->value( 'userid',   "$ARGV[0]" );
$form->value( 'password', "$ARGV[1]" );

$req = $ua->request( $form->click('Account Summary') );

print $req->as_string;

here is the output of the script:

HTTP/1.1 200 OK
Date: Fri, 01 Jun 2001 13:52:48 GMT
Pragma: no-cache
Server: Netscape-Enterprise/3.6 SP2
Content-Type: text/html
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Client-Date: Fri, 01 Jun 2001 13:54:17 GMT
Client-Peer: 159.37.31.144:443
Client-SSL-Cert-Issuer: /O=VeriSign Trust Network/OU=VeriSign,
Inc./OU=VeriSign International Server CA - Class 3/OU=www
.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
Client-SSL-Cert-Subject: /C=US/ST=California/L=San Francisco/O=Wells Fargo
and Company/OU=ISG/CN=mn1-gx6-ib.banking.well
sfargo.com
Client-SSL-Cipher: RC4-MD5
Client-SSL-Warning: Peer certificate not verified
Refresh: 1;
URL=https://mn1-gx6-ib.banking.wellsfargo.com/cgi-bin/session.cgi?sessargs=e
352150ca8c828ab136853e921c6cb9cf
84ede2a096bdeaa435e2fc9a99168d2
Title: Authenticating User




 Authenticating User 

[snipped]



Re: Using SSL and Perl to Gather Process Information

2001-05-17 Thread Matt Cauthorn

You may want to check this out:

http://search.cpan.org/doc/BTROTT/Net-SSH-Perl-1.13/lib/Net/SSH/Perl.pm

I bet this will get you where you want to go.

~Matt C.

--- Ken Hammer <[EMAIL PROTECTED]> wrote:
> 
>  I need to write a perl script that will gather system information
> from remote machines. I must communicate to the remote machines
> using SSL.  I'm thinking I can use the Socket method to accomplish
> this, but I have had little luck in figuring it out.
> 
>  Can anyone point me in the right direction?
> 
>  Thank you.
> 
> -- 
> Ken Hammer
> Information Technology Central Services
> University Of Michigan
> [EMAIL PROTECTED]


__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



RE: Using SSL and Perl to Gather Process Information

2001-05-16 Thread King, Jason

Ken Hammer writes ..

> I need to write a perl script that will gather system information
>from remote machines. I must communicate to the remote machines
>using SSL.  I'm thinking I can use the Socket method to accomplish
>this, but I have had little luck in figuring it out.
>
> Can anyone point me in the right direction?


CPAN has a number of SSL modules .. you should just search for SSL on the
seach page

  http://search.cpan.org/

-- 
  jason king

  It is illegal to "annoy a bird" in any city park of Honolulu, Hawaii.
  - http://dumblaws.com/



Using SSL and Perl to Gather Process Information

2001-05-16 Thread Ken Hammer


 I need to write a perl script that will gather system information
from remote machines. I must communicate to the remote machines
using SSL.  I'm thinking I can use the Socket method to accomplish
this, but I have had little luck in figuring it out.

 Can anyone point me in the right direction?

 Thank you.

-- 
Ken Hammer
Information Technology Central Services
University Of Michigan
[EMAIL PROTECTED]