Telnet Honeypot – all passwords

[insert_php]

$servername = „db683540042.db.1and1.com“;
$username = „dbo683540042“;
$password = „ibiudbd“;

try {
$conn = new PDO(„mysql:host=$servername;dbname=db683540042;port=3306“, $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
die();
}

$statement = $conn->prepare(„SELECT count(DISTINCT password, user) as countD, count(*) as countA FROM hpCredentials“);
$statement->execute(array(
„hash“ => $hash));
$row = $statement->fetch();
if ($row != null)
{
$totalLogins = $row[„countA“];
$distinctCredentials = $row[„countD“];
echo $row[„countD“].“ distinct Username / Password combinations observed
„;
echo $row[„countA“].“ login requests
„;
}

$statement = $conn->prepare(„SELECT a.connect, a.password, a.user, count(a.user + a.password) as count, b.content as pw, c.content as us, MIN(d.time) as firstseen, MAX(d.time) as lastseen FROM hpCredentials a LEFT JOIN hpStrings b ON (b.id = a.password) LEFT JOIN hpStrings c ON (c.id = a.user) LEFT JOIN hpConnects d ON (a.connect = d.id) GROUP BY a.password, a.user order by count desc „);
$statement->execute(array(
„hash“ => $hash));
$rows = $statement->fetchAll();
echo „

„;
foreach ($rows as $row)
{
$percent = sprintf(„%0.2f“, (($row[‚count‘] / $totalLogins)*100));
echo „

„;
}
echo „

Username Password # of uses % of all login tries first seen last seen
„.$row[‚us‘].“ „.$row[‚pw‘].“ „.$row[‚count‘].“ „. $percent.“ „.$row[‚firstseen‘].“ „.$row[‚lastseen‘].“

„;

[/insert_php]