This repository has been archived by the owner on Sep 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new set-config command and new tests
- Loading branch information
Showing
15 changed files
with
232 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,5 +24,5 @@ | |
"zip" | ||
], | ||
"ssl-cert-check": 1, | ||
"version": "1.1.2" | ||
"version": "1.1.3" | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
/** | ||
* The Shone Security Scanner is used to help a developer determine if the versions of the | ||
* dependencies he is using are vulnerable to known exploits. | ||
* | ||
* @category Shone | ||
* @package Scanner | ||
* @author Thomas Shone <xsist10@gmail.com> | ||
*/ | ||
|
||
namespace Shone\Scanner\Command; | ||
|
||
use Shone\Scanner\Scanner; | ||
|
||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Command\Command; | ||
|
||
use \Exception; | ||
|
||
/** | ||
* The self-update command only accessable when accessing from a phar | ||
* | ||
* @category Shone | ||
* @package Scanner\Command | ||
* @author Thomas Shone <xsist10@gmail.com> | ||
*/ | ||
class SetConfigCommand extends Command | ||
{ | ||
/** | ||
* Configure our command call | ||
* | ||
* @return void | ||
*/ | ||
protected function configure() | ||
{ | ||
$help = <<<EOT | ||
The <info>set-config</info> command sets the configuration for a user. | ||
EOT; | ||
|
||
$this | ||
->setName('set-config') | ||
->setHelp($help) | ||
->setAliases(array('setconfig')) | ||
->setDescription('Setup the configuration for a user.') | ||
->setDefinition(array( | ||
new InputOption('key', null, InputOption::VALUE_REQUIRED, 'Set an API key.'), | ||
new InputOption('common-checksum', 'c', InputOption::VALUE_REQUIRED, 'Set whether to always ignore files that are very common.', true), | ||
new InputOption('no-cert-check', null, InputOption::VALUE_REQUIRED, 'Set whether to disable CA certificate checks.', false), | ||
)); | ||
} | ||
|
||
/** | ||
* Execute our command call | ||
* | ||
* @param Symfony\Component\Console\Input\InputInterface $input Input source | ||
* @param Symfony\Component\Console\Output\OutputInterface $output Output source | ||
* | ||
* @return void | ||
* @codeCoverageIgnore | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$config = $this->getApplication()->getConfig(); | ||
|
||
$no_cert_check = $input->getOption('no-cert-check') ? true : false; | ||
$config->set('no-cert-check', $no_cert_check); | ||
$output->writeln(sprintf("Setting no-cert-check to <info>%b</info>.", $no_cert_check)); | ||
|
||
$common_checksum = $input->getOption('common-checksum') ? true : false; | ||
$config->set('common-checksum', $common_checksum); | ||
$output->writeln(sprintf("Setting common-checksum to <info>%b</info>.", $common_checksum)); | ||
|
||
if ($input->getOption('key')) | ||
{ | ||
$config->set('key', $input->getOption('key')); | ||
$output->writeln(sprintf("Setting key to <info>%s</info>.", $config->get('key'))); | ||
} | ||
|
||
$output->writeln("<info>Config file saved.</info>"); | ||
$config->save(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters