|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Mage Scan |
|
4
|
|
|
* |
|
5
|
|
|
* PHP version 5 |
|
6
|
|
|
* |
|
7
|
|
|
* @category MageScan |
|
8
|
|
|
* @package MageScan |
|
9
|
|
|
* @author Steve Robbins <[email protected]> |
|
10
|
|
|
* @copyright 2015 Steve Robbins |
|
11
|
|
|
* @license http://creativecommons.org/licenses/by/4.0/ CC BY 4.0 |
|
12
|
|
|
* @link https://github.com/steverobbins/magescan |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace MageScan\Command\Scan; |
|
16
|
|
|
|
|
17
|
|
|
use MageScan\Check\TechHeader; |
|
18
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
19
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Scan server tech command |
|
23
|
|
|
* |
|
24
|
|
|
* @category MageScan |
|
25
|
|
|
* @package MageScan |
|
26
|
|
|
* @author Steve Robbins <[email protected]> |
|
27
|
|
|
* @copyright 2015 Steve Robbins |
|
28
|
|
|
* @license http://creativecommons.org/licenses/by/4.0/ CC BY 4.0 |
|
29
|
|
|
* @link https://github.com/steverobbins/magescan |
|
30
|
|
|
*/ |
|
31
|
|
|
class ServerCommand extends AbstractCommand |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* Configure command |
|
35
|
|
|
* |
|
36
|
|
|
* @return void |
|
37
|
|
|
*/ |
|
38
|
|
|
protected function configure() |
|
39
|
|
|
{ |
|
40
|
|
|
$this |
|
41
|
|
|
->setName('scan:server') |
|
42
|
|
|
->setDescription('Check server technology'); |
|
43
|
|
|
parent::configure(); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Execute command |
|
48
|
|
|
* |
|
49
|
|
|
* @param InputInterface $input |
|
50
|
|
|
* @param OutputInterface $output |
|
51
|
|
|
* |
|
52
|
|
|
* @return void |
|
53
|
|
|
*/ |
|
54
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
55
|
|
|
{ |
|
56
|
|
|
$techHeader = new TechHeader; |
|
57
|
|
|
$techHeader->setRequest($this->request); |
|
58
|
|
|
$values = $techHeader->getHeaders(); |
|
59
|
|
|
if (empty($values)) { |
|
60
|
|
|
return $this->out('Server Technology', 'No detectable technology was found'); |
|
61
|
|
|
} |
|
62
|
|
|
$rows = []; |
|
63
|
|
|
foreach ($values as $key => $value) { |
|
64
|
|
|
$rows[] = [$key, $value]; |
|
65
|
|
|
} |
|
66
|
|
|
$this->out('Server Technology', [[ |
|
67
|
|
|
'type' => 'table', |
|
68
|
|
|
'data' => [ |
|
69
|
|
|
['Key', 'Value'], |
|
70
|
|
|
$rows |
|
71
|
|
|
] |
|
72
|
|
|
]]); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|