Whitespace

This commit is contained in:
Alex 2023-08-09 14:30:07 +02:00
parent c26583ebfd
commit 6947a61d98
21 changed files with 82 additions and 83 deletions

12
.vscode/setup.sh vendored
View file

@ -39,7 +39,7 @@ function print_config {
function setup_serial_port {
if [ -z "$SerialPort" ]; then
pm3list=$($VSCODEPATH/../pm3 --list 2>/dev/null)
#Use first port listed
#Use first port listed
export SerialPort=$(echo $pm3list | head -n 1 | cut -c 4-)
if [ -z "$SerialPort" ]; then
echo >&2 "[!!] No serial port found, please set SerialPort manually"
@ -129,17 +129,17 @@ fi
HOSTOS=$(uname | awk '{print toupper($0)}')
if [ "$HOSTOS" = "LINUX" ]; then
if uname -a|grep -q Microsoft; then
if uname -a|grep -q Microsoft; then
setup_wsl
else
else
setup_linux
fi
fi
elif [ "$HOSTOS" = "DARWIN" ]; then
echo >&2 "[!!] MacOS not supported, sorry!"
exit 1
elif [[ "$HOSTOS" =~ MINGW(32|64)_NT* ]]; then
setup_ps
else
echo >&2 "[!!] Host OS not recognized, abort: $HOSTOS"
exit 1
echo >&2 "[!!] Host OS not recognized, abort: $HOSTOS"
exit 1
fi

View file

@ -95,43 +95,43 @@ void SetupSpi(int mode) {
case SPI_FPGA_MODE:
AT91C_BASE_SPI->SPI_MR =
(0 << 24) | // Delay between chip selects (take default: 6 MCK periods)
(0xE << 16) | // Peripheral Chip Select (selects FPGA SPI_NCS0 or PA11)
(0xE << 16) | // Peripheral Chip Select (selects FPGA SPI_NCS0 or PA11)
(0 << 7) | // Local Loopback Disabled
AT91C_SPI_MODFDIS | // Mode Fault Detection disabled
AT91C_SPI_MODFDIS | // Mode Fault Detection disabled
(0 << 2) | // Chip selects connected directly to peripheral
AT91C_SPI_PS_FIXED | // Fixed Peripheral Select
AT91C_SPI_PS_FIXED | // Fixed Peripheral Select
AT91C_SPI_MSTR; // Master Mode
AT91C_BASE_SPI->SPI_CSR[0] =
(1 << 24) | // Delay between Consecutive Transfers (32 MCK periods)
(1 << 16) | // Delay Before SPCK (1 MCK period)
(6 << 8) | // Serial Clock Baud Rate (baudrate = MCK/6 = 24MHz/6 = 4M baud
AT91C_SPI_BITS_16 | // Bits per Transfer (16 bits)
AT91C_SPI_BITS_16 | // Bits per Transfer (16 bits)
(0 << 3) | // Chip Select inactive after transfer
AT91C_SPI_NCPHA | // Clock Phase data captured on leading edge, changes on following edge
AT91C_SPI_NCPHA | // Clock Phase data captured on leading edge, changes on following edge
(0 << 0); // Clock Polarity inactive state is logic 0
break;
/*
case SPI_LCD_MODE:
AT91C_BASE_SPI->SPI_MR =
( 0 << 24) | // Delay between chip selects (take default: 6 MCK periods)
(0xB << 16) | // Peripheral Chip Select (selects LCD SPI_NCS2 or PA10)
( 0 << 7) | // Local Loopback Disabled
( 1 << 4) | // Mode Fault Detection disabled
( 0 << 2) | // Chip selects connected directly to peripheral
( 0 << 1) | // Fixed Peripheral Select
( 1 << 0); // Master Mode
/*
case SPI_LCD_MODE:
AT91C_BASE_SPI->SPI_MR =
( 0 << 24) | // Delay between chip selects (take default: 6 MCK periods)
(0xB << 16) | // Peripheral Chip Select (selects LCD SPI_NCS2 or PA10)
( 0 << 7) | // Local Loopback Disabled
( 1 << 4) | // Mode Fault Detection disabled
( 0 << 2) | // Chip selects connected directly to peripheral
( 0 << 1) | // Fixed Peripheral Select
( 1 << 0); // Master Mode
AT91C_BASE_SPI->SPI_CSR[2] =
( 1 << 24) | // Delay between Consecutive Transfers (32 MCK periods)
( 1 << 16) | // Delay Before SPCK (1 MCK period)
( 6 << 8) | // Serial Clock Baud Rate (baudrate = MCK/6 = 24MHz/6 = 4M baud
AT91C_SPI_BITS_9 | // Bits per Transfer (9 bits)
( 0 << 3) | // Chip Select inactive after transfer
( 1 << 1) | // Clock Phase data captured on leading edge, changes on following edge
( 0 << 0); // Clock Polarity inactive state is logic 0
break;
*/
AT91C_BASE_SPI->SPI_CSR[2] =
( 1 << 24) | // Delay between Consecutive Transfers (32 MCK periods)
( 1 << 16) | // Delay Before SPCK (1 MCK period)
( 6 << 8) | // Serial Clock Baud Rate (baudrate = MCK/6 = 24MHz/6 = 4M baud
AT91C_SPI_BITS_9 | // Bits per Transfer (9 bits)
( 0 << 3) | // Chip Select inactive after transfer
( 1 << 1) | // Clock Phase data captured on leading edge, changes on following edge
( 0 << 0); // Clock Polarity inactive state is logic 0
break;
*/
default:
DisableSpi();
break;

View file

@ -53,7 +53,7 @@ SECTIONS
.bss : {
__bss_start__ = .;
*(.bss)
*(.bss.*)
*(.bss.*)
. = ALIGN(4);
__bss_end__ = .;
} >ram AT>ram :bss

View file

@ -379,7 +379,7 @@ set (TARGET_SOURCES
${PM3_ROOT}/client/src/fileutils.c
${PM3_ROOT}/client/src/flash.c
${PM3_ROOT}/client/src/graph.c
${PM3_ROOT}/client/src/iso4217.c
${PM3_ROOT}/client/src/iso4217.c
${PM3_ROOT}/client/src/jansson_path.c
${PM3_ROOT}/client/src/preferences.c
${PM3_ROOT}/client/src/pm3.c
@ -656,14 +656,14 @@ if (MINGW)
set(CMAKE_C_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_CXX_FLAGS}")
# GCC 10 has issues with false positives on stringop-overflow,
# GCC 10 has issues with false positives on stringop-overflow,
# let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335)
# beware these flags didn't exist for GCC < 7
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_GREATER 10.0 OR GCC_VERSION VERSION_EQUAL 10.0)
set(CMAKE_C_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}")
endif()
endif(CMAKE_COMPILER_IS_GNUCXX)

View file

@ -10,8 +10,8 @@ add_library(pm3rrg_rdv4_mbedtls STATIC
../../common/mbedtls/error.c
../../common/mbedtls/ecp.c
../../common/mbedtls/ecdh.c
../../common/mbedtls/ecc_point_compression.c
../../common/mbedtls/gcm.c
../../common/mbedtls/ecc_point_compression.c
../../common/mbedtls/gcm.c
../../common/mbedtls/ecp_curves.c
../../common/mbedtls/certs.c
../../common/mbedtls/camellia.c

View file

@ -37,5 +37,5 @@ F41DAF58B20C8B91
66584C91EE80D5E5
C1B74D7478053AE2
#
# default iCLASS RFIDeas
# default iCLASS RFIDeas
6B65797374726B72

View file

@ -36,7 +36,7 @@ D01AFEEB890A
2612C6DE84CA
707B11FC1481
#
# QL88 diversifed
# QL88 diversifed
03F9067646AE
2352C5B56D85
#
@ -71,8 +71,8 @@ B27CCAB30DBD
D2ECE8B9395E
# NSCP default key
1494E81663D7
#
# NFC tools
#
# NFC tools
7c9fb8474242
#
# Kiev keys
@ -299,7 +299,7 @@ AAFB06045877
25094DF6F148
#
#
# https://mattionline.de/fitnessstudio-armband-reverse-engineering/
# https://mattionline.de/fitnessstudio-armband-reverse-engineering/
# https://mattionline.de/milazycracker/
# gym wistband A, same as Fysiken A
# gym wistband B
@ -310,7 +310,7 @@ AAFB06045877
A05DBD98E0FC
#
# GoFit
AA4DDA458EBB
AA4DDA458EBB
EAB8066C7479
#
# Nordic Wellness A, same as Fysiken A
@ -871,7 +871,7 @@ AD4FB33388BF
#
# HID MIFARE Classic 1k Key
484944204953
204752454154
204752454154
# HID MIFARE SO
3B7E4FD575AD
11496F97752A

View file

@ -15,7 +15,7 @@ ffffffffffffffffffffffffffffffffffffffffffffffff
6AC292FAA1315B4D858AB3A3D7D5933A
404142434445464748494a4b4c4d4e4f
3112B738D8862CCD34302EB299AAB456 # Gallagher AES (https://pastebin.com/GkbGLz8r)
47454D5850524553534F53414D504C45 # Gemalto
47454D5850524553534F53414D504C45 # Gemalto
2b7e151628aed2a6abf7158809cf4f3c
fbeed618357133667c85e08f7236a8de
f7ddac306ae266ccf90bc11ee46d513b

View file

@ -379,7 +379,7 @@ set (TARGET_SOURCES
${PM3_ROOT}/client/src/fileutils.c
${PM3_ROOT}/client/src/flash.c
${PM3_ROOT}/client/src/graph.c
${PM3_ROOT}/client/src/iso4217.c
${PM3_ROOT}/client/src/iso4217.c
${PM3_ROOT}/client/src/jansson_path.c
${PM3_ROOT}/client/src/preferences.c
${PM3_ROOT}/client/src/pm3.c
@ -632,7 +632,7 @@ add_library(pm3rrg_rdv4 SHARED
)
target_compile_definitions(pm3rrg_rdv4 PRIVATE LIBPM3)
target_compile_options(pm3rrg_rdv4 PUBLIC -Wall -Werror -O3)
if (EMBED_READLINE)
if (NOT SKIPREADLINE EQUAL 1)
@ -656,14 +656,14 @@ if (MINGW)
set(CMAKE_C_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_CXX_FLAGS}")
# GCC 10 has issues with false positives on stringop-overflow,
# GCC 10 has issues with false positives on stringop-overflow,
# let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335)
# beware these flags didn't exist for GCC < 7
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_GREATER 10.0 OR GCC_VERSION VERSION_EQUAL 10.0)
set(CMAKE_C_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}")
endif()
endif(CMAKE_COMPILER_IS_GNUCXX)

View file

@ -25,7 +25,6 @@
"description": "iPhones before IOS17 emit this frame so that other Apple devices don't react to the field during background reading. Also emitted during NFCReaderSession subtypes"
},
{
"value": "6a02c801000300000000000000",
"name": "Transit: Ventra",

View file

@ -690,7 +690,7 @@ static int CmdSetDivisor(const char *Cmd) {
CLIParserFree(ctx);
if (arg < 19) {
PrintAndLogEx(ERR, "Divisor must be between" _YELLOW_("19") " and " _YELLOW_("255"));
PrintAndLogEx(ERR, "Divisor must be between " _YELLOW_("19") " and " _YELLOW_("255"));
return PM3_EINVARG;
}
// 12 000 000 (12MHz)

View file

@ -1230,9 +1230,9 @@ int CmdEM4x50Sim(const char *Cmd) {
clearCommandBuffer();
SendCommandNG(CMD_LF_EM4X50_SIM, (uint8_t *)&password, sizeof(password));
PrintAndLogEx(INFO, "Press " _GREEN_("<Enter>") " or pm3-button to abort simulation");
PacketResponseNG resp;
// init to ZERO
resp.cmd = 0,
@ -1245,7 +1245,7 @@ int CmdEM4x50Sim(const char *Cmd) {
resp.oldarg[1] = 0;
resp.oldarg[2] = 0;
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
bool keypress;
do {
keypress = kbd_enter_pressed();

View file

@ -3,10 +3,10 @@ CRAPTO1
Provides a set of library functions which aid the verification
of crypto1 weaknesses.
In short a partial implementation of:
In short a partial implementation of:
Dismantling MIFARE Classic
URL: http://www.sos.cs.ru.nl/applications/rfid/2008-esorics.pdf
Flavio D. Garcia, Gerhard de Koning Gans, Ruben Muijrers,
Flavio D. Garcia, Gerhard de Koning Gans, Ruben Muijrers,
Peter van Rossum, Roel Verdult, Ronny Wichers Schreur, Bart Jacobs
Institute for Computing and Information Sciences,
Radboud University Nijmegen, The Netherlands

View file

@ -83,7 +83,7 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
if (num_infiles == 1) {
// 1M bytes for now
buffer_size = 1024 * 1024;
buffer_size = 1024 * 1024;
}
uint32_t outsize_max = LZ4_compressBound(buffer_size);
@ -92,7 +92,7 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
if (outbuf == NULL) {
fprintf(stderr, "failed to allocate memory");
free(fpga_config);
return (EXIT_FAILURE);
return (EXIT_FAILURE);
}
char *ring_buffer = calloc(buffer_size, sizeof(char));
@ -100,7 +100,7 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
fprintf(stderr, "failed to allocate memory");
free(outbuf);
free(fpga_config);
return (EXIT_FAILURE);
return (EXIT_FAILURE);
}
LZ4_streamHC_t *lz4_streamhc = LZ4_createStreamHC();
@ -108,7 +108,7 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
int current_in = 0;
int current_out = 0;
while (current_in < total_size) {
int bytes_to_copy = MIN(FPGA_RING_BUFFER_BYTES, (total_size - current_in));
@ -261,7 +261,7 @@ static int zlib_decompress(FILE *infile, FILE *outfiles[], uint8_t num_outfiles,
for (long k = 0; k < *outsize / (FPGA_INTERLEAVE_SIZE * num_outfiles); k++) {
for (uint16_t j = 0; j < num_outfiles; j++) {
if (k * FPGA_INTERLEAVE_SIZE < outfilesizes[j]) {
uint16_t chunk = (outfilesizes[j] - (k * FPGA_INTERLEAVE_SIZE) < FPGA_INTERLEAVE_SIZE) ?
uint16_t chunk = (outfilesizes[j] - (k * FPGA_INTERLEAVE_SIZE) < FPGA_INTERLEAVE_SIZE) ?
outfilesizes[j] - (k * FPGA_INTERLEAVE_SIZE) : FPGA_INTERLEAVE_SIZE;
fwrite(outbufall + offset, chunk, sizeof(char), outfiles[j]);
@ -534,7 +534,7 @@ int main(int argc, char **argv) {
for (uint16_t j = 0; j < num_input_files; j++) {
fclose(infiles[j]);
}
free(infile_names);
free(infiles);
return (EXIT_FAILURE);
@ -546,7 +546,7 @@ int main(int argc, char **argv) {
} else {
ret = zlib_compress(infiles, num_input_files, outfile);
}
// close file handlers
fclose(outfile);
for (uint16_t j = 0; j < num_input_files; j++) {

View file

@ -1,6 +1,6 @@
ht2crack2buildtable
ht2crack2search
ht2crack2gentest
ht2crack2buildtable
ht2crack2search
ht2crack2gentest
ht2crack2buildtable.exe
ht2crack2search.exe

View file

@ -603,7 +603,7 @@ void find_state(const uint candidate_index_base,
const bitslice_t filter9_3 = f_b_bs(state[-2 + 37], state[-2 + 38], state[-2 + 40], state[-2 + 42]);
const bitslice_t filter9 = f_c_bs(filter9_0, filter9_1, filter9_2, filter9_3, filter9_4);
results8 &= (filter9 ^ keystream[9]);
if (!results8) continue;

View file

@ -42,10 +42,10 @@ expected result:
261c07a23f2bc8262f69f10a5bdf3764
Bruteforce using 8 threads
Found timestamp........ 1631100305 ( '2021-09-08 13:25:05' )
key.................... 261c07a23f2bc8262f69f10a5bdf3764
execution time 1.00 sec
Bruteforce using 8 threads
Found timestamp........ 1631100305 ( '2021-09-08 13:25:05' )
key.................... 261c07a23f2bc8262f69f10a5bdf3764
execution time 1.00 sec
#
# complex
@ -55,8 +55,8 @@ expected result:
e757178e13516a4f3171bc6ea85e165a
Bruteforce using 8 threads
Found timestamp........ 1606834416 ( '2020-12-01 15:53:36' )
key.................... e757178e13516a4f3171bc6ea85e165a
execution time 18.54 sec
Bruteforce using 8 threads
Found timestamp........ 1606834416 ( '2020-12-01 15:53:36' )
key.................... e757178e13516a4f3171bc6ea85e165a
execution time 18.54 sec

View file

@ -10,20 +10,20 @@
+ 1287: : a1 e4 58 ce 6e ea 41 e0
+ 64: 0: TAG 5c ad f4 39
:: Sample of trace above,
:: Sample of trace above,
./mfkey64 9c599b32 82a4166c a1e458ce 6eea41e0 5cadf439
-----------------------------------------------------------------------------------------------------
:: For mfkey32, you want to get two different NR_0/NR_1 values.
:: <uid> <nt> <nr_0> <ar_0> <nr_1> <ar_1>
./mfkey32 52B0F519 5417D1F8 4D545EA7 E15AC8C2 DAC1A7F4 5AE5C37F
./mfkey32 52B0F519 5417D1F8 4D545EA7 E15AC8C2 DAC1A7F4 5AE5C37F
:: For mfkey32v2 (moebius), you want to get two different NT/NT1 values. (like in the SIM commands)
:: <uid> <nt> <nr_0> <ar_0> <nt1> <nr_1> <ar_1>
./mfkey32v2 12345678 1AD8DF2B 1D316024 620EF048 30D6CB07 C52077E2 837AC61A
./mfkey32v2 52B0F519 5417D1F8 4D545EA7 E15AC8C2 A1BA88C6 DAC1A7F4 5AE5C37F
./mfkey32v2 52B0F519 5417D1F8 4D545EA7 E15AC8C2 A1BA88C6 DAC1A7F4 5AE5C37F
:: for mfkey64, you want to have the AT response from tag.
@ -32,7 +32,7 @@
./mfkey64 52B0F519 5417D1F8 4D545EA7 E15AC8C2 5056E41B
-----------------------------------------------------------------------------------------------------
New functionality from @zhovner,
New functionality from @zhovner,
-----------------------------------------------------------------------------------------------------
### Communication decryption
RDR 26

View file

@ -1,7 +1,7 @@
To test the nonce2key tool.
:: tip
You can use the output from "hf mf mifare" to use with this tool.
You can use the output from "hf mf mifare" to use with this tool.
:: sample
./nonce2key e9cadd9c a8bf4a12 a020a8285858b090 050f010607060e07 5693be6c00000000

View file

@ -288,7 +288,7 @@ while true; do
if ! CheckFileExist "mf_nonce_brute exists" "$MFNONCEBRUTEBIN"; then break; fi
if ! CheckExecute slow "mf_nonce_brute test 1/2" "$MFNONCEBRUTEBIN 9c599b32 5a920d85 1011 98d76b77 d6c6e870 0000 ca7e0b63 0111 3e709c8a" "Key found \[.*ffffffffffff.*\]"; then break; fi
if ! CheckExecute slow "mf_nonce_brute test 2/2" "$MFNONCEBRUTEBIN 96519578 d7e3c6ac 0011 cd311951 9da49e49 0010 2bb22e00 0100 a4f7f398" "Key found \[.*3b7e4fd575ad.*\]"; then break; fi
fi
fi
if $TESTALL || $TESTMFDAESBRUTE; then
echo -e "\n${C_BLUE}Testing mfd_aes_brute:${C_NC} ${MFDASEBRUTEBIN:=./tools/mfd_aes_brute/mfd_aes_brute}"
if ! CheckFileExist "mfd_aes_brute exists" "$MFDASEBRUTEBIN"; then break; fi

View file

@ -44,7 +44,7 @@ lf indala clone --fc 123 --cn 1337
lf read s 10000
data save f lf_ATA5577_indala
lf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5
lf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5
lf read s 10000
data save f lf_ATA5577_indala_224
@ -92,7 +92,7 @@ lf noralsy clone 112233
lf read s 10000
data save f lf_ATA5577_noralsy
lf pac clone c CD4F5552
lf pac clone c CD4F5552
lf read s 10000
data save f lf_ATA5577_pac