forked from Shadow-Network/perl-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnumerates directorys-users on a webserver.pl
More file actions
54 lines (39 loc) · 2.17 KB
/
Enumerates directorys-users on a webserver.pl
File metadata and controls
54 lines (39 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/perl
use Socket;
my $target = $ARGV[0];
my $dirlist = $ARGV[1];
my $hold = $ARGV[2];
die "usage: $0 <target> <inputfile> <secs>" if (!$ARGV[1]);
system('clear');
open(TXT, "$dirlist") || die "Error: couldn't open $dirlist\n";
@dirs = <TXT>;
close(TXT);
my $dircount = @dirs;
print "Loaded $dircount directory names\n\n";
print "Press Enter To Continue...\n";
<STDIN>;
foreach(@dirs) {
$iaddr = inet_aton($target);
$paddr = sockaddr_in('80', $iaddr);
$proto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto);
connect(SOCK, $paddr) || die "Error: Couldnt connect to socket\n";
send(SOCK, "GET /".$_."\n\n", 0) || die "Error: Couldnt send to socket\n";
@results = <SOCK>;
if (grep /301 Moved Permanently/i, @results ){
push(@valid, $_);
$count++;
print "VALID\t\t$_\n";
}
else {
print "INVALID\t\t$_\n";
}
$scanned++;
sleep $hold;
}
if (!$count) {print "No valid directorys at $target\n"; exit}
print "\n $count valid dir(s) at $target\n\n";
print "x" x 50; print "\n\n";
foreach(@valid) {
print "$_\n"
}