develooper Front page | perl.beginners | Postings from December 2002

Super Newbie Q

Thread Next
Alan Moote
December 8, 2002 12:08
Super Newbie Q
Message ID:
Hey gang,

As you will soon see, I am quite new to Perl.  I am
trying to out put a list of IPs that are trying to
access cmd.exe on my webserver.  The problem is, when
I run the script against my access_log the output is a
bunch of blank lines.  Here's the script so far:

#!/usr/bin/perl -w
## Use pattern matching to find IPs that have searched
for "cmd.exe"

## Example log lines:
## - - [08/Dec/2002:08:47:46 -0500] "GET
/c/winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 293 "-"
## - - [08/Dec/2002:08:47:48 -0500] "GET
/d/winnt/system32/cmd.exe?/c+dir HTTP/1.0" 404 293 "-"
## - - [08/Dec/2002:08:47:51 -0500] "GET
HTTP/1.0" 404 307 "-" "-"


## Open the file called from command line, die with
error if not readable

open(ACCLOG, "<$LogFile") || die "Cannot open

while(<ACCLOG>) {
        print "$1\n";


It's not much, and to me, it looks right, but
obviously I am overlooking some details.
Any ideas?



Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About