-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
35 lines (30 loc) · 1.12 KB
/
index.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
<?php
/**
* PHP auto indexer: the tool against directory traversal security vulnerability.
*
* @author Maksim T. <zapalm@yandex.com>
* @copyright 2019 Maksim T.
* @license https://opensource.org/licenses/MIT MIT
* @link https://github.com/zapalm/auto-indexer GitHub
* @link https://prestashop.modulez.ru/en/tools-scripts/78-tool-against-directory-traversal-security-vulnerability.html Homepage
*/
use zapalm\AutoIndexer;
require __DIR__ . DIRECTORY_SEPARATOR . 'AutoIndexer.php';
if ('cli' !== php_sapi_name()) {
exit(1);
}
if ($argc >= 3) {
array_shift($argv);
$command = trim(array_shift($argv));
if ('--add' === $command) {
$autoIndexer = new AutoIndexer(array_shift($argv), array_shift($argv));
$autoIndexer->addIndex();
exit(0);
} elseif ('--remove' === $command) {
$autoIndexer = new AutoIndexer(array_shift($argv));
$autoIndexer->removeIndex();
exit(0);
}
}
echo 'php index.php (--add or --remove) (The directory path for recursively adding or removing the index.php) [The template path for adding the index.php file]' . PHP_EOL;
exit(1);