n00dles has asked for the wisdom of the Perl Monks concerning the following question:
Repeated a rather large amount of times. I think that @source is not beening assigned any values? and using perl -d did not reap much help but im still learning my way round the debuger.Use of uninitialized value in pattern match (m//) at ./usercheck.pl li +ne 35. Use of uninitialized value in pattern match (m//) at ./usercheck.pl li +ne 35.
Any wisdom you can offer would be greatly recived. I have made a command-line version of this app that uses @ARGV to take the target and userlist from the prompt witch works fine, but this version does not.#!/usr/bin/perl -w # by n00dles use IO::Socket; use strict; my $target = 'localhost'; my $userlist = 'uselist.txt'; my $timeout = 40; print "Content-type: text/html\n\n"; print "<BODY BGCOLOR=#000000 Text=#008000 link=#00c000 vlink=lightblue +>"; print "<PRE>\n"; print "<H2>Active Apache user accounts</H2>\n\n"; print "<B>Loading from file $userlist</B>\n"; open(USERS, "< $userlist") or die "cannot open file: $!\n"; my @users =<USERS>; close(USERS); print "<B>User list $userlist loaded!</B>\n"; print "<B>Starting Scan please wait...</B>\n"; for (my $i = 0; $i < scalar(@users); $i++) { my $socket = new IO::Socket::INET ( peerAddr => $target, peerPort => '80', Proto => 'tcp', Timeout => $timeout,); die "Socket failed at $target\n" unless $socket; print $socket "GET http://$target/~$users[$i] HTTP/1.0\r\n\r\n +"; my @source = <$socket>; foreach my $line ($source[2]) { if ($line =~/302 Found/ || $line =~ /200 OK/ || $line +=~ /403 Forbidden/ || $line =~ /301 Moved Permanetly/) { print "Found: $users[$i]"; } } close($socket); } print "</BODY></HTML>";
2006-09-03 Retitled by g0n, as per Monastery guidelines
Original title: 'Completely lost :('
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Completely lost - 'Use of uninitialized value in pattern match...' error :(
by merlyn (Sage) on Sep 02, 2006 at 14:25 UTC | |
|
Re: Completely lost - 'Use of uninitialized value in pattern match...' error :(
by japhy (Canon) on Sep 01, 2006 at 19:49 UTC | |
|
Re: Completely lost - 'Use of uninitialized value in pattern match...' error :(
by GrandFather (Saint) on Sep 01, 2006 at 20:12 UTC | |
|
Re: Completely lost - 'Use of uninitialized value in pattern match...' error :(
by chromatic (Archbishop) on Sep 01, 2006 at 23:42 UTC | |
|
Re: Completely lost - 'Use of uninitialized value in pattern match...' error :(
by McDarren (Abbot) on Sep 01, 2006 at 22:19 UTC |