Fake wifi scan

This commit is contained in:
Michele Marcucci 2018-11-07 16:41:43 +01:00
parent ef22cb77c6
commit 2878d232fe
2 changed files with 52 additions and 1 deletions

50
scripts/wifi_scan_fake Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
sleep 1
cat << EOF
[{
"ssid": "befree",
"mode": "Infra",
"channel": 11,
"rate": 195,
"signal": 74,
"security": "WPA1 WPA2",
"inuse": false
},
{
"ssid": "Telecom-32949531",
"mode": "Infra",
"channel": 1,
"rate": 270,
"signal": 67,
"security": "WPA1 WPA2",
"inuse": false
},
{
"ssid": "Vodafone-WiFi",
"mode": "Infra",
"channel": 13,
"rate": 130,
"signal": 44,
"security": "",
"inuse": false
},
{
"ssid": "Vodafone-33516851",
"mode": "Infra",
"channel": 13,
"rate": 130,
"signal": 44,
"security": "WPA2",
"inuse": false
},
{
"ssid": "TeleTu_f0842f8dbef1",
"mode": "Infra",
"channel": 11,
"rate": 130,
"signal": 39,
"security": "WPA1 WPA2",
"inuse": false
}
]
EOF

View File

@ -12,7 +12,8 @@ module.exports = ({ define }) => {
function getWifiScan() {
return new Promise((resolve, reject) => {
const scriptPath = join(__dirname, '..', '..', '..', '..', 'scripts', 'wifi_scan')
const scriptName = (process.env.NODE_ENV === 'production') ? 'wifi_scan' : 'wifi_scan_fake'
const scriptPath = join(__dirname, '..', '..', '..', '..', 'scripts', scriptName)
exec(scriptPath, {}, (err, stdout) => {
if (err) {
reject(err)