From dc3a8cb936014883fec892ad5737837910ecfc0a Mon Sep 17 00:00:00 2001 From: Slava Bacherikov Date: Sat, 19 Feb 2022 18:44:44 +0200 Subject: [PATCH] Make dell service tags case insensitive Dell service tag is always uppercase, so there is no point in allowing lowercase input. This supposed reduce amount of errors users can make when generating password. --- src/keygen/dell.spec.ts | 6 ++++++ src/keygen/dell/index.ts | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/keygen/dell.spec.ts b/src/keygen/dell.spec.ts index 63fa823..25cbc4c 100644 --- a/src/keygen/dell.spec.ts +++ b/src/keygen/dell.spec.ts @@ -310,6 +310,11 @@ describe("Test Dell BIOS", () => { it("Dell for: 1234567-1F66", () => { expect(dellSolver("1234567-1f66")).toEqual(["kIpTBzx0m3s10JDR"]); }); + it("Dell for: 123456a-1F66", () => { + // AFAIK Dell service tags is always uppercase + // so this supposed to calculate password for 123456A-1F66 + expect(dellSolver("123456a-1f66")).toEqual(["5sS11TUKBmBOQKRS"]); + }); it("Dell HDD for: 1234567890A-595B", () => { expect(dellHddSolver("1234567890A-595b")).toEqual(["nyoap4lq"]); }); @@ -336,5 +341,6 @@ describe("Latitude 3540", () => { }); it("Dell Latitude 3540 Solver", () => { expect(dellLatitude3540Solver("5F3988D5E0ACE4BF-7QH8602")).toEqual(["98072364"]); + expect(dellLatitude3540Solver("5F3988D5E0ACE4bF-7QH8602")).toEqual(["98072364"]); }); }); diff --git a/src/keygen/dell/index.ts b/src/keygen/dell/index.ts index 67389b7..6f35d9d 100644 --- a/src/keygen/dell/index.ts +++ b/src/keygen/dell/index.ts @@ -257,8 +257,8 @@ export let dellSolver = makeSolver({ } }, fun: (password: string) => { - let suffix = password.slice(7, 11).toUpperCase(); - return keygenDell(password.slice(0, 7), suffix as DellTag, SuffixType.ServiceTag); + const suffix = password.slice(7, 11).toUpperCase(); + return keygenDell(password.slice(0, 7).toUpperCase(), suffix as DellTag, SuffixType.ServiceTag); } }); @@ -274,8 +274,8 @@ export let dellHddSolver = makeSolver({ } }, fun: (password: string) => { - let suffix = password.slice(11, 15).toUpperCase(); - return keygenDell(password.slice(0, 11), suffix as DellTag, SuffixType.HDD); + const suffix = password.slice(11, 15).toUpperCase(); + return keygenDell(password.slice(0, 11).toUpperCase(), suffix as DellTag, SuffixType.HDD); } });