mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-09-11 18:30:14 -07:00
Merge pull request #341 from MusicLeecher/main
Fix typo in hid prox econfig and add ACTProx HID card type
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#define PREAMBLE_34BIT (0x009)
|
||||
#define PREAMBLE_35BIT (0x005)
|
||||
#define PREAMBLE_36BIT (0x003)
|
||||
#define PREAMBLE_ACTP (0x095)
|
||||
|
||||
/**@brief Set a bit in the uint64 word.
|
||||
*
|
||||
@@ -548,6 +549,37 @@ static wiegand_card_t *unpack_c15001(uint64_t hi, uint64_t lo) {
|
||||
return d;
|
||||
}
|
||||
|
||||
static uint64_t pack_actprox(wiegand_card_t *card) {
|
||||
if (card->oem == 0) {
|
||||
card->oem = 900;
|
||||
}
|
||||
uint64_t bits = PREAMBLE_ACTP;
|
||||
bits <<= 1;
|
||||
bits = (bits << 10) | (card->oem & 0x3ff);
|
||||
bits = (bits << 8) | (card->facility_code & 0xff);
|
||||
bits = (bits << 16) | (card->card_number & 0xffff);
|
||||
bits <<= 1;
|
||||
if (evenparity32((bits >> 18) & 0x1ffff)) {
|
||||
SET_BIT64(bits, 35);
|
||||
}
|
||||
if (oddparity32((bits >> 1) & 0x1ffff)) {
|
||||
SET_BIT64(bits, 0);
|
||||
}
|
||||
return bits;
|
||||
}
|
||||
|
||||
static wiegand_card_t *unpack_actprox(uint64_t hi, uint64_t lo) {
|
||||
if (!(IS_SET(lo, 35) == evenparity32((lo >> 18) & 0x1ffff) &&
|
||||
IS_SET(lo, 0) == oddparity32((lo >> 1) & 0x1ffff))) {
|
||||
return NULL;
|
||||
}
|
||||
wiegand_card_t *d = wiegand_card_alloc();
|
||||
d->oem = (lo >> 25) & 0x3ff;
|
||||
d->facility_code = (lo >> 17) & 0xff;
|
||||
d->card_number = (lo >> 1) & 0xffff;
|
||||
return d;
|
||||
}
|
||||
|
||||
static uint64_t pack_s12906(wiegand_card_t *card) {
|
||||
uint64_t bits = PREAMBLE_36BIT;
|
||||
bits <<= 1;
|
||||
@@ -819,6 +851,7 @@ static const card_format_table_t formats[] = {
|
||||
{P10004, pack_p10004, unpack_p10004, 37, {0, 0x1FFF, 0x3FFFF, 0, 0}}, // HID P10004 37-bit PCSC
|
||||
{HGEN37, pack_hgeneric37, unpack_hgeneric37, 37, {1, 0, 0xFFFFFFFF, 0, 0}}, // HID Generic 37-bit
|
||||
{MDI37, pack_mdi37, unpack_mdi37, 37, {1, 0xF, 0x1FFFFFFF, 0, 0}}, // PointGuard MDI 37-bit
|
||||
{ACTPHID, pack_actprox, unpack_actprox, 36, {1, 0xFF, 0xFFFF, 0x3FF, 0}}, // HID ACTProx 36-bit
|
||||
};
|
||||
|
||||
uint64_t pack(wiegand_card_t *card) {
|
||||
|
||||
@@ -72,6 +72,7 @@ typedef enum {
|
||||
C1K48S,
|
||||
AVIG56,
|
||||
IR56,
|
||||
ACTPHID,
|
||||
} card_format_t;
|
||||
|
||||
// Structure for defined Wiegand card formats available for packing/unpacking
|
||||
|
||||
@@ -199,7 +199,7 @@ class DeviceRequiredUnit(BaseCLIUnit):
|
||||
if ret:
|
||||
return True
|
||||
else:
|
||||
print("Please connect to chameleon device first(use 'hw connect').")
|
||||
print("Please connect to chameleon device first (use 'hw connect').")
|
||||
return False
|
||||
|
||||
|
||||
@@ -453,6 +453,7 @@ class LFHIDIdArgsUnit(DeviceRequiredUnit):
|
||||
HIDFormat.C1K35S: [0xFFF, 0xFFFFF, 0, 0],
|
||||
HIDFormat.C15001: [0xFF, 0xFFFF, 0, 0x3FF],
|
||||
HIDFormat.S12906: [0xFF, 0xFFFFFF, 0x3, 0],
|
||||
HIDFormat.ACTPHID: [0xFF, 0xFFFFFF, 0, 0x3FF],
|
||||
HIDFormat.SIE36: [0x3FFFF, 0xFFFF, 0, 0],
|
||||
HIDFormat.H10320: [0, 99999999, 0, 0],
|
||||
HIDFormat.H10302: [0, 0x7FFFFFFFF, 0, 0],
|
||||
@@ -3675,19 +3676,19 @@ class LFHIDProxEconfig(SlotIndexArgsAndGoUnit, LFHIDIdArgsUnit):
|
||||
format = HIDFormat[args.format]
|
||||
id = struct.pack(">BIBIBH", format.value, args.fc, (args.cn >> 32), args.cn & 0xffffffff, args.il, args.oem)
|
||||
self.cmd.hidprox_set_emu_id(id)
|
||||
print(' - Set hidprox tag id success.')
|
||||
print(' - SET hidprox tag id success.')
|
||||
else:
|
||||
(format, fc, cn1, cn2, il, oem) = self.cmd.hidprox_get_emu_id()
|
||||
cn = (cn1 << 32) + cn2
|
||||
print(' - Get hidprox tag id success.')
|
||||
print(' - GET hidprox tag id success.')
|
||||
print(f" - HIDProx/{HIDFormat(format)}")
|
||||
if fc > 0:
|
||||
print(f" FC: {color_string((CG, fc))}")
|
||||
if il > 0:
|
||||
print(f" IL: {color_string((CG, il))}")
|
||||
if oem > 0:
|
||||
print(f" OEM: {color_string((CG, oem))}")
|
||||
print(f" CN: {color_string((CG, cn))}")
|
||||
if fc > 0:
|
||||
print(f" FC: {color_string((CG, fc))}")
|
||||
if il > 0:
|
||||
print(f" IL: {color_string((CG, il))}")
|
||||
if oem > 0:
|
||||
print(f" OEM: {color_string((CG, oem))}")
|
||||
print(f" CN: {color_string((CG, cn))}")
|
||||
|
||||
@lf_viking.command('read')
|
||||
class LFVikingRead(ReaderRequiredUnit):
|
||||
|
||||
@@ -581,6 +581,7 @@ class HIDFormat(enum.IntEnum):
|
||||
C1K35S = 21
|
||||
C15001 = 22
|
||||
S12906 = 23
|
||||
ACTPHID = 42
|
||||
SIE36 = 24
|
||||
H10320 = 25
|
||||
H10302 = 26
|
||||
@@ -614,6 +615,7 @@ class HIDFormat(enum.IntEnum):
|
||||
HIDFormat.C1K35S: "HID Corporate 1000 35-bit Std",
|
||||
HIDFormat.C15001: "HID KeyScan 36-bit",
|
||||
HIDFormat.S12906: "HID Simplex 36-bit",
|
||||
HIDFormat.ACTPHID: "HID ACTProx 36-bit",
|
||||
HIDFormat.SIE36: "HID 36-bit Siemens",
|
||||
HIDFormat.H10320: "HID H10320 37-bit BCD",
|
||||
HIDFormat.H10302: "HID H10302 37-bit huge ID",
|
||||
|
||||
Reference in New Issue
Block a user