echo serialize($router); break; case 'import': if (!wire('user')->isLoggedin()) { $content = "<article><h2>Gesicherte Seite</h2>Bitte Anmelden oder Registrieren.</article>"; } elseif (!wire('user')->authsuccess) { $content = "<article><h2>Authorisiere deinen Account</h2><p>Um deine Nodes zu importieren musst du deine E-Mail Adresse verifizieren.</p></article>"; } else { $query = new mysqlMigrate(); $nodes = $query->searchNodes(wire('user')->email); if (empty($nodes)) { $content = "<article>\n <h2>Keine Nodes gefunden</h2>\n <p>Es konnten keine Nodes gefunden werden.\n Die Nodes werden mit Hilfe deiner E-Mail Adresse gesucht.\n Bitte überprüfe das deine E-Mail Adresse die selbe wie\n im alten System ist. Sollten weiterhin Probleme sein\n dann sprich einfach einen der Administratoren an.</p>\n </article>"; break; } foreach ($nodes as $node) { $content .= registerNode($node['MAC'], $node['PublicKey']); } $content = "<h2>Nodes Hinzufügen</h2><ul>{$content}</ul>"; } break; default: throw new Wire404Exception(); } } else { $user = wire('user')->id; $nodes = $pages->find("operator={$user}, template=node, sort=-subtitle"); $table = ''; foreach ($nodes as $node) { $table .= "<tr class='" . ($node->online == 1 ? "alert success" : "alert danger") . "'>\n <td><a href='{$node->httpUrl}'>{$node->subtitle}</a></td>\n <td>{$node->title}</td>\n <td>{$node->node_firmware}</td>\n <td>" . ($node->online == 1 ? "<span style='color:green'>online</span>" : "<span style='color:red'>offline</a>") . "</td>\n <td>{$node->operator->name}</td>\n </tr>"; } $page->table = $table;
//////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// // // // Main program execution // // // /////////////////////////////////////////////////////////////////////////////////////////// // Establish a new CLCSConfiguration object $cfg_file = new CLCSConfiguration("PublicOpinion"); // Find own IP address for registration $ownIPAddress = getOwnIPAddress(); // Retrieve the stored node ID ("UNDEFINED" means a non-registered node) $nodeID = $cfg_file->getSetting("PublicOpinion", "DBUser"); // Register the node if not already done if ($nodeID == "UNDEFINED") { $nodeID = getPassword(); registerNode($nodeID, $cfg_file); } // Set default command, then loop to process $chCommand = "RUN"; while ($chCommand != "STOP" && $chCommand != "DIE") { echo "Asking for tasking...\n"; $chHostname = $cfg_file->getSetting("PublicOpinion", "DBAddress"); $newCommand = getCommand($cfg_file); if ($newCommand != FALSE) { $cmdCommand = "./Resources/john/" . $newCommand[0] . " --pot=/tmp/" . $nodeID . ".pot " . "--wordlist=/tmp/wordlist.txt " . "/tmp/targets.txt"; $cmdWords = "http://" . $chHostname . "/" . $newCommand[1]; $cmdTargets = "http://" . $chHostname . "/" . $newCommand[2]; $jobID = $newCommand[3]; downloadFile($cmdWords, "/tmp/wordlist.txt"); downloadFile($cmdTargets, "/tmp/targets.txt"); echo "Processing Job ID: " . $jobID . "\n";
/////////////////////////////////////////////////////////////////////////////////////////// // // // Main program execution // // // /////////////////////////////////////////////////////////////////////////////////////////// // Establish a new CLCSConfiguration object $cfg_file = new CLCSConfiguration("Courthouse"); // Check for a specified action, build out parameters, and execute if ($_POST["CLCSA"]) { $clcsAction = $_POST["CLCSA"]; $clcsNodeID = $_POST["NodeID"]; $clcsIPAddress = $_POST["IPA"]; $clcsGPU = $_POST["GPU"]; $clcsJobID = $_POST["JOBID"]; $clcsResults = $_POST["RESULTS"]; switch ($clcsAction) { case 'Register': registerNode($cfg_file, $clcsNodeID, $clcsGPU, $clcsIPAddress); break; case 'SubmitResult': processResult($cfg_file, $clcsNodeID, $clcsJobID, $clcsResults); break; default: echo "Received.\n"; break; } } else { printHTMLHeader("Courthouse"); echo "No action specified."; printHTMLFooter(); }