[15626] in Perl-Users-Digest
Perl-Users Digest, Issue: 3039 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 13 21:08:35 2000
Date: Sat, 13 May 2000 18:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <958266308-v9-i3039@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 13 May 2000 Volume: 9 Number: 3039
Today's topics:
Re: How to replace "\" , HELP! malverian@my-deja.com
New to Perl, How to get started <langg@earthlink.net>
Re: New to Perl, How to get started malverian@hotmail.com
Re: perl reverse interpolations <makarand_kulkarni@My-Deja.com>
Re: Please Help friend on perl problem <velocity@youreallythinkitsme.com>
Re: Problem with server scripting <HERBERTSPENCER@email.msn.com>
Re: Problem with server scripting <tony_curtis32@yahoo.com>
Re: Problem with server scripting <flavell@mail.cern.ch>
Re: Question about Warnings (David Combs)
Re: Question about Warnings <lr@hpl.hp.com>
Re: Regular Expressions help malverian@hotmail.com
Re: Regular Expressions help <tony_curtis32@yahoo.com>
Re: Removing everything in a string before ":" mching@bigfoot.com
Re: shooting yourself in the foot ... (Peter Heslin)
sorry repost i need help despertly can someone just loo <velocity@youreallythinkitsme.com>
Re: sorry repost i need help despertly can someone just <velocity@youreallythinkitsme.com>
Re: spoofing identity <anmcguire@ce.mediaone.net>
the Test, to write to conference <teterlevsv@mtu-net.ru>
This error catching code should work right? (Kevin Stone)
Re: This error catching code should work right? malverian@my-deja.com
Update problem with DBI-ODBC and MSAccess <gortergj@cityweb.de>
Re: Using user-variables in external commands? (Michael J Assels)
Why does Perl do this? <slu_2@altavista.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 14 May 2000 00:19:45 GMT
From: malverian@my-deja.com
Subject: Re: How to replace "\" , HELP!
Message-Id: <8fkreo$thf$1@nnrp1.deja.com>
> have no control on the \
Very simple mistake, if you want to print a \ you must use \\
I'm guessing you are using something like this..
$location = 'c:\this\folder\file.file';
you will have to use the following
$location = 'c:\\this\\folder\\file.file';
Have fun, happy perl hacking ;P
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 13 May 2000 23:53:22 GMT
From: "langg" <langg@earthlink.net>
Subject: New to Perl, How to get started
Message-Id: <SVlT4.59789$g4.1651932@newsread2.prod.itd.earthlink.net>
I'm new to Perl and new to Linux. I have Linux Mandrake and Perl 5 is
located at /usr/lib/perl5. Once I write some code what do I need to do to
run the Perl complier? Thanks for any help.
------------------------------
Date: Sun, 14 May 2000 00:25:16 GMT
From: malverian@hotmail.com
Subject: Re: New to Perl, How to get started
Message-Id: <8fkrp3$u3p$1@nnrp1.deja.com>
>Once I write some code what do I need to do to
> run the Perl complier? Thanks for any help.
First off, good choice in switching to Linux =)
All you have to do to compile and run a program is type
'perl <program>'
That simple.
Make sure you are in the directory of the program when you type it.
Have fun =)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 13 May 2000 15:06:25 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: perl reverse interpolations
Message-Id: <391DD1E1.322633A9@My-Deja.com>
> for instance.
>
> for(c=0; $c<$radiocount; $c++)
> {
> $radio[$c] = '$radio' . "$C";
> # Here I want the lvalue of $radio1 (ect.) not the string "$radio1";
> }
eg;
$radiocount=6 ;
$radio0=0;
$radio1=1;
$radio2=2;
$radio3=3;
$radio4=4;
$radio5=5;
for($c=0; $c<$radiocount; $c++)
{
$radio[$c] = ${'radio'.$c};
}
print join '|', @radio;
for more info read
perldoc perlref
See the section "Symbolic references".
--
------------------------------
Date: Sat, 13 May 2000 23:37:21 GMT
From: "velocity" <velocity@youreallythinkitsme.com>
Subject: Re: Please Help friend on perl problem
Message-Id: <RGlT4.62104$fF5.1954158@news1.rdc1.il.home.com>
could you rewrite it so it is right?need it badly thanx
velocity
brian d foy <brian@smithrenaud.com> wrote in message
news:brian-1305001502110001@sri.dialup.access.net...
> In article <%GhT4.61780$fF5.1941446@news1.rdc1.il.home.com>, "velocity"
<velocity@youreallythinkitsme.com> wrote:
>
> >Can any of you guys tell me why this program wont work.
> >It's a simple news poster allowing header hacking.
>
>
> you forgot to
>
> use Net::NNTP;
>
> --
> brian d foy
> Perl Mongers <URI:http://www.perl.org>
> CGI MetaFAQ
> <URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
>
------------------------------
Date: Sat, 13 May 2000 14:09:12 -0800
From: "a56dragon" <HERBERTSPENCER@email.msn.com>
Subject: Re: Problem with server scripting
Message-Id: <ewsbaiSv$GA.90@cpmsnbbsa04>
<zam74@singnet.com.sg> wrote in message
news:391E5A26.A167B0EC@singnet.com.sg...
> Hi,
>
> I am creating a form whereby users will be able to append a text file(or
> create one if they don't have any files) which they have specified in
> the form. This text file is stored remotely. I have tried this for my
> previous perl script (a different organization) and it worked fine. But
> I am not sure why this script is not even creating the text file at the
> server side. Can anyone help me and tell me what is wrong with my code??
>
> #!/usr/local/bin/perl5
>
> print "Content-type: text/html\n\n";
>
> if ($ENV{REQUEST_METHOD}eq'GET'){
> $buffer=$ENV{'QUERY_STRING'};
You are going to read NOTHING from REQUEST_METHOD. It must be in quotes (as
you did for QUERY_STRING).
> }
> else{
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> }
Since your REQUEST_METHOD check failed, any input from the QUERY_STRING has
been lost. So far your program "should" work for 'POST' but not for 'GET'...
>
> @pairs = split(/&/, $buffer);
> foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
> $pair =~ tr/+/ /;
> $FORM{$name} = $value;
> }
... Some problems here.... Not only is there a MAJOR security problem here,
but you're not checking for HEX values. Add the following lines:
# translate hex values
$pair =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))//eg;
# security - don't allow SSIs or comment lines
$pair =~ s/<!--(.|\n)*-->//g;
>
> $name = "$FORM{'name'}";
> $file = "$FORM{'file'}";
> $ext = "$FORM{'ext'}";
> print "File: $file<br>";
> print "Name: $name<br>";
> print "Ext: $ext<br>";
>
> open (f, ">/export/companyName/WWW/cgi-bin/news/zammy/$file.$ext") ||
> die $!;
> $myFile = <f>;
> close (f);
Two problems here:
(1) You're assuming that your input file has a single line when you set
$myFile = <f>. If it contains more lines, than one - or if the first line is
a "newline" ("\n"), you have no output. [For multiple lines, use an array
(e.g. @myFile = <f>; )];
(2) You CLOSED the file. Nothing can now be written to this file without
reopening it. So now your file contains an EOF (end of file) character and
nothing else ...
>
> print $myFile $name;
> print "contents of file<br>$myFile";
>
Since your output file is closed, your print statements would go to the mime
type that you originally set ("text/html"). But your "print $myFile $name;"
statement is incorrect anyway - it should have been "print f $name;". Since
you're telling Perl to send your output to an EOF character, I don't know
where your output is going to end up. With the mime set to "text/html", it
may be sending it to the default html form. But since $myFile doesn't
contain a printable ASCII character, you probably wouldn't notice it anyway
...
>
> Thanks a million in advance!!!
>
> Zam
>
------------------------------
Date: Sat, 13 May 2000 22:21:52 GMT
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Problem with server scripting
Message-Id: <87snvmf5vj.fsf@shleppie.uh.edu>
>> On Sat, 13 May 2000 14:09:12 -0800,
>> "a56dragon" <HERBERTSPENCER@email.msn.com> said:
> <zam74@singnet.com.sg> wrote in message
> news:391E5A26.A167B0EC@singnet.com.sg...
>> Hi,
>>
>> I am creating a form whereby users will be able to
>> append a text file(or create one if they don't have any
>> files) which they have specified in the form. This text
>> file is stored remotely. I have tried this for my
>> previous perl script (a different organization) and it
>> worked fine. But I am not sure why this script is not
>> even creating the text file at the server side. Can
>> anyone help me and tell me what is wrong with my code??
>>
>> #!/usr/local/bin/perl5
>>
>> print "Content-type: text/html\n\n";
>>
>> if ($ENV{REQUEST_METHOD}eq'GET'){
>> $buffer=$ENV{'QUERY_STRING'};
> You are going to read NOTHING from REQUEST_METHOD. It
> must be in quotes (as you did for QUERY_STRING).
$ENV{REQUEST_METHOD} is fine.
However, as you pointed out, the OP is using code which
introduces all manner of security problems. The OP should
switch to using CGI.pm, which makes all of this moot.
hth
t
------------------------------
Date: Sun, 14 May 2000 01:33:35 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Problem with server scripting
Message-Id: <Pine.GHP.4.21.0005140113310.20745-100000@hpplus01.cern.ch>
On Sun, 14 May 2000 zam74@singnet.com.sg caused the following to
appear:
Parts/Attachments:
1 Shown 46 lines Text
2 OK 9 lines Text, "Card for ^CD^H^K^N("
Please adjust your news client to post plain text only, without
attachments, in accordance with the usual usenet customs. Thanks.
(Your choice of Subject header could also benefit from some
attention. There's a useful FAQ on composing effective Subject
headers.)
Now to business...
[...]
> I am not sure why this script is not even creating the text file at the
> server side. Can anyone help me and tell me what is wrong with my code??
Well, there's a lot wrong in detail, but the two main problems both
seem to be aspects of the same issue. You have failed to read the
discussion on the c.l.p.* groups and learn anything from them _before_
posting your question. Therefore, you are wasting everyone's time
with trivia which you could easily fix for yourself, and thereby
missing whatever real substantial problem it might be that's hidden in
your script amongst all the trivia. To be specific:
1. You have failed to use most of the features which Perl has for
helping you to find problems (-w flag, -T when appropriate - which it
is - 'use strict;' etc.).
2. You have coded for yourself (and dangerously) things which are
already coded (safely) in CGI.pm for you.
It would be impossible to read c.l.p.m postings covering even a few
days without discovering that this is the view of the regular
informants here, and I can only endorse that.
Every programmer in this field _should_ know how to code those things,
correctly, for themselves; but they should also know that it's better
not to code them when someone else has already packaged them in a
widely-used and -tested and -reviewed module.
This may seem harsh, but when you are programming for the CGI, you are
in effect writing extensions for your web server. If you do it badly,
you can put your server seriously at risk, and there are people (as
any web server log will show) who go around deliberately trying to
break servers via their CGI scripts. Better to get some harsh words
on c.l.p.m first, than have to rebuild your web server after such a
successful penetration.
--
Partake of distilled wisdom of Usenet - read the FAQs.
Before you ask.
------------------------------
Date: 13 May 2000 22:50:44 GMT
From: dkcombs@netcom.com (David Combs)
Subject: Re: Question about Warnings
Message-Id: <8fkm84$6u0$1@slb3.atl.mindspring.net>
In article <3o0O4.8856$95.71198@news1.rdc1.mb.home.com>,
<SNIP>
>You can also declare your variables with my():
>
>#!/usr/bin/perl -w
>my($fname, $mname, $lname);
>$_ = 'firstname:middlename:lastname';
>($fname, $mname, $lname) = split /:/;
>print "$fname $lname\n";
>__END__
>
>This doesn't produce a warning because $mname is seen twice -- once
>in the declaration and once in the assignment.
SNIP
Haven't tried it, but if what you say is true (the "is seen twice",
ie that the my counts as "seen once"), I'd call it a BUG.
I don't know about others, but for myself, I'd surely WANT
to be notified in such a case, of an assignment to a var
without a subsequent ref (er, "reachable" subsequent ref)
to it.
Am willing to pay the price of dummy print or other
stmt (if (4=5) {print $myvar}) (or hopefully something
less wordy; hopefully the above would be optimized-away).
With comment saying why I was doing that -- to avoid err
msg, but keep varname being assigned-to as documentation.
In fact, I'll pay ALMOST ANYTHING for the computer to find
possible bugs FOR me!
David
------------------------------
Date: Sat, 13 May 2000 16:29:09 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Question about Warnings
Message-Id: <MPG.13878513d0faecf398aa77@nntp.hpl.hp.com>
In article <8fkm84$6u0$1@slb3.atl.mindspring.net> on 13 May 2000
22:50:44 GMT, David Combs <dkcombs@netcom.com> says...
> In article <3o0O4.8856$95.71198@news1.rdc1.mb.home.com>,
> <SNIP>
>
> >You can also declare your variables with my():
> >
> >#!/usr/bin/perl -w
> >my($fname, $mname, $lname);
> >$_ = 'firstname:middlename:lastname';
> >($fname, $mname, $lname) = split /:/;
> >print "$fname $lname\n";
> >__END__
> >
> >This doesn't produce a warning because $mname is seen twice -- once
> >in the declaration and once in the assignment.
> SNIP
>
> Haven't tried it, but if what you say is true (the "is seen twice",
> ie that the my counts as "seen once"), I'd call it a BUG.
No, it's really worse than that. It's a capability that isn't
implemented. Consider this:
#!/usr/bin/perl -w
use strict;
$_ = 'firstname:middlename:lastname';
my ($fname, $mname, $lname) = split /:/;
__END__
The variables are named once each, set, but never used; no warnings.
> I don't know about others, but for myself, I'd surely WANT
> to be notified in such a case, of an assignment to a var
> without a subsequent ref (er, "reachable" subsequent ref)
> to it.
The "$foo set but not used" capability exists in C's 'lint' program.
But Perl evidently doesn't have the kind of data-flow analysis necessary
to make that happen. I have never seen such a warning, and I can't find
one like it in perldiag.
> Am willing to pay the price of dummy print or other
> stmt (if (4=5) {print $myvar}) (or hopefully something
> less wordy; hopefully the above would be optimized-away).
You mean '4 == 5', but anyhow, it doesn't matter.
> With comment saying why I was doing that -- to avoid err
> msg, but keep varname being assigned-to as documentation.
>
> In fact, I'll pay ALMOST ANYTHING for the computer to find
> possible bugs FOR me!
Hire a consultant. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 13 May 2000 23:29:05 GMT
From: malverian@hotmail.com
Subject: Re: Regular Expressions help
Message-Id: <8fkofk$qiv$1@nnrp1.deja.com>
> There's something else that's going on here that you're
> not telling us about.
>
> Where does $username come from?
It comes from a data file.
open(USERS, $userfile);
@users = <USERS>;
close(USERS);
$userlist = "@users";
$username comes from the QUERY_STRING
as well as $pass
It reads from the file correctly, but the thing is, if I type a
password with the same amount of characters it logs me in no matter
what, haha.
Actually with the same or more since I am using regular expressions for
now. (don't ask why =P)
If this doesn't help I could paste that section of the script.
Basically, so far I have tried
if ($userlist =~ /Username=('$username')/i)
if ($userlist =~ /"Username=$username"/i)
In both cases it was a syntax error.
Thanks again.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 13 May 2000 23:43:12 GMT
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Regular Expressions help
Message-Id: <87puqqf23z.fsf@shleppie.uh.edu>
>> On Sat, 13 May 2000 23:29:05 GMT,
>> malverian@hotmail.com said:
[ please indicate who you are citing ]
>> There's something else that's going on here that you're
>> not telling us about.
>>
>> Where does $username come from?
> It comes from a data file.
> open(USERS, $userfile); @users = <USERS>; close(USERS);
> $userlist = "@users";
[ unchecked open ]
> $username comes from the QUERY_STRING as well as $pass
And what might $pass be? If you keep on posting articles
that don't tell people anything that might help to find a
solution, you're going to get very frustrated.
hth
t
------------------------------
Date: Sun, 14 May 2000 00:21:13 GMT
From: mching@bigfoot.com
Subject: Re: Removing everything in a string before ":"
Message-Id: <391DF1AF.FED8044C@bigfoot.com>
> How can I remove all numbers and characters before and with ":"
> I have this string: $string = "14-1:5645";
> I only need the part after the :
$new = substr $string, index($string, ":")+1;
read the docs on substr and index
perldoc -f substr
perldoc -f index
index returns the position of the : in the string, add one to eliminate
the : itself.
------------------------------
Date: 13 May 2000 23:42:03 GMT
From: pj@no.spam (Peter Heslin)
Subject: Re: shooting yourself in the foot ...
Message-Id: <8fkp8b$rod$1@fraggle.esatclear.ie>
On Thu, 11 May 2000 10:10:03 -0400, Tad McClellan <tadmc@metronet.com> wrote:
>On 11 May 2000 09:10:45 GMT, Ilmari Karonen <iltzu@sci.invalid> wrote:
>>In article <391A2049.39E05465@citr.com.au>, James Beard wrote:
>>>I was just trolling through some old jokes, and I came across
>>>http://www.users.csbsju.edu/~lziegler/ShootingInFoot.html
>>>
>>>Does anyone have a "shooting yourself in the foot with perl"?
>>
>>"You grab the gun and pull the trigger without aiming. The bullet
>> hits your foot, which is what Perl assumed you wanted."
>
>
>Make a trigger pulling motion, and Perl will:
>
> autovivify a gun for you
>
> initialize it with bullets
>
> fire a bullet
>
> move your foot so as to coincide with the bullet's trajectory
>
> say "Ouch!" for you
Excellent! Here is a small modification:
Make a trigger pulling motion, and Perl will autovivify a gun for you,
initialize it with bullets, fire a bullet ... and shoot you in the head --
because `head' is the default operand for that function and you didn't
specify another.
Peter
--
Anti-spam -- Pluck the flower from the following to obtain my
correct e-mail address: Peter.Heslin@ucd.rose.ie
------------------------------
Date: Sat, 13 May 2000 23:35:55 GMT
From: "velocity" <velocity@youreallythinkitsme.com>
Subject: sorry repost i need help despertly can someone just look what is wrong
Message-Id: <vFlT4.62102$fF5.1953994@news1.rdc1.il.home.com>
Can any of you guys tell me why this program wont work.
It's a simple news poster allowing header hacking.
It seems to work, but no posts show up on usenet.
I redirected output to a text file and it looked good. I
then used netcat to send the info in that text file to the
news server and it worked. I even typed in the commands from
that file in telnet, that worked also.
It would seem im using the right posting commands.
It's connecting ok to the server, and quitting ok.
i added 3 seconds of sleep time after every command
to the server in case i needed some wait time.
i changed post commands to caps/no caps.
still nothing!
Can anybody figure this out??
#!/usr/bin/perl
#perl news-poster
#
##################################################################
# #
# perlnews 1.0 vinny@tampabay.rr.com #
# #
##################################################################
$from = "\"vinny\"\<vinny\@perlguru.com\>"; # change this
$server = 'news-server'; # change
this
$port = 119;
$win = 1; #
enter zero for unix/linux
# anything else for windows
#$refer = "<245@nowhere.com> <ed4f@joeblow.com>"
# cut and paste references
# here if replying to a thread.
if ($win) {
$win="Z";
} else {
$win="D";
}
print "\n\n Enter group to post to: \n\n";
$group=<STDIN>;
chop($group);
print "\n\n Enter a subject for the post: \n\n\n";
$subj=<STDIN>;
chop($subj);
print "\n\n\n Enter your message now:\n\n";
print " Type \^$win on a by itself and press enter when done:
\n\n:";
print " BE SURE TO NOT LEAVE ANY BLANK LINES AT THE END OF YOUR MESSAGE.
\n\n\n";
@msg=<STDIN>;
print "\n\n\n Now add any headers you like on its own line,\n\n";
print " Type ^$win on a line by itself and press enter when done:
\n\n\n";
@header=<STDIN>;
print "\n\nAttempting to connect to server, please wait\n\n";
use Socket;
$iaddr = inet_aton($server) || die "no host reachable at:
$server";
$proto = getprotobyname('tcp');
$paddr = sockaddr_in($port, $iaddr);
socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
connect(SOCK, $paddr) || die "connect: $!";
print SOCK "post\n";
print SOCK "Message-ID: \<fu4jdh4\@perlguru.com>\n";
print SOCK "From: $from\n";
print SOCK "Newsgroups: $group\n";
print SOCK "References: $refer\n";
print SOCK @header;
############ add permanent headers here#####################
print SOCK "Organization: Sons of Liberty\n";
print SOCK "FUCK CABAL\n";
print SOCK "FUCK NANAU\n";
############################################################
print SOCK "Subject: $subj\n";
print SOCK "\n";
print SOCK @msg;
print SOCK "\n.\n";
close(SOCK) || die "close: $!";
exit;
------------------------------
Date: Sat, 13 May 2000 23:38:49 GMT
From: "velocity" <velocity@youreallythinkitsme.com>
Subject: Re: sorry repost i need help despertly can someone just look what is wrong
Message-Id: <dIlT4.62105$fF5.1953999@news1.rdc1.il.home.com>
and if possible just add or take out to make it right please!! asny help
would be greatly appreciated,
velocity
velocity <velocity@youreallythinkitsme.com> wrote in message
news:vFlT4.62102$fF5.1953994@news1.rdc1.il.home.com...
> Can any of you guys tell me why this program wont work.
> It's a simple news poster allowing header hacking.
> It seems to work, but no posts show up on usenet.
> I redirected output to a text file and it looked good. I
> then used netcat to send the info in that text file to the
> news server and it worked. I even typed in the commands from
> that file in telnet, that worked also.
> It would seem im using the right posting commands.
> It's connecting ok to the server, and quitting ok.
> i added 3 seconds of sleep time after every command
> to the server in case i needed some wait time.
> i changed post commands to caps/no caps.
> still nothing!
> Can anybody figure this out??
>
> #!/usr/bin/perl
> #perl news-poster
> #
> ##################################################################
> # #
> # perlnews 1.0 vinny@tampabay.rr.com #
> # #
> ##################################################################
>
>
> $from = "\"vinny\"\<vinny\@perlguru.com\>"; # change this
> $server = 'news-server'; # change
> this
> $port = 119;
> $win = 1;
#
> enter zero for unix/linux
>
> # anything else for windows
>
>
>
>
> #$refer = "<245@nowhere.com> <ed4f@joeblow.com>"
>
> # cut and paste references
> # here if replying to a thread.
>
>
>
>
>
>
> if ($win) {
> $win="Z";
> } else {
> $win="D";
> }
> print "\n\n Enter group to post to: \n\n";
> $group=<STDIN>;
> chop($group);
> print "\n\n Enter a subject for the post: \n\n\n";
> $subj=<STDIN>;
> chop($subj);
> print "\n\n\n Enter your message now:\n\n";
> print " Type \^$win on a by itself and press enter when done:
> \n\n:";
> print " BE SURE TO NOT LEAVE ANY BLANK LINES AT THE END OF YOUR
MESSAGE.
> \n\n\n";
> @msg=<STDIN>;
> print "\n\n\n Now add any headers you like on its own line,\n\n";
> print " Type ^$win on a line by itself and press enter when done:
> \n\n\n";
> @header=<STDIN>;
>
>
> print "\n\nAttempting to connect to server, please wait\n\n";
>
>
> use Socket;
> $iaddr = inet_aton($server) || die "no host reachable at:
> $server";
> $proto = getprotobyname('tcp');
> $paddr = sockaddr_in($port, $iaddr);
> socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
> connect(SOCK, $paddr) || die "connect: $!";
>
>
> print SOCK "post\n";
> print SOCK "Message-ID: \<fu4jdh4\@perlguru.com>\n";
> print SOCK "From: $from\n";
> print SOCK "Newsgroups: $group\n";
> print SOCK "References: $refer\n";
> print SOCK @header;
> ############ add permanent headers here#####################
> print SOCK "Organization: Sons of Liberty\n";
> print SOCK "FUCK CABAL\n";
> print SOCK "FUCK NANAU\n";
> ############################################################
> print SOCK "Subject: $subj\n";
> print SOCK "\n";
> print SOCK @msg;
> print SOCK "\n.\n";
>
> close(SOCK) || die "close: $!";
> exit;
>
>
>
>
>
>
------------------------------
Date: Sat, 13 May 2000 18:15:28 -0500
From: "Andrew N. McGuire" <anmcguire@ce.mediaone.net>
Subject: Re: spoofing identity
Message-Id: <391DE210.AB0085C6@ce.mediaone.net>
blah80 wrote:
>
> I know this is pretty basic, but here goes:
>
> Every 5 minutes I want to execute a pgm that hits a site and scrapes then
> parses the html. I don't really have permission to do this, so they might
> spot me in the logs pretty soon and block my ip address. I know people have
> bots hitting sites all the time and they solve this. How do they do that?
Why don't you ask for permission, they may say yes.
Having been a sysadmin for an ISP before, I can honestly
say... What your trying to do will end up pissing some
people off. Better to get permission, and if they don't
give it to you, don't do it.
Regards,
anm
--
/*-------------------------------------------------------.
| Andrew N. McGuire |
| anmcguire@ce.mediaone.net |
`-------------------------------------------------------*/
------------------------------
Date: Sun, 14 May 2000 02:24:36 +0400
From: "Teterlev Sergey" <teterlevsv@mtu-net.ru>
Subject: the Test, to write to conference
Message-Id: <8fkkou$1f9j$1@gavrilo.mtu.ru>
just a test
WarkaMEN.
------------------------------
Date: Sat, 13 May 2000 17:54:40 -0600
From: stone@stoneentertainment.com (Kevin Stone)
Subject: This error catching code should work right?
Message-Id: <stone-1305001754410001@fc-pm7-01.enetis.net>
I'm experimenting with error catching code that is more robust than the
standard "WORK OR DIE" method. Below is an example of my error catching
code. All I'm doing is opening a file saving its contents to an array and
closing it. My intent is to create highly descriptive, intuitive error
messages for a log file and also for printing it to the screen...
$status = open (DBASE, $database);
if ($status > 0) {last;}
else
{
$error='failed to open';
$file='database file';
$location='add entries';
&errorlog;
}
@database = <DBASE>;
$status = close (DBASE);
if ($status == 1) {last;}
else
{
$error='failed to close';
$file='database file';
$location='add entries';
&errorlog;
}
The way I understand it, OPEN returns an undefined value if it fails and a
non-zero value upon success. CLOSE returns 1 upon success. The problem
is that it (that is the Server) does not seem to like me assigning a
variable to catch the returned values from the OPEN and CLOSE functions.
Syntax is okay, but I get an INTERNAL SERVER ERROR unless I remove the
"$status" variable.
What's the solution here? Any help will be greatly appreciated!
--
Kevin Stone
stone@enetis.net
------------------------------
Date: Sun, 14 May 2000 00:27:48 GMT
From: malverian@my-deja.com
Subject: Re: This error catching code should work right?
Message-Id: <8fkrtq$u4e$1@nnrp1.deja.com>
> $status = open (DBASE, $database);
> if ($status > 0) {last;}
Last isn't a valid command, the reason it works when you remove $status
is that it runs the else instead.
Therefor going through and skipping last;
I'm guessing you meant this to be &last;
Good luck.
~Malv
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 14 May 2000 00:55:27 +0200
From: "Geert-Jan" <gortergj@cityweb.de>
Subject: Update problem with DBI-ODBC and MSAccess
Message-Id: <8fklnl$9sc$1@news.cityweb.de>
Everytime I try an "UPDATE... " or an "INSERT..." SQL command on an Access
Database
using a Perl program with DBI and DBD-ODBC, it fails. The SELECT-strings
work fine though.
The web server returns an error, like:
"DBD::ODBC::st fetchall_arrayref failed: (DBD: no select statement currently
executing err=-1)
at C:\sambar41\docs\odigon_1\cgi-bin\test\update.cgi line 16."
I was also given a reference to an error in the DBI.pm.
Here's an example of the script, although I don't think there's something
wrong with it
(because the SELECTs work):
#!c:\Perl\bin\perl.exe
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
$dbName = "DBI:ODBC:Keywords";
$dbUserName = "user";
$dbPassword = "";
$dbh = &connectToDB();
$dataObject = $dbh->prepare("UPDATE tbl_smg_dat_Class_Synonym_Ger_1 SET
tbl_smg_dat_Class_Synonym_Ger_1.Name_Class = 'Kräuter' WHERE
tbl_smg_dat_Class_Synonym_Ger_1.Name_Class='Gewürze'");
$dataObject->execute();
@dbRows = $dataObject->
fetchall_arrayref();
sub connectToDB
{
# return (DBI->connect($dbName, $dbUserName, $dbPassword));
$dbh = DBI->connect($dbName, $dbUserName, $dbPassword ,
{ RaiseError=>1 },
)
}
Can anybody help me with this problem?
Thanks!
Geert-Jan Gorter
------------------------------
Date: 13 May 2000 02:47:49 GMT
From: mjassels@cs.concordia.ca (Michael J Assels)
Subject: Re: Using user-variables in external commands?
Message-Id: <8fifol$qmv$1@newsflash.concordia.ca>
In article <11ca6ec0dac77212155a826d847f7b2a@mixmaster.shinn.net>,
Anonymous Sender <nobody@mixmaster.shinn.net> wrote:
>I know that I have to escape chars if
>I use something like that:
>
>system("sendmail $recipient");
>
>because someone can do nasty things with
>that, but how is it if I use the following:
>
>open(MAIL,"| sendmail");
>print <<MAIL;
>To: $recipient
>
>$body
>end
>close(MAIL);
>
>Can someone here also do nasty things?
>And how can I savely send mails by
>allowing _all_ characters?
My sendmail wouldn't like to be called that way, your "print"
statement is going to STDOUT rather than MAIL, and your
here-document never ends. However, there is still *some* sense
in your questions. The answers:
1. Yes. Someone can still do nasty things:
$recipient =<<EOWORM;
prisoner-of-bill@somewhere.com
Subject: ILOVEYOU
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_00E9_01BFB5D9.02FA44F0"
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
This is a multi-part message in MIME format.
------=_NextPart_000_00E9_01BFB5D9.02FA44F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
kindly check the attached LOVELETTER coming from me.
------=_NextPart_000_00E9_01BFB5D9.02FA44F0
Content-Type: application/octet-stream;
name="LOVE-LETTER-FOR-YOU.TXT.vbs"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="LOVE-LETTER-FOR-YOU.TXT.vbs"
rem barok -loveletter(vbe) <i hate go to school>
rem by: spyder / ispyder@mail.com / @GRAMMERSoft
Group
/ =
Manila,Philippines
On Error Resume Next
...
EOWORM
2. You can't send mail safely by allowing all characters.
Hope This Helps,
Michael
------------------------------
Date: Sat, 13 May 2000 19:09:15 -0400
From: Sydney Lu <slu_2@altavista.net>
Subject: Why does Perl do this?
Message-Id: <uknrhs8h6i0haagdkokiio64r2h08obob9@4ax.com>
I just spent about half an hour scratching my head wondering why Perl
kept giving me "Out of Memory" when there was clearly enough memory
available.
Turns out, I was trying to use a hash reference as the index into an
array. Whoops.
What I'm wondering is, why didn't Perl warn me about that? I ran with
warnings, with strict, and got a fatal error instead. :-)
I'm guessing that references are just stored as really big integers or
something internally?
So that when I asked for $b[ $hash_ref ], it tried to allocate a few
gigs of memory for an array after evaluating $hash_ref to a really
huge integer, and then read from it? (thus making malloc() return 0?)
But either way, would there ever be a legal situation where one would
need to use a reference as the subscript for an array? and if not, why
doesn't Perl catch this type of behavior?
TIA,
Sydney
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3039
**************************************