Beispiel #1
0
function updateAllCourthouses($jconfig)
{
    $dbCon = connectTo($jconfig, "Justice", TRUE, FALSE);
    $sqlAllCourthouses = "SELECT `address`,`port`,`username`,`userpass` FROM Courthouses;";
    $allCH = $dbCon->query($sqlAllCourthouses);
    $sqlAllWords = "SELECT * from Words ORDER BY `id`;";
    echo "Retrieving all words...\n";
    $allWords = $dbCon->query($sqlAllWords);
    // Convert the words to a suitable insertion statement
    $sqlInsertWords = "INSERT IGNORE INTO `Words` (`id`, `word`) VALUES ";
    while ($wordRecord = $allWords->fetch_row()) {
        $wid = $wordRecord[0];
        $word = $wordRecord[1];
        $sqlInsertWords .= "( '" . $wid . "', '" . $word . "' ),";
    }
    $sqlInsertWords = substr($sqlInsertWords, 0, -1) . ";";
    $sqlAllTargets = "SELECT * from `Targets` ORDER BY `id`;";
    echo "Retrieving all unsolved targets...\n";
    $allTargets = $dbCon->query($sqlAllTargets);
    // Convert the targets to a suitable insertion statement
    $sqlInsertTargets = "TRUNCATE TABLE `Targets`; INSERT IGNORE INTO `Targets` (`id`, `ishash`, `isbenchmark`, `hashtype_id`, `hash_value`, `confidence` ) VALUES ";
    while ($targetRecord = $allTargets->fetch_row()) {
        if (is_null($targetRecord[5])) {
            $tID = $targetRecord[0];
            $tIH = $targetRecord[1];
            $tBM = $targetRecord[2];
            $tHI = $targetRecord[3];
            $tHV = $targetRecord[4];
            $tCF = $targetRecord[6];
            $sqlInsertTargets .= "( '" . $tID . "', '" . $tIH . "', '" . $tBM . "', '" . $tHI . "', '" . $tHV . "', '" . $tCF . "' ),";
        }
    }
    $sqlInsertTargets = substr($sqlInsertTargets, 0, -1) . ";";
    while ($chRecord = $allCH->fetch_row()) {
        $chAddress = $chRecord[0];
        $chPort = $chRecord[1];
        $chUser = $chRecord[2];
        $chPass = $chRecord[3];
        $chCon = connectManual($chAddress, $chUser, $chPort, $chPass, "Courthouse", FALSE);
        echo "Pushing updated wordlist to " . $chAddress . ":" . $chPort . "\n";
        $pushWords = $chCon->query($sqlInsertWords);
        echo "Pushing updated targets to " . $chAddress . ":" . $chPort . "\n";
        $pushTargets = $chCon->multi_query($sqlInsertTargets);
        $chCon->close();
    }
    $dbCon->close();
    userAck();
}
Beispiel #2
0
 public function showAllSettings()
 {
     foreach ($this->settings as $section => $setting) {
         echo $section . "\n";
         echo "-----------------------\n";
         foreach ($setting as $key => $value) {
             echo "   " . $key . " : " . $value . "\n";
         }
     }
     userAck();
 }
Beispiel #3
0
function showCourthouseStatus($chConfig)
{
    $dbCon = connectTo($chConfig, "Courthouse", TRUE, FALSE);
    $tempWordResults = $dbCon->query("SELECT COUNT(*) FROM Words");
    $tempWord = $tempWordResults->fetch_row();
    if (is_null($tempWord)) {
        $wordCount = 0;
    } else {
        $wordCount = $tempWord[0];
    }
    $tempTargetResults = $dbCon->query("SELECT COUNT(*) FROM Targets");
    $tempTarget = $tempTargetResults->fetch_row();
    if (is_null($tempTarget)) {
        $targetCount = 0;
    } else {
        $targetCount = $tempTarget[0];
    }
    $tempWordResults->close();
    $tempTargetResults->close();
    $dbCon->close();
    echo "Statistics:\n";
    echo "Words:   " . $wordCount . "\n";
    echo "Targets: " . $targetCount . "\n";
    userAck();
}