[24590] in Perl-Users-Digest
Perl-Users Digest, Issue: 6766 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 5 09:05:56 2004
Date: Mon, 5 Jul 2004 06:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 5 Jul 2004 Volume: 10 Number: 6766
Today's topics:
Cleanup file path <ymartin@nospam.fr>
Re: Cleanup file path (Peter J. Acklam)
estimate passwords <%l%e%n%n%u%@_l_e_n_n_u.$d$e$>
Re: estimate passwords (Walter Roberson)
Re: estimate passwords <postmaster@castleamber.com>
Re: estimate passwords <postmaster@castleamber.com>
Re: estimate passwords <invalid-email@rochester.rr.com>
Re: estimate passwords <me@privacy.net>
How To do a Simple Convert of A single-tag HTML To XML? (valued customer)
Re: How To do a Simple Convert of A single-tag HTML To <postmaster@castleamber.com>
Re: Newbie: How to I extract word <Joe.Smith@inwap.com>
Newbie: Simple problem with htm file. <johnsmith@john.com>
Re: Newbie: Simple problem with htm file. (Walter Roberson)
Re: Newbie: Simple problem with htm file. <Joe.Smith@inwap.com>
read COBOL index file with perl <gabriell@programmer.net>
Re: read COBOL index file with perl <postmaster@castleamber.com>
Re: read COBOL index file with perl (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 05 Jul 2004 13:46:54 +0200
From: Yves Martin <ymartin@nospam.fr>
Subject: Cleanup file path
Message-Id: <f67jtivfpt.fsf@pcyma.elca.ch>
Hello,
I'm looking for a way to clean file paths like the following:
~/dir1/../dir2
~/dir1/../dir2/f1
~/dir1/./dir2/f1
/dir1/../dir2
/dir1/../dir2/f1
/dir1/./dir2/f1
I tested Cwd->realpath that reduce ./ and ../ but has many drawbacks:
- it does not understand ~/
- it follows symbolic links
- it checks path over the filesystem, so an unexisting file becomes
undef.
Results I expect are obviously:
~/dir1/../dir2 -> ~/dir2
~/dir1/../dir2/f1 -> ~/dir2/f1
~/dir1/./dir2/f1 -> ~/dir1/dir2/f1
/dir1/../dir2 -> /dir2
/dir1/../dir2/f1 -> /dir2/f1
/dir1/./dir2/f1 -> /dir1/dir2/f1
what ever the filesystem looks like (non existing file or symlink)
and which is multiplatform of course ;)
I'm really demanding but I just ask question before writing the code
myself from File::Spec splitpath, catpath, splitdir, catdir
If there is a simple existing way to do that, please just tell
me. Thank you in advance.
If you just want to check your ideas, here is a short test case:
my @testCase = (
"~/dir1/../dir2",
"~/dir1/../dir2/f1",
"~/dir1/./dir2/f1",
"/dir1/../dir2",
"/dir1/../dir2/f1",
"/dir1/./dir2/f1",
);
print "Result: " . join( " ", map { File::Spec->canonpath($_) } @testCase ) . "\n";
Result: ~/dir1/../dir2 ~/dir1/../dir2/f1 ~/dir1/dir2/f1 /dir1/../dir2 /dir1/../dir2/f1 /dir1/dir2/f1
Regards,
--
Yves Martin
------------------------------
Date: 05 Jul 2004 14:32:53 +0200
From: pjacklam@online.no (Peter J. Acklam)
Subject: Re: Cleanup file path
Message-Id: <isd2y6q2.fsf@online.no>
Yves Martin <ymartin@nospam.fr> wrote:
> I'm looking for a way to clean file paths like the following:
> ~/dir1/../dir2
> ~/dir1/../dir2/f1
> ~/dir1/./dir2/f1
> /dir1/../dir2
> /dir1/../dir2/f1
> /dir1/./dir2/f1
>
> I tested Cwd->realpath that reduce ./ and ../ but has many
> drawbacks:
None of them are drawbacks. I'm not sure you understand what the
purpose of it is. :-)
> - it does not understand ~/
It works fine for me:
$ cd /var/tmp
$ mkdir -p '~/dir1'
$ perl -MCwd -wle 'print Cwd::realpath "~/dir1"'
/var/tmp/~/dir1
You can't expect it to expand "~" into your home directory since
"~" might very well be an existing directory.
If you want tilde expansion, do it yourself. It is mentioned in
the FAQ how to do this.
> - it follows symbolic links
Of course it does. How else would it find the absolute path?
> - it checks path over the filesystem, so an unexisting file
> becomes undef.
That makes sense, since a non-existing file has no real pathname.
> Results I expect are obviously:
> ~/dir1/../dir2 -> ~/dir2
> ~/dir1/../dir2/f1 -> ~/dir2/f1
> ~/dir1/./dir2/f1 -> ~/dir1/dir2/f1
> /dir1/../dir2 -> /dir2
> /dir1/../dir2/f1 -> /dir2/f1
> /dir1/./dir2/f1 -> /dir1/dir2/f1
>
> what ever the filesystem looks like (non existing file or
> symlink) and which is multiplatform of course ;)
You can't simplify '~/dir1/../dir2' into '~/dir2' unless you make
sure that 'dir1' is a directory. If 'dir1' is a symbolic link,
then '~/dir1/../dir2' and '~/dir2' might be two totally different
directories.
Peter
--
#!/local/bin/perl5 -wp -*- mode: cperl; coding: iso-8859-1; -*-
# matlab comment stripper (strips comments from Matlab m-files)
s/^((?:(?:[])}\w.]'+|[^'%])+|'[^'\n]*(?:''[^'\n]*)*')*).*/$1/x;
------------------------------
Date: Mon, 5 Jul 2004 00:48:33 +0200
From: "Lennart Freyberg" <%l%e%n%n%u%@_l_e_n_n_u.$d$e$>
Subject: estimate passwords
Message-Id: <40e88915@news.pironet-ndh.com>
hi there,
i'm developing a user management interface @work (to allow our users to
change their passwords on solaris, linux, novell & windows through one web
interface).
does anybody of you know a script or a module to estimate passwords? it
shouldn't only check the length of the password but also how strong or how
weak it is (alphanumeric, not "qwerty", not part of the username, etc.).
can anyone help me?
thanx a lot,
lennu
------------------------------
Date: 4 Jul 2004 23:11:40 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: estimate passwords
Message-Id: <cca2rc$cal$1@canopus.cc.umanitoba.ca>
In article <40e88915@news.pironet-ndh.com>,
Lennart Freyberg <%l%e%n%n%u%@_l_e_n_n_u.$d$e$> wrote:
:i'm developing a user management interface @work (to allow our users to
:change their passwords on solaris, linux, novell & windows through one web
:interface).
:does anybody of you know a script or a module to estimate passwords? it
:shouldn't only check the length of the password but also how strong or how
:weak it is (alphanumeric, not "qwerty", not part of the username, etc.).
Is the input the password itself, or the encrypted password?
Is the result to be returned some kind of numerical result
such as "It may interesting you to know that your password is
about 17% strong", or as in "Someone could probably break your
password in about 38 minutes on s good PC"? Or is the result to
be a "pass/fail" result along the lines of "That password isn't
complex enough, choose another one!" ?
If you are looking for a go/no-go result, then there are a
variety of programs around that can take an input password, pass it
through a bunch of [configurable] translation rules, and give you
an answer.
The particular one I use here is named 'passwd+'. Looks like I
picked it up about 9 years ago from the 'net. I remember that I
fixed a few bugs and added some new kinds of rule processing.
In particular, I added the ability to call an outside program,
and then added a daemon that accepts an encrypted copy of the
password over the 'net and checks that against about 110
wordlists that I put together from various sources (e.g.,
Tolkien, Star Trek, basic Swedish vocabulary -- whatever I could
find.)
I'm sure the field has advanced quite a bit since I did these hacks,
--
So you found your solution
What will be your last contribution?
-- Supertramp (Fool's Overture)
------------------------------
Date: Sun, 04 Jul 2004 19:30:30 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: estimate passwords
Message-Id: <40e8a126$0$878$58c7af7e@news.kabelfoon.nl>
Walter Roberson wrote:
> Tolkien, Star Trek, basic Swedish vocabulary -- whatever I could
> find.)
Swedish passwords... Now there is an idea :-D
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Sun, 04 Jul 2004 19:34:04 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: estimate passwords
Message-Id: <40e8a1fe$0$211$58c7af7e@news.kabelfoon.nl>
Lennart Freyberg wrote:
> hi there,
>
> i'm developing a user management interface @work (to allow our users to
> change their passwords on solaris, linux, novell & windows through one web
> interface).
> does anybody of you know a script or a module to estimate passwords? it
> shouldn't only check the length of the password but also how strong or how
> weak it is (alphanumeric, not "qwerty", not part of the username, etc.).
>
> can anyone help me?
IIRC, but it has been ages, the pink Camel (Perl "4") book had such a
program. Might have been the cookbook. But anyway, it is a start. You
might start with looking for dictionaries used in brute force attacks,
and make all the entries invalid passwords. The variations are huge,
username, username reversed, part of the username normal, part reversed,
733+ (e.g. j0H|\|6O<M4 :-D)
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Mon, 05 Jul 2004 01:28:50 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: estimate passwords
Message-Id: <40E8AED0.7010207@rochester.rr.com>
Lennart Freyberg wrote:
...
> i'm developing a user management interface @work (to allow our users to
> change their passwords on solaris, linux, novell & windows through one web
> interface).
> does anybody of you know a script or a module to estimate passwords? it
> shouldn't only check the length of the password but also how strong or how
> weak it is (alphanumeric, not "qwerty", not part of the username, etc.).
...
> lennu
CPAN is your friend -- did you check there? You should find things like
the Data::Password::BasicCheck, Data::Password::Check and
Data::Password modules -- and probably some more. One of them might be
what you're looking for.
http://www.perl.com/CPAN/
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Mon, 5 Jul 2004 22:08:33 +1200
From: "Tintin" <me@privacy.net>
Subject: Re: estimate passwords
Message-Id: <2ksnk1F58sjpU1@uni-berlin.de>
"Lennart Freyberg" <%l%e%n%n%u%@_l_e_n_n_u.$d$e$> wrote in message
news:40e88915@news.pironet-ndh.com...
> hi there,
>
> i'm developing a user management interface @work (to allow our users to
> change their passwords on solaris, linux, novell & windows through one web
> interface).
> does anybody of you know a script or a module to estimate passwords? it
> shouldn't only check the length of the password but also how strong or how
> weak it is (alphanumeric, not "qwerty", not part of the username, etc.).
I'd write a frontend to npasswd.
http://www.utexas.edu/cc/unix/software/npasswd/
------------------------------
Date: 4 Jul 2004 15:11:56 -0700
From: scooterm@hotmail.com (valued customer)
Subject: How To do a Simple Convert of A single-tag HTML To XML?
Message-Id: <1b347673.0407041411.65689b7f@posting.google.com>
I have the following HTML code:
<code><b>Être en colère</b></code>
How do I convert that to well-formed XML?
I tried using HTML::Entities, but this does not produce well-formed
XML because it creates undefined entity references.
So how can it be done?
------------------------------
Date: Sun, 04 Jul 2004 19:37:31 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: How To do a Simple Convert of A single-tag HTML To XML?
Message-Id: <40e8a2cd$0$198$58c7af7e@news.kabelfoon.nl>
valued customer wrote:
> I have the following HTML code:
>
> <code><b>Être en colère</b></code>
>
> How do I convert that to well-formed XML?
use an ISO encoding in your XML, e.g:
<?xml version="1.0" encoding="ISO-8859-1"?>
> I tried using HTML::Entities, but this does not produce well-formed
> XML because it creates undefined entity references.
or put those in the DTD.
> So how can it be done?
see above. I use the encoding one. If you use XML::Twig, see:
<http://johnbokma.com/mexit/2004/04/22/xmltwiginputfilter.html>
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Mon, 05 Jul 2004 11:00:28 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Newbie: How to I extract word
Message-Id: <gxaGc.28300$7t3.10388@attbi_s51>
Dale Henderson wrote:
> An equivalent way to do this is:
>
> (my $project = $string) =~ s/.*Project:([^,]+),.*/$1/;
>
> However, this makes $project pointless since the replacement
> modifies $string to be the $1 and then $project is assigned the
> value of $string.
No, it does not.
It copies the value of $string to the variable $project first, and then
performs the substitution on $project, leaving $string untouched.
-Joe
------------------------------
Date: Mon, 05 Jul 2004 06:46:20 GMT
From: "John Smith" <johnsmith@john.com>
Subject: Newbie: Simple problem with htm file.
Message-Id: <0P6Gc.27284$P7.12816@pd7tw3no>
Hello Perl guru's.
I am having a problem reading a file that is a log file created by another
program that is in html format.
I have been using the open command to read and write to some text files and
things are fine. When I open and read these htm log files Perl seems to be
adding an extra space after each character. For example:
< H e a d e r >
T a p e L o g
When I open the htm file with notepad the html code looks fine. What am I
missing here? Perl seems to know this file is different than a standard
text file and is adding all these spaces on it's own.
Thanks for any assistance you can provide.
------------------------------
Date: 5 Jul 2004 06:50:01 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Newbie: Simple problem with htm file.
Message-Id: <ccatmp$hme$1@canopus.cc.umanitoba.ca>
In article <0P6Gc.27284$P7.12816@pd7tw3no>,
John Smith <johnsmith@john.com> wrote:
:I am having a problem reading a file that is a log file created by another
:program that is in html format.
:I have been using the open command to read and write to some text files and
:things are fine. When I open and read these htm log files Perl seems to be
:adding an extra space after each character. For example:
:< H e a d e r >
:T a p e L o g
Just a guess -- but I suspect the html file is utf8. See perldoc utf8
--
csh is bad drugs.
------------------------------
Date: Mon, 05 Jul 2004 10:16:35 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Newbie: Simple problem with htm file.
Message-Id: <7U9Gc.26828$IQ4.942@attbi_s02>
Walter Roberson wrote:
> In article <0P6Gc.27284$P7.12816@pd7tw3no>,
> John Smith <johnsmith@john.com> wrote:
> :I am having a problem reading a file that is a log file created by another
> :program that is in html format.
>
> :I have been using the open command to read and write to some text files and
> :things are fine. When I open and read these htm log files Perl seems to be
> :adding an extra space after each character. For example:
> :< H e a d e r >
> :T a p e L o g
>
> Just a guess -- but I suspect the html file is utf8. See perldoc utf8
If there is a null byte between every printing character, then it is
utf16, not utf8 (and not ASCII and not ISO-8859-1).
-Joe
------------------------------
Date: Mon, 05 Jul 2004 13:16:40 +0200
From: Gabkin <gabriell@programmer.net>
Subject: read COBOL index file with perl
Message-Id: <2ksrkrF61nsoU1@uni-berlin.de>
I need to parse a COBOL index file using a perl script.
I don't know _that_ much about COBOL but it seems the index file is
written in some kind of binary format, its not ASCII, thats for sure!
Has this been done before?
Is there an existing library I can use for this?
failing that...
Does anyone know how COBOL writes its index files and how I could go
about parsing them with perl?
Or is there a simple way to read and parse binary style data?
------------------------------
Date: Mon, 05 Jul 2004 06:25:36 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: read COBOL index file with perl
Message-Id: <40e93ab2$0$207$58c7af7e@news.kabelfoon.nl>
Gabkin wrote:
> I need to parse a COBOL index file using a perl script.
> I don't know _that_ much about COBOL but it seems the index file is
> written in some kind of binary format, its not ASCII, thats for sure!
>
> Has this been done before?
> Is there an existing library I can use for this?
>
> failing that...
> Does anyone know how COBOL writes its index files and how I could go
> about parsing them with perl?
> Or is there a simple way to read and parse binary style data?
perldoc -f read
perldoc -f unpack
perldoc -f binmode
<http://search.cpan.org/search?mode=all&query=COBOL> gave:
<http://search.cpan.org/~grommel/Convert-IBM390-0.18/IBM390.pm>
"A COBOL EXAMPLE"
<http://www.google.com/search?q=COBOL+%22index+file%22+specification>
<http://myfileformats.com/search.php?cat_id=170&cat_name=Miscellaneous&start=1>
Ryan McFarland (RM-COBOL) Index File layout
Might be helpful.
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: 5 Jul 2004 11:28:48 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: read COBOL index file with perl
Message-Id: <ccbe1g$djc$1@mamenchi.zrz.TU-Berlin.DE>
Gabkin <gabriell@programmer.net> wrote in comp.lang.perl.misc:
> I need to parse a COBOL index file using a perl script.
> I don't know _that_ much about COBOL but it seems the index file is
> written in some kind of binary format, its not ASCII, thats for sure!
>
> Has this been done before?
> Is there an existing library I can use for this?
>
> failing that...
> Does anyone know how COBOL writes its index files and how I could go
> about parsing them with perl?
> Or is there a simple way to read and parse binary style data?
There is (see "perldoc -f pack" and "perldoc -f unpack"), but you got
to know the style. I have no idea what an index file is in COBOL,
but it's quite possible that the format depends on the particular
system and compiler.
Anno
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 6766
***************************************