Skip to content

Commit

Permalink
#18 Xiaomi QR format update
Browse files Browse the repository at this point in the history
  • Loading branch information
kokoye2007 committed May 21, 2023
1 parent cc1643b commit 529382d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions wifi-qr
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,20 @@ call_wifi_scan() {
WIFIQRDATA="${wifiqrdata}"

# Extract the SSID
QSSID=$(echo "$WIFIQRDATA" | sed -n 's/.*S:\(.*\);T.*/\1/p' | sed 's/\\\([\\;,:"\]\)/\1/g' )
# QSSID=$(echo "$WIFIQRDATA" | sed -n 's/.*S:\(.*\);T.*/\1/p' | sed 's/\\\([\\;,:"\]\)/\1/g' )
QSSID=$(echo "$WIFIQRDATA" | sed -n 's/.*S:\([^;]*\)\(;[PHT]\).*$/\1/p' | sed 's/\\\([\\;,:"\]\)/\1/g' )

# Extract the security type
QTYPE=$(echo "$WIFIQRDATA" | sed -n 's/.*T:\(.*\);P.*/\1/p')
# QTYPE=$(echo "$WIFIQRDATA" | sed -n 's/.*T:\(.*\);P.*/\1/p')
QTYPE=$(echo "$WIFIQRDATA" | sed -n 's/.*T:\([^;]*\)\(;[PHS]\).*$/\1/p' | sed 's/\\\([\\;,:"\]\)/\1/g' )

# Extract the password
if [[ $WIFIQRDATA == *';H:'* ]]; then
QKEES=$(echo "$WIFIQRDATA" | sed -n 's/.*;P:\(.*\);H:.*/\1/p' | sed 's/\\:/:/g' | sed 's/\\\([\\;,:"\]\)/\1/g' )
# QKEES=$(echo "$WIFIQRDATA" | sed -n 's/.*;P:\(.*\);H:.*/\1/p' | sed 's/\\:/:/g' | sed 's/\\\([\\;,:"\]\)/\1/g' )
QKEES=$(echo "$WIFIQRDATA" | sed -n 's/.*P:\([^;]*\)\(;[TSH]\).*$/\1/p' | sed 's/\\\([\\;,:"\]\)/\1/g' )
else
QKEES=$(echo "$WIFIQRDATA" | sed -n 's/.*;P:\(.*\);;.*/\1/p' | sed 's/\\:/:/g' | sed 's/\\\([\\;,:"\]\)/\1/g' )
# QKEES=$(echo "$WIFIQRDATA" | sed -n 's/.*;P:\(.*\);;.*/\1/p' | sed 's/\\:/:/g' | sed 's/\\\([\\;,:"\]\)/\1/g' )
QKEES=$(echo "$WIFIQRDATA" | sed -n 's/.*P:\([^;]*\)\(;[TS]\).*$/\1/p' | sed 's/\\\([\\;,:"\]\)/\1/g' )
fi

# Check if the Wi-Fi network is hidden
Expand Down

0 comments on commit 529382d

Please sign in to comment.