Ejemplo n.º 1
0
function runMenu($courthouseConfig)
{
    $UserChoice = "I";
    while ($UserChoice != "X") {
        clearScreen();
        echo "+-------------------------------------------------------------------------+\n";
        echo "|                                                                         |\n";
        echo "|          Cryptolingus Cracking Suite (CLCS) - COURTHOUSE                |\n";
        echo "|                                                                         |\n";
        echo "+-------------------------------------------------------------------------+\n";
        echo "\n";
        echo "Commands:\n";
        echo "---------\n";
        echo "[I] Initialize Courthouse\n";
        echo "[B] Build jobs... for 'murica\n";
        echo "[S] Show configuration\n";
        echo "[V] View status\n";
        echo "[X] Exit Justice\n";
        echo "\n";
        $UserChoice = getUserInput("Choice:", TRUE);
        switch ($UserChoice) {
            case 'B':
                buildJobs($courthouseConfig);
                break;
            case 'I':
                initializeCourthouse($courthouseConfig);
                break;
            case 'S':
                $courthouseConfig->showAllSettings();
                break;
            case 'V':
                showCourthouseStatus($courthouseConfig);
                break;
            case 'X':
                break;
            default:
                showError();
                break;
        }
    }
}
Ejemplo n.º 2
0
function runMenu($justiceConfig)
{
    $UserChoice = "I";
    $TgtCH = "localhost";
    while ($UserChoice != "X") {
        clearScreen();
        echo "+-------------------------------------------------------------------------+\n";
        echo "|                                                                         |\n";
        echo "|          Cryptolingus Cracking Suite (CLCS) - JUSTICE                   |\n";
        echo "|                                                                         |\n";
        echo "+-------------------------------------------------------------------------+\n";
        echo "\n";
        echo "Current Courthouse: " . $TgtCH . "\n";
        echo "\n";
        echo "Commands:\n";
        echo "---------\n";
        echo "[W] Load wordlist\n";
        echo "[T] Load targets\n";
        echo "\n";
        echo "[V] View status\n";
        echo "[Q] Query Courthouses\n";
        echo "[S] Sync Courthouses\n";
        echo "\n";
        echo "[C] Show configuration\n";
        echo "[I] Initiate/Reset Database\n";
        echo "[A] Add Courthouse\n";
        echo "[K] Shutdown Courthouse\n";
        echo "[X] Exit Justice\n";
        echo "\n";
        echo "\n";
        $UserChoice = getUserInput("Choice:", TRUE);
        switch ($UserChoice) {
            case 'A':
                addCourthouse($justiceConfig);
                break;
            case 'I':
                initializeJustice($justiceConfig);
                break;
            case 'K':
                $TargetCourthouse = chooseCourthouse();
                stopCourthouse($TargetCourthouse);
                userAck();
                break;
            case 'Q':
                updateFromCourthouses($justiceConfig);
                break;
            case 'C':
                $justiceConfig->showAllSettings();
                userAck();
                break;
            case 'T':
                loadTargets(FALSE, "Justice", $justiceConfig);
                userAck();
                break;
            case 'V':
                showJusticeStatus($justiceConfig);
                break;
            case 'W':
                loadWordlist(FALSE, "Justice", $justiceConfig);
                userAck();
                break;
            case 'X':
                break;
            case 'S':
                updateFromCourthouses($justiceConfig);
                updateAllCourthouses($justiceConfig);
                break;
            default:
                showError();
                break;
        }
    }
}
function drawSelectTable($db, $database)
{
    $tables = [];
    $length = 0;
    $num_len = 0;
    $num = 1;
    $db->query('USE ' . $database);
    foreach ($db->query('SHOW TABLES')->fetchAll(PDO::FETCH_COLUMN) as $table) {
        if (strlen($table) > $length) {
            $length = strlen($table);
        }
        if (strlen($num) > $num_len) {
            $num_len = strlen($num);
        }
        $tables[$num] = $table;
        $num++;
    }
    $total_len = $length + $num_len + 4;
    // num:   string
    clearScreen();
    drawEmptyLine();
    drawRow("DATABASE: " . $database);
    drawTableLine($total_len);
    drawEmptyTableLine($total_len);
    foreach ($tables as $num => $table) {
        drawTableRow($num . ":" . str_repeat(" ", $num_len - strlen($num) + 3) . $table, $total_len);
    }
    drawEmptyTableLine($total_len);
    drawTableLine($total_len);
    drawEmptyLine();
    drawEmptyLine();
    $table_num = 0;
    while (!isset($tables[$table_num])) {
        $table_num = drawQuestion("Select table");
    }
    $table = $tables[$table_num];
    drawEmptyLine();
    return $table;
}