mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-14 02:26:59 -07:00
Merge branch 'master' of https://github.com/Proxmark/proxmark3
This commit is contained in:
commit
db4de4d82f
7 changed files with 152 additions and 81 deletions
|
@ -513,17 +513,31 @@ int CmdHFiClassReader_Dump(const char *Cmd)
|
|||
|
||||
}
|
||||
|
||||
|
||||
UsbCommand c = {CMD_READER_ICLASS, {0}};
|
||||
c.arg[0] = FLAG_ICLASS_READER_ONLY_ONCE;
|
||||
|
||||
SendCommand(&c);
|
||||
|
||||
UsbCommand resp;
|
||||
uint8_t key_sel[8] = {0};
|
||||
uint8_t key_sel_p[8] = { 0 };
|
||||
|
||||
if (WaitForResponseTimeout(CMD_ACK,&resp,4500)) {
|
||||
//HACK -- Below is for testing without access to a tag
|
||||
uint8_t fake_dummy_test = false;
|
||||
if(fake_dummy_test)
|
||||
{
|
||||
uint8_t xdata[16] = {0x01,0x02,0x03,0x04,0xF7,0xFF,0x12,0xE0, //CSN from http://www.proxmark.org/forum/viewtopic.php?pid=11230#p11230
|
||||
0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; // Just a random CC. Would be good to add a real testcase here
|
||||
memcpy(resp.d.asBytes,xdata, 16);
|
||||
resp.arg[0] = 2;
|
||||
}
|
||||
|
||||
//End hack
|
||||
|
||||
|
||||
UsbCommand c = {CMD_READER_ICLASS, {0}};
|
||||
c.arg[0] = FLAG_ICLASS_READER_ONLY_ONCE;
|
||||
if(!fake_dummy_test)
|
||||
SendCommand(&c);
|
||||
|
||||
|
||||
|
||||
if (fake_dummy_test || WaitForResponseTimeout(CMD_ACK,&resp,4500)) {
|
||||
uint8_t isOK = resp.arg[0] & 0xff;
|
||||
uint8_t * data = resp.d.asBytes;
|
||||
|
||||
|
@ -547,6 +561,7 @@ int CmdHFiClassReader_Dump(const char *Cmd)
|
|||
printvar("hash1", key_index,8);
|
||||
for(i = 0; i < 8 ; i++)
|
||||
key_sel[i] = keytable[key_index[i]] & 0xFF;
|
||||
PrintAndLog("Pre-fortified 'permuted' HS key that would be needed by an iclass reader to talk to above CSN:");
|
||||
printvar("k_sel", key_sel,8);
|
||||
//Permute from iclass format to standard format
|
||||
permutekey_rev(key_sel,key_sel_p);
|
||||
|
@ -563,8 +578,11 @@ int CmdHFiClassReader_Dump(const char *Cmd)
|
|||
used_key = KEY;
|
||||
|
||||
}
|
||||
|
||||
PrintAndLog("Pre-fortified key that would be needed by the OmniKey reader to talk to above CSN:");
|
||||
printvar("Used key",used_key,8);
|
||||
diversifyKey(CSN,used_key, div_key);
|
||||
PrintAndLog("Hash0, a.k.a diversified key, that is computed using Ksel and stored in the card (Block 3):");
|
||||
printvar("Div key", div_key, 8);
|
||||
printvar("CC_NR:",CCNR,12);
|
||||
doMAC(CCNR,12,div_key, MAC);
|
||||
|
@ -572,7 +590,7 @@ int CmdHFiClassReader_Dump(const char *Cmd)
|
|||
|
||||
UsbCommand d = {CMD_READER_ICLASS_REPLAY, {readerType}};
|
||||
memcpy(d.d.asBytes, MAC, 4);
|
||||
SendCommand(&d);
|
||||
if(!fake_dummy_test) SendCommand(&d);
|
||||
|
||||
}else{
|
||||
PrintAndLog("Failed to obtain CC! Aborting");
|
||||
|
|
|
@ -555,9 +555,9 @@ static command_t CommandTable[] =
|
|||
{"em4x", CmdLFEM4X, 1, "{ EM4X RFIDs... }"},
|
||||
{"flexdemod", CmdFlexdemod, 1, "Demodulate samples for FlexPass"},
|
||||
{"hid", CmdLFHID, 1, "{ HID RFIDs... }"},
|
||||
{"io", CmdLFIO, 1, "{ ioProx tags... }"},
|
||||
{"io", CmdLFIO, 1, "{ ioProx tags... }"},
|
||||
{"indalademod", CmdIndalaDemod, 1, "['224'] -- Demodulate samples for Indala 64 bit UID (option '224' for 224 bit)"},
|
||||
{"indalaclone", CmdIndalaClone, 1, "<UID> ['l']-- Clone Indala to T55x7 (tag must be in antenna)(UID in HEX)(option 'l' for 224 UID"},
|
||||
{"indalaclone", CmdIndalaClone, 0, "<UID> ['l']-- Clone Indala to T55x7 (tag must be in antenna)(UID in HEX)(option 'l' for 224 UID"},
|
||||
{"read", CmdLFRead, 0, "['h' or <divisor>] -- Read 125/134 kHz LF ID-only tag (option 'h' for 134, alternatively: f=12MHz/(divisor+1))"},
|
||||
{"sim", CmdLFSim, 0, "[GAP] -- Simulate LF tag from buffer with optional GAP (in microseconds)"},
|
||||
{"simbidir", CmdLFSimBidir, 0, "Simulate LF tag (with bidirectional data transmission between reader and tag)"},
|
||||
|
|
|
@ -40,7 +40,10 @@ int CmdHIDDemod(const char *Cmd)
|
|||
|
||||
int CmdHIDDemodFSK(const char *Cmd)
|
||||
{
|
||||
int findone=0;
|
||||
UsbCommand c={CMD_HID_DEMOD_FSK};
|
||||
if(Cmd[0]=='1') findone=1;
|
||||
c.arg[0]=findone;
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
@ -104,9 +107,9 @@ static command_t CommandTable[] =
|
|||
{
|
||||
{"help", CmdHelp, 1, "This help"},
|
||||
{"demod", CmdHIDDemod, 1, "Demodulate HID Prox Card II (not optimal)"},
|
||||
{"fskdemod", CmdHIDDemodFSK, 1, "Realtime HID FSK demodulator"},
|
||||
{"sim", CmdHIDSim, 1, "<ID> -- HID tag simulator"},
|
||||
{"clone", CmdHIDClone, 1, "<ID> ['l'] -- Clone HID to T55x7 (tag must be in antenna)(option 'l' for 84bit ID)"},
|
||||
{"fskdemod", CmdHIDDemodFSK, 0, "['1'] Realtime HID FSK demodulator (option '1' for one tag only)"},
|
||||
{"sim", CmdHIDSim, 0, "<ID> -- HID tag simulator"},
|
||||
{"clone", CmdHIDClone, 0, "<ID> ['l'] -- Clone HID to T55x7 (tag must be in antenna)(option 'l' for 84bit ID)"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,10 @@ static int CmdHelp(const char *Cmd);
|
|||
|
||||
int CmdIODemodFSK(const char *Cmd)
|
||||
{
|
||||
int findone=0;
|
||||
if(Cmd[0]=='1') findone=1;
|
||||
UsbCommand c={CMD_IO_DEMOD_FSK};
|
||||
c.arg[0]=findone;
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
@ -71,8 +74,8 @@ static command_t CommandTable[] =
|
|||
{
|
||||
{"help", CmdHelp, 1, "This help"},
|
||||
{"demod", CmdIOProxDemod, 1, "Demodulate Stream"},
|
||||
{"fskdemod", CmdIODemodFSK, 1, "Demodulate ioProx Tag"},
|
||||
{"clone", CmdIOClone, 1, "Clone ioProx Tag"},
|
||||
{"fskdemod", CmdIODemodFSK, 0, "['1'] Realtime IO FSK demodulator (option '1' for one tag only)"},
|
||||
{"clone", CmdIOClone, 0, "Clone ioProx Tag"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -113,9 +113,9 @@ void hash1(uint8_t csn[] , uint8_t k[])
|
|||
k[0] = csn[0]^csn[1]^csn[2]^csn[3]^csn[4]^csn[5]^csn[6]^csn[7];
|
||||
k[1] = csn[0]+csn[1]+csn[2]+csn[3]+csn[4]+csn[5]+csn[6]+csn[7];
|
||||
k[2] = rr(swap( csn[2]+k[1] ));
|
||||
k[3] = rr(swap( csn[3]+k[0] ));
|
||||
k[4] = ~rr(swap( csn[4]+k[2] ))+1;
|
||||
k[5] = ~rr(swap( csn[5]+k[3] ))+1;
|
||||
k[3] = rl(swap( csn[3]+k[0] ));
|
||||
k[4] = ~rr( csn[4]+k[2] )+1;
|
||||
k[5] = ~rl( csn[5]+k[3] )+1;
|
||||
k[6] = rr( csn[6]+(k[4]^0x3c) );
|
||||
k[7] = rl( csn[7]+(k[5]^0xc3) );
|
||||
int i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue