mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
CHG: Missing some headers
FIX: some message/warning in pm3_binlib.c @gm4tr1x
This commit is contained in:
parent
e9a92fe237
commit
1a570b0a6a
3 changed files with 166 additions and 164 deletions
|
@ -202,8 +202,7 @@ void ReadTItag(void)
|
||||||
crc = update_crc16(crc, (shift1>>16)&0xff);
|
crc = update_crc16(crc, (shift1>>16)&0xff);
|
||||||
crc = update_crc16(crc, (shift1>>24)&0xff);
|
crc = update_crc16(crc, (shift1>>24)&0xff);
|
||||||
|
|
||||||
Dbprintf("Info: Tag data: %x%08x, crc=%x",
|
Dbprintf("Info: Tag data: %x%08x, crc=%x", (unsigned int)shift1, (unsigned int)shift0, (unsigned int)shift2 & 0xFFFF);
|
||||||
(unsigned int)shift1, (unsigned int)shift0, (unsigned int)shift2 & 0xFFFF);
|
|
||||||
if (crc != (shift2&0xffff)) {
|
if (crc != (shift2&0xffff)) {
|
||||||
Dbprintf("Error: CRC mismatch, expected %x", (unsigned int)crc);
|
Dbprintf("Error: CRC mismatch, expected %x", (unsigned int)crc);
|
||||||
} else {
|
} else {
|
||||||
|
@ -349,7 +348,7 @@ void WriteTItag(uint32_t idhi, uint32_t idlo, uint16_t crc)
|
||||||
// start by writing 0xBB (keyword) and 0xEB (password)
|
// start by writing 0xBB (keyword) and 0xEB (password)
|
||||||
// then write 80 bits of data (or 64 bit data + 16 bit crc if you prefer)
|
// then write 80 bits of data (or 64 bit data + 16 bit crc if you prefer)
|
||||||
// finally end with 0x0300 (write frame)
|
// finally end with 0x0300 (write frame)
|
||||||
// all data is sent lsb firts
|
// all data is sent lsb first
|
||||||
// finish with 15ms programming time
|
// finish with 15ms programming time
|
||||||
|
|
||||||
// modulate antenna
|
// modulate antenna
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
#include "cmdparser.h"
|
#include "cmdparser.h"
|
||||||
#include "cmdlfti.h"
|
#include "cmdlfti.h"
|
||||||
|
#include "cmdmain.h"
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
|
@ -245,16 +246,19 @@ int CmdTIDemod(const char *Cmd)
|
||||||
crc = update_crc16(crc, (shift1>>8)&0xff);
|
crc = update_crc16(crc, (shift1>>8)&0xff);
|
||||||
crc = update_crc16(crc, (shift1>>16)&0xff);
|
crc = update_crc16(crc, (shift1>>16)&0xff);
|
||||||
crc = update_crc16(crc, (shift1>>24)&0xff);
|
crc = update_crc16(crc, (shift1>>24)&0xff);
|
||||||
PrintAndLog("Info: Tag data = %08X%08X", shift1, shift0);
|
|
||||||
if (crc != (shift2&0xffff)) {
|
//crc = crc16_ccitt(message, sizeof(message);
|
||||||
|
|
||||||
|
char *crcStr = (crc == (shift2&0xffff) ) ? "Passed" : "Failed";
|
||||||
|
|
||||||
|
PrintAndLog("Tag data = %08X%08X [Crc %04X %s]", shift1, shift0, crc, crcStr );
|
||||||
|
|
||||||
|
if (crc != (shift2&0xffff))
|
||||||
PrintAndLog("Error: CRC mismatch, calculated %04X, got ^04X", crc, shift2&0xffff);
|
PrintAndLog("Error: CRC mismatch, calculated %04X, got ^04X", crc, shift2&0xffff);
|
||||||
} else {
|
|
||||||
PrintAndLog("Info: CRC %04X is good", crc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PrintAndLog("Unknown tag type.");
|
PrintAndLog("Unknown tag type.");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -263,7 +267,7 @@ int CmdTIDemod(const char *Cmd)
|
||||||
int CmdTIRead(const char *Cmd)
|
int CmdTIRead(const char *Cmd)
|
||||||
{
|
{
|
||||||
UsbCommand c = {CMD_READ_TI_TYPE};
|
UsbCommand c = {CMD_READ_TI_TYPE};
|
||||||
clearCommandbuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -271,16 +275,15 @@ int CmdTIRead(const char *Cmd)
|
||||||
// write new data to a r/w TI tag
|
// write new data to a r/w TI tag
|
||||||
int CmdTIWrite(const char *Cmd)
|
int CmdTIWrite(const char *Cmd)
|
||||||
{
|
{
|
||||||
UsbCommand c = {CMD_WRITE_TI_TYPE};
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
UsbCommand c = {CMD_WRITE_TI_TYPE};
|
||||||
res = sscanf(Cmd, "%012"llx" %012"llx" %012"llx"", &c.arg[0], &c.arg[1], &c.arg[2]);
|
res = sscanf(Cmd, "%012"llx" %012"llx" %012"llx"", &c.arg[0], &c.arg[1], &c.arg[2]);
|
||||||
|
|
||||||
if (res == 2) c.arg[2]=0;
|
if (res == 2) c.arg[2]=0;
|
||||||
if (res < 2)
|
if (res < 2)
|
||||||
PrintAndLog("Please specify the data as two hex strings, optionally the CRC as a third");
|
PrintAndLog("Please specify the data as two hex strings, optionally the CRC as a third");
|
||||||
else
|
else
|
||||||
clearCommandbuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ static int l_unpack(lua_State *L) /** unpack(f,s, [init]) */
|
||||||
size_t len;
|
size_t len;
|
||||||
const char *s=luaL_checklstring(L,2,&len); /* switched s and f */
|
const char *s=luaL_checklstring(L,2,&len); /* switched s and f */
|
||||||
const char *f=luaL_checkstring(L,1);
|
const char *f=luaL_checkstring(L,1);
|
||||||
int i_read = luaL_optint(L,3,1)-1;
|
int i_read = (int)luaL_optint(L,(3),(1))-1;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
if (i_read >= 0) {
|
if (i_read >= 0) {
|
||||||
i = i_read;
|
i = i_read;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue