In my attempts to make the LEGIC code better, its not working now. Timings if off.
CHG: switching to US clock. CHG: better trace annotation for legic CHG: Legic prng can now give a x bits in once.
This commit is contained in:
@@ -652,7 +652,6 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
|
||||
uint8_t parityBits = parityBytes[j>>3];
|
||||
if (protocol != ISO_14443B && protocol != ISO_7816_4 && (isResponse || protocol == ISO_14443A) && (oddparity != ((parityBits >> (7-(j&0x0007))) & 0x01))) {
|
||||
snprintf(line[j/16]+(( j % 16) * 4),110, "%02x! ", frame[j]);
|
||||
|
||||
} else {
|
||||
snprintf(line[j/16]+(( j % 16) * 4),110, "%02x ", frame[j]);
|
||||
}
|
||||
|
||||
@@ -403,9 +403,34 @@ int CmdLegicRFRead(const char *Cmd) {
|
||||
}
|
||||
PrintAndLog("Current IV: 0x%02x", IV);
|
||||
|
||||
UsbCommand c= {CMD_READER_LEGIC_RF, {offset, len, IV}};
|
||||
// get some prng bytes from
|
||||
uint8_t temp[12];
|
||||
legic_prng_init(IV);
|
||||
for ( uint8_t j = 0; j < sizeof(temp); ++j)
|
||||
temp[j] = legic_prng_get_bits(8);
|
||||
|
||||
PrintAndLog("PRNG: %s", sprint_hex(temp, sizeof(temp)));
|
||||
|
||||
UsbCommand c = {CMD_READER_LEGIC_RF, {offset, len, IV}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
||||
uint8_t isOK = resp.arg[0] & 0xFF;
|
||||
uint16_t len = resp.arg[1] & 0x3FF;
|
||||
if ( isOK ) {
|
||||
PrintAndLog("OK : %d", isOK);
|
||||
PrintAndLog("use 'hf legic decode' or");
|
||||
PrintAndLog("'data hexsamples %d' to view results", len);
|
||||
}
|
||||
} else {
|
||||
PrintAndLog("command execution time out");
|
||||
return 1;
|
||||
}
|
||||
|
||||
//uint8_t got[12000];
|
||||
//GetFromBigBuf(got,sizeof(got),0);
|
||||
//WaitForResponse(CMD_ACK,NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "cmdmain.h"
|
||||
#include "util.h"
|
||||
#include "crc.h"
|
||||
#include "legic_prng.h"
|
||||
|
||||
int CmdHFLegic(const char *Cmd);
|
||||
|
||||
|
||||
@@ -54,17 +54,27 @@ void SendCommand(UsbCommand *c) {
|
||||
}
|
||||
|
||||
struct receiver_arg {
|
||||
int run;
|
||||
int run;
|
||||
};
|
||||
|
||||
struct main_loop_arg {
|
||||
int usb_present;
|
||||
char *script_cmds_file;
|
||||
int usb_present;
|
||||
char *script_cmds_file;
|
||||
};
|
||||
|
||||
byte_t rx[0x1000000];
|
||||
byte_t* prx = rx;
|
||||
|
||||
// static void showBanner(void){
|
||||
// printf("██████╗ ███╗ ███╗ ████╗ ...Iceman fork\n");
|
||||
// printf("██╔══██╗████╗ ████║ ══█║\n");
|
||||
// printf("██████╔╝██╔████╔██║ ████╔╝\n");
|
||||
// printf("██╔═══╝ ██║╚██╔╝██║ ══█║ iceman@icesql.net\n");
|
||||
// printf("██║ ██║ ╚═╝ ██║ ████╔╝ https://github.com/iceman1001/proxmark3\n");
|
||||
// printf("╚═╝ ╚═╝ ╚═╝ ╚═══╝v1.6.4\n");
|
||||
// }
|
||||
|
||||
|
||||
static void *uart_receiver(void *targ) {
|
||||
struct receiver_arg *arg = (struct receiver_arg*)targ;
|
||||
size_t rxlen;
|
||||
@@ -105,6 +115,7 @@ static void *main_loop(void *targ) {
|
||||
char *cmd = NULL;
|
||||
pthread_t reader_thread;
|
||||
|
||||
|
||||
if (arg->usb_present == 1) {
|
||||
rarg.run = 1;
|
||||
pthread_create(&reader_thread, NULL, &uart_receiver, &rarg);
|
||||
|
||||
Reference in New Issue
Block a user