ykinfo - Get basic information from a YubiKey
.SH SYNOPSIS
.B ykinfo
-[\fI-s\fR] [\fI-m\fR] [\fI-H\fR] [\fI-v\fR] [\fI-t\fR] [\fI-q\fR] [\fI-h\fR]
+[\fI-s\fR] [\fI-m\fR] [\fI-H\fR] [\fI-v\fR] [\fI-t\fR] [\fI-p\fR] [\fI-q\fR] [\fI-h\fR]
.SH DESCRIPTION
.PP
Get basic information from a YubiKey. Can get serial number, version and current
\fB\-t\fR
get the touch level and output it.
.TP
+\fB\-p\fR
+get the programming sequence and output it.
+.TP
\fB\-q\fR
modifier, only show the relevant data from the YubiKey, no extra information.
.TP
Output of all information from a YubiKey
.nf
-$ \fBykinfo \-s \-m \-H \-v \-t\fR
+$ \fBykinfo \-s \-m \-H \-v \-t \-p\fR
serial: 1077254
serial_hex: 107006
serial_modhex: bcicch
version: 2.2.3
touch_level: 1793
+programming_sequence: 1
$
.fi
"\t-H Get serial in hex from YubiKey\n"
"\t-v Get version from YubiKey\n"
"\t-t Get touchlevel from YubiKey\n"
+ "\t-p Get programming sequence from YubiKey\n"
"\n"
"\t-q Only output information from YubiKey\n"
"\n"
"\n"
"\n"
;
-const char *optstring = "smHvtqh";
+const char *optstring = "smHvtpqh";
static void report_yk_error(void)
{
static int parse_args(int argc, char **argv,
bool *serial_dec, bool *serial_modhex, bool *serial_hex,
- bool *version, bool *touch_level, bool *quiet,
+ bool *version, bool *touch_level, bool *pgm_seq, bool *quiet,
int *exit_code)
{
int c;
case 't':
*touch_level = true;
break;
+ case 'p':
+ *pgm_seq = true;
+ break;
case 'q':
*quiet = true;
break;
}
if (!*serial_dec && !*serial_modhex && !*serial_hex &&
- !*version && !*touch_level) {
+ !*version && !*touch_level && !*pgm_seq) {
/* no options at all */
fputs("You must give at least one option.\n", stderr);
fputs(usage, stderr);
bool serial_hex = false;
bool version = false;
bool touch_level = false;
+ bool pgm_seq = false;
bool quiet = false;
if (! parse_args(argc, argv,
&serial_dec, &serial_modhex, &serial_hex,
- &version, &touch_level, &quiet,
+ &version, &touch_level, &pgm_seq, &quiet,
&exit_code))
exit(exit_code);
printf("%s\n", modhex_serial);
}
}
- if(version || touch_level) {
+ if(version || touch_level || pgm_seq) {
YK_STATUS *st = ykds_alloc();
if(!yk_get_status(yk, st)) {
ykds_free(st);
printf("touch_level: ");
printf("%d\n", ykds_touch_level(st));
}
+ if(pgm_seq) {
+ if(!quiet)
+ printf("programming_sequence: ");
+ printf("%d\n", ykds_pgm_seq(st));
+ }
ykds_free(st);
}