mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-17 18:50:32 +08:00
Merge branch 'master' of https://github.com/RfidResearchGroup/proxmark3
This commit is contained in:
commit
859a5e80ce
9 changed files with 38 additions and 29 deletions
4
Makefile
4
Makefile
|
@ -145,12 +145,12 @@ style:
|
|||
# Make sure astyle is installed
|
||||
@which astyle >/dev/null || ( echo "Please install 'astyle' package first" ; exit 1 )
|
||||
# Remove spaces & tabs at EOL, add LF at EOF if needed on *.c, *.h, *.cpp. *.lua, *.py, *.pl, Makefile
|
||||
find . \( -name "*.[ch]" -or -name "*.cpp" -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" \) \
|
||||
find . \( -name "*.[ch]" -or \( -name "*.cpp" -and -not -name "*.moc.cpp" \) -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" \) \
|
||||
-exec perl -pi -e 's/[ \t]+$$//' {} \; \
|
||||
-exec sh -c "tail -c1 {} | xxd -p | tail -1 | grep -q -v 0a$$" \; \
|
||||
-exec sh -c "echo >> {}" \;
|
||||
# Apply astyle on *.c, *.h, *.cpp
|
||||
find . \( -name "*.[ch]" -or -name "*.cpp" \) -exec astyle --formatted --mode=c --suffix=none \
|
||||
find . \( -name "*.[ch]" -or \( -name "*.cpp" -and -not -name "*.moc.cpp" \) \) -exec astyle --formatted --mode=c --suffix=none \
|
||||
--indent=spaces=4 --indent-switches \
|
||||
--keep-one-line-blocks --max-instatement-indent=60 \
|
||||
--style=google --pad-oper --unpad-paren --pad-header \
|
||||
|
|
|
@ -625,7 +625,8 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain) {
|
|||
}
|
||||
|
||||
// Incoming anti-collision frame
|
||||
if (receivedCmd_len >= 2 && receivedCmd_len <= 6 && receivedCmd[1] == 0x50) {
|
||||
// receivedCmd[1] indicates number of byte and bit collision, supports only for bit collision is zero
|
||||
if (receivedCmd_len >= 3 && receivedCmd_len <= 6 && (receivedCmd[1] & 0x0f) == 0) {
|
||||
// we can process only full-byte frame anti-collision procedure
|
||||
if (memcmp(&receivedCmd[2], responses[uid_index].response, receivedCmd_len - 2) == 0) {
|
||||
// response missing part of UID via relative array index
|
||||
|
@ -1036,8 +1037,9 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain) {
|
|||
);
|
||||
}
|
||||
cardAUTHKEY = AUTHKEYNONE; // not authenticated
|
||||
EmSend4bit(mf_crypto1_encrypt4bit(pcs, CARD_NACK_NA));
|
||||
cardSTATE_TO_IDLE();
|
||||
// Really tags not respond NACK on invalid authentication
|
||||
LogTrace(uart->output, uart->len, uart->startTime * 16 - DELAY_AIR2ARM_AS_TAG, uart->endTime * 16 - DELAY_AIR2ARM_AS_TAG, uart->parity, true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -375,7 +375,7 @@ static void print_version_info_preamble(FILE *outfile, int num_infiles) {
|
|||
fprintf(outfile, "\n");
|
||||
fprintf(outfile, "\n");
|
||||
fprintf(outfile, "const int fpga_bitstream_num = %d;\n", num_infiles);
|
||||
fprintf(outfile, "const char* const fpga_version_information[%d] = {\n", num_infiles);
|
||||
fprintf(outfile, "const char *const fpga_version_information[%d] = {\n", num_infiles);
|
||||
}
|
||||
|
||||
static int generate_fpga_version_info(FILE *infile[], char *infile_names[], int num_infiles, FILE *outfile) {
|
||||
|
@ -386,7 +386,7 @@ static int generate_fpga_version_info(FILE *infile[], char *infile_names[], int
|
|||
|
||||
for (int i = 0; i < num_infiles; i++) {
|
||||
FpgaGatherVersion(infile[i], infile_names[i], version_string, sizeof(version_string));
|
||||
fprintf(outfile, "\t\" %s\"", version_string);
|
||||
fprintf(outfile, " \" %s\"", version_string);
|
||||
if (i != num_infiles - 1) {
|
||||
fprintf(outfile, ",");
|
||||
}
|
||||
|
|
|
@ -166,3 +166,4 @@ Or, by specifying the COM port manually:
|
|||
client/proxmark3 /dev/ttySX
|
||||
```
|
||||
|
||||
Note that it may take a quite long time for a freshly plugged Proxmark3 to be visible on a WSL /dev/ttySX port.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd $(dirname "$0")
|
||||
PM3PATH=$(dirname "$0")
|
||||
cd "$PM3PATH" || exit 1
|
||||
. proxmark3.sh
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd $(dirname "$0")
|
||||
PM3PATH=$(dirname "$0")
|
||||
cd "$PM3PATH" || exit 1
|
||||
. proxmark3.sh
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd $(dirname "$0")
|
||||
PM3PATH=$(dirname "$0")
|
||||
cd "$PM3PATH" || exit 1
|
||||
. proxmark3.sh
|
||||
|
|
40
proxmark3.sh
40
proxmark3.sh
|
@ -3,28 +3,31 @@
|
|||
FULLIMAGE="armsrc/obj/fullimage.elf"
|
||||
BOOTIMAGE="bootrom/obj/bootrom.elf"
|
||||
|
||||
cd $(dirname "$0")
|
||||
PM3PATH=$(dirname "$0")
|
||||
cd "$PM3PATH" || exit 1
|
||||
|
||||
function wait4proxmark_Linux {
|
||||
echo >&2 "Waiting for Proxmark to appear..."
|
||||
while [ ! -c /dev/ttyACM? -a ! -c /dev/pm3-? ]; do
|
||||
while true; do
|
||||
PM3=$(find /dev/pm3-* /dev/ttyACM* 2>/dev/null | head -1)
|
||||
if [[ $PM3 != "" ]]; then
|
||||
break
|
||||
fi
|
||||
sleep .1
|
||||
done
|
||||
local PM3=`ls -1 /dev/pm3-? /dev/ttyACM? 2>/dev/null | head -1`
|
||||
echo $PM3
|
||||
echo "$PM3"
|
||||
}
|
||||
|
||||
function wait4proxmark_macOS {
|
||||
echo >&2 "Waiting for Proxmark to appear..."
|
||||
while true; do
|
||||
PM3=$(ls /dev/pm3-* /dev/cu.usbmodem* 2>/dev/null | head -1)
|
||||
PM3=$(find /dev/pm3-* /dev/cu.usbmodem* 2>/dev/null | head -1)
|
||||
if [[ $PM3 != "" ]]; then
|
||||
#echo >&2 -e "Found proxmark on $(ls /dev/pm3-* /dev/cu.usbmodem* 2>/dev/null | head -1)\n"
|
||||
break
|
||||
fi
|
||||
sleep .1
|
||||
done
|
||||
echo $PM3
|
||||
echo "$PM3"
|
||||
}
|
||||
|
||||
function wait4proxmark_Windows {
|
||||
|
@ -37,7 +40,7 @@ function wait4proxmark_Windows {
|
|||
fi
|
||||
sleep .1
|
||||
done
|
||||
echo $PM3
|
||||
echo "$PM3"
|
||||
}
|
||||
|
||||
function wait4proxmark_WSL {
|
||||
|
@ -51,23 +54,23 @@ function wait4proxmark_WSL {
|
|||
fi
|
||||
sleep .1
|
||||
done
|
||||
echo $PM3
|
||||
if [ -e "$PM3" ] && [ ! -w "$PM3" ]; then
|
||||
echo "We need to give current user read/write access to $PM3"
|
||||
sudo chmod 666 "$PM3"
|
||||
fi
|
||||
echo "$PM3"
|
||||
}
|
||||
|
||||
SCRIPT=$(basename -- "$0")
|
||||
|
||||
if [ "$SCRIPT" = "proxmark3.sh" ]; then
|
||||
CMD=client/proxmark3
|
||||
CMD() { client/proxmark3 "$@"; }
|
||||
elif [ "$SCRIPT" = "flash-all.sh" ]; then
|
||||
CMD=client/flasher
|
||||
ARG1="-b $BOOTIMAGE"
|
||||
ARG2="$FULLIMAGE"
|
||||
CMD() { client/flasher "$1" -b "$BOOTIMAGE" "$FULLIMAGE"; }
|
||||
elif [ "$SCRIPT" = "flash-fullimage.sh" ]; then
|
||||
CMD=client/flasher
|
||||
ARG2="$FULLIMAGE"
|
||||
CMD() { client/flasher "$1" "$FULLIMAGE"; }
|
||||
elif [ "$SCRIPT" = "flash-bootrom.sh" ]; then
|
||||
CMD=client/flasher
|
||||
ARG1="-b $BOOTIMAGE"
|
||||
CMD() { client/flasher "$1" -b "$BOOTIMAGE"; }
|
||||
else
|
||||
echo "Script ran under unknown name, abort: $SCRIPT"
|
||||
exit 1
|
||||
|
@ -92,6 +95,5 @@ if [ "$PORT" = "" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
#echo Running "$CMD" "$PORT" $ARG1 $ARG2 "$@"
|
||||
"$CMD" "$PORT" $ARG1 $ARG2 "$@"
|
||||
CMD "$PORT" "$@"
|
||||
exit $?
|
||||
|
|
|
@ -238,7 +238,8 @@ void uart_close(const serial_port sp) {
|
|||
// Does the system allows us to place a lock on this file descriptor
|
||||
int err = fcntl(spu->fd, F_SETLK, &fl);
|
||||
if (err == -1) {
|
||||
printf("[!] UART error while closing port\n");
|
||||
//silent error message as it can be called from uart_open failing modes, e.g. when waiting for port to appear
|
||||
//printf("[!] UART error while closing port\n");
|
||||
}
|
||||
close(spu->fd);
|
||||
free(sp);
|
||||
|
|
Loading…
Reference in a new issue