Rename solvers, make names unique
This commit is contained in:
1 parent
3c954ccc2b
commit
6c6c02da4e
9 files changed
+47
-20
No files matched your search
+1
-1
@@ -37,7 +37,7 @@
|
|||||||
<form name="pwgen" id="form_id">
|
<form name="pwgen" id="form_id">
|
||||||
<input placeholder="Code" type="text" name="serial" id="serial_id" />
|
<input placeholder="Code" type="text" name="serial" id="serial_id" />
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<input type="button" class="btn primary" name="serial" id="button_id" value="Get password" />
|
<input type="submit" class="btn primary" name="serial" id="button_id" value="Get password" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="result_id">
|
<div id="result_id">
|
||||||
|
|||||||
+6
-3
@@ -198,14 +198,16 @@ function checkDellTag(tag: string): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export let hddOldSolver = makeSolver({
|
export let hddOldSolver = makeSolver({
|
||||||
name: "Dell HDD Serial Number (old)",
|
name: "dellHDDOld",
|
||||||
|
description: "Dell HDD Serial Number (old)",
|
||||||
examples: ["12345678901"],
|
examples: ["12345678901"],
|
||||||
inputValidator: (s) => s.length === 11,
|
inputValidator: (s) => s.length === 11,
|
||||||
fun: (s) => [keygenHddOld(s)]
|
fun: (s) => [keygenHddOld(s)]
|
||||||
});
|
});
|
||||||
|
|
||||||
export let dellSolver = makeSolver({
|
export let dellSolver = makeSolver({
|
||||||
name: "Dell from serial number",
|
name: "dellTag",
|
||||||
|
description: "Dell from serial number",
|
||||||
examples: ["1234567-595B", "1234567-1D3B"],
|
examples: ["1234567-595B", "1234567-1D3B"],
|
||||||
inputValidator: (password: string) => {
|
inputValidator: (password: string) => {
|
||||||
if (password.length !== 11) {
|
if (password.length !== 11) {
|
||||||
@@ -221,7 +223,8 @@ export let dellSolver = makeSolver({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export let dellHddSolver = makeSolver({
|
export let dellHddSolver = makeSolver({
|
||||||
name: "Dell from hdd serial number",
|
name: "dellHddNew",
|
||||||
|
description: "Dell from hdd serial number",
|
||||||
examples: ["1234567890A-595B"],
|
examples: ["1234567890A-595B"],
|
||||||
inputValidator: (password: string) => {
|
inputValidator: (password: string) => {
|
||||||
if (password.length !== 15) {
|
if (password.length !== 15) {
|
||||||
|
|||||||
+6
-3
@@ -123,21 +123,24 @@ function fsi20DecNewKeygen(serial: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export let fsiHexSolver = makeSolver({
|
export let fsiHexSolver = makeSolver({
|
||||||
name: "Fujitsu-Siemens hexdigits",
|
name: "fsiHex",
|
||||||
|
description: "Fujitsu-Siemens hexdigits",
|
||||||
examples: ["DEADBEEF", "AAAA-BBBB-CCCC-DEAD-BEEF"],
|
examples: ["DEADBEEF", "AAAA-BBBB-CCCC-DEAD-BEEF"],
|
||||||
inputValidator: (s) => /^([0-9ABCDEF]{20}|[0-9ABCDEF]{8})$/i.test(s),
|
inputValidator: (s) => /^([0-9ABCDEF]{20}|[0-9ABCDEF]{8})$/i.test(s),
|
||||||
fun: (code: string) => [fsiHexKeygen(code)]
|
fun: (code: string) => [fsiHexKeygen(code)]
|
||||||
});
|
});
|
||||||
|
|
||||||
export let fsi20DecNewSolver = makeSolver({
|
export let fsi20DecNewSolver = makeSolver({
|
||||||
name: "Fujitsu-Siemens decimal new",
|
name: "fsiDecNew",
|
||||||
|
description: "Fujitsu-Siemens decimal new",
|
||||||
examples: ["1234-4321-1234-4321-1234"],
|
examples: ["1234-4321-1234-4321-1234"],
|
||||||
inputValidator: (s) => /^\d{20}$/i.test(s),
|
inputValidator: (s) => /^\d{20}$/i.test(s),
|
||||||
fun: (code: string) => [fsi20DecNewKeygen(code)]
|
fun: (code: string) => [fsi20DecNewKeygen(code)]
|
||||||
});
|
});
|
||||||
|
|
||||||
export let fsi20DecOldSolver = makeSolver({
|
export let fsi20DecOldSolver = makeSolver({
|
||||||
name: "Fujitsu-Siemens decimal old",
|
name: "fsiDecOld",
|
||||||
|
description: "Fujitsu-Siemens decimal old",
|
||||||
examples: ["1234-4321-1234-4321-1234"],
|
examples: ["1234-4321-1234-4321-1234"],
|
||||||
inputValidator: (s) => /^\d{20}$/i.test(s),
|
inputValidator: (s) => /^\d{20}$/i.test(s),
|
||||||
fun: (code: string) => [fsi20DecOldKeygen(code)]
|
fun: (code: string) => [fsi20DecOldKeygen(code)]
|
||||||
|
|||||||
+2
-1
@@ -36,7 +36,8 @@ function hpMiniKeygen(serial: string): string[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export let hpMiniSolver = makeSolver({
|
export let hpMiniSolver = makeSolver({
|
||||||
name: "HPMini",
|
name: "hpMini",
|
||||||
|
description: "HP/Compaq Mini Netbooks",
|
||||||
examples: ["CNU1234ABC"],
|
examples: ["CNU1234ABC"],
|
||||||
inputValidator: (s) => /^[0-9A-Z]{10}$/i.test(s),
|
inputValidator: (s) => /^[0-9A-Z]{10}$/i.test(s),
|
||||||
fun: hpMiniKeygen
|
fun: hpMiniKeygen
|
||||||
|
|||||||
+2
-1
@@ -25,7 +25,8 @@ function insydeKeygen(serial: string): string[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export let insydeSolver = makeSolver({
|
export let insydeSolver = makeSolver({
|
||||||
name: "Insyde H2O",
|
name: "insydeH2O",
|
||||||
|
description: "Insyde H2O BIOS (Acer, HP)",
|
||||||
examples: ["03133610"],
|
examples: ["03133610"],
|
||||||
inputValidator: (s) => /^\d{8}$/i.test(s),
|
inputValidator: (s) => /^\d{8}$/i.test(s),
|
||||||
fun: insydeKeygen
|
fun: insydeKeygen
|
||||||
|
|||||||
+11
-1
@@ -1,8 +1,18 @@
|
|||||||
import { keygen } from "./keygen";
|
import { keygen, solvers } from "./keygen";
|
||||||
|
|
||||||
describe("BIOS keygen", () => {
|
describe("BIOS keygen", () => {
|
||||||
it("Sony key for 1234567 is 9648669", () => {
|
it("Sony key for 1234567 is 9648669", () => {
|
||||||
let keysList = keygen("1234567");
|
let keysList = keygen("1234567");
|
||||||
expect(keysList[0][1]).toEqual(["9648669"]);
|
expect(keysList[0][1]).toEqual(["9648669"]);
|
||||||
});
|
});
|
||||||
|
it("Solvers names should be unique", () => {
|
||||||
|
let names: {[key: string]: boolean} = {};
|
||||||
|
solvers.forEach((solver) => {
|
||||||
|
if (solver.biosName in names) {
|
||||||
|
throw Error(`${solver.biosName} isn't unique name`);
|
||||||
|
} else {
|
||||||
|
names[solver.biosName] = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
+15
-8
@@ -188,49 +188,56 @@ function makePhoenixSolver(description?: PhoenixBios): PhoenixSolver {
|
|||||||
solver.calculateHash = calculateHash;
|
solver.calculateHash = calculateHash;
|
||||||
|
|
||||||
if (description.description) {
|
if (description.description) {
|
||||||
solver.description = description;
|
solver.description = description.description;
|
||||||
}
|
}
|
||||||
return solver as PhoenixSolver;
|
return solver as PhoenixSolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
export let phoenixSolver = makePhoenixSolver({
|
export let phoenixSolver = makePhoenixSolver({
|
||||||
name: "Generic Phoenix"
|
name: "phoenix",
|
||||||
|
description: "Generic Phoenix"
|
||||||
});
|
});
|
||||||
|
|
||||||
export let phoenixHPCompaqSolver = makePhoenixSolver({
|
export let phoenixHPCompaqSolver = makePhoenixSolver({
|
||||||
name: "HP/Compaq Phoenix BIOS",
|
name: "phoenixHP",
|
||||||
|
description: "HP/Compaq Phoenix BIOS",
|
||||||
salt: 17232
|
salt: 17232
|
||||||
});
|
});
|
||||||
|
|
||||||
export let phoenixFsiSolver = makePhoenixSolver({
|
export let phoenixFsiSolver = makePhoenixSolver({
|
||||||
name: "Fujitsu-Siemens Phoenix",
|
name: "phoenixFSI",
|
||||||
|
description: "Fujitsu-Siemens Phoenix",
|
||||||
salt: 65,
|
salt: 65,
|
||||||
dictionary: digitsOnly
|
dictionary: digitsOnly
|
||||||
});
|
});
|
||||||
|
|
||||||
export let phoenixFsiLSolver = makePhoenixSolver({
|
export let phoenixFsiLSolver = makePhoenixSolver({
|
||||||
name: "Fujitsu-Siemens (model L) Phoenix",
|
name: "phoenixFSIModelL",
|
||||||
|
description: "Fujitsu-Siemens (model L) Phoenix",
|
||||||
shift: 1,
|
shift: 1,
|
||||||
salt: "L".charCodeAt(0),
|
salt: "L".charCodeAt(0),
|
||||||
dictionary: digitsOnly
|
dictionary: digitsOnly
|
||||||
});
|
});
|
||||||
|
|
||||||
export let phoenixFsiPSolver = makePhoenixSolver({
|
export let phoenixFsiPSolver = makePhoenixSolver({
|
||||||
name: "Fujitsu-Siemens (model P) Phoenix",
|
name: "phoenixFSIModelP",
|
||||||
|
description: "Fujitsu-Siemens (model P) Phoenix",
|
||||||
shift: 1,
|
shift: 1,
|
||||||
salt: "P".charCodeAt(0),
|
salt: "P".charCodeAt(0),
|
||||||
dictionary: digitsOnly
|
dictionary: digitsOnly
|
||||||
});
|
});
|
||||||
|
|
||||||
export let phoenixFsiSSolver = makePhoenixSolver({
|
export let phoenixFsiSSolver = makePhoenixSolver({
|
||||||
name: "Fujitsu-Siemens (model S) Phoenix",
|
name: "phoenixFSIModelS",
|
||||||
|
description: "Fujitsu-Siemens (model S) Phoenix",
|
||||||
shift: 1,
|
shift: 1,
|
||||||
salt: "S".charCodeAt(0),
|
salt: "S".charCodeAt(0),
|
||||||
dictionary: digitsOnly
|
dictionary: digitsOnly
|
||||||
});
|
});
|
||||||
|
|
||||||
export let phoenixFsiXSolver = makePhoenixSolver({
|
export let phoenixFsiXSolver = makePhoenixSolver({
|
||||||
name: "Fujitsu-Siemens (model X) Phoenix",
|
name: "phoenixFSIModelX",
|
||||||
|
description: "Fujitsu-Siemens (model X) Phoenix",
|
||||||
shift: 1,
|
shift: 1,
|
||||||
salt: "X".charCodeAt(0),
|
salt: "X".charCodeAt(0),
|
||||||
dictionary: digitsOnly
|
dictionary: digitsOnly
|
||||||
|
|||||||
+2
-1
@@ -69,7 +69,8 @@ function samsungKeygen(serial: string): string[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export let samsungSolver = makeSolver({
|
export let samsungSolver = makeSolver({
|
||||||
name: "Samsung",
|
name: "samsung",
|
||||||
|
description: "Samsung",
|
||||||
examples: ["07088120410C0000"],
|
examples: ["07088120410C0000"],
|
||||||
inputValidator: (s) => /^[0-9ABCDEF]+$/i.test(s) && (
|
inputValidator: (s) => /^[0-9ABCDEF]+$/i.test(s) && (
|
||||||
s.length === 12 || s.length === 14 || s.length === 16 || s.length === 18
|
s.length === 12 || s.length === 14 || s.length === 16 || s.length === 18
|
||||||
|
|||||||
+2
-1
@@ -12,7 +12,8 @@ function sonyKeygen(serial: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export let sonySolver = makeSolver({
|
export let sonySolver = makeSolver({
|
||||||
name: "Sony",
|
name: "sony",
|
||||||
|
description: "Old Sony",
|
||||||
examples: ["1234567"],
|
examples: ["1234567"],
|
||||||
inputValidator: (s) => /^\d{7}$/i.test(s),
|
inputValidator: (s) => /^\d{7}$/i.test(s),
|
||||||
fun: (code: string) => {
|
fun: (code: string) => {
|
||||||
|
|||||||
Reference in new issue
Block a user