FIX: cleanup code, sync of output texts.

This commit is contained in:
Chris 2018-09-05 18:58:58 +02:00
commit 4c72acaf63
3 changed files with 66 additions and 61 deletions

View file

@ -47,7 +47,7 @@ void RunMod() {
// Was our button held down or pressed?
int button_pressed = BUTTON_HELD(1000);
//SpinDelay(300);
SpinDelay(300);
// Button was held for a second, begin recording
if (button_pressed > 0 && cardRead == 0) {
@ -56,7 +56,7 @@ void RunMod() {
LED(LED_RED2, 0);
// record
DbpString("[+] starting recording");
DbpString("[=] starting recording");
// wait for button to be released
while(BUTTON_PRESS())
@ -66,7 +66,7 @@ void RunMod() {
SpinDelay(500);
CmdHIDdemodFSK(1, &high[selected], &low[selected], 0);
Dbprintf("[+] recorded %x %x %08x", selected, high[selected], low[selected]);
Dbprintf("[=] recorded %x %x %08x", selected, high[selected], low[selected]);
LEDsoff();
LED(selected + 1, 0);
@ -82,7 +82,7 @@ void RunMod() {
LED(LED_ORANGE, 0);
// record
Dbprintf("[+] cloning %x %x %08x", selected, high[selected], low[selected]);
Dbprintf("[=] cloning %x %x %08x", selected, high[selected], low[selected]);
// wait for button to be released
while(BUTTON_PRESS())
@ -92,7 +92,7 @@ void RunMod() {
SpinDelay(500);
CopyHIDtoT55x7(0, high[selected], low[selected], 0);
Dbprintf("[+] cloned %x %x %08x", selected, high[selected], low[selected]);
Dbprintf("[=] cloned %x %x %08x", selected, high[selected], low[selected]);
LEDsoff();
LED(selected + 1, 0);
@ -109,6 +109,7 @@ void RunMod() {
// Next option if we were previously playing
if (playing)
selected = (selected + 1) % OPTS;
playing = !playing;
LEDsoff();
@ -118,21 +119,18 @@ void RunMod() {
if (playing && selected != 2) {
LED(LED_GREEN, 0);
DbpString("[+] playing");
DbpString("[=] playing");
// wait for button to be released
while (BUTTON_PRESS())
WDT_HIT();
Dbprintf("[+] %x %x %08x", selected, high[selected], low[selected]);
Dbprintf("[=] %x %x %08x", selected, high[selected], low[selected]);
CmdHIDsimTAG(high[selected], low[selected], 0);
DbpString("[+] done playing");
DbpString("[=] done playing");
if (BUTTON_HELD(1000) > 0) {
DbpString("[+] exiting");
LEDsoff();
return;
}
if (BUTTON_HELD(1000) > 0)
goto out;
/* We pressed a button so ignore it here with a delay */
SpinDelay(300);
@ -166,18 +164,18 @@ void RunMod() {
uint32_t fc = ((high[selected] & 1 ) << 11 ) | (low[selected] >> 21);
uint32_t original_cardnum = cardnum;
Dbprintf("[+] Proxbrute - starting decrementing card number");
Dbprintf("[=] Proxbrute - starting decrementing card number");
while (cardnum >= 0) {
// Needed for exiting from proxbrute when button is pressed
if (BUTTON_PRESS()) {
if (BUTTON_HELD(1000) > 0) {
DbpString("[+] exiting");
LEDsoff();
return;
goto out;
} else {
while (BUTTON_PRESS()) { WDT_HIT(); }
while (BUTTON_PRESS()) {
WDT_HIT();
}
break;
}
}
@ -189,23 +187,21 @@ void RunMod() {
hid_corporate_1000_calculate_checksum_and_set(&high[selected], &low[selected], cardnum, fc);
// Print actual code to brute
Dbprintf("[+] TAG ID: %x%08x (%d) - FC: %u - Card: %u", high[selected], low[selected], (low[selected] >> 1) & 0xFFFF, fc, cardnum);
Dbprintf("[=] TAG ID: %x%08x (%d) - FC: %u - Card: %u", high[selected], low[selected], (low[selected] >> 1) & 0xFFFF, fc, cardnum);
CmdHIDsimTAGEx(high[selected], low[selected], 1, 50000);
}
cardnum = original_cardnum;
Dbprintf("[+] Proxbrute - starting incrementing card number");
Dbprintf("[=] Proxbrute - starting incrementing card number");
while (cardnum <= 0xFFFFF) {
// Needed for exiting from proxbrute when button is pressed
if (BUTTON_PRESS()) {
if (BUTTON_HELD(1000) > 0) {
DbpString("[+] exiting");
LEDsoff();
return;
goto out;
} else {
while (BUTTON_PRESS()) { WDT_HIT(); }
break;
@ -219,17 +215,14 @@ void RunMod() {
hid_corporate_1000_calculate_checksum_and_set(&high[selected], &low[selected], cardnum, fc);
// Print actual code to brute
Dbprintf("[+] TAG ID: %x%08x (%d) - FC: %u - Card: %u", high[selected], low[selected], (low[selected] >> 1) & 0xFFFF, fc, cardnum);
Dbprintf("[=] TAG ID: %x%08x (%d) - FC: %u - Card: %u", high[selected], low[selected], (low[selected] >> 1) & 0xFFFF, fc, cardnum);
CmdHIDsimTAGEx(high[selected], low[selected], 1, 50000);
}
DbpString("[+] done bruteforcing");
if (BUTTON_HELD(1000) > 0) {
DbpString("Exiting");
LEDsoff();
return;
}
DbpString("[=] done bruteforcing");
if (BUTTON_HELD(1000) > 0)
goto out;
/* We pressed a button so ignore it here with a delay */
SpinDelay(300);
@ -246,6 +239,10 @@ void RunMod() {
}
}
}
out:
DbpString("[=] exiting");
LEDsoff();
}
// Function that calculate next value for the brutforce of HID corporate 1000