profiler: mask-match IMSI/ICCID contents on 'Profile from card'
When generating a ruleset from the card, capture EF.IMSI (6F07) and EF.ICCID (2FE2) contents as a mask matching only the first 4 bytes (e.g. 08290591??????????), the rest are '?' wildcards. Add profilerMaskPrefix4 helper + PROFILER_MASK_PREFIX4_FIDS map + tests. SW cache v44.
This commit is contained in:
@@ -21,7 +21,7 @@ function extractFunc(src, name) {
|
||||
return src.slice(m.index, i + 1);
|
||||
}
|
||||
|
||||
const FNS = ['profilerNormHex', 'profilerMatch', 'profilerMatchMin', 'profilerValidateProfile'];
|
||||
const FNS = ['profilerNormHex', 'profilerMatch', 'profilerMatchMin', 'profilerMaskPrefix4', 'profilerValidateProfile'];
|
||||
let code = '';
|
||||
for (const f of FNS) code += extractFunc(html, f) + '\n';
|
||||
eval(code);
|
||||
@@ -68,6 +68,12 @@ test('profilerMatchMin compares the shorter overlapping portion', () => {
|
||||
assert.ok(!profilerMatchMin('mask', '08?91?AA', '091110'));
|
||||
});
|
||||
|
||||
test('profilerMaskPrefix4 keeps first 4 bytes and masks the rest', () => {
|
||||
assert.strictEqual(profilerMaskPrefix4('082905911234567890'), '08290591??????????');
|
||||
assert.strictEqual(profilerMaskPrefix4('08290591'), '08290591');
|
||||
assert.strictEqual(profilerMaskPrefix4('1234'), '1234');
|
||||
});
|
||||
|
||||
test('profile validation', () => {
|
||||
assert.strictEqual(profilerValidateProfile(null), 'Not an object');
|
||||
assert.strictEqual(profilerValidateProfile({ name: 'x' }), 'Missing rules array');
|
||||
|
||||
Reference in New Issue
Block a user