I have written this little app, really just for somthing to.
but I keep getting the following error.
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.
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.
#!/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>";
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.
2006-09-03 Retitled by g0n, as per Monastery guidelines
Original title: 'Completely lost :('