The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ
Browse Source

Added the checknonusedpasswords.php script

This script checks for passwords that were not accessed for a while.
master
Gergely Polonkai (W00d5t0ck) 12 years ago
parent
commit
a850066271
  1. 8
      class.db.php
  2. 24
      scripts/checknonusedpasswords.php

8
class.db.php

@ -410,6 +410,14 @@ if (!class_exists('PWSdb'))
return $sth->fetchAll();
}
function getInactivePasswords($inactiveInterval)
{
$sth = $this->prepare('SELECT id, short, long, username, groups, lastaccess FROM passwords WHERE datetime(lastaccess, ?) < datetime(\'now\')');
$sth->execute(array($inactiveInterval));
return $sth->fetchAll();
}
}
}

24
scripts/checknonusedpasswords.php

@ -0,0 +1,24 @@
<?php
// Check for inactive users
// OPTIONS
$webDir = '/var/www/localhost/htdocs/passwordstore';
require_once $webDir . '/config.php';
require_once $webDir . '/class.db.php';
$passwords = pwsdbh($dbDSN)->getInactivePasswords($passwordInactiveTime);
foreach ($passwords as $password)
{
if ($password['username'] == '')
{
printf("The password for %s (%s) was not accessed since %s\n", $password['short'], $password['long'], $password['lastaccess']);
}
else
{
printf("The password for %s on %s (%s) was not accessed since %s\n", $password['username'], $password['short'], $password['long'], $password['lastaccess']);
}
}
Loading…
Cancel
Save