add -S (scramble) option
This commit is contained in:
parent
361fb62804
commit
95a762ee0f
30
src/main.cpp
30
src/main.cpp
|
@ -1,16 +1,18 @@
|
||||||
|
#include "ansi.hpp"
|
||||||
#include "fprint.hpp"
|
#include "fprint.hpp"
|
||||||
|
#include "scramble.hpp"
|
||||||
#include "worker.hpp"
|
#include "worker.hpp"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define _WIN32_LEAN_AND_MEAN
|
#define _WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
DWORD lastVtMode = 0;
|
DWORD lastVtMode = 0;
|
||||||
|
|
||||||
void EnableVtMode() {
|
void EnableVtMode() {
|
||||||
GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), &lastVtMode);
|
GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), &lastVtMode);
|
||||||
auto newMode = lastVtMode | ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
auto newMode = lastVtMode | ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||||
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), newMode);
|
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), newMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisableVtMode() {
|
void DisableVtMode() {
|
||||||
|
@ -79,6 +81,23 @@ struct Arguments {
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'S': { // Scramble
|
||||||
|
if(argv[i + 1] == nullptr || argv[i + 1][0] == '-') {
|
||||||
|
swbf::fprint(stdout, "Invalid value passed to -S\n");
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
auto str = std::string(argv[i + 1]);
|
||||||
|
|
||||||
|
if(str.length() > 8) {
|
||||||
|
swbf::fprint(stdout, "Invalid value passed to -S\n");
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
swbf::fprint(stdout, "Scramble of {}\"{}\"{} is {}{:8x}{}\n", swbf::ansi::Color(172), str, swbf::ansi::Reset(),
|
||||||
|
swbf::ansi::Color(166), swbf::SwsfScramble(str), swbf::ansi::Reset());
|
||||||
|
std::exit(0);
|
||||||
|
} break;
|
||||||
|
|
||||||
// terminals
|
// terminals
|
||||||
case '?':
|
case '?':
|
||||||
case 'h': {
|
case 'h': {
|
||||||
|
@ -132,8 +151,9 @@ struct Arguments {
|
||||||
swbf::fprint(stdout,
|
swbf::fprint(stdout,
|
||||||
// clang-format off
|
// clang-format off
|
||||||
"SWSF Bruteforcer, (C) 2023 Lily Tsuru under the MIT License\n"
|
"SWSF Bruteforcer, (C) 2023 Lily Tsuru under the MIT License\n"
|
||||||
"Usage: {} [-?/-h] [-X] [-s START_LENGTH] [-e END_LENGTH] <hash to crack, in hexadecimal>\n"
|
"Usage: {} [-?/-h] [-X] [-s START_LENGTH] [-e END_LENGTH] <-S STRING> <hash to crack, in hexadecimal>\n"
|
||||||
" -X Test exact length. Uses value of -s; -e is ignored in this mode.\n"
|
" -X Test exact length. Uses value of -s; -e is ignored in this mode.\n"
|
||||||
|
" -S Scramble the given input string\n"
|
||||||
" -s Start length to check. Must be greater than or equal to 2 and less than the end size (default 2)\n"
|
" -s Start length to check. Must be greater than or equal to 2 and less than the end size (default 2)\n"
|
||||||
" -e End length to check. Must be greater than the start size, and less than or equal to 8 (default 8)\n"
|
" -e End length to check. Must be greater than the start size, and less than or equal to 8 (default 8)\n"
|
||||||
" -?/-h Show this help message (and exit)\n",
|
" -?/-h Show this help message (and exit)\n",
|
||||||
|
|
Loading…
Reference in New Issue