mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
FIX: cleanup code, sync of output texts.
This commit is contained in:
parent
4c37126baf
commit
4c72acaf63
3 changed files with 66 additions and 61 deletions
|
@ -19,7 +19,7 @@ void RunMod() {
|
|||
int selected = 0;
|
||||
int playing = 0;
|
||||
int cardRead = 0;
|
||||
|
||||
bool gotCard;
|
||||
// Turn on selected LED
|
||||
LED(selected + 1, 0);
|
||||
|
||||
|
@ -31,7 +31,9 @@ void RunMod() {
|
|||
|
||||
// Was our button held down or pressed?
|
||||
int button_pressed = BUTTON_HELD(1000);
|
||||
//SpinDelay(300);
|
||||
|
||||
Dbprintf("button %d", button_pressed);
|
||||
SpinDelay(300);
|
||||
|
||||
// Button was held for a second, begin recording
|
||||
if (button_pressed > 0 && cardRead == 0) {
|
||||
|
@ -40,7 +42,7 @@ void RunMod() {
|
|||
LED(LED_RED2, 0);
|
||||
|
||||
// record
|
||||
DbpString("[+] starting recording");
|
||||
DbpString("[=] starting recording");
|
||||
|
||||
// wait for button to be released
|
||||
while (BUTTON_PRESS())
|
||||
|
@ -50,7 +52,7 @@ void RunMod() {
|
|||
SpinDelay(500);
|
||||
|
||||
CmdHIDdemodFSK(1, &high[selected], &low[selected], 0);
|
||||
Dbprintf("[+] recorded %x %x %08x", selected, high[selected], low[selected]);
|
||||
Dbprintf("[=] recorded bank %x | %x %08x", selected, high[selected], low[selected]);
|
||||
|
||||
LEDsoff();
|
||||
LED(selected + 1, 0);
|
||||
|
@ -58,7 +60,9 @@ void RunMod() {
|
|||
// If we were previously playing, set playing off
|
||||
// so next button push begins playing what we recorded
|
||||
playing = 0;
|
||||
cardRead = 1;
|
||||
cardRead = 1;
|
||||
|
||||
gotCard = true;
|
||||
}
|
||||
else if (button_pressed > 0 && cardRead == 1) {
|
||||
LEDsoff();
|
||||
|
@ -66,7 +70,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())
|
||||
|
@ -76,7 +80,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);
|
||||
|
@ -89,10 +93,11 @@ void RunMod() {
|
|||
}
|
||||
|
||||
// Change where to record (or begin playing)
|
||||
else if (button_pressed) {
|
||||
else if (button_pressed && gotCard) {
|
||||
// Next option if we were previously playing
|
||||
if (playing)
|
||||
selected = (selected + 1) % OPTS;
|
||||
|
||||
playing = !playing;
|
||||
|
||||
LEDsoff();
|
||||
|
@ -100,21 +105,20 @@ void RunMod() {
|
|||
|
||||
// Begin transmitting
|
||||
if (playing) {
|
||||
|
||||
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], false);
|
||||
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);
|
||||
|
@ -131,4 +135,8 @@ void RunMod() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
DbpString("[=] exiting");
|
||||
LEDsoff();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue