mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 06:13:27 -07:00
Merge branch 'master' into argtable
This commit is contained in:
commit
b761cb0a46
23 changed files with 76 additions and 70 deletions
|
@ -232,8 +232,8 @@ test_script:
|
||||||
#--- end Job
|
#--- end Job
|
||||||
|
|
||||||
[bool]$res=$false
|
[bool]$res=$false
|
||||||
# Wait 40 sec timeout for Job
|
# Wait 120 sec timeout for Job
|
||||||
if(Wait-Job $Job -Timeout 40){
|
if(Wait-Job $Job -Timeout 120){
|
||||||
$Results = $Job | Receive-Job
|
$Results = $Job | Receive-Job
|
||||||
if($Results -like "true"){
|
if($Results -like "true"){
|
||||||
$res=$true
|
$res=$true
|
||||||
|
@ -278,6 +278,11 @@ test_script:
|
||||||
ExecTest "hf mf hardnested" "hf mf hardnested" {bash -lc "cd ~/client;proxmark3 comx -c 'hf mf hardnested t 1 000000000000'"} "found:"
|
ExecTest "hf mf hardnested" "hf mf hardnested" {bash -lc "cd ~/client;proxmark3 comx -c 'hf mf hardnested t 1 000000000000'"} "found:"
|
||||||
|
|
||||||
|
|
||||||
|
#proxmark crypto tests
|
||||||
|
|
||||||
|
ExecTest "hf emv test" "hf emv test" {bash -lc "cd ~/client;proxmark3 comx -c 'hf emv test'"} "Tests ?OK"
|
||||||
|
|
||||||
|
|
||||||
if ($global:TestsPassed) {
|
if ($global:TestsPassed) {
|
||||||
Write-Host "Tests [ OK ]" -ForegroundColor Green
|
Write-Host "Tests [ OK ]" -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -40,14 +40,14 @@ int split(char *str, char *arr[MAX_ARGS]){
|
||||||
int wordCnt = 0;
|
int wordCnt = 0;
|
||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
while(isspace(str[beginIndex])){
|
while(isspace((unsigned char)str[beginIndex])){
|
||||||
++beginIndex;
|
++beginIndex;
|
||||||
}
|
}
|
||||||
if(str[beginIndex] == '\0') {
|
if(str[beginIndex] == '\0') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
endIndex = beginIndex;
|
endIndex = beginIndex;
|
||||||
while (str[endIndex] && !isspace(str[endIndex])){
|
while (str[endIndex] && !isspace((unsigned char)str[endIndex])){
|
||||||
++endIndex;
|
++endIndex;
|
||||||
}
|
}
|
||||||
int len = endIndex - beginIndex;
|
int len = endIndex - beginIndex;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "util_posix.h"
|
#include "util_posix.h"
|
||||||
#include "iso14443crc.h"
|
#include "iso14443crc.h"
|
||||||
|
@ -748,9 +749,9 @@ int CmdHF14AAPDU(const char *cmd) {
|
||||||
// len = data + PCB(1b) + CRC(2b)
|
// len = data + PCB(1b) + CRC(2b)
|
||||||
CLIGetStrBLessWithReturn(4, data, &datalen, 1 + 2);
|
CLIGetStrBLessWithReturn(4, data, &datalen, 1 + 2);
|
||||||
|
|
||||||
|
|
||||||
CLIParserFree();
|
CLIParserFree();
|
||||||
// PrintAndLog("---str [%d] %s", arg_get_str(4)->count, arg_get_str(4)->sval[0]);
|
// PrintAndLog("---str [%d] %s", arg_get_str(4)->count, arg_get_str(4)->sval[0]);
|
||||||
|
|
||||||
PrintAndLog(">>>>[%s%s%s] %s", activateField ? "sel ": "", leaveSignalON ? "keep ": "", decodeTLV ? "TLV": "", sprint_hex(data, datalen));
|
PrintAndLog(">>>>[%s%s%s] %s", activateField ? "sel ": "", leaveSignalON ? "keep ": "", decodeTLV ? "TLV": "", sprint_hex(data, datalen));
|
||||||
|
|
||||||
int res = ExchangeAPDU14a(data, datalen, activateField, leaveSignalON, data, USB_CMD_DATA_SIZE, &datalen);
|
int res = ExchangeAPDU14a(data, datalen, activateField, leaveSignalON, data, USB_CMD_DATA_SIZE, &datalen);
|
||||||
|
|
|
@ -987,6 +987,7 @@ int CmdHF14AMfChk(const char *Cmd)
|
||||||
int i, res;
|
int i, res;
|
||||||
int keycnt = 0;
|
int keycnt = 0;
|
||||||
char ctmp = 0x00;
|
char ctmp = 0x00;
|
||||||
|
int clen = 0;
|
||||||
char ctmp3[3] = {0x00};
|
char ctmp3[3] = {0x00};
|
||||||
uint8_t blockNo = 0;
|
uint8_t blockNo = 0;
|
||||||
uint8_t SectorsCnt = 0;
|
uint8_t SectorsCnt = 0;
|
||||||
|
@ -1015,32 +1016,36 @@ int CmdHF14AMfChk(const char *Cmd)
|
||||||
blockNo = param_get8(Cmd, 0);
|
blockNo = param_get8(Cmd, 0);
|
||||||
|
|
||||||
ctmp = param_getchar(Cmd, 1);
|
ctmp = param_getchar(Cmd, 1);
|
||||||
switch (ctmp) {
|
clen = param_getlength(Cmd, 1);
|
||||||
case 'a': case 'A':
|
if (clen == 1) {
|
||||||
keyType = 0;
|
switch (ctmp) {
|
||||||
break;
|
case 'a': case 'A':
|
||||||
case 'b': case 'B':
|
keyType = 0;
|
||||||
keyType = 1;
|
break;
|
||||||
break;
|
case 'b': case 'B':
|
||||||
case '?':
|
keyType = 1;
|
||||||
keyType = 2;
|
break;
|
||||||
break;
|
case '?':
|
||||||
default:
|
keyType = 2;
|
||||||
PrintAndLog("Key type must be A , B or ?");
|
break;
|
||||||
free(keyBlock);
|
default:
|
||||||
return 1;
|
PrintAndLog("Key type must be A , B or ?");
|
||||||
};
|
free(keyBlock);
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// transfer to emulator & create dump file
|
// transfer to emulator & create dump file
|
||||||
ctmp = param_getchar(Cmd, 2);
|
ctmp = param_getchar(Cmd, 2);
|
||||||
if (ctmp == 't' || ctmp == 'T') transferToEml = 1;
|
clen = param_getlength(Cmd, 2);
|
||||||
if (ctmp == 'd' || ctmp == 'D') createDumpFile = 1;
|
if (clen == 1 && (ctmp == 't' || ctmp == 'T')) transferToEml = 1;
|
||||||
|
if (clen == 1 && (ctmp == 'd' || ctmp == 'D')) createDumpFile = 1;
|
||||||
|
|
||||||
param3InUse = transferToEml | createDumpFile;
|
param3InUse = transferToEml | createDumpFile;
|
||||||
|
|
||||||
timeout14a = 500; // fast by default
|
timeout14a = 500; // fast by default
|
||||||
// double parameters - ts, ds
|
// double parameters - ts, ds
|
||||||
int clen = param_getlength(Cmd, 2);
|
clen = param_getlength(Cmd, 2);
|
||||||
if (clen == 2 || clen == 3){
|
if (clen == 2 || clen == 3){
|
||||||
param_getstr(Cmd, 2, ctmp3, sizeof(ctmp3));
|
param_getstr(Cmd, 2, ctmp3, sizeof(ctmp3));
|
||||||
ctmp = ctmp3[1];
|
ctmp = ctmp3[1];
|
||||||
|
@ -1089,7 +1094,7 @@ int CmdHF14AMfChk(const char *Cmd)
|
||||||
|
|
||||||
if( buf[0]=='#' ) continue; //The line start with # is comment, skip
|
if( buf[0]=='#' ) continue; //The line start with # is comment, skip
|
||||||
|
|
||||||
if (!isxdigit(buf[0])){
|
if (!isxdigit((unsigned char)buf[0])){
|
||||||
PrintAndLog("File content error. '%s' must include 12 HEX symbols",buf);
|
PrintAndLog("File content error. '%s' must include 12 HEX symbols",buf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1433,7 +1433,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
|
||||||
//The line start with # is comment, skip
|
//The line start with # is comment, skip
|
||||||
if( buf[0]=='#' ) continue;
|
if( buf[0]=='#' ) continue;
|
||||||
|
|
||||||
if (!isxdigit(buf[0])) {
|
if (!isxdigit((unsigned char)buf[0])) {
|
||||||
PrintAndLog("File content error. '%s' must include 8 HEX symbols", buf);
|
PrintAndLog("File content error. '%s' must include 8 HEX symbols", buf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeo
|
||||||
if (msclock() - start_time > 2000 && show_warning) {
|
if (msclock() - start_time > 2000 && show_warning) {
|
||||||
PrintAndLog("Waiting for a response from the proxmark...");
|
PrintAndLog("Waiting for a response from the proxmark...");
|
||||||
PrintAndLog("Don't forget to cancel its operation first by pressing on the button");
|
PrintAndLog("Don't forget to cancel its operation first by pressing on the button");
|
||||||
break;
|
show_warning = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -76,8 +76,11 @@ int CmdList(const char *Cmd)
|
||||||
{
|
{
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
struct dirent *ep;
|
struct dirent *ep;
|
||||||
char script_directory_path[strlen(get_my_executable_directory()) + strlen(LUA_SCRIPTS_DIRECTORY) + 1];
|
char const * exedir = get_my_executable_directory();
|
||||||
strcpy(script_directory_path, get_my_executable_directory());
|
if (exedir == NULL)
|
||||||
|
return 0;
|
||||||
|
char script_directory_path[strlen(exedir) + strlen(LUA_SCRIPTS_DIRECTORY) + 1];
|
||||||
|
strcpy(script_directory_path, exedir);
|
||||||
strcat(script_directory_path, LUA_SCRIPTS_DIRECTORY);
|
strcat(script_directory_path, LUA_SCRIPTS_DIRECTORY);
|
||||||
dp = opendir(script_directory_path);
|
dp = opendir(script_directory_path);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
// EMV commands
|
// EMV commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
#include "cmdemv.h"
|
#include "cmdemv.h"
|
||||||
#include "test/cryptotest.h"
|
#include "test/cryptotest.h"
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ int CmdHFEMVSelect(const char *cmd) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isxdigit(c)) {
|
if (isxdigit((unsigned char)c)) {
|
||||||
switch(param_gethex_to_eol(cmd, cmdp, data, sizeof(data), &datalen)) {
|
switch(param_gethex_to_eol(cmd, cmdp, data, sizeof(data), &datalen)) {
|
||||||
case 1:
|
case 1:
|
||||||
PrintAndLog("Invalid HEX value.");
|
PrintAndLog("Invalid HEX value.");
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as published
|
* it under the terms of the GNU General Public License version 2 as published
|
||||||
* by the Free Software Foundation.
|
* by the Free Software Foundation, or, at your option, any later version.
|
||||||
*
|
*
|
||||||
* This file is distributed in the hope that it will be useful,
|
* This file is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as published
|
* it under the terms of the GNU General Public License version 2 as published
|
||||||
* by the Free Software Foundation.
|
* by the Free Software Foundation, or, at your option, any later version.
|
||||||
*
|
*
|
||||||
* This file is distributed in the hope that it will be useful,
|
* This file is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as published
|
* it under the terms of the GNU General Public License version 2 as published
|
||||||
* by the Free Software Foundation.
|
* by the Free Software Foundation, or, at your option, any later version.
|
||||||
*
|
*
|
||||||
* This file is distributed in the hope that it will be useful,
|
* This file is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as published
|
* it under the terms of the GNU General Public License version 2 as published
|
||||||
* by the Free Software Foundation.
|
* by the Free Software Foundation, or, at your option, any later version.
|
||||||
*
|
*
|
||||||
* This file is distributed in the hope that it will be useful,
|
* This file is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as published
|
* it under the terms of the GNU General Public License version 2 as published
|
||||||
* by the Free Software Foundation.
|
* by the Free Software Foundation, or, at your option, any later version.
|
||||||
*
|
*
|
||||||
* This file is distributed in the hope that it will be useful,
|
* This file is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as published
|
* it under the terms of the GNU General Public License version 2 as published
|
||||||
* by the Free Software Foundation.
|
* by the Free Software Foundation, or, at your option, any later version.
|
||||||
*
|
*
|
||||||
* This file is distributed in the hope that it will be useful,
|
* This file is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as published
|
* it under the terms of the GNU General Public License version 2 as published
|
||||||
* by the Free Software Foundation.
|
* by the Free Software Foundation, or, at your option, any later version.
|
||||||
*
|
*
|
||||||
* This file is distributed in the hope that it will be useful,
|
* This file is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef ON_DEVICE
|
#ifndef ON_DEVICE
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as published
|
* it under the terms of the GNU General Public License version 2 as published
|
||||||
* by the Free Software Foundation.
|
* by the Free Software Foundation, or, at your option, any later version.
|
||||||
*
|
*
|
||||||
* This file is distributed in the hope that it will be useful,
|
* This file is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef FILEUTILS_H
|
#ifndef FILEUTILS_H
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as published
|
* it under the terms of the GNU General Public License version 2 as published
|
||||||
* by the Free Software Foundation.
|
* by the Free Software Foundation, or, at your option, any later version.
|
||||||
*
|
*
|
||||||
* This file is distributed in the hope that it will be useful,
|
* This file is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -740,18 +739,16 @@ int readKeyFile(uint8_t key[8])
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int retval = 1;
|
int retval = 1;
|
||||||
f = fopen("iclass_key.bin", "rb");
|
f = fopen("iclass_key.bin", "rb");
|
||||||
if (f)
|
if (!f)
|
||||||
{
|
return retval;
|
||||||
if(fread(key, sizeof(uint8_t), 8, f) == 1)
|
|
||||||
{
|
if (fread(key, sizeof(uint8_t), 8, f) == 8) {
|
||||||
retval = 0;
|
retval = 0;
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
}
|
}
|
||||||
|
fclose(f);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int doKeyTests(uint8_t debuglevel)
|
int doKeyTests(uint8_t debuglevel)
|
||||||
{
|
{
|
||||||
debug_print = debuglevel;
|
debug_print = debuglevel;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as published
|
* it under the terms of the GNU General Public License version 2 as published
|
||||||
* by the Free Software Foundation.
|
* by the Free Software Foundation, or, at your option, any later version.
|
||||||
*
|
*
|
||||||
* This file is distributed in the hope that it will be useful,
|
* This file is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef IKEYS_H
|
#ifndef IKEYS_H
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as published
|
* it under the terms of the GNU General Public License version 2 as published
|
||||||
* by the Free Software Foundation.
|
* by the Free Software Foundation, or, at your option, any later version.
|
||||||
*
|
*
|
||||||
* This file is distributed in the hope that it will be useful,
|
* This file is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
* along with loclass. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,7 @@ static int l_pack(lua_State *L) /** pack(f,...) */
|
||||||
sbyte = 0;
|
sbyte = 0;
|
||||||
odd = 0;
|
odd = 0;
|
||||||
}
|
}
|
||||||
} else if (isspace(a[ii])) {
|
} else if (isspace((unsigned char)a[ii])) {
|
||||||
/* ignore */
|
/* ignore */
|
||||||
} else {
|
} else {
|
||||||
/* err ... ignore too*/
|
/* err ... ignore too*/
|
||||||
|
|
|
@ -596,7 +596,7 @@ mbynam(model_t *dest, const char *key) {
|
||||||
uerror("cannot allocate memory for comparison string");
|
uerror("cannot allocate memory for comparison string");
|
||||||
akey.name = uptr = ukey;
|
akey.name = uptr = ukey;
|
||||||
do
|
do
|
||||||
*uptr++ = toupper(*key);
|
*uptr++ = toupper((unsigned char)*key);
|
||||||
while(*key++);
|
while(*key++);
|
||||||
|
|
||||||
aptr = bsearch(&akey, aliases, NALIASES, sizeof(struct malias), (int (*)(const void *, const void *)) &acmp);
|
aptr = bsearch(&akey, aliases, NALIASES, sizeof(struct malias), (int (*)(const void *, const void *)) &acmp);
|
||||||
|
|
14
client/ui.c
14
client/ui.c
|
@ -9,12 +9,14 @@
|
||||||
// UI utilities
|
// UI utilities
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdbool.h>
|
||||||
|
#ifndef EXTERNAL_PRINTANDLOG
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdbool.h>
|
#include <stdarg.h>
|
||||||
#include <readline/readline.h>
|
#include <readline/readline.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
|
||||||
|
@ -26,10 +28,12 @@ int GridOffset = 0;
|
||||||
bool GridLocked = false;
|
bool GridLocked = false;
|
||||||
bool showDemod = true;
|
bool showDemod = true;
|
||||||
|
|
||||||
extern pthread_mutex_t print_lock;
|
|
||||||
|
|
||||||
static char *logfilename = "proxmark3.log";
|
static char *logfilename = "proxmark3.log";
|
||||||
|
|
||||||
|
#ifndef EXTERNAL_PRINTANDLOG
|
||||||
|
// Declared in proxmark3.c
|
||||||
|
extern pthread_mutex_t print_lock;
|
||||||
|
|
||||||
void PrintAndLog(char *fmt, ...)
|
void PrintAndLog(char *fmt, ...)
|
||||||
{
|
{
|
||||||
char *saved_line;
|
char *saved_line;
|
||||||
|
@ -94,7 +98,7 @@ void PrintAndLog(char *fmt, ...)
|
||||||
//release lock
|
//release lock
|
||||||
pthread_mutex_unlock(&print_lock);
|
pthread_mutex_unlock(&print_lock);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void SetLogFilename(char *fn)
|
void SetLogFilename(char *fn)
|
||||||
{
|
{
|
||||||
|
|
|
@ -496,7 +496,7 @@ int param_gethex(const char *line, int paramnum, uint8_t * data, int hexcnt)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for(i = 0; i < hexcnt; i += 2) {
|
for(i = 0; i < hexcnt; i += 2) {
|
||||||
if (!(isxdigit(line[bg + i]) && isxdigit(line[bg + i + 1])) ) return 1;
|
if (!(isxdigit((unsigned char)line[bg + i]) && isxdigit((unsigned char)line[bg + i + 1])) ) return 1;
|
||||||
|
|
||||||
sscanf((char[]){line[bg + i], line[bg + i + 1], 0}, "%X", &temp);
|
sscanf((char[]){line[bg + i], line[bg + i + 1], 0}, "%X", &temp);
|
||||||
data[i / 2] = temp & 0xff;
|
data[i / 2] = temp & 0xff;
|
||||||
|
@ -518,7 +518,7 @@ int param_gethex_ex(const char *line, int paramnum, uint8_t * data, int *hexcnt)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for(i = 0; i < *hexcnt; i += 2) {
|
for(i = 0; i < *hexcnt; i += 2) {
|
||||||
if (!(isxdigit(line[bg + i]) && isxdigit(line[bg + i + 1])) ) return 1;
|
if (!(isxdigit((unsigned char)line[bg + i]) && isxdigit((unsigned char)line[bg + i + 1])) ) return 1;
|
||||||
|
|
||||||
sscanf((char[]){line[bg + i], line[bg + i + 1], 0}, "%X", &temp);
|
sscanf((char[]){line[bg + i], line[bg + i + 1], 0}, "%X", &temp);
|
||||||
data[i / 2] = temp & 0xff;
|
data[i / 2] = temp & 0xff;
|
||||||
|
@ -543,7 +543,7 @@ int param_gethex_to_eol(const char *line, int paramnum, uint8_t * data, int maxd
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isxdigit(line[indx])) {
|
if (isxdigit((unsigned char)line[indx])) {
|
||||||
buf[strlen(buf) + 1] = 0x00;
|
buf[strlen(buf) + 1] = 0x00;
|
||||||
buf[strlen(buf)] = line[indx];
|
buf[strlen(buf)] = line[indx];
|
||||||
} else {
|
} else {
|
||||||
|
@ -620,7 +620,7 @@ int hextobinarray(char *target, char *source)
|
||||||
else if (x >= 'A' && x <= 'F')
|
else if (x >= 'A' && x <= 'F')
|
||||||
x -= 'A' - 10;
|
x -= 'A' - 10;
|
||||||
else {
|
else {
|
||||||
printf("Discovered unknown character %c %d at idx %d of %s\n", x, x, source - start, start);
|
printf("Discovered unknown character %c %d at idx %tu of %s\n", x, x, source - start, start);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// output
|
// output
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue