-
-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Included an alternative to netsh * Cleaned up leftover logging and indentations
- Loading branch information
Showing
3 changed files
with
164 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,3 +83,7 @@ nohup.out | |
|
||
# Temp files | ||
*~ | ||
|
||
# binaries and binary folders | ||
bin/ | ||
*.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package main | ||
|
||
import ( | ||
"strconv" | ||
"strings" | ||
"time" | ||
) | ||
|
||
// windows2 uses a third party alternative to netsh | ||
// See https://github.com/ScottSWu/windows-wlan-util for details | ||
|
||
func windows2FindMac(line string) (string, bool) { | ||
return linuxFindMac(line) | ||
} | ||
|
||
func windows2FindRssi(line string) (int, bool) { | ||
line = strings.Trim(line, " ") | ||
space := strings.Index(line, " ") | ||
|
||
if space == -1 { | ||
return 0, false | ||
} | ||
|
||
rssi, err := strconv.ParseFloat(line[:space], 10) | ||
|
||
// This is probably not the best place for this | ||
// Rough timings suggest that finding ~30 access points takes around 10 | ||
// seconds. Thus for each MAC/Rssi value found, we should wait about 300 ms. | ||
time.Sleep(300 * time.Millisecond) | ||
|
||
return int(rssi), (err == nil) | ||
} |