SiRFIDaL - Simple RFID authentication for Linux

by the way I love that your code has provisioned for multiple readers of the same type and concurrent serials with differing baud, thats really thorough

The thing with the PM3 client is this: the SiRFIDaL server calls it as if it were an ordinary user (as root, but still as if it was run manually) and then issues commands to it.

So if you (as root) can manually cd into /tmp, invoke the absolute path of the PM3 client’s executable as declared in the server parameters and get a prompt, it should work with the server too - because essentially, that’s exactly what the server does.

If the PM3 client throws a fit when you try to run it manually that way, it’ll throw a fit when the server tries to run it too. And that manifests itself as the server telling you the PM3 client died (because most likely it started then immediately stopped) and telling you it can’t read its stdout because, well, the client has died :slight_smile:

It’s kind of a hacky thing to do, talking to the PM3 through the interactive client that way. It would be much better if the SiRFIDaL server talked to the device directly. Unfortunately, the PM3’s API is quite a moving target, and the only things that can be relied upon to be somewhat stable from one release to the next is the PM3 client’s user-facing commands. Hence this kludge.

By the way, which client / firmware are you running? Iceman’s? I seem to recall his client compiled as a proxmark3 binary, not pm3, so that’s a bit surprising.

Thanks! It wasn’t like that until recently. But I run multiple readers on my machines, and so does one user in an industrial setting that needed 10 of them connected at the same time. So I recently took the time to turn my huge pile of copy/pasted stuff into a more nicely organized and more versatile pile of copy/pasted stuff :slight_smile:

yes, I tried it just after I wrote my last response- sudo /usr/local/bin/proxmark3/pm3 works fine although I notice this message just after the PM3 launch artwork-
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-root’

Correct -its the iceman version, here is the displayed info.


[ CLIENT ]
RRG/Iceman/master/v4.14434-89-g85fb51564 2021-11-17 22:27:14
compiled with… GCC 11.2.0
platform… Linux / x86_64
Readline support… present
QT GUI support… present
native BT support… present
Python script support… present
Lua SWIG support… present
Python SWIG support… present

[ PROXMARK3 ]
firmware… PM3 GENERIC

[ ARM ]
bootrom: RRG/Iceman/master/v4.14434-89-g85fb51564 2021-11-11 21:51:00
os: RRG/Iceman/master/v4.14434-89-g85fb51564 2021-11-17 22:27:39
compiled with GCC 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]


I wonder, could it be something regarding permission to access the USB device, do I need a udev rule or something?

It should work without any special permissions, since the server runs as root.

One question: does /dev/ttyACM0 exist when the PM3 is connected? The server will literally try to run the command /usr/local/bin/proxmark3/pm3 /dev/ttyACM0 as defined in your parameters. If the serial device file doesn’t exist, that will cause the PM3 client to quit immediately.

Yep, it’s /dev/ttyACM0

Hmm okay, try this: in line 1089, just after “b = proc[0].stdout.read(256).decode(“ascii”)”, add “print(b)” in the sirfidal_server.py script (just to see what the client says before it dies).

That makes me think I should add better stdout / stderr debugging for both the PM3 and the Android listeners. As it is, it’s not terribly easy to troubleshoot. Sorry about that…

Nothing to apologize for! you are being super helpful already.
Shit, this makes me think it’s choking on emoji pref setting set to “emoji”
…editing sirfidal_server.py now.

ok see below

*[server] Started
[proxmark3_listener] [proxmark3_#1] Started
[pcsc_listener] [pcsc_readers] Started
[pcsc_listener] [pcsc_readers] No readers
[=] Session log /tmp/.proxmark3/logs/log_20211122.txt

syntax: proxmark3 [-h|-t|-m|–fulltext]
proxmark3 [[-p] ] [-b] [-w] [-f] [-c ]|[-l <lua_script_file>]|[-y <python_script_file>]|[-s <cmd_script_file>] [-i] [-d <0|1|2>]
p
[proxmark3_listener_sigchld_handler] [proxmark3_#1] Proxmark3 client died
roxmark3 [-p] --flash [–unlock-bootloader] [–image ]+ [-w] [-f] [-d <0|1|2>]

[proxmark3_listener] [proxmark3_#1] Error reading Proxmark3 client’s stdout
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[=] Session log /tmp/.proxmark3/logs/log_20211122.txt

syntax: proxmark3 [-h|-t|-m|–fulltext]
proxmark3 [[-p] ] [-b] [-w] [-f] [-c ]|[-l <lua_script_file>]|[-y <python_script_file>]|[-s <cmd_script_file>] [-i] [-d <0|1|2>]
p
roxmark3 [-p] --flash [–unlock-bootloader] [–image ]+ [-w] [-f] [-d <0|1|2>]

[proxmark3_listener_sigchld_handler] [proxmark3_#1] Proxmark3 client died

[proxmark3_listener] [proxmark3_#1] Error reading Proxmark3 client’s stdout
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[pcsc_listener] [pcsc_readers] No readers
[=] Session log /tmp/.proxmark3/logs/log_20211122.txt

syntax: proxmark3 [-h|-t|-m|–fulltext]
proxmark3 [[-p] ] [-b] [-w] [-f] [-c ]|[-l <lua_script_file>]|[-y <python_script_file>]|[-s <cmd_script_file>] [-i] [-d <0|1|2>]
p
roxmark3 [-p] --flash [–unlock-bootloader] [–image ]+ [-w] [-f] [-d <0|1|2>]

[proxmark3_listener_sigchld_handler] [proxmark3_#1] Proxmark3 client died

that log in tmp contains repeating msg:

[!!] ERROR: cannot parse command line. We got /dev/ttyACM0 as port and now we got also: /dev/ttyACM0

syntax: proxmark3 [-h|-t|-m|–fulltext]
proxmark3 [[-p] ] [-b] [-w] [-f] [-c ]|[-l <lua_script_file>]|[-y <python_script_file>]|[-s <cmd_script_file>] [-i] [-d <0>
proxmark3 [-p] --flash [–unlock-bootloader] [–image ]+ [-w] [-f] [-d <0|1|2>]
[!!] ERROR: cannot parse command line. We got /dev/ttyACM0 as port and now we got also: /dev/ttyACM0

Argh… It looks like Iceman changed something in the client again :frowning: Lemme get the latest version and try it here.

Err… Just one question: that pm3 binary you call, is that directly the PM3 client executable, or a script you wrote to point it to /dev/ttyACM0 without having to retype it each time?

I can reproduce the problem if I call my /usr/local/bin/proxmark3 /dev/ttyACM0 /dev/ttyACM0 (with /dev/ttyACM0 repeated twice). So something tells me the pm3 file is a script that passes the device file already.

nah, thats the file I’ve always used, it came from “make build”

But the thing about Port reminds me there was specific one or two lines of code in the proxmark3 installation instructions where I had to add something -f port something…Searching the git to find that instruction now

Okay try this: in sirfidal_server.py, line 1061, replace

proc[0] = Popen([client, device], bufsize = 0, env = {},

with

proc[0] = Popen([client], bufsize = 0, env = {},

(and you can remove that print(b) line in line 1089)

Or…

Do you have a /usr/local/bin/proxmark3/client/proxmark3 binary?

If so, use that in the client parameter instead of pm3

Oh, shit, I just discoverd it I think proxmark3 is in /clients and pm3 is a script

Well I don’t have the pm3 script in my (slightly older) Proxmark3 repo. It looks like a wrapper to make things easier that was added later.

Hmm I should update the documentation probably…

Yes!! Proxmark is flashing now, and I was able to see UID reads with sirfidal_server.py -d and enrolled my chip with sirfidal_useradm

At last :slight_smile:

Okay I’ll update the code to include better debugging for this, and probably I’ll add something to cope with people who pass it the pm3 executable instead of the proxmark3 executable. Thanks for the feedback :slight_smile:

By the way, if you’d like your PM3 to flash a little less, or if it runs hot over time, you can try to increase “poll_throttle”. It’ll make it a little less reactive, but it won’t keep it quite as busy.

Also, from the debug log you posted, you probably can disable the PC/SC readers (first config block). I leave it enabled by default in the repo, on the assumption that most people will try SiRFIDaL with an ACR122U, but you don’t need it.