Skip to content

Commit

Permalink
Add support for Dell Latitude 3540
Browse files Browse the repository at this point in the history
  • Loading branch information
bacher09 committed Jun 30, 2020
1 parent 2a283c2 commit bcb4f5d
Show file tree
Hide file tree
Showing 7 changed files with 943 additions and 686 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Latest released version available [here][bios-pw] and latest testing version (*s
* Asus — current BIOS date. For example: ``01-02-2013``
* Compaq — 5 decimal digits (*e.g*. ``12345``)
* Dell — supports such series: ``595B``, ``D35B``, ``2A7B``, ``A95B``, ``1D3B``, ``6FF1``, ``1F66``, ``1F5A`` and ``BF97``. *e.g*: ``1234567-2A7B`` or ``1234567890A-D35B`` for HDD.
* Dell Insyde BIOS (Latitude 3540) — *e.g.* ``5F3988D5E0ACE4BF-7QH8602`` (``7QH8602`` — service tag).
* Fujitsu-Siemens — 5 decimal digits, 8 hexadecimal digits, 5x4 hexadecimal digits, 5x4 decimal digits
* Hewlett-Packard — 5 decimal digits, 10 characters
* Insyde H20 (Acer, HP) — 8 decimal digits, 10 decimal digits or HP `i ` (lowercase and uppercase) prefixed 8 digits.
Expand Down
1,273 changes: 596 additions & 677 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"jsbi": "^3.1.3"
},
"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/preset-env": "^7.10.2",
"@babel/core": "^7.10.4",
"@babel/preset-env": "^7.10.4",
"@jsdevtools/coverage-istanbul-loader": "^3.0.3",
"@types/jasmine": "^3.5.10",
"@types/jasmine": "^3.5.11",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1",
Expand All @@ -20,21 +20,21 @@
"html-webpack-plugin": "^3.2.0",
"jasmine": "^3.5.0",
"jasmine-spec-reporter": "^5.0.2",
"karma": "^5.0.9",
"karma": "^5.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-firefox-launcher": "^1.3.0",
"karma-jasmine": "^3.3.1",
"karma-sauce-launcher": "^1.2.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^4.0.2",
"terser-webpack-plugin": "^3.0.3",
"terser-webpack-plugin": "^3.0.6",
"ts-loader": "^6.2.2",
"ts-node": "^8.10.2",
"tslint": "^5.20.1",
"typescript": "^3.9.5",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
},
"scripts": {
Expand Down
22 changes: 21 additions & 1 deletion src/keygen/dell.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
//
// HDD SN WXH109A14712 ?
import {
calculateSuffix, dellHddSolver, dellSolver, DellTag, hddOldSolver, keygenDell, SuffixType
calculateSuffix, dellHddSolver, dellLatitude3540Solver, dellSolver, DellTag, DES, hddOldSolver,
keygenDell, latitude3540Keygen, SuffixType
} from "./dell";

// shortcut for simpler testing
Expand Down Expand Up @@ -281,3 +282,22 @@ describe("Test Dell BIOS", () => {
expect(dellHddSolver("1234567-SHORT")).toEqual([]);
});
});

describe("Latitude 3540", () => {
it("DES", () => {
const data = Uint8Array.from("12345678".split("").map((v) => v.charCodeAt(0)));
let enc = new DES(data);
const encoded = Uint8Array.from([150, 208, 2, 136, 120, 213, 140, 137]);
expect(enc.encryptBlock(data)).toEqual(encoded);
expect(enc.decryptBlock(encoded)).toEqual(data);
});
it("Latitude 3540 Keygen", () => {
expect(latitude3540Keygen("5F3988D5E0ACE4BF", "7QH8602")).toEqual("98072364");
expect(latitude3540Keygen("76A7D90FD9563C5F", "3FN2J22")).toEqual("60485207");
expect(latitude3540Keygen("1B6DD24D26E7B566", "BJVDG22")).toEqual("99937880");
expect(latitude3540Keygen("1B6DD24D26E7C566", "BJVDG22")).toEqual(undefined);
});
it("Dell Latitude 3540 Solver", () => {
expect(dellLatitude3540Solver("5F3988D5E0ACE4BF-7QH8602")).toEqual(["98072364"]);
});
});
23 changes: 22 additions & 1 deletion src/keygen/dell/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* tslint:disable:no-bitwise */
import { makeSolver } from "../utils";
import { blockEncode } from "./encode";
import { DES, latitude3540Keygen } from "./latitude";
import { DellTag, SuffixType } from "./types";
export { DellTag, SuffixType};
export { DellTag, SuffixType, DES, latitude3540Keygen };

const scanCodes: string =
"\0\x1B1234567890-=\x08\x09qwertyuiop[]\x0D\xFFasdfghjkl;'`\xFF\\zxcvbnm,./";
Expand Down Expand Up @@ -242,3 +243,23 @@ export let dellHddSolver = makeSolver({
return [keygenDell(password.slice(0, 11), suffix as DellTag, SuffixType.HDD)];
}
});

const latitude3540RE = /^([0-9A-F]{16})([0-9A-Z]{7})$/i;

// TODO: implement solver with 2 inputs
export let dellLatitude3540Solver = makeSolver({
name: "dellLatitude3540",
description: "Dell Latitude 3540",
examples: ["5F3988D5E0ACE4BF-7QH8602"],
inputValidator: (pwd) => latitude3540RE.test(pwd),
fun: (input: string) => {
const match = latitude3540RE.exec(input);
if (match && match.length === 3) {
const output = latitude3540Keygen(match[1], match[2]);
if (output) {
return [output];
}
}
return [];
}
});
Loading

0 comments on commit bcb4f5d

Please sign in to comment.