Merge pull request #1920 from henrygab/wsl2_enum_fix

Prevent double-enumeration under WSL2
This commit is contained in:
Iceman 2023-02-19 10:58:30 +01:00 committed by GitHub
commit cf98b70364
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

6
pm3
View file

@ -68,13 +68,14 @@ function get_pm3_list_Linux {
fi fi
fi fi
# WSL2 with usbipd detection - doesn't report same things as WSL1 # WSL2 with usbipd detection - doesn't report same things as WSL1
if grep -q "proxmark.org" "/sys/class/tty/${DEV#/dev/}/../../../manufacturer" 2>/dev/null; then if grep -q "proxmark.org" "/sys/class/tty/${DEV#/dev/}/../../../manufacturer" 2>/dev/null; then
if echo "${PM3LIST[*]}" | grep -qv "${DEV}"; then
PM3LIST+=("$DEV") PM3LIST+=("$DEV")
if [ ${#PM3LIST[*]} -ge "$N" ]; then if [ ${#PM3LIST[*]} -ge "$N" ]; then
return return
fi fi
fi fi
fi
done done
if $FINDBTDONGLE; then if $FINDBTDONGLE; then
# check if the HC-06-USB white dongle is present (still, that doesn't tell us if it's paired with a Proxmark3...) # check if the HC-06-USB white dongle is present (still, that doesn't tell us if it's paired with a Proxmark3...)
@ -474,7 +475,8 @@ fi
HOSTOS=$(uname | awk '{print toupper($0)}') HOSTOS=$(uname | awk '{print toupper($0)}')
if [ "$HOSTOS" = "LINUX" ]; then if [ "$HOSTOS" = "LINUX" ]; then
if uname -a|grep -qi Microsoft; then # Detect when running under WSL1 (but exclude WSL2)
if uname -a | grep -qi Microsoft && uname -a | grep -qvi WSL2; then
# First try finding it using the PATH environment variable # First try finding it using the PATH environment variable
PSHEXE=$(command -v powershell.exe 2>/dev/null) PSHEXE=$(command -v powershell.exe 2>/dev/null)