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=getsearch=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 m...@smtp.fakessh.eu:
  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=getsearch=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=getsearch=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
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 m...@smtp.fakessh.eu:
   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=getsearch=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=getsearch=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


I'd like to explain to me how to do testing on lists and list slices

2012-03-09 Thread ml
hello the list
hello the perl guru
hello this

I want to know how to work on slices of lists. 
I has 3 slices of the form.
$t[0] = user;
$t[1] = ip; 
$t[2] = time();

the registration of the list are checked by me
I know what the file contains
and recording are separated by a space (/\s+/)
I would like to test on how many times a user or an ip c is connected
via the time value and authorize or not the execution of the following
function

I'd like to explain to me how to do testing on lists and list slices

sincerely
-- 
http://pgp.mit.edu:11371/pks/lookup?op=getsearch=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


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('Any-Enter' = sub { $txt-Tk::focus });
$txt-bind('Return' = [\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())){diecan 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=getsearch=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('Any-Enter' = sub { $txt-Tk::focus });
$txt-bind('Return' = [\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())){diecan 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=getsearch=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/




Broken unsubscribble

2002-01-04 Thread rich+ml

List admin: please unsub me manually, the ezmlm mailto is barfing on the
'+' in my address.

Thanks -- Rich


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




Re: Need help with workweek to week dates ...

2001-12-03 Thread rich+ml

Been a while since I had to do this... you need 'zeller congruence', an
arithmetic formula to convert date to day-of-week (circa late 1800's
IIRC). Google says 475 hits -- Rich

On Mon, 3 Dec 2001, C.E.O. wrote:

 Date: Mon, 3 Dec 2001 13:25:18 -0600
 From: C.E.O. [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Need help with workweek to week dates ...

 My company uses a custom workweek that begins
 at Midnight on Saturday and ends on Friday at 23:59:59.99.

 I need a subroutine that can take as input a workweek (12, 26, 36)
 and take as input a year (2002, 2003, 2004) all in the same
 operation. Then I need the subroutine to return values as
 custom workweek dates, like ...

 For workweek 12 of 2002, the return values would be ..

 16-MAR-2002, 17-MAR-2002, 18-MAR-2002, 19-MAR-2002, 20-MAR-2002,
 21-MAR-2002, 22-MAR-2002.

 For workweek 26 of 2003, the return values would be ..

 21-JUN-2003, 22-JUN-2003, 23-JUN-2003, 24-JUN-2003, 25-JUN-2003,
 26-JUN-2003, 27-JUN-2003.

 For workweek 36 of 2004, the return values would be ..

 28-AUG-2004, 29-AUG-2004, 30-AUG-2004, 31-AUG-2004, 1-SEP-2004,
 2-SEP-2004, 3-SEP-2004.

 I can take a yearday and get a workweek number like ..

 March 25th is the 85th day of the year, if there is no leap year that year.

 (85/7)+1 = 13.14285714

 So I know it's in workweek 13. I can take 7*.14285714 and get approximately 1.
 Assuming that Zero is Sunday, I can match up 1 with Monday and so on.

 My problem is that the custom workweek starts on Saturdays.

 Any help/code examples are really appreciated,

 ~









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




Re: Listing directory contents

2001-10-18 Thread rich+ml

Mebbe something like this?

sub ls { for ($_[0]/*) { print $_\n; ls($_) if -d; } }

ls .;

On Tue, 16 Oct 2001, The Black Man wrote:

 Date: Tue, 16 Oct 2001 08:10:31 -0700 (PDT)
 From: The Black Man [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Listing directory contents

 Hi all,

 Is there a command to recursively list the contents of
 a directory, and all subdirectories?

 Thanks,

 James

 =
 Still pond, frog jumps in. Splash!

 There he goes...one of God's own prototypes.
 A high-powered mutant of some sort, never meant for mass production...
 Too weird to live, and too rare to die...

 AIM: TaoJonesin

 __
 Do You Yahoo!?
 Make a great connection at Yahoo! Personals.
 http://personals.yahoo.com




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




Re: convert hexa to text

2001-09-24 Thread rich+ml

If you mean that you have a string containing 61626364 and you want
abcd:

print pack a*, 61626364;

 On Mon, 24 Sep 2001, Hernan wrote:

 Date: Mon, 24 Sep 2001 13:50:52 -0400
 From: Hernan [EMAIL PROTECTED]
 To: [EMAIL PROTECTED] [EMAIL PROTECTED]
 Subject: convert hexa to text

 Folks
 I need to know how can get to convert a hexadecimal string to text,
 there are some function or something, thanks!!
 sorry by my english
 hernan





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




Re: Problems using REGEXP

2001-09-11 Thread rich+ml

OK, first:

$job{ra}=~/^(.*)\d\d/

does two things: returns true if $job{ra} contains two digits, and assigns
the portion of the string BEFORE the two digits to $1.

Second: The ? is not part of the regex. Syntax x?y:z evaluates to y if x
is true, or to z if x is false, basically an inline if-then-else.
So equivalent to:

if ($job{ra}=~/^(.*)\d\d/)
{
  $p = length $1;
} else
{
  $p = -1;
}

length $1, of course, is the offset to the two digits.

On 11 Sep 2001, Rupert Heesom wrote:

 Date: 11 Sep 2001 14:20:57 -0400
 From: Rupert Heesom [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: Beginners Perl [EMAIL PROTECTED]
 Subject: Re: Problems using REGEXP

 On 10 Sep 2001 10:15:38 -0700, [EMAIL PROTECTED] wrote:
  For position, try:
 
  $p=($job{ra}=~/^(.*)\d\d/?length $1:-1);
 
  $p is 0-based index of '\d\d', or -1 if none.

 Wow, I can hardly follow the syntax above.  It's very compact.

 Could you perhaps break it down so that I can understand what  you've
 put in it.  Particularly the REGEXP of '/^(.*)\d\d/', the next part
 ?length and the $1:-1.

 Actually having looked at one of my Perl books, I can see that /^(.*)/
 means match any character from the beginning of the string.

 //? I can't quite find the meaning of.  //*? means match 0 or more
 times, //+? means match 1 or more times, //?? means match 0 or 1 time.

 However, once the regexp is matched, can I compare each of the 2 digit
 numbers found with a reference number?




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




Re: Problems using REGEXP

2001-09-10 Thread rich+ml

For position, try:

$p=($job{ra}=~/^(.*)\d\d/?length $1:-1);

$p is 0-based index of '\d\d', or -1 if none.

On 10 Sep 2001, Rupert Heesom wrote:

 Date: 10 Sep 2001 12:28:11 -0400
 From: Rupert Heesom [EMAIL PROTECTED]
 To: Beginners Perl [EMAIL PROTECTED]
 Subject: Problems using REGEXP

 Hi guys:

 I'm a linux enthusiast who is trying to get stuck into Perl.

 Currently I'm trying to put together a script which will handle text
 files.

 I'm having problems with one line which is trying to ascertain the
 position of ascii 2-digit numbers in a string.

 I've used the following line --

 if (($x = index($job{Ra}, /[0-90-9]/,0)) != -1)

 -- in which $x keeps on being assigned 0 instead of 4.

 The content of $job{Ra} is:  Ra: 45k

 I've fairly sure that I'm correct on the REGEXP syntax of /[0-90-9]/
 which is looking for 2 consecutive numbers in the string.  I've checked
 the REGEXP syntax with lines like --

 if ($job{Ra} =~ /[0-90-9]/)

 -- which are evaluated as True.

 What's going wrong in the index function above?  I should be able to use
 a REGEXP for the SUBSTR in the INDEX function shouldn't I?

 BTW, in case I can do this a better way, what I am trying to do is
 extract any numbers in this string.  May be 0, 1 or 2 numbers.  Then
 compare the number(s) with a reference number.




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