add Enter IMSI dialog

This commit is contained in:
Neels Hofmeyr 2020-02-24 21:30:42 +01:00
parent c0c95621ea
commit 0866f3a036
1 changed files with 23 additions and 3 deletions

View File

@ -23,11 +23,12 @@ public class IMSIPseudo extends Applet implements ToolkitInterface, ToolkitConst
private final Object[] itemListMain = {title, showLU, showIMSI, changeIMSI};
/* Change IMSI menu */
private static final byte[] enterIMSI = new byte[] {'E', 'n', 't', 'e', 'r', ' ', 'I', 'M', 'S', 'I' };
private static final byte[] setDigit1 = new byte[] {'S', 'e', 't', ' ', '1', ' ', 'a', 's', ' ', 'l', 'a', 's', 't', ' ',
'd', 'i', 'g', 'i', 't'};
private static final byte[] setDigit2 = new byte[] {'S', 'e', 't', ' ', '2', ' ', 'a', 's', ' ', 'l', 'a', 's', 't', ' ',
'd', 'i', 'g', 'i', 't'};
private final Object[] itemListChangeIMSI = {changeIMSI, setDigit1, setDigit2};
private final Object[] itemListChangeIMSI = {changeIMSI, enterIMSI, setDigit1, setDigit2};
private static final byte MI_IMSI = 1;
@ -314,13 +315,32 @@ public class IMSIPseudo extends Applet implements ToolkitInterface, ToolkitConst
showIMSI();
break;
case 3: /* Change IMSI */
showMenu(itemListChangeIMSI, (byte)3);
showMenu(itemListChangeIMSI, (byte)4);
handleMenuResponseChangeIMSI();
break;
}
}
private void handleMenuResponseChangeIMSI() {
/* TODO */
ProactiveResponseHandler rspHdlr = ProactiveResponseHandler.getTheHandler();
switch (rspHdlr.getItemIdentifier()) {
case 1: /* enter IMSI */
promptIMSI();
break;
case 2: /* set last digit to 1 */
promptIMSI();
break;
case 3: /* set last digit to 2 */
promptIMSI();
break;
}
}
private void promptIMSI()
{
byte[] msg = {'N', 'e', 'w', ' ', 'I', 'M', 'S', 'I', '?'};
byte imsi[] = prompt(msg, (short)0, (short)15);
byte mi[] = str2mi(imsi, MI_IMSI);
showMsgAndWaitKey(hexdump(mi));
}
}