function step36SetupDB() { echo __("Connecting to the MySQL Server... "); $db = @mysql_connect($_POST['mysql_server_post'], $_POST['mysql_new_user'], $_POST['mysql_new_pass']) or die('Could not connect: ' . mysql_error()); echo __("Success!") . "<br />"; mysql_select_db($_POST['mysql_new_db']); echo __("Success!") . "<br />"; // Load SQL contents to write to server echo __("Creating tables... "); $filename = "scripts/open_audit.sql"; $handle = fopen($filename, "rb"); $contents = fread($handle, filesize($filename)); fclose($handle); $sql = stripslashes($contents); $sql2 = explode(";", $sql); foreach ($sql2 as $sql3) { $result = mysql_query($sql3 . ";"); } echo __("Success!") . "<br />"; mysql_close($db); // Write configuration file echo __("Writing configuration file... "); $filename = 'include_config.php'; $content = returnConfig(); if (!file_exists($filename) or is_writable($filename)) { $handle = @fopen($filename, 'w') or die(writeConfigHtml()); @fwrite($handle, $content) or die(writeConfigHtml()); @fclose($handle); echo __("Success!") . "<br />"; } else { writeConfigHtml(); } ?> <br /><br /><?php echo __("Setup has completed creating your database. Continue on to finish setup."); ?> <br /><br /> <form method="post" action="setup.php" name="options"> <input type="hidden" name="step" value="4" /> <input type="submit" value="<?php echo __("Finish Setup"); ?> >>" name="submit_button" /> </form> <?php }
} $content .= "echo \"<tr bgcolor=\\\"" . $bgcolor . "\\\">"; $content .= "<td><a href=\\\"system.php?pc=" . $myrow['scan_latest_uuid'] . "\\\">" . $myrow['system_name'] . "</a></td>"; $content .= "<td align=\\\"center\\\">" . $myrow['scan_latest_ip_address'] . "</td>"; $content .= "<td align=\\\"center\\\">" . $myrow['scan_latest_type'] . "</td>"; $content .= "<td align=\\\"center\\\">" . $myrow['scan_latest_detail'] . "</td>"; $content .= "<td align=\\\"center\\\">" . $myrow['scan_latest_date_time'] . "</td>"; $content .= $success; $content .= "</tr>\";\n"; } while ($myrow = mysql_fetch_array($result)); } $content .= "?>"; $filename = "scan_results_include.php"; if (!file_exists($filename) or is_writable($filename)) { $handle = @fopen($filename, 'w') or die(writeConfigHtml()); @fwrite($handle, $content) or die(writeConfigHtml()); @fclose($handle); } else { echo "Problem creating scan_results.php"; } function port_scan($ip, $port) { $nmap_exec = 'nmap -vv ' . $ip . ' -p' . $port; $nmap_command = shell_exec($nmap_exec) or die("Failed to evecute nmap command - are you root ?"); $nmap_input = explode("\n", $nmap_command); $test = $port . '/tcp'; foreach ($nmap_input as $nmap_input_line) { if (substr($nmap_input_line, 0, strlen($test)) == $test) { $return = explode(" ", $nmap_input_line); return $return[1]; }