[26362] in Perl-Users-Digest
Perl-Users Digest, Issue: 8535 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 18 03:05:24 2005
Date: Tue, 18 Oct 2005 00: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 Tue, 18 Oct 2005 Volume: 10 Number: 8535
Today's topics:
Case Sensitive Regex <rbutcher.nospam@hotmail.com>
Re: Case Sensitive Regex <rbutcher.nospam@hotmail.com>
Re: Case Sensitive Regex <noreply@gunnar.cc>
Re: making same change to *lots* of files, *without* da (David Combs)
Re: making same change to *lots* of files, *without* da (David Combs)
Re: Microsoft Hatred FAQ <davids@webmaster.com>
Re: Microsoft Hatred FAQ <my_email_is_posted_on_my_website@munged.invalid>
Re: Microsoft Hatred FAQ <my_email_is_posted_on_my_website@munged.invalid>
Re: Microsoft Hatred FAQ <my_email_is_posted_on_my_website@munged.invalid>
Newsgroup guidelines <gisterogue@gmail.com>
Re: Newsgroup guidelines <sbryce@scottbryce.com>
Re: Newsgroup guidelines <1usa@llenroc.ude.invalid>
Re: perldoc -q 'date|time' FAQ -- and -- Re: making sam (David Combs)
Re: perldoc -q 'date|time' FAQ -- and -- Re: making sam <someone@example.com>
Re: perldoc -q 'date|time' FAQ -- and -- Re: making sam (David Combs)
Re: Request for help <someone@example.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 18 Oct 2005 06:35:30 GMT
From: "Robert" <rbutcher.nospam@hotmail.com>
Subject: Case Sensitive Regex
Message-Id: <SI05f.228445$tl2.1110@pd7tw3no>
Hello,
I am trying to secure my mailer script from those who might try to hijack it
by adding "To:" etc fields in the form fields.
Currently I am using this:
my $name = param('name');
if ($name =~ /To:/) { &spamattempt; }
if ($name =~ /to:/) { &spamattempt; }
Basically if the "name" fields contains either an upper or lower case To or
to the script will direct to a subroutine where the process is terminated.
This all works fine. My Question ... is there an easier way to write the
regex above that looks for To:/to: etc? I was thinking maybe it could be
done with a single regex where is searches for either an upper or lower case
T or O followed by a : I did some research on regex case sensitivity and
found that the "i" operator is needed but couldn't make it work. Thanx all
in advance.
Robert
------------------------------
Date: Tue, 18 Oct 2005 06:54:45 GMT
From: "Robert" <rbutcher.nospam@hotmail.com>
Subject: Re: Case Sensitive Regex
Message-Id: <V_05f.220215$1i.182297@pd7tw2no>
"Robert" <rbutcher.nospam@hotmail.com> wrote in message
news:SI05f.228445$tl2.1110@pd7tw3no...
>
> Basically if the "name" fields contains either an upper or lower case To
or
> to the script will direct to a subroutine where the process is terminated.
> This all works fine. My Question ... is there an easier way to write the
> regex above that looks for To:/to: etc? I was thinking maybe it could be
> done with a single regex where is searches for either an upper or lower
case
> T or O followed by a : I did some research on regex case sensitivity and
> found that the "i" operator is needed but couldn't make it work. Thanx all
> in advance.
Year ok, I feel stupid:
if ($name =~ /To:/i) { &spamattempt; }
Robert
------------------------------
Date: Tue, 18 Oct 2005 09:05:22 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Case Sensitive Regex
Message-Id: <3rjl1qFjdma3U1@individual.net>
Robert wrote:
> I am trying to secure my mailer script from those who might try to hijack it
> by adding "To:" etc fields in the form fields.
> Currently I am using this:
>
> my $name = param('name');
> if ($name =~ /To:/) { &spamattempt; }
> if ($name =~ /to:/) { &spamattempt; }
>
> Basically if the "name" fields contains either an upper or lower case To or
> to the script will direct to a subroutine where the process is terminated.
> This all works fine. My Question ... is there an easier way to write the
> regex above that looks for To:/to: etc? I was thinking maybe it could be
> done with a single regex where is searches for either an upper or lower case
> T or O followed by a : I did some research on regex case sensitivity and
> found that the "i" operator is needed but couldn't make it work.
How could you not make it work? Please post a short but complete script,
that people can copy and run, and that illustrates the issue.
( /to:/i should do what you want. )
OTOH, I'd think that a simpler and safer way to prevent that kind of
abuse is to ensure that none of the email header fields includes linebreaks.
$name =~ s/\s+/ /g;
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 18 Oct 2005 04:23:22 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: making same change to *lots* of files, *without* date changed
Message-Id: <dj1tbq$ekt$1@reader2.panix.com>
In article <slrndl7qg5.568.1usa@asu1cornelledu.unur.com>,
A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
...
>
>Alternatively, you can use the shell script provided by Tintin.
>Personally, that's what I would have done, but you asked on a Perl
>group.
Yeah, neat script!
I've tried it, and it seems to work just fine!
David
------------------------------
Date: Tue, 18 Oct 2005 04:56:03 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: making same change to *lots* of files, *without* date changed
Message-Id: <dj1v93$c66$1@reader2.panix.com>
In article <20051017134556.428$hg@newsreader.com>, <xhoster@gmail.com> wrote:
>
>Not all combinations of OS/FS/mount options/phase of moon allow you to
>back-date files. So test your program out on test files on the same
>mount-point your real files, otherwise you may permently lose your date
>information if something goes wrong. (Or backup your files in
>data-preserving way before doing anything)
>
>
>Xho
Thanks for the warning. Will try to be alert to it.
David
------------------------------
Date: Mon, 17 Oct 2005 19:43:16 -0700
From: "David Schwartz" <davids@webmaster.com>
Subject: Re: Microsoft Hatred FAQ
Message-Id: <dj1ng4$qbn$1@nntp.webmaster.com>
"Roedy Green" <my_email_is_posted_on_my_website@munged.invalid> wrote in
message news:86h8l15n3odeetug7j231fi9rb3jrauo7h@4ax.com...
> On Mon, 17 Oct 2005 17:29:36 -0700, "David Schwartz"
> <davids@webmaster.com> wrote or quoted :
>> By the way, this is based on the same flawed premise that a lot of
>>post-Y2K griping was based on. It went like this, "wow, we get all
>>concerned
>>and spent all this money on a problem that never even happened". Well,
>>perhaps it didn't happen because we were all concerned and spent all this
>>money on it.
> The worry was that the work would not be completed in time. The work
> had to be done or the programs would simply stop working. There was
> no way to avoid the expense.
I understand why the argument is invalid. I'm presenting it as an
example of a similar invalid argument.
DS
------------------------------
Date: Tue, 18 Oct 2005 04:59:10 GMT
From: Roedy Green <my_email_is_posted_on_my_website@munged.invalid>
Subject: Re: Microsoft Hatred FAQ
Message-Id: <7809l15uqvhvmleds067rj7af6acpot47v@4ax.com>
On Mon, 17 Oct 2005 19:43:16 -0700, "David Schwartz"
<davids@webmaster.com> wrote or quoted :
> I understand why the argument is invalid. I'm presenting it as an
>example of a similar invalid argument.
Not every post is meant to contradict or inform the OP.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
------------------------------
Date: Tue, 18 Oct 2005 06:35:57 GMT
From: Roedy Green <my_email_is_posted_on_my_website@munged.invalid>
Subject: Re: Microsoft Hatred FAQ
Message-Id: <2u59l1555jubv8qv09q57qh8m4skei9dqi@4ax.com>
On 18 Oct 2005 06:20:56 GMT, John Bokma <john@castleamber.com> wrote
or quoted :
>
>That an HTML standard (ISO/IEC 15445:2000) and an HTML recommendation by
>w3c (4.01 for example) are two different things, and mixing them up by
>calling both standards is a bad thing.
Because ... what are the consequences?
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
------------------------------
Date: Tue, 18 Oct 2005 06:37:51 GMT
From: Roedy Green <my_email_is_posted_on_my_website@munged.invalid>
Subject: Re: Microsoft Hatred FAQ
Message-Id: <iv59l1d1h68mi5f2dns2lib5lvoi4vlr07@4ax.com>
On Mon, 17 Oct 2005 22:21:55 -0700, "David Schwartz"
<davids@webmaster.com> wrote or quoted :
> I don't think any of it bordered on force or fraud. However, their
>obligation to their shareholders requires them to do anythign that borders
>on force/fraud so long as it isn't force/fraud.
I avoid MS products whenever possible. Surely others feel the same
way because we have had it up to the teeth with MS dirty tactics. That
has to be factored into profitability as well.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
------------------------------
Date: Tue, 18 Oct 2005 03:04:29 +0100
From: Leonard Challis <gisterogue@gmail.com>
Subject: Newsgroup guidelines
Message-Id: <4tl8l15j17bhkdca12opbgpqr3cjhsf393@4ax.com>
Good day everyone,
I am new to the newsgroup (and newsgroups as a whole in fact) and just
wondered if someone would please point me in the direction of the
guidelines I must adhere to and anything else you guys think would be
worth me reading and understanding before I begin to participate.
Thank you,
Leonard Challis
------------------------------
Date: Mon, 17 Oct 2005 20:11:35 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: Newsgroup guidelines
Message-Id: <_Y2dnXFYa6hKxMneRVn-qQ@comcast.com>
Leonard Challis wrote:
> Good day everyone,
>
> I am new to the newsgroup (and newsgroups as a whole in fact) and just
> wondered if someone would please point me in the direction of the
> guidelines I must adhere to and anything else you guys think would be
> worth me reading and understanding before I begin to participate.
The posting guidelines are posted here twice a week. They can also be
found at
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Tue, 18 Oct 2005 02:14:28 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Newsgroup guidelines
Message-Id: <Xns96F2E2409BDAAasu1cornelledu@127.0.0.1>
Leonard Challis <gisterogue@gmail.com> wrote in news:4tl8l15j17bhkdca12opbgpqr3cjhsf393@4ax.com:
> I am new to the newsgroup
Hmmm ... I remember someone else by the same name. Could
be a coincidence, though.
<URL: http://groups.google.com/groups?as_q=leonard+challis&as_ugroup=comp.lang.perl.misc>
> (and newsgroups as a whole in fact) and just
> wondered if someone would please point me in the direction of the
> guidelines
See my signature.
> I must adhere to and anything else you guys think would be
> worth me reading and understanding before I begin to participate.
The Perl FAQ list, along with an overview of the documentation:
perldoc perlfaq
perldoc perlfunc
perldoc perltoc
Just the fact that you actually asked for this information is
a good sign, and is sincerely appreciated.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Tue, 18 Oct 2005 04:26:21 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: perldoc -q 'date|time' FAQ -- and -- Re: making same change to *lots* of files, *without* date changed
Message-Id: <dj1thd$dhu$1@reader2.panix.com>
In article <slrndl7qli.568.1usa@asu1cornelledu.unur.com>,
A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
>> FYI: Here's what "perldoc -q 'date|time' >! foo.out" gets me:
>
>What is your point?
>
>Sinan
Good question -- turns out that stuffed a whole lot more
into that post than I intended to. WAY more.
Sorry for having you all look through all that stuff;
shouldn't have been there. :-(
David
------------------------------
Date: Tue, 18 Oct 2005 01:25:03 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: perldoc -q 'date|time' FAQ -- and -- Re: making same change to *lots* of files, *without* date changed
Message-Id: <P9Y4f.33411$S4.32929@edtnps84>
David Combs wrote:
> In article <dwH4f.29049$Io.3499@clgrps13>,
> John W. Krahn <krahnj@telus.net> wrote:
>>David Combs wrote:
> ...
>>>But doing that will screw up the creation dates of the
>>>files, on which I rely to remind me what I've been
>>>working on recently.
>>AFAIK Unix doesn't record the creation dates of files anywhere.
>
> Well, then whatever date it does change upon a "touch" of the file.
>
>>
>>>Since I want to make this change to just about EVERYTHING,
>>>I think it best if the dates do NOT change.
>>>
>>>So, my question: how would *you* accomplish this task?
>>man tar
>>man cpio
>
> John, how does that help me *edit* the gillion files?,
Sorry, I misread the question.
> , all the while, *not* changing any of the dates/times associated
> with the files?
>
> I figured that if anyone could come up with a one-liner,
> it would be *you*! :-)
UNTESTED:
perl -MFile::Find -e'find sub {
my ( $atime, $mtime ) = ( stat )[ 8, 9 ];
local ( @ARGV, $^I ) = $_;
s!/home!/myhome!g while <>;
close ARGV;
utime $atime, $mtime, $_;
}, "."'
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 18 Oct 2005 04:44:41 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: perldoc -q 'date|time' FAQ -- and -- Re: making same change to *lots* of files, *without* date changed
Message-Id: <dj1ujp$bvt$1@reader2.panix.com>
In article <P9Y4f.33411$S4.32929@edtnps84>,
John W. Krahn <krahnj@telus.net> wrote:
...
...
>
>UNTESTED:
>
>perl -MFile::Find -e'find sub {
> my ( $atime, $mtime ) = ( stat )[ 8, 9 ];
> local ( @ARGV, $^I ) = $_;
> s!/home!/myhome!g while <>;
> close ARGV;
> utime $atime, $mtime, $_;
> }, "."'
>
Thanks, John!
David
------------------------------
Date: Tue, 18 Oct 2005 03:51:52 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Request for help
Message-Id: <sj_4f.31858$Io.14980@clgrps13>
leigh wrote:
> All,
>
> I'd like to request some help.
>
> I am a network engineer and am currently studying for my Cisco ccie. I'm
> doing loads of practice labs trying to get up to speed for the exam.
>
> I have used a bit of Perl in the past - configuring progams such as mrtg
> on both linux and windows.
>
> During my lab configurations, I write out false routes on my boxes so
> that I have got lots of routes to tweak and play around with. However,
> this is a very tedious task, especially when writing out many (sometimes
> hundreds) of static routes.
>
> I would like to devise a perl script that I could share with other ccie
> candidates (mainly on www.groupstudy.com) to produce random routes that
> we can paste into the routers for testing.
>
> routes are entered in the form:-
>
> ip route 1.2.3.0 255.255.255.0 null 0
>
> breakdown:-
> ip route - tells the router what this line is for
> 1.2.3.0 - is the address of a network
> 255.255.255.0 - is the network mask
> null 0 - is the interface that the route points to (null 0 is a logical
> interface)
>
> I would need "ip route " to be static
>
> 1.2.3.0 to be a random number. Anything from 1 - 223 in the first octet
> and anything from 0 - 255 in the latter 3.
>
> The network mask portion would need to be either: 128 192 224 240 248
> 252 254 or 255 for the first octet
> For the three latter octets, 0 128 192 224 240 248 252 254 or 255
>
> Network mask is written from left to right. If one of the octest is
> less than 255 then the rest have to be 0. ie:
> 255.128.0.0 is ok
> 255.128.192.0 would not work
> 255.255.255.0 is ok
> 128.0.0.0 is ok
> 128.0.224.0 would not work
>
> "null 0" should also be static.
>
> Would it also be possible to enter the amount of routes that I would
> like to generate ? i.e - have a script so that I could type in "200"
> and it would fire me back 200 random routes.
>
> Any help on this, or any pointers would be greatly appreciated.
Perhaps something like this will do what you want:
#!/usr/bin/perl
use warnings;
use strict;
# extra 255 octets give more varied net masks - adjust to taste
my @mask_octets = qw(
0 128 192 224 240 248 252 254 255 255 255 255 255 255 255 255 255 255 255
);
die "usage: $0 count\n"
unless @ARGV and ( my $count = shift ) =~ /^[1-9]\d*$/;
while ( $count-- ) {
my @ip = (
int( 1 + rand 223 ),
map int rand( 256 ), 1 .. 3
);
# First octet cannot be 0
my @mask = (
$mask_octets[ 1 + rand $#mask_octets ],
map $mask_octets[ rand @mask_octets ], 1 .. 3
);
# Set rightmost octets to 0
for ( 0 .. $#mask ) {
if ( $mask[ $_ ] < 255 ) {
@mask = ( @mask[ 0 .. $_ ], 0, 0, 0 )[ 0 .. 3 ];
last;
}
}
# Last octet cannot be 255 - first 8 in @mask_octets are less then 255
$mask[ -1 ] = $mask_octets[ rand 8 ] if $mask[ -1 ] == 255;
local $" = '.';
print "ip route @ip @mask null 0\n";
}
__END__
John
--
use Perl;
program
fulfillment
------------------------------
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 8535
***************************************