2010-01-25 16:30:59 +01:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
|
|
|
|
2010-01-25 16:41:13 +01:00
|
|
|
set_include_path(get_include_path() . PATH_SEPARATOR . "/usr/share/ykval:/etc/ykval");
|
2010-01-25 16:39:59 +01:00
|
|
|
|
2010-01-25 16:30:59 +01:00
|
|
|
require_once 'ykval-config.php';
|
2011-10-31 11:11:14 +01:00
|
|
|
require_once 'ykval-db.php';
|
2010-01-25 16:30:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
$logname="ykval-export";
|
|
|
|
$myLog = new Log($logname);
|
|
|
|
|
|
|
|
$db=new Db($baseParams['__YKVAL_DB_DSN__'],
|
|
|
|
$baseParams['__YKVAL_DB_USER__'],
|
|
|
|
$baseParams['__YKVAL_DB_PW__'],
|
2012-05-29 11:07:19 +02:00
|
|
|
$baseParams['__YKVAL_DB_OPTIONS__'],
|
2010-01-25 16:30:59 +01:00
|
|
|
$logname . ':db');
|
|
|
|
|
|
|
|
if (!$db->connect()) {
|
|
|
|
$myLog->log(LOG_WARNING, "Could not connect to database");
|
|
|
|
exit(1);
|
2012-05-29 11:07:19 +02:00
|
|
|
}
|
2010-01-25 16:30:59 +01:00
|
|
|
|
2010-01-25 18:00:42 +01:00
|
|
|
$result=$db->customQuery("SELECT active, created, modified, yk_publicname, yk_counter, yk_use, yk_low, yk_high, nonce, notes FROM yubikeys ORDER BY yk_publicname");
|
2010-01-25 16:30:59 +01:00
|
|
|
while($row = $result->fetch(PDO::FETCH_ASSOC)){
|
|
|
|
echo $row['active'] .
|
|
|
|
"\t" . $row['created'] .
|
|
|
|
"\t" . $row['modified'] .
|
|
|
|
"\t" . $row['yk_publicname'] .
|
|
|
|
"\t" . $row['yk_counter'] .
|
|
|
|
"\t" . $row['yk_use'] .
|
|
|
|
"\t" . $row['yk_low'] .
|
|
|
|
"\t" . $row['yk_high'] .
|
|
|
|
"\t" . $row['nonce'] .
|
|
|
|
"\t" . $row['notes'] .
|
|
|
|
"\n";
|
|
|
|
}
|
|
|
|
|
2010-01-25 16:49:53 +01:00
|
|
|
$result=null;
|
2010-01-25 16:48:48 +01:00
|
|
|
$db=null;
|
2010-01-25 16:30:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
?>
|