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.
Pages: 1
Hello everyone!This is my first try on the program of PM3 and I'm not good at programming .So Please point out my mistake ,THX.
Many friend,including me,are doubting how to simulate the Mifare Classic 1K UID.I tried to check the "iso14443a.c" and found the reason why the "hi14asim" doesn't work.
The original code is:
void SimulateIso14443aTag(int tagType, int TagUid)
{
// This function contains the tag emulation
// Prepare protocol messages
static const uint8_t response1[] = { 0x44, 0x03 }; // Says: I am a DESFire Tag, ph33r me
// UID response
static const uint8_t response2[] = { 0x88, 0x04, 0x21, 0x3f, 0x4d }; // my desfire known uid - note
SO,if we wanna simulate a MIFARE Classic UID,we need to chage it to :
void SimulateIso14443aTag(int tagType, int TagUid)
{
// This function contains the tag emulation
// Prepare protocol messages
//static const uint8_t response1[] = { 0x44, 0x03 }; // Says: I am a DESFire Tag, ph33r me
static const uint8_t response1[] = { 0x04, 0x00 };//Nemer Edited
// UID response
//static const uint8_t response2[] = { 0x88, 0x04, 0x21, 0x3f, 0x4d }; // my desfire known uid - note
static const uint8_t response2[] ={ 0xd2, 0x37, 0x56, 0x48, 0xfb};//Nemer Edited
Now,it will simulate as Mifare card with UID:d2375648.The last byte"0xfb" is a crc and can be calculate by "XOR (UID1,UID2,UID3,UID4);
After this I tried to edit "cmdhf14a.c" and "iso14443a.c" ,because the parameter "TagUid" in the function above is not calculate ,transfered and used correctly ,though it should be.I want to calculate the crc in the function "int CmdHF14ASim(const char *Cmd)" from "cmdhf14a.c" .But ,for my poor programming ability,it still in wronging....
It will be very thankful if someone can help me .THX!
Offline
I reprogram the "int CmdHF14ASim(const char *Cmd)" from "cmdhf14a.c" like this:
int CmdHF14ASim(const char *Cmd)
{
int i, temp;
uint8_t uid[4] = {0, 0, 0, 0};
uint8_t wcrc=0;
const char *cmdp = Cmd;
if (strlen(Cmd)<3) {
PrintAndLog("Usage: hf 14a mfsim <uid (8 hex symbols)>");
PrintAndLog(" sample: hf 14a mfsim 0a0a0a0a ");
return 0;
}
// skip spaces
while (*cmdp==' ' || *cmdp=='\t') cmdp++;
if (strlen(cmdp) != 8) {
PrintAndLog("Length of UID must be 8 hex symbols");
return 0;
}
for(i = 0; i < 4; i++) {
sscanf((char[]){cmdp[0],cmdp[1],0},"%X",&temp);
uid[i] = temp & 0xff;
wcrc=wcrc^uin[i];
cmdp++;
cmdp++;
}
PrintAndLog(" uid:%s ", sprint_hex(uid, 4));
// c.arg should be set to *Cmd or convert *Cmd to the correct format for a uid
UsbCommand c = {CMD_SIMULATE_TAG_ISO_14443a, {uid,wcrc}};
PrintAndLog("Emulating 14443A TAG with UID %16x \n %16x ...", uid,wcrc);
SendCommand(&c);
return 0;
}
And chang
void SimulateIso14443aTag(int tagType, int *TagUid)
{
// This function contains the tag emulation
// Prepare protocol messages
//static const uint8_t response1[] = { 0x44, 0x03 }; // Says: I am a DESFire Tag, ph33r me
static const uint8_t response1[] = { 0x04, 0x00 };//Nemer Edited
// UID response
//static const uint8_t response2[] = { 0x88, 0x04, 0x21, 0x3f, 0x4d }; // my desfire known uid - note
static const uint8_t *response2 =TagUid;//Nemer Edited
When compiling,it shows:
.....
iso14443a.c:940:error:conflicting type for 'SimulateIso14443aTag'
....
iso14443a.c:958:error:initialization from incompatible pointer type
iso14443a.c:958:error:initializer element is not constant
Help me ,anyone.
Offline
do you have correct declaration in iso14443a.h?
Offline
do you have correct declaration in iso14443a.h?
NO,but there is no delaration for SimulateIso14443aTag in iso14443a.h originally.
I found the data type of "{uid,wcrc}" is not correct during the transfer ,but have no idea with this problem.I am working on it .
Offline
Finally,I got it.The Uid[] can't be transport through c->arg[0].I mistaked the data type of it.
Now I followed http://www.proxmark.org/forum/viewtopic.php?id=747 and it works.
Thank you,merlok !
Offline
Pages: 1