Research, development and trades concerning the powerful Proxmark3 device.
Remember; sharing is caring. Bring something back to the community.
"Learn the tools of the trade the hard way." +Fravia
You are not logged in.
Time changes and with it the technology
Proxmark3 @ discord
Users of this forum, please be aware that information stored on this site is not private.
I've added a new command:
detectreader -- ['l'|'h'] -- Detect external reader field (option 'l' or 'h' to limit to LF or HF)
This just listens for an external reader field and lights up green for HF and/or red for LF. Button press exits. Output columns are:
PREVIOUS, CURRENT, LOOPS
Where PREVIOUS is the ADC value we just changed from, CURRENT is the value we changed to, and LOOPS is the number of times we went around the loop between changes. It would obviously be more helpful to have an actual time, but since the resolution proved not to be high enough to be able to measure reader commands (which is why I started on this in the first place!) I didn't bother...
However, it proved to be a useful little feature when you're wondering what that reader on the wall is actually listening for...
Here it is in action:
proxmark3> detectreader
> detectreader
#db# LF 125/134 Baseline:
#db# 00000000, 00000000, 00000000
#db# HF 13.56 Baseline:
#db# 00000000, 00000000, 00000000
#db# HF 13.56 Field Change:
#db# 00000000, 0000000b, 0000c899
#db# HF 13.56 Field Change:
#db# 0000000b, 00000000, 00000001
#db# HF 13.56 Field Change:
#db# 00000000, 00000037, 00000001
#db# HF 13.56 Field Change:
#db# 00000037, 00000053, 00000001
#db# LF 125/134 Field Change:
#db# 00000000, 00000018, 000198f9
#db# LF 125/134 Field Change:
#db# 00000018, 0000000d, 00000003
#db# LF 125/134 Field Change:
#db# 0000000d, 00000018, 0000775f
#db# LF 125/134 Field Change:
#db# 00000018, 00000024, 00000001
#db# LF 125/134 Field Change:
#db# 00000024, 0000003e, 00000001
#db# LF 125/134 Field Change:
#db# 0000003e, 00000082, 00000001
#db# LF 125/134 Field Change:
#db# 00000082, 0000003f, 00000001
#db# LF 125/134 Field Change:
#db# 0000003f, 0000000e, 00000001
It's also great for seeing how far out the reader field extends (or how sensitive your antenna is)...
Last edited by adam@algroup.co.uk (2009-07-07 18:34:45)
Offline
Nice Adam!
Offline
great, i'll add this into the reference manual.
Offline
Hi Adam,
I have tested your 'detectreader' and it works very nicely! I added a functionnality, and now it's possible to visually detect, using the LED's, the best location to put your antenna for maximum snooping performance Let me know what you guys think and if it works for you. I will get a hold on a LF reader really soon, and will be able to add the LF functionnality also
Here is a patch to r56, 'patch appmain.c < patch.diff':
1017c1017,1056
< // listen for external reader
---
> /*
> OBJECTIVE
> Listen and detect an external reader. Determine the best location
> for the antenna.
>
> INSTRUCTIONS:
> Inside the ListenReaderField() function, there is two mode.
> By default, when you call the function, you will enter mode 1.
> If you press the PM3 button one time, you will enter mode 2.
> If you press the PM3 button a second time, you will exit the function.
>
> DESCRIPTION OF MODE 1:
> This mode just listens for an external reader field and lights up green
> for HF and/or red for LF. This is the original mode of the detectreader
> function.
>
> DESCRIPTION OF MODE 2:
> This mode will visually represent, using the LEDs, the actual strength of the
> current compared to the maximum current detected. Basically, once you know
> what kind of external reader is present, it will help you spot the best location to place
> your antenna. You will probably not get some good results if there is a LF and a HF reader
> at the same place! :-)
>
> LIGHT SCHEME USED:
>
> Light scheme | Descriptiong
> ----------------------------------------------------
> ---- | No field detected
> X--- | 14% of maximum current detected
> -X-- | 29% of maximum current detected
> --X- | 43% of maximum current detected
> ---X | 57% of maximum current detected
> --XX | 71% of maximum current detected
> -XXX | 86% of maximum current detected
> XXXX | 100% of maximum current detected
>
> TODO:
> Add the LF part for MODE 2
>
> */
1021c1060,1061
< int hf_av, hf_av_new, hf_baseline= 0, hf_count= 0;
---
> int hf_av, hf_av_new, hf_baseline= 0, hf_count= 0, hf_max;
> int mode=1;
1040,1041c1080
< hf_av= ReadAdc(ADC_CHAN_HF);
<
---
> hf_av=hf_max=ReadAdc(ADC_CHAN_HF);
1052,1057c1091,1105
< if(BUTTON_PRESS())
< {
< DbpString("Stopped");
< LED_B_OFF();
< LED_D_OFF();
< return;
---
> if (BUTTON_PRESS()) {
> SpinDelay(500);
> switch (mode) {
> case 1:
> mode=2;
> break;
> case 2:
> default:
> DbpString("Stopped");
> LED_A_OFF();
> LED_B_OFF();
> LED_C_OFF();
> LED_D_OFF();
> return;
> break;
1058a1107
> }
1061d1109
<
1082,1085c1130,1164
< if (abs(hf_av - hf_baseline) > 10)
< LED_B_ON();
< else
< LED_B_OFF();
---
> if (abs(hf_av - hf_baseline) > 10) {
> if (mode == 1)
> LED_B_ON();
> if (mode == 2) {
> if ( hf_av>(hf_max/7)*6) {
> LED_A_ON(); LED_B_ON(); LED_C_ON(); LED_D_ON();
> }
> if ( (hf_av>(hf_max/7)*5) && (hf_av<=(hf_max/7)*6) ) {
> LED_A_ON(); LED_B_ON(); LED_C_OFF(); LED_D_ON();
> }
> if ( (hf_av>(hf_max/7)*4) && (hf_av<=(hf_max/7)*5) ) {
> LED_A_OFF(); LED_B_ON(); LED_C_OFF(); LED_D_ON();
> }
> if ( (hf_av>(hf_max/7)*3) && (hf_av<=(hf_max/7)*4) ) {
> LED_A_OFF(); LED_B_OFF(); LED_C_OFF(); LED_D_ON();
> }
> if ( (hf_av>(hf_max/7)*2) && (hf_av<=(hf_max/7)*3) ) {
> LED_A_OFF(); LED_B_ON(); LED_C_OFF(); LED_D_OFF();
> }
> if ( (hf_av>(hf_max/7)*1) && (hf_av<=(hf_max/7)*2) ) {
> LED_A_ON(); LED_B_OFF(); LED_C_OFF(); LED_D_OFF();
> }
> if ( (hf_av>(hf_max/7)*0) && (hf_av<=(hf_max/7)*1) ) {
> LED_A_OFF(); LED_B_OFF(); LED_C_ON(); LED_D_OFF();
> }
> }
> } else {
> if (mode == 1) {
> LED_B_OFF();
> }
> if (mode == 2) {
> LED_A_OFF(); LED_B_OFF(); LED_C_OFF(); LED_D_OFF();
> }
> }
>
1093a1173,1174
> if (hf_av > hf_max)
> hf_max = hf_av;
1098a1180
>
Offline
Very nice! Please email me the full 'diff -u' file - it's not in a useful form once cut & pasted...
Offline
Finally, I had the time to made the patch. I have emailed it to you, hope it will work
Offline
Yep, worked first time, thanks! I've added a confirmation message that you've entered signal strength mode and committed.
Offline
Nice, thanks for your time
Offline
I've generalized the detect reader field functionality to also show the pretty lights for a LF field. I sent the patch to Adam a week ago, but he is probably too busy right now, what with Defcon and all. Anybody else care to look at it?
Index: appmain.c
===================================================================
--- appmain.c (Revision 144)
+++ appmain.c (Arbeitskopie)
@@ -373,56 +373,47 @@
at the same place! :-)
LIGHT SCHEME USED:
-
-Light scheme | Descriptiong
-----------------------------------------------------
- ---- | No field detected
- X--- | 14% of maximum current detected
- -X-- | 29% of maximum current detected
- --X- | 43% of maximum current detected
- ---X | 57% of maximum current detected
- --XX | 71% of maximum current detected
- -XXX | 86% of maximum current detected
- XXXX | 100% of maximum current detected
-
-TODO:
-Add the LF part for MODE 2
-
*/
+static const char LIGHT_SCHEME[] = {
+ 0x0, /* ---- | No field detected */
+ 0x1, /* X--- | 14% of maximum current detected */
+ 0x2, /* -X-- | 29% of maximum current detected */
+ 0x4, /* --X- | 43% of maximum current detected */
+ 0x8, /* ---X | 57% of maximum current detected */
+ 0xC, /* --XX | 71% of maximum current detected */
+ 0xE, /* -XXX | 86% of maximum current detected */
+ 0xF, /* XXXX | 100% of maximum current detected */
+};
+static const int LIGHT_LEN = sizeof(LIGHT_SCHEME)/sizeof(LIGHT_SCHEME[0]);
+
void ListenReaderField(int limit)
{
- int lf_av, lf_av_new, lf_baseline= 0, lf_count= 0;
+ int lf_av, lf_av_new, lf_baseline= 0, lf_count= 0, lf_max;
int hf_av, hf_av_new, hf_baseline= 0, hf_count= 0, hf_max;
- int mode=1;
+ int mode=1, display_val, display_max, i;
#define LF_ONLY 1
#define HF_ONLY 2
- LED_A_OFF();
- LED_B_OFF();
- LED_C_OFF();
- LED_D_OFF();
+ LEDsoff();
- lf_av= ReadAdc(ADC_CHAN_LF);
+ lf_av=lf_max=ReadAdc(ADC_CHAN_LF);
- if(limit != HF_ONLY)
- {
+ if(limit != HF_ONLY) {
DbpString("LF 125/134 Baseline:");
DbpIntegers(lf_av,0,0);
lf_baseline= lf_av;
- }
+ }
hf_av=hf_max=ReadAdc(ADC_CHAN_HF);
- if (limit != LF_ONLY)
- {
+ if (limit != LF_ONLY) {
DbpString("HF 13.56 Baseline:");
DbpIntegers(hf_av,0,0);
hf_baseline= hf_av;
- }
+ }
- for(;;)
- {
+ for(;;) {
if (BUTTON_PRESS()) {
SpinDelay(500);
switch (mode) {
@@ -433,85 +424,78 @@
case 2:
default:
DbpString("Stopped");
- LED_A_OFF();
- LED_B_OFF();
- LED_C_OFF();
- LED_D_OFF();
+ LEDsoff();
return;
break;
}
}
WDT_HIT();
- if (limit != HF_ONLY)
- {
- if (abs(lf_av - lf_baseline) > 10)
- LED_D_ON();
- else
- LED_D_OFF();
+ if (limit != HF_ONLY) {
+ if(mode==1) {
+ if (abs(lf_av - lf_baseline) > 10) LED_D_ON();
+ else LED_D_OFF();
+ }
+
++lf_count;
lf_av_new= ReadAdc(ADC_CHAN_LF);
// see if there's a significant change
- if(abs(lf_av - lf_av_new) > 10)
- {
+ if(abs(lf_av - lf_av_new) > 10) {
DbpString("LF 125/134 Field Change:");
DbpIntegers(lf_av,lf_av_new,lf_count);
lf_av= lf_av_new;
+ if (lf_av > lf_max)
+ lf_max = lf_av;
lf_count= 0;
- }
}
+ }
- if (limit != LF_ONLY)
- {
- if (abs(hf_av - hf_baseline) > 10) {
- if (mode == 1)
- LED_B_ON();
- if (mode == 2) {
- if ( hf_av>(hf_max/7)*6) {
- LED_A_ON(); LED_B_ON(); LED_C_ON(); LED_D_ON();
- }
- if ( (hf_av>(hf_max/7)*5) && (hf_av<=(hf_max/7)*6) ) {
- LED_A_ON(); LED_B_ON(); LED_C_OFF(); LED_D_ON();
- }
- if ( (hf_av>(hf_max/7)*4) && (hf_av<=(hf_max/7)*5) ) {
- LED_A_OFF(); LED_B_ON(); LED_C_OFF(); LED_D_ON();
- }
- if ( (hf_av>(hf_max/7)*3) && (hf_av<=(hf_max/7)*4) ) {
- LED_A_OFF(); LED_B_OFF(); LED_C_OFF(); LED_D_ON();
- }
- if ( (hf_av>(hf_max/7)*2) && (hf_av<=(hf_max/7)*3) ) {
- LED_A_OFF(); LED_B_ON(); LED_C_OFF(); LED_D_OFF();
- }
- if ( (hf_av>(hf_max/7)*1) && (hf_av<=(hf_max/7)*2) ) {
- LED_A_ON(); LED_B_OFF(); LED_C_OFF(); LED_D_OFF();
- }
- if ( (hf_av>(hf_max/7)*0) && (hf_av<=(hf_max/7)*1) ) {
- LED_A_OFF(); LED_B_OFF(); LED_C_ON(); LED_D_OFF();
- }
- }
- } else {
- if (mode == 1) {
- LED_B_OFF();
- }
- if (mode == 2) {
- LED_A_OFF(); LED_B_OFF(); LED_C_OFF(); LED_D_OFF();
- }
+ if (limit != LF_ONLY) {
+ if (mode == 1){
+ if (abs(hf_av - hf_baseline) > 10) LED_B_ON();
+ else LED_B_OFF();
}
-
+
++hf_count;
hf_av_new= ReadAdc(ADC_CHAN_HF);
// see if there's a significant change
- if(abs(hf_av - hf_av_new) > 10)
- {
+ if(abs(hf_av - hf_av_new) > 10) {
DbpString("HF 13.56 Field Change:");
DbpIntegers(hf_av,hf_av_new,hf_count);
hf_av= hf_av_new;
if (hf_av > hf_max)
hf_max = hf_av;
hf_count= 0;
+ }
+ }
+
+ if(mode == 2) {
+ if (limit == LF_ONLY) {
+ display_val = lf_av;
+ display_max = lf_max;
+ } else if (limit == HF_ONLY) {
+ display_val = hf_av;
+ display_max = hf_max;
+ } else { /* Pick one at random */
+ if( (hf_max - hf_baseline) > (lf_max - lf_baseline) ) {
+ display_val = hf_av;
+ display_max = hf_max;
+ } else {
+ display_val = lf_av;
+ display_max = lf_max;
}
}
+ for (i=0; i<LIGHT_LEN; i++) {
+ if (display_val >= ((display_max/LIGHT_LEN)*i) && display_val <= ((display_max/LIGHT_LEN)*(i+1))) {
+ if (LIGHT_SCHEME[i] & 0x1) LED_C_ON(); else LED_C_OFF();
+ if (LIGHT_SCHEME[i] & 0x2) LED_A_ON(); else LED_A_OFF();
+ if (LIGHT_SCHEME[i] & 0x4) LED_B_ON(); else LED_B_OFF();
+ if (LIGHT_SCHEME[i] & 0x8) LED_D_ON(); else LED_D_OFF();
+ break;
+ }
+ }
}
+ }
}
void UsbPacketReceived(BYTE *packet, int len)
Offline
Did this get added? If not, you can shoot it to me (samy@samy.pl) and I can czech it out
Offline
I've just double checked and it doesn't look like I ever received that message.
Feel free to send it again and I'll get it committed!
Offline
It's ok, Roel gave me commit access and I just committed it.
Offline