diff options
author | Oliver Smith <osmith@sysmocom.de> | 2020-02-24 15:44:56 +0100 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2020-02-24 15:46:38 +0100 |
commit | 89879a09c2fa130ddba9f793ecfff79b05405312 (patch) | |
tree | 0e17b7ceab181729247f4f4bf95ccef7f740d902 | |
parent | 6634a5d26bdcd5f1f308181927020f24450f038b (diff) |
IMSIPseudo.java: fix up length somewhat
Since it is counting nibbles, we need to take the length, which is in
bytes, two times. Also increase the size of the whole string, because
there are additional numbers infront of the imsi, it seems.
There are still two numbers missing at the end, and there is a
mysterious ) character. But other than that, it's working.
-rwxr-xr-x | sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java b/sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java index 0a1a2b0..bd3a9ec 100755 --- a/sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java +++ b/sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java @@ -103,7 +103,7 @@ public class IMSIPseudo extends Applet implements ToolkitInterface, ToolkitConst /* 3GPP TS 31.102 4.2.2: IMSI */ byte[] IMSI = new byte[9]; byte[] msg = {'C', 'u', 'r', 'r', 'e', 'n', 't', ' ', 'I', 'M', 'S', 'I', ':', ' ', - '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_'}; + '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_'}; gsmFile.select((short) SIMView.FID_DF_GSM); gsmFile.select((short) SIMView.FID_EF_IMSI); @@ -114,10 +114,11 @@ public class IMSIPseudo extends Applet implements ToolkitInterface, ToolkitConst showError(e.getReason()); return; } + byte len = (byte) (IMSI[0] * 2); - for (byte i = (byte)0; i < (byte)15; i++) { + for (byte i = (byte)0; i < (byte)18; i++) { byte msg_i = (byte)(14 + i); - if (i >= IMSI[0]) { + if (i >= len) { msg[msg_i] = ' '; } else if (i % (byte)2 == (byte)0) { msg[msg_i] = (byte)('0' + (IMSI[i / (byte)2] & 0x0f)); |