mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-30 03:29:01 -07:00
style
This commit is contained in:
parent
88f4de3ef9
commit
ea5680dba8
5 changed files with 41 additions and 41 deletions
|
@ -22,7 +22,7 @@ vpath %.dic dictionaries
|
||||||
OBJDIR = obj
|
OBJDIR = obj
|
||||||
|
|
||||||
LDLIBS ?= -L/usr/local/lib
|
LDLIBS ?= -L/usr/local/lib
|
||||||
LDLIBS += -lreadline -lsndfile -lpthread -lm
|
LDLIBS += -lreadline -lsndfile -lpthread -lm
|
||||||
|
|
||||||
# RPi Zero gcc requires -latomic
|
# RPi Zero gcc requires -latomic
|
||||||
# but MacOSX /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
|
# but MacOSX /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
|
||||||
|
|
|
@ -37,13 +37,13 @@ static int CmdHelp(const char *Cmd);
|
||||||
static int usage_data_save(void) {
|
static int usage_data_save(void) {
|
||||||
PrintAndLogEx(NORMAL, "Save trace from graph window , i.e. the GraphBuffer");
|
PrintAndLogEx(NORMAL, "Save trace from graph window , i.e. the GraphBuffer");
|
||||||
PrintAndLogEx(NORMAL, "This is a text file with number -127 to 127. With the option `w` you can save it as wave file");
|
PrintAndLogEx(NORMAL, "This is a text file with number -127 to 127. With the option `w` you can save it as wave file");
|
||||||
PrintAndLogEx(NORMAL, "Filename should be without file extension");
|
PrintAndLogEx(NORMAL, "Filename should be without file extension");
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(NORMAL, "Usage: data save [h] [w] [f <filename w/o ext>]");
|
PrintAndLogEx(NORMAL, "Usage: data save [h] [w] [f <filename w/o ext>]");
|
||||||
PrintAndLogEx(NORMAL, "Options:");
|
PrintAndLogEx(NORMAL, "Options:");
|
||||||
PrintAndLogEx(NORMAL, " h this help");
|
PrintAndLogEx(NORMAL, " h this help");
|
||||||
PrintAndLogEx(NORMAL, " w save as wave format (.wav)");
|
PrintAndLogEx(NORMAL, " w save as wave format (.wav)");
|
||||||
PrintAndLogEx(NORMAL, " f <filename> save file name");
|
PrintAndLogEx(NORMAL, " f <filename> save file name");
|
||||||
PrintAndLogEx(NORMAL, "Samples:");
|
PrintAndLogEx(NORMAL, "Samples:");
|
||||||
PrintAndLogEx(NORMAL, " data save f mytrace - save graphbuffer to file");
|
PrintAndLogEx(NORMAL, " data save f mytrace - save graphbuffer to file");
|
||||||
PrintAndLogEx(NORMAL, " data save f mytrace w - save graphbuffer to wave file");
|
PrintAndLogEx(NORMAL, " data save f mytrace w - save graphbuffer to wave file");
|
||||||
|
@ -1925,10 +1925,10 @@ int CmdSave(const char *Cmd) {
|
||||||
|
|
||||||
if (errors || cmdp == 0) return usage_data_save();
|
if (errors || cmdp == 0) return usage_data_save();
|
||||||
|
|
||||||
if ( as_wave )
|
if (as_wave)
|
||||||
return saveFileWAVE(filename, GraphBuffer, GraphTraceLen);
|
return saveFileWAVE(filename, GraphBuffer, GraphTraceLen);
|
||||||
else
|
else
|
||||||
return saveFilePM3(filename, GraphBuffer, GraphTraceLen);
|
return saveFilePM3(filename, GraphBuffer, GraphTraceLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CmdScale(const char *Cmd) {
|
static int CmdScale(const char *Cmd) {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "crc16.h"
|
#include "crc16.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "cmdhf14a.h"
|
#include "cmdhf14a.h"
|
||||||
#include "protocols.h"
|
#include "protocols.h"
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ static void lto_switch_on_field(void) {
|
||||||
|
|
||||||
// send a raw LTO-CM command, returns the length of the response (0 in case of error)
|
// send a raw LTO-CM command, returns the length of the response (0 in case of error)
|
||||||
static int lto_send_cmd_raw(uint8_t *cmd, uint8_t len, uint8_t *response, uint16_t *response_len, bool verbose) {
|
static int lto_send_cmd_raw(uint8_t *cmd, uint8_t len, uint8_t *response, uint16_t *response_len, bool verbose) {
|
||||||
|
|
||||||
SendCommandOLD(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_NO_DISCONNECT | ISO14A_NO_RATS, len, 0, cmd, len);
|
SendCommandOLD(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_NO_DISCONNECT | ISO14A_NO_RATS, len, 0, cmd, len);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
||||||
|
@ -71,7 +71,7 @@ static int lto_send_cmd_raw(uint8_t *cmd, uint8_t len, uint8_t *response, uint16
|
||||||
static int topaz_select(uint8_t *id_response, uint8_t id_len, bool verbose) {
|
static int topaz_select(uint8_t *id_response, uint8_t id_len, bool verbose) {
|
||||||
// Todo: implement anticollision
|
// Todo: implement anticollision
|
||||||
|
|
||||||
uint8_t resp[] = {0,0};
|
uint8_t resp[] = {0, 0};
|
||||||
uint16_t resp_len;
|
uint16_t resp_len;
|
||||||
uint8_t wupa_cmd[] = {LTO_REQ_STANDARD};
|
uint8_t wupa_cmd[] = {LTO_REQ_STANDARD};
|
||||||
uint8_t select_cmd[] = {LTO_SELECT, 0x20};
|
uint8_t select_cmd[] = {LTO_SELECT, 0x20};
|
||||||
|
@ -132,41 +132,41 @@ static int CmdHfLTOInfo(const char *Cmd) {
|
||||||
int infoLTO(bool verbose) {
|
int infoLTO(bool verbose) {
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
|
|
||||||
uint8_t serial_number[5];
|
uint8_t serial_number[5];
|
||||||
uint8_t serial_len = 0;
|
uint8_t serial_len = 0;
|
||||||
|
|
||||||
topaz_select(serial_number, serial_len, verbose);
|
topaz_select(serial_number, serial_len, verbose);
|
||||||
|
|
||||||
lto_switch_off_field();
|
lto_switch_off_field();
|
||||||
/*
|
/*
|
||||||
|
|
||||||
-- "hf 14a raw -a -p -b 7 45"
|
-- "hf 14a raw -a -p -b 7 45"
|
||||||
-- "hf 14a raw -c -p 9320"
|
-- "hf 14a raw -c -p 9320"
|
||||||
-- "hf 14a raw -c -p 9370%s", serial_number
|
-- "hf 14a raw -c -p 9370%s", serial_number
|
||||||
-- "disconnect"
|
-- "disconnect"
|
||||||
|
|
||||||
|
|
||||||
SendCommandNG(CMD_HF_THINFILM_READ, NULL, 0);
|
SendCommandNG(CMD_HF_THINFILM_READ, NULL, 0);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_HF_THINFILM_READ, &resp, 1500)) {
|
if (!WaitForResponseTimeout(CMD_HF_THINFILM_READ, &resp, 1500)) {
|
||||||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
|
||||||
|
|
||||||
if (resp.status == PM3_SUCCESS) {
|
|
||||||
if (resp.length == 16 || resp.length == 32) {
|
|
||||||
print_barcode(resp.data.asBytes, resp.length, verbose);
|
|
||||||
} else {
|
|
||||||
if (verbose)
|
|
||||||
PrintAndLogEx(WARNING, "Response is wrong length. (%d)", resp.length);
|
|
||||||
|
|
||||||
return PM3_ESOFT;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return resp.status;
|
if (resp.status == PM3_SUCCESS) {
|
||||||
*/
|
if (resp.length == 16 || resp.length == 32) {
|
||||||
|
print_barcode(resp.data.asBytes, resp.length, verbose);
|
||||||
|
} else {
|
||||||
|
if (verbose)
|
||||||
|
PrintAndLogEx(WARNING, "Response is wrong length. (%d)", resp.length);
|
||||||
|
|
||||||
|
return PM3_ESOFT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp.status;
|
||||||
|
*/
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -401,20 +401,20 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
int saveFileWAVE(const char *preferredName, int *data, size_t datalen) {
|
int saveFileWAVE(const char *preferredName, int *data, size_t datalen) {
|
||||||
|
|
||||||
if (data == NULL) return PM3_EINVARG;
|
if (data == NULL) return PM3_EINVARG;
|
||||||
char *fileName = newfilenamemcopy(preferredName, ".wav");
|
char *fileName = newfilenamemcopy(preferredName, ".wav");
|
||||||
if (fileName == NULL) return PM3_EMALLOC;
|
if (fileName == NULL) return PM3_EMALLOC;
|
||||||
|
|
||||||
int retval = PM3_SUCCESS;
|
int retval = PM3_SUCCESS;
|
||||||
|
|
||||||
SF_INFO wave_info;
|
SF_INFO wave_info;
|
||||||
|
|
||||||
// TODO update for other tag types
|
// TODO update for other tag types
|
||||||
wave_info.samplerate = 125000;
|
wave_info.samplerate = 125000;
|
||||||
wave_info.channels = 1;
|
wave_info.channels = 1;
|
||||||
wave_info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_U8;
|
wave_info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_U8;
|
||||||
SNDFILE* wave_file = sf_open(fileName, SFM_WRITE, &wave_info);
|
SNDFILE *wave_file = sf_open(fileName, SFM_WRITE, &wave_info);
|
||||||
|
|
||||||
if (!wave_file) {
|
if (!wave_file) {
|
||||||
PrintAndLogEx(WARNING, "file not found or locked. "_YELLOW_("'%s'"), fileName);
|
PrintAndLogEx(WARNING, "file not found or locked. "_YELLOW_("'%s'"), fileName);
|
||||||
|
@ -437,7 +437,7 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
int saveFilePM3(const char *preferredName, int *data, size_t datalen) {
|
int saveFilePM3(const char *preferredName, int *data, size_t datalen) {
|
||||||
|
|
||||||
if (data == NULL) return PM3_EINVARG;
|
if (data == NULL) return PM3_EINVARG;
|
||||||
char *fileName = newfilenamemcopy(preferredName, ".pm3");
|
char *fileName = newfilenamemcopy(preferredName, ".pm3");
|
||||||
if (fileName == NULL) return PM3_EMALLOC;
|
if (fileName == NULL) return PM3_EMALLOC;
|
||||||
|
|
|
@ -78,7 +78,7 @@ local function sendRaw(rawdata, options)
|
||||||
if options.append_crc then
|
if options.append_crc then
|
||||||
flags = flags + lib14a.ISO14A_COMMAND.ISO14A_APPEND_CRC
|
flags = flags + lib14a.ISO14A_COMMAND.ISO14A_APPEND_CRC
|
||||||
end
|
end
|
||||||
|
|
||||||
local arg2 = #rawdata / 2
|
local arg2 = #rawdata / 2
|
||||||
if options.bits7 then
|
if options.bits7 then
|
||||||
arg2 = arg2 + tonumber(lshift(7, 16))
|
arg2 = arg2 + tonumber(lshift(7, 16))
|
||||||
|
@ -170,7 +170,7 @@ function main(args)
|
||||||
if err then return end
|
if err then return end
|
||||||
|
|
||||||
local d0_d15 = getdata(res)
|
local d0_d15 = getdata(res)
|
||||||
|
|
||||||
payload = "80"
|
payload = "80"
|
||||||
res, err = send(payload, {ignore_response = false, append_crc = false})
|
res, err = send(payload, {ignore_response = false, append_crc = false})
|
||||||
if err then return end
|
if err then return end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue