mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-31 12:31:32 +08:00
pm3: stop as soon as enough devs found
This commit is contained in:
parent
691e70ed74
commit
cdd1aef34f
1 changed files with 25 additions and 3 deletions
28
pm3
28
pm3
|
@ -26,10 +26,14 @@ PM3LIST=()
|
|||
SHOWLIST=false
|
||||
|
||||
function get_pm3_list_Linux {
|
||||
N=$1
|
||||
PM3LIST=()
|
||||
for DEV in $(find /dev/ttyACM* 2>/dev/null); do
|
||||
if udevadm info -q property -n "$DEV" |grep -q "ID_VENDOR=proxmark.org"; then
|
||||
PM3LIST+=("$DEV")
|
||||
if [ ${#PM3LIST[*]} -ge $N ]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if $FINDBTDONGLE; then
|
||||
|
@ -37,6 +41,9 @@ function get_pm3_list_Linux {
|
|||
for DEV in $(find /dev/ttyUSB* 2>/dev/null); do
|
||||
if udevadm info -q property -n "$DEV" |grep -q "ID_MODEL=CP2104_USB_to_UART_Bridge_Controller"; then
|
||||
PM3LIST+=("$DEV")
|
||||
if [ ${#PM3LIST[*]} -ge $N ]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
@ -48,25 +55,36 @@ function get_pm3_list_Linux {
|
|||
# check if Proxmark3 is actually present
|
||||
if hcitool name "$MAC" | grep -q "PM3"; then
|
||||
PM3LIST+=("/dev/$DEV")
|
||||
if [ ${#PM3LIST[*]} -ge $N ]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function get_pm3_list_macOS {
|
||||
N=$1
|
||||
PM3LIST=()
|
||||
for DEV in $(ioreg -r -c "IOUSBHostDevice" -l|awk -F '"' '
|
||||
$2=="USB Vendor Name"{b=($4=="proxmark.org")}
|
||||
b==1 && $2=="IODialinDevice"{print $4}'); do
|
||||
PM3LIST+=("$DEV")
|
||||
if [ ${#PM3LIST[*]} -ge $N ]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function get_pm3_list_Windows {
|
||||
N=$1
|
||||
PM3LIST=()
|
||||
for DEV in $(wmic path Win32_SerialPort where "PNPDeviceID like '%VID_9AC4&PID_4B8F%'" get DeviceID,PNPDeviceID 2>/dev/null|awk '/^COM/{print $1}'); do
|
||||
DEV=${DEV/ */}
|
||||
PM3LIST+=("$DEV")
|
||||
if [ ${#PM3LIST[*]} -ge $N ]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -82,6 +100,9 @@ function get_pm3_list_WSL {
|
|||
echo "[!!] Let's give users read/write access to $DEV"
|
||||
sudo chmod 666 "$DEV"
|
||||
fi
|
||||
if [ ${#PM3LIST[*]} -ge $N ]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -265,7 +286,8 @@ else
|
|||
fi
|
||||
|
||||
if $SHOWLIST; then
|
||||
$GETPM3LIST
|
||||
# Probe for up to 9 devs
|
||||
$GETPM3LIST 9
|
||||
if [ ${#PM3LIST} -lt 1 ]; then
|
||||
echo "[!!] No port found"
|
||||
exit 0
|
||||
|
@ -280,7 +302,7 @@ if $SHOWLIST; then
|
|||
fi
|
||||
|
||||
# Wait till we get at least N proxmark3 devices
|
||||
$GETPM3LIST
|
||||
$GETPM3LIST $N
|
||||
if [ ${#PM3LIST} -lt $N ]; then
|
||||
echo >&2 "[=] Waiting for Proxmark3 to appear..."
|
||||
fi
|
||||
|
@ -289,7 +311,7 @@ while true; do
|
|||
break
|
||||
fi
|
||||
sleep .1
|
||||
$GETPM3LIST
|
||||
$GETPM3LIST $N
|
||||
done
|
||||
|
||||
if [ ${#PM3LIST} -lt $N ]; then
|
||||
|
|
Loading…
Reference in a new issue