-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
main.php
61 lines (56 loc) · 1.99 KB
/
main.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
<?php
require __DIR__ . '/vendor/autoload.php';
use Cvar1984\SqlScan\SqlScan;
use Cvar1984\SqlScan\Cli as Cout;
use Cvar1984\SqlScan\Dorker;
try {
$count = scandir('phar://main.phar/assets/');
$count = sizeof($count);
$path = 'phar://main.phar/assets/banner_' . rand(0, ($count - 2)) . '.txt';
$file = fopen($path, 'r');
if ($file) {
$file = fread($file, filesize($path));
Cout::printStandar($file);
} else {
Cout::printWarning('can\'t load banner');
}
if ($argc >= 3) {
switch ($argv[2]) {
case '--scan':
$sql = new Sqlscan();
$url = trim($argv[1]);
if (filter_var($url, FILTER_VALIDATE_URL)) {
$sql->scan($url, 'result.txt');
} else {
$pwd = getcwd() . DIRECTORY_SEPARATOR . $url;
if (file_exists($pwd)) {
$file = file_get_contents($pwd);
$file = trim($file, " \n");
$url = explode("\n", $file);
foreach ($url as $url) {
$sql->scan($url, 'result.txt');
}
} else {
Cout::printError('File not exists ' . $pwd);
}
}
break;
case '--dork':
$dork = new Dorker($argv[1], 'result_url.txt');
break;
case '--shell':
Cout::printError('under development');
break;
default:
Cout::printAsk('Available method : --scan, --dork, --shell');
Cout::printError('Undefined method : ' . $argv[2]);
break;
}
} else {
Cout::printAsk('Usage : sqlscan [required] [option]');
Cout::printLine('Examples : sqlscan http://hackme.org --scan');
}
} catch (Exception $e) {
fprintf(STDERR, '%s%s', $e->getMessage(), PHP_EOL);
exit(1);
}