protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $transformer = $this->rainbow->getTransformer("base64");
     $value = $input->getArgument("value");
     if (!$transformer->canValueBeReversed($value)) {
         throw new \InvalidArgumentException(sprintf("The value '%s' is not a valid base64", $value));
     }
     $output->writeln($transformer->reverseTransformation($value));
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $charList = $input->getOption("char-list");
     $charList = str_replace("::Alpha::", "::alpha::::ALPHA::", $charList);
     $charList = str_replace("::alpha::", IncrementalDataProvider::CHAR_LIST_ALPHA_LOWER, $charList);
     $charList = str_replace("::ALPHA::", IncrementalDataProvider::CHAR_LIST_ALPHA_UPPER, $charList);
     $charList = str_replace("::numeric::", IncrementalDataProvider::CHAR_LIST_NUMBER, $charList);
     $minLength = (int) (null !== $input->getOption("min-length") ? $input->getOption("min-length") : static::DEFAULT_MIN_LENGTH);
     $maxLength = (int) (null !== $input->getOption("max-length") ? $input->getOption("max-length") : static::DEFAULT_MAX_LENGTH);
     $transformers = $input->getArgument("transformers");
     if (null !== $input->getOption("dictionary")) {
         $dataProvider = new FileDataProvider(new FileHandler($input->getOption("dictionary")));
     } else {
         $dataProvider = new IncrementalDataProvider($minLength, $maxLength, [$charList]);
     }
     $file = $input->hasOption("filepath") ? $input->getOption("filepath") : "php://stdout";
     $fileHandler = new FileHandler($file, $input->hasOption("filepath") ? FileHandlerInterface::MODE_APPEND_AND_READ : FileHandlerInterface::MODE_ERASE_AND_WRITE_ONLY);
     $this->rainbow->generateRainbowTable($fileHandler, $dataProvider, array_map("trim", explode(",", $transformers)));
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $hash = $input->getArgument("hash");
     $guessedTransformers = $this->rainbow->guessHashTransformer($hash);
     $guessedTransformersCount = count($guessedTransformers);
     if (0 === $guessedTransformersCount) {
         $output->writeln(sprintf("The hash '%s' seems to be not supported", $hash));
     } else {
         $formattedTransformers = "";
         foreach ($guessedTransformers as $alias => $transformer) {
             $formattedTransformers .= $transformer->getName();
             if ($alias !== $transformer->getName()) {
                 $formattedTransformers .= "(alias: " . $alias . ")";
             }
             $formattedTransformers .= ',';
         }
         $output->writeln(sprintf("%d type%s of hash has been found for the hash '%s': %s", $guessedTransformersCount, $guessedTransformersCount >= 2 ? "s" : "", $hash, substr($formattedTransformers, 0, -1)));
     }
 }
 protected function configure()
 {
     parent::configure();
     $this->setName("rainbow:lookup")->addArgument("hash", InputArgument::REQUIRED, "The hash you want to guess the type")->addOption("rainbow-table", "r", InputOption::VALUE_REQUIRED, "The rainbow table to use")->addOption("deep-search", "d", InputOption::VALUE_NONE, "Deep search in the rainbow table")->addOption("partial", "p", InputOption::VALUE_NONE, "The given hash is partial");
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $output->writeln($this->rainbow->getTransformer("urlencode")->reverseTransformation($input->getArgument("value")));
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $output->writeln($this->rainbow->getTransformer("base64")->transform($input->getArgument("value")));
 }