mirror of
https://github.com/Chewbaccalakis/rfid-database.git
synced 2026-09-10 00:11:56 -07:00
Accept Proxmark dump uploads, mfc v2 JSON, and key.bin
Parse object-shaped mfc v2 dumps (the format Proxmark writes today) and let the new-tag form upload dump.json/dump.bin plus an optional binary hf-mf-*-key.bin instead of only pasting text.
This commit is contained in:
@@ -270,4 +270,38 @@ FFFFFFFFFFFFFF078069FFFFFFFFFFFF
|
||||
);
|
||||
expect(restore.status).toBe(200);
|
||||
});
|
||||
|
||||
it("imports Proxmark mfc v2 JSON dumps", async () => {
|
||||
const auth = { Authorization: `Bearer ${bearer}` };
|
||||
const siteRes = await postSite(
|
||||
req("http://localhost/api/v1/sites", {
|
||||
method: "POST",
|
||||
headers: { ...auth, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ code: "PM3", name: "Proxmark" }),
|
||||
})
|
||||
);
|
||||
const site = await siteRes.json();
|
||||
const dump = fs.readFileSync(
|
||||
path.join(import.meta.dirname, "../fixtures/hf-mf-91A2F020-dump.json"),
|
||||
"utf8"
|
||||
);
|
||||
|
||||
const imported = await importTag(
|
||||
req("http://localhost/api/v1/tags/import", {
|
||||
method: "POST",
|
||||
headers: { ...auth, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
siteId: site.id,
|
||||
label: "Proxmark v2",
|
||||
content: dump,
|
||||
filename: "hf-mf-91A2F020-dump.json",
|
||||
}),
|
||||
})
|
||||
);
|
||||
expect(imported.status).toBe(201);
|
||||
const tag = await imported.json();
|
||||
expect(tag.uid).toBe("91A2F020");
|
||||
expect(tag.protocol).toBe("MIFARE_CLASSIC_1K");
|
||||
expect(tag.keys.A[0]).toBe("A1D4FAFD4CAF");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user