Proxmark3 community

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.

Announcement

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.

#1 2017-01-19 15:44:14

marcuch
Contributor
Registered: 2016-12-09
Posts: 9

serial communication string protocol

Hi,
I was searching in the forum for a description of a serial communication protocol in order to integrate the Proxmark card into a high level Java software. I didn't found it. Could you maybe indicate where can I find a description of the communication protocol used?
Basically I would like to avoid the use of proxmark.exe, and talk directly to the card through the virtual COM port that is already created by the driver. Do you think that this could be possible?

Thank you in advance for your help

Offline

#2 2017-01-19 16:09:29

iceman
Administrator
Registered: 2013-04-25
Posts: 9,538
Website

Re: serial communication string protocol

You want to re-write the proxmark client in Java?  Good luck with that!

The GUI by Gaucho,  (a vb.net project), is calling the proxmark client as its own process. Sending to standard input / output.
That would be the simplest way of doing it.

I don't see you gonna "replace" the pm3 client as is in the near future.  The question you have to ask yourself, is it worth it?

Offline

#3 2017-01-19 18:12:53

marcuch
Contributor
Registered: 2016-12-09
Posts: 9

Re: serial communication string protocol

In fact we have a really simple application. I don't want to use and rewrite all the possibilities of the card.
It would be just the reading of different tags and getting the IDs read.
So I could imagine a situation in which all the configuration is done through the proxmark.exe and the java serial communication could be used only for reading and getting the IDs read.
Do you think that it's a utopian idea?
Is there a specification or a document somewhere describing the serial communication protocol between the card and the proxmark.exe?

Thank you in advance for your help.



Thank you

Offline

#4 2017-01-19 19:34:52

iceman
Administrator
Registered: 2013-04-25
Posts: 9,538
Website

Re: serial communication string protocol

Some ppl parse the tracelog file (proxmark3.log)  for IDs'

You will need to dig into the sourcecode to figure out the usbcommands and their individual uses.
The overall structure is easy to figure out.  Have fun!

Offline

#5 2017-04-27 21:02:34

cjbrigato
Contributor
Registered: 2016-09-04
Posts: 52

Re: serial communication string protocol

The Protocol is very, very simple :

commands are there :
https://github.com/Proxmark/proxmark3/blob/master/common/protocols.h

Commands are transmitted over classic CDC-ACM, which should already be worked out at the OS level.

Then the command structure is :

#define USB_CMD_DATA_SIZE 512

#define PACKED __attribute__((packed))
typedef struct {
	uint64_t cmd;
	uint64_t arg[3];
	union {
		uint8_t asBytes[USB_CMD_DATA_SIZE];
		uint32_t asDwords[USB_CMD_DATA_SIZE / 4];
	} d;
}PACKED UsbCommand;

then transmission is as simple as :

bool cmd_send(uint32_t cmd, uint32_t arg0, uint32_t arg1, uint32_t arg2,
		void* data, size_t len) {
	UsbCommand txcmd;

	for (size_t i = 0; i < sizeof(UsbCommand); i++) {
		((byte_t*) &txcmd)[i] = 0x00;
	}
	txcmd.cmd = cmd;
	txcmd.arg[0] = arg0;
	txcmd.arg[1] = arg1;
	txcmd.arg[2] = arg2;
	if (data && len) {
		len = MIN(len, USB_CMD_DATA_SIZE);
		for (size_t i = 0; i < len; i++) {
			txcmd.d.asBytes[i] = ((byte_t*) data)[i];
		}
	}
	memcpy(CDC_TX_Buffer,&txcmd,sizeof(UsbCommand));
	USBH_CDC_Stop(&hUSBHost);
	//USBH_CDC_Transmit(&hUSBHost, (byte_t*) &txcmd, sizeof(UsbCommand)+1);
	USBH_CDC_Transmit(&hUSBHost, CDC_TX_Buffer, sizeof(UsbCommand)+1);
	return true;
}

Offline

Board footer

Powered by FluxBB