changeset 55:5268246520de

simsniff-dec: decode command opcodes
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 04 Oct 2023 00:20:05 +0000
parents 2855330ab96f
children 966a54303d68
files sw/sniff-dec/command.c
diffstat 1 files changed, 79 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sw/sniff-dec/command.c	Tue Oct 03 23:32:43 2023 +0000
+++ b/sw/sniff-dec/command.c	Wed Oct 04 00:20:05 2023 +0000
@@ -37,6 +37,84 @@
 }
 
 static void
+decode_cmd_opcode()
+{
+	char *cmdname;
+
+	switch (cmd_hdr[1]) {
+	case 0xA4:
+		cmdname = "SELECT";
+		break;
+	case 0xF2:
+		cmdname = "STATUS";
+		break;
+	case 0xB0:
+		cmdname = "READ BINARY";
+		break;
+	case 0xD6:
+		cmdname = "UPDATE BINARY";
+		break;
+	case 0xB2:
+		cmdname = "READ RECORD";
+		break;
+	case 0xDC:
+		cmdname = "UPDATE RECORD";
+		break;
+	case 0xA2:
+		cmdname = "SEEK";
+		break;
+	case 0x32:
+		cmdname = "INCREASE";
+		break;
+	case 0x20:
+		cmdname = "VERIFY PIN";
+		break;
+	case 0x24:
+		cmdname = "CHANGE PIN";
+		break;
+	case 0x26:
+		cmdname = "DISABLE PIN";
+		break;
+	case 0x28:
+		cmdname = "ENABLE PIN";
+		break;
+	case 0x2C:
+		cmdname = "UNBLOCK PIN";
+		break;
+	case 0x04:
+		cmdname = "INVALIDATE";
+		break;
+	case 0x44:
+		cmdname = "REHABILITATE";
+		break;
+	case 0x88:
+		cmdname = "RUN GSM ALGO";
+		break;
+	case 0xFA:
+		cmdname = "SLEEP";
+		break;
+	case 0xC0:
+		cmdname = "GET RESPONSE";
+		break;
+	case 0x10:
+		cmdname = "TERMINAL PROFILE";
+		break;
+	case 0xC2:
+		cmdname = "ENVELOPE";
+		break;
+	case 0x12:
+		cmdname = "FETCH";
+		break;
+	case 0x14:
+		cmdname = "TERMINAL RESPONSE";
+		break;
+	default:
+		cmdname = "Unknown!";
+	}
+	printf(" Command: %s\n", cmdname);
+}
+
+static void
 print_cmd_hdr()
 {
 	unsigned n;
@@ -59,6 +137,7 @@
 		state = STATE_ERROR;
 		return;
 	}
+	decode_cmd_opcode();
 	if (cmd_hdr[4])
 		data_total = cmd_hdr[4];
 	else