-
-
Notifications
You must be signed in to change notification settings - Fork 90
/
s3-buckets-bruteforcer.php
executable file
·132 lines (103 loc) · 1.89 KB
/
s3-buckets-bruteforcer.php
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/usr/bin/php
<?php
spl_autoload_register(function ( $c ) {
include( $c.'.php' );
});
set_time_limit( 0 );
// parse command line
{
$options = [
'bucket:',
'detect-region',
'force-recurse',
'google',
'glue:',
'h',
'help',
'list',
'max-depth:',
'no-color',
'perform:',
'permut:',
'prefix:',
'provider:',
'region:',
'suffix:',
'thread:',
'verbosity:',
];
$t_options = getopt( '', $options );
//var_dump( $t_options );
$bruteforcer = new BucketBruteForcer();
$argc = $_SERVER['argc'] - 1;
foreach( $t_options as $k=>$v )
{
switch( $k )
{
case 'bucket':
$bruteforcer->setBucket( $v );
break;
case 'detect-region':
$bruteforcer->detectRegion();
break;
case 'force-recurse':
$bruteforcer->forceRecurse();
break;
case 'glue':
$bruteforcer->setGlue( $v );
break;
case '-h':
case 'help':
Utils::help();
break;
case 'list':
$bruteforcer->disableTest();
break;
case 'max-depth':
$bruteforcer->setMaxDepth( $v );
break;
case 'no-color':
$bruteforcer->disableColor();
break;
case 'perform':
$bruteforcer->setTests( $v );
break;
case 'permut':
$bruteforcer->setPermutation( $v );
break;
case 'prefix':
$bruteforcer->setPrefix( $v );
break;
case 'provider':
$bruteforcer->setProvider( $v );
break;
case 'region':
if( !$bruteforcer->setRegion($v) ) {
Utils::help( 'Invalid region "'.$v.'" ' );
}
break;
case 'suffix':
$bruteforcer->setSuffix( $v );
break;
case 'thread':
$bruteforcer->setMaxChild( $v );
break;
case '-v':
case 'verbosity':
$bruteforcer->setVerbosity( (int)$v );
break;
default:
Utils::help( 'Unknown option: '.$k );
}
}
if( !$bruteforcer->getBucket() ) {
Utils::help( 'Bucket not found' );
}
}
// ---
// main loop
{
$bruteforcer->run();
}
// ---
exit();