mirror of
https://github.com/RoganDawes/P4wnP1_aloa.git
synced 2025-03-27 01:51:45 +01:00
Make mergable
This commit is contained in:
commit
d17ddc46a3
74
Makefile
74
Makefile
@ -1,45 +1,59 @@
|
||||
all: build
|
||||
SHELL := /bin/bash
|
||||
PATH := /usr/local/go/bin:$(PATH)
|
||||
|
||||
all: compile
|
||||
|
||||
test:
|
||||
# export PATH="$$PATH:/usr/local/go/bin" # put into ~/.profile
|
||||
echo $(CURDIR)
|
||||
echo $(HOME)
|
||||
|
||||
# make dep runs without sudo
|
||||
dep:
|
||||
sudo apt-get -y install git screen hostapd autossh bluez bluez-tools bridge-utils policykit-1 genisoimage iodine haveged
|
||||
sudo apt-get -y install tcpdump
|
||||
sudo apt-get -y install python-pip python-dev
|
||||
sudo apt-get -y install git screen hostapd autossh bluez bluez-tools bridge-utils policykit-1 genisoimage iodine haveged
|
||||
sudo apt-get -y install tcpdump
|
||||
sudo apt-get -y install python-pip python-dev
|
||||
|
||||
# before installing dnsmasq, the nameserver from /etc/resolv.conf should be saved
|
||||
# to restore after install (gets overwritten by dnsmasq package)
|
||||
cp /etc/resolv.conf /tmp/backup_resolv.conf
|
||||
sudo apt-get -y install dnsmasq
|
||||
sudo /bin/bash -c 'cat /tmp/backup_resolv.conf > /etc/resolv.conf'
|
||||
# before installing dnsmasq, the nameserver from /etc/resolv.conf should be saved
|
||||
# to restore after install (gets overwritten by dnsmasq package)
|
||||
cp /etc/resolv.conf /tmp/backup_resolv.conf
|
||||
sudo apt-get -y install dnsmasq
|
||||
sudo /bin/bash -c 'cat /tmp/backup_resolv.conf > /etc/resolv.conf'
|
||||
|
||||
# python dependencies for HIDbackdoor
|
||||
sudo pip install pycrypto # already present on stretch
|
||||
sudo pip install pydispatcher
|
||||
# python dependencies for HIDbackdoor
|
||||
sudo pip install pycrypto # already present on stretch
|
||||
sudo pip install pydispatcher
|
||||
|
||||
# install go
|
||||
wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
|
||||
sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
|
||||
export PATH=$PATH:/usr/local/go/bin # put into ~/.profile
|
||||
echo export PATH=$PATH:/usr/local/go/bin >> ~/.profile
|
||||
sudo bash -c 'echo export PATH=\$PATH:/usr/local/go/bin >> ~/.profile'
|
||||
# install go
|
||||
wget https://storage.googleapis.com/golang/go1.10.linux-armv6l.tar.gz
|
||||
sudo tar -C /usr/local -xzf go1.10.linux-armv6l.tar.gz
|
||||
|
||||
# install gopherjs
|
||||
go get -u github.com/gopherjs/gopherjs
|
||||
export PATH="$$PATH:/usr/local/go/bin"
|
||||
|
||||
# we don't need protoc + protoc-grpc-web, because the proto file is shipped pre-compiled
|
||||
# put into ~/.profile
|
||||
# ToDo: check if already present
|
||||
echo "export PATH=\$$PATH:/usr/local/go/bin" >> ~/.profile
|
||||
sudo bash -c 'echo export PATH=\$$PATH:/usr/local/go/bin >> ~/.profile'
|
||||
|
||||
# go dependencies for webapp (without my own)
|
||||
#go get google.golang.org/grpc
|
||||
#go get -u github.com/improbable-eng/grpc-web/go/grpcweb
|
||||
#go get -u github.com/gorilla/websocket
|
||||
# install gopherjs
|
||||
go get -u github.com/gopherjs/gopherjs
|
||||
|
||||
build:
|
||||
go get -u github.com/mame82/P4wnP1_go # partially downloads again, but we need the library packages in go path to build
|
||||
env GOBIN=$(pwd)/build go install ./... # compile all main packages to the build folder
|
||||
# we don't need protoc + protoc-grpc-web, because the proto file is shipped pre-compiled
|
||||
|
||||
# go dependencies for webapp (without my own)
|
||||
#go get google.golang.org/grpc
|
||||
#go get -u github.com/improbable-eng/grpc-web/go/grpcweb
|
||||
#go get -u github.com/gorilla/websocket
|
||||
|
||||
compile:
|
||||
go get -u github.com/mame82/P4wnP1_go/... # partially downloads again, but we need the library packages in go path to build
|
||||
# <--- second compilation, maybe -d flag on go get above is better
|
||||
env GOBIN=$(CURDIR)/build go install ./cmd/... # compile all main packages to the build folder
|
||||
|
||||
# compile the web app
|
||||
# ToDo: (check if dependencies have been fetched by 'go get', even with the build js tags)
|
||||
gopherjs build -m -o build/webapp.js web_client/*.go
|
||||
$(HOME)/go/bin/gopherjs get github.com/mame82/P4wnP1_go/web_client/...
|
||||
$(HOME)/go/bin/gopherjs build -m -o build/webapp.js web_client/*.go
|
||||
|
||||
install:
|
||||
cp build/P4wnP1_service /usr/local/bin/
|
||||
@ -56,7 +70,7 @@ install:
|
||||
|
||||
# careful testing
|
||||
#sudo update-rc.d dhcpcd disable
|
||||
#sudo update-rc.d dnsmasq disable
|
||||
#sudo update-rc.d dnsmasq disable
|
||||
|
||||
# reinit service daemon
|
||||
systemctl daemon-reload
|
||||
|
@ -43,7 +43,7 @@ func main() {
|
||||
*/
|
||||
|
||||
// ToDo: The webroot has to be changed to /usr/local/P4wnP1/www
|
||||
service.StartRpcServerAndWeb("0.0.0.0", "50051", "80", "/home/pi/P4wnP1_go/dist/www") //start gRPC service
|
||||
service.StartRpcServerAndWeb("0.0.0.0", "50051", "80", "/usr/local/P4wnP1/www") //start gRPC service
|
||||
|
||||
//Indicate servers up with LED blink count 1
|
||||
state.Led.SetLed(&pb.LEDSettings{1})
|
||||
|
396
cmd/testhid/testhid.go
Normal file
396
cmd/testhid/testhid.go
Normal file
@ -0,0 +1,396 @@
|
||||
// +build linux,arm
|
||||
|
||||
package main
|
||||
|
||||
import(
|
||||
"github.com/mame82/P4wnP1_go/hid"
|
||||
|
||||
"log"
|
||||
"fmt"
|
||||
"time"
|
||||
"math"
|
||||
"os"
|
||||
"runtime/trace"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
_ "net/http/pprof"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"context"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
var (
|
||||
StringAscii = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
|
||||
StringSpecial1 = "§°üÜöÖäĵ€ß¹²³⁴⁵⁶⁷⁸⁹⁰¼½¬„“¢«»æſðđŋħĸł’¶ŧ←↓→øþ"
|
||||
|
||||
)
|
||||
|
||||
func TestMapCreation() {
|
||||
//Define test keyboard map
|
||||
mapDeASCII := hid.HIDKeyboardLanguageMap{
|
||||
Name: "DE",
|
||||
Description: "German ASCII to USB Keyboard report mapping",
|
||||
Mapping: map[string][]hid.KeyboardOutReport{},
|
||||
}
|
||||
mapDeASCII.Mapping["c"] = []hid.KeyboardOutReport{
|
||||
hid.NewKeyboardOutReport(0, hid.HID_KEY_C),
|
||||
}
|
||||
mapDeASCII.Mapping["C"] = []hid.KeyboardOutReport{
|
||||
hid.NewKeyboardOutReport(hid.HID_MOD_KEY_LEFT_SHIFT, hid.HID_KEY_C),
|
||||
}
|
||||
|
||||
//Store map to file
|
||||
err := mapDeASCII.StoreToFile("/tmp/DE_ASCII.json")
|
||||
if err != nil { log.Fatal(err)}
|
||||
|
||||
/*
|
||||
testmap, err := hid.loadKeyboardLanguageMapFromFile("keymaps/DE_ASCII.json")
|
||||
if err != nil { log.Fatal(err)}
|
||||
fmt.Println(testmap)
|
||||
*/
|
||||
}
|
||||
|
||||
func TestComboPress(hidCtl *hid.HIDController) {
|
||||
testcombos := []string {"SHIFT 1", "ENTER", "ALT TAB", "ALT TABULATOR", " WIN ", "GUI "}
|
||||
for _,comboStr := range testcombos {
|
||||
fmt.Printf("Pressing combo '%s'\n", comboStr)
|
||||
err := hidCtl.Keyboard.StringToPressKeyCombo(comboStr)
|
||||
if err == nil {
|
||||
fmt.Printf("... '%s' pressed sleeping 2s\n", comboStr)
|
||||
time.Sleep(2000 * time.Millisecond)
|
||||
} else {
|
||||
fmt.Printf("Error pressing combo '%s': %v\n", comboStr, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLEDTriggers(hidCtl *hid.HIDController) {
|
||||
fmt.Println("Initial sleep to test if we capture LED state changes from the past, as soon as we start waiting (needed at boot)")
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
|
||||
ch := make(chan func(),0)
|
||||
defer close(ch)
|
||||
|
||||
//Test repeat trigger on any LED
|
||||
fmt.Println("Waiting for any repeated LED state change (5 times frequently), wait timeout after 20 seconds...")
|
||||
trigger, err := hidCtl.Keyboard.WaitLEDStateChangeRepeated(ch, hid.MaskAny, 5, time.Millisecond*500, 20*time.Second)
|
||||
if err != nil {
|
||||
fmt.Printf("Waiting aborted with error: %v\n", err)
|
||||
} else {
|
||||
fmt.Printf("Triggered by %+v\n", trigger)
|
||||
}
|
||||
|
||||
//Test single trigger on any LED
|
||||
fmt.Println("Waiting for any LED single state change, timeout after 15 seconds")
|
||||
trigger, err = hidCtl.Keyboard.WaitLEDStateChange(ch,hid.MaskAny, 15*time.Second)
|
||||
if err != nil {
|
||||
fmt.Printf("Waiting aborted with error: %v\n", err)
|
||||
} else {
|
||||
fmt.Printf("Triggered by %+v\n", trigger)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Test single trigger on NUMLOCK LED (ignore CAPSLOCK, SCROLLLOCK etc.)
|
||||
fmt.Println("Waiting for NUMLOCK LED state change, timeout after 15 seconds")
|
||||
trigger, err = hidCtl.Keyboard.WaitLEDStateChange(ch,hid.MaskNumLock, 15*time.Second)
|
||||
if err != nil {
|
||||
fmt.Printf("Waiting aborted with error: %v\n", err)
|
||||
} else {
|
||||
fmt.Printf("Triggered by %+v\n", trigger)
|
||||
}
|
||||
|
||||
//Test single trigger on NUMLOCK LED (ignore CAPSLOCK, SCROLLLOCK etc.)
|
||||
fmt.Println("Waiting for CAPSLOCK LED state change for 15 seconds")
|
||||
trigger, err = hidCtl.Keyboard.WaitLEDStateChange(ch, hid.MaskCapsLock, 15*time.Second)
|
||||
if err != nil {
|
||||
fmt.Printf("Waiting aborted with error: %v\n", err)
|
||||
} else {
|
||||
fmt.Printf("Triggered by %+v\n", trigger)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMultiLEDTrigges(hidCtl *hid.HIDController, triggerMask byte) {
|
||||
//Test repeat trigger on given LED
|
||||
ch := make(chan func(),0)
|
||||
defer close(ch)
|
||||
fmt.Printf("Waiting for repeated LED state change (5 times frequently) of mask %v, wait timeout after 20 seconds...\n", triggerMask)
|
||||
trigger, err := hidCtl.Keyboard.WaitLEDStateChangeRepeated(ch ,triggerMask, 5, time.Millisecond*500, 20*time.Second)
|
||||
if err != nil {
|
||||
fmt.Printf("Waiting aborted with error: %v\n", err)
|
||||
} else {
|
||||
fmt.Printf("Triggered by %+v\n", trigger)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConcurrentLEDTriggers(hidCtl *hid.HIDController) {
|
||||
go TestMultiLEDTrigges(hidCtl, hid.MaskNumLock)
|
||||
go TestMultiLEDTrigges(hidCtl, hid.MaskCapsLock)
|
||||
go TestMultiLEDTrigges(hidCtl, hid.MaskCapsLock | hid.MaskScrollLock)
|
||||
time.Sleep(2*time.Second)
|
||||
go TestMultiLEDTrigges(hidCtl, hid.MaskAny)
|
||||
TestMultiLEDTrigges(hidCtl, hid.MaskKana)
|
||||
|
||||
}
|
||||
|
||||
|
||||
func TestStringTyping(hidCtl *hid.HIDController) {
|
||||
fmt.Println("Typing:")
|
||||
fmt.Println(StringAscii)
|
||||
//err := hidCtl.Keyboard.StringToPressKeySequence("Test:" + StringAscii + "\t" + StringSpecial1)
|
||||
err := hidCtl.Keyboard.StringToPressKeySequence(StringAscii)
|
||||
if err != nil { fmt.Println(err)}
|
||||
}
|
||||
|
||||
func TestCombinedScript(hidCtl *hid.HIDController) (err error) {
|
||||
|
||||
testcript := `
|
||||
|
||||
console.log("HID Script test for P4wnP1 rework"); //Print to internal console
|
||||
for (var i = 0; i<5; i++) {
|
||||
move(128, 0);
|
||||
delay(500);
|
||||
move(0, -100.1);
|
||||
delay(500);
|
||||
move(-100, 0);
|
||||
delay(500);
|
||||
move(0, 100);
|
||||
delay(500);
|
||||
}
|
||||
|
||||
console.log("HID Script test for P4wnP1 rework"); //Print to internal console
|
||||
for (var i = 0; i<5; i++) {
|
||||
moveTo(0.0, 0.0);
|
||||
delay(500);
|
||||
moveTo(0.8, 0.0);
|
||||
delay(500);
|
||||
moveTo(0.8, 0.8);
|
||||
delay(500);
|
||||
moveTo(0.8, 0.8);
|
||||
delay(500);
|
||||
}
|
||||
waitLED(ANY)
|
||||
|
||||
layout("US"); //Switch to US keyboard layout
|
||||
type("Some ASCII test text QWERTZ\n") //Type text to target ('\n' translates to RETURN key)
|
||||
|
||||
delay(200); //sleep 200 milliseconds
|
||||
|
||||
//waitLEDRepeat test
|
||||
var mask = NUM | SCROLL;
|
||||
var repeatCount = 5;
|
||||
var repeatIntervalMs = 800;
|
||||
var timeout = 20;
|
||||
|
||||
//result = waitLEDRepeat(mask, repeatCount, repeatIntervalMs, timeout)
|
||||
result = waitLEDRepeat(mask, repeatCount)
|
||||
console.log("Result: " + JSON.stringify(result)); //Log result object as JSON to internal console
|
||||
|
||||
waitLED(NUM | SCROLL, 2); //Wait for NumLock or ScrollLock LED change, abort after 2 seconds
|
||||
|
||||
layout("DE"); //Switch to German keyboard layout
|
||||
type("Non ASCII: üÜöÖäÄ"); //Type non ASCII
|
||||
press("ENTER"); //Introduce linebreak by pressing RETURN directly
|
||||
press("RETURN"); //Alias
|
||||
|
||||
counter = 4; //set a var ...
|
||||
type("Pressing <ALT>+<TAB> "+ counter +" times\n"); //... and type it, along with a string
|
||||
for (var i=0; i<counter; i++) {
|
||||
press("ALT TAB");
|
||||
delay(500)
|
||||
}
|
||||
|
||||
//Test LED change based branching
|
||||
result = waitLED(NUM | CAPS); //Wait for change on NUM or CAPS LED only, without timeout, store result
|
||||
console.log("Result: " + JSON.stringify(result)); //Log result object as JSON to internal console
|
||||
if (result.NUM) { //Branch depending on result of LED change
|
||||
type("NUMLock LED changed\n");
|
||||
} else {
|
||||
type("Seems CAPSLock LED changed\n");
|
||||
}
|
||||
`
|
||||
|
||||
_,err = hidCtl.RunScript(context.Background(),testcript)
|
||||
if err != nil {panic(err)}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
func TestMouseNoScript(hidCtl *hid.HIDController) (err error) {
|
||||
hidCtl.Mouse.MoveStepped(100,0)
|
||||
hidCtl.Mouse.MoveStepped(0,-100)
|
||||
hidCtl.Mouse.MoveStepped(0,100)
|
||||
|
||||
time.Sleep(2*time.Second)
|
||||
|
||||
hidCtl.Mouse.SetButtons(true, false, false)
|
||||
for alpha := 0.0; alpha < 8*math.Pi; alpha+=(math.Pi/180) {
|
||||
cos := int16(math.Cos(6.0*alpha) * 5)
|
||||
sin := int16(math.Sin(alpha) * 5)
|
||||
|
||||
hidCtl.Mouse.MoveStepped(sin,cos)
|
||||
}
|
||||
hidCtl.Mouse.SetButtons(false, false, false)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestMouseCircle(hidCtl *hid.HIDController) {
|
||||
scriptMouse := `
|
||||
//circular mouse movement with rotating vector
|
||||
turns = 2
|
||||
degree = Math.PI/180.0
|
||||
scale = 4
|
||||
for (var alpha = 0; alpha < 2 * Math.PI * turns; alpha += degree) {
|
||||
vecx = Math.cos(alpha) * scale
|
||||
vecy = Math.sin(alpha) * scale
|
||||
|
||||
moveStepped(vecx, vecy);
|
||||
}
|
||||
`
|
||||
|
||||
_,err := hidCtl.RunScript(context.Background(),scriptMouse)
|
||||
if err != nil { panic(err)}
|
||||
}
|
||||
|
||||
|
||||
// To profile for memory leaks and test clean cancellation of already running scripts on controller re-init
|
||||
func TestControllerReInit() {
|
||||
//Test for memory leaks
|
||||
hidCtlTests := make([]*hid.HIDController,0)
|
||||
for i:=0; i<10;i++ {
|
||||
//create new controller
|
||||
fmt.Printf("****Creating HIDController %d\n", i)
|
||||
hidCtlTest,_ := hid.NewHIDController(context.Background(),"/dev/hidg0", "keymaps", "/dev/hidg1")
|
||||
|
||||
//run script which utilizes LED read
|
||||
fmt.Printf("****Starting async LED reading script for HIDController %d\n", i)
|
||||
//script := "waitLEDRepeat(ANY);"
|
||||
script := "console.log('...started');delay(3000);console.log('...ended');"
|
||||
ctx := context.Background()
|
||||
for i:=0;i<4;i++ {
|
||||
job,err := hidCtlTest.StartScriptAsBackgroundJob(ctx, script)
|
||||
if err != nil {
|
||||
fmt.Printf("Error starting new job: %v\n",err)
|
||||
} else {
|
||||
fmt.Printf("New job started: %+v\n",job)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
time.Sleep(time.Second)
|
||||
|
||||
//add to slice
|
||||
hidCtlTests = append(hidCtlTests, hidCtlTest)
|
||||
|
||||
|
||||
}
|
||||
hidCtlTests = make([]*hid.HIDController,0)
|
||||
runtime.GC()
|
||||
}
|
||||
|
||||
func main() {
|
||||
f, err := os.Create("trace.out")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
err = trace.Start(f)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer trace.Stop()
|
||||
|
||||
|
||||
|
||||
//TestControllerReInit()
|
||||
|
||||
|
||||
|
||||
hidCtl, err := hid.NewHIDController(context.Background(),"/dev/hidg0", "keymaps", "/dev/hidg1")
|
||||
|
||||
|
||||
if err != nil {panic(err)}
|
||||
hidCtl.Keyboard.KeyDelay = 100
|
||||
// hidCtl.Keyboard.KeyDelayJitter = 200
|
||||
|
||||
|
||||
fmt.Printf("Available language maps:\n%v\n",hidCtl.Keyboard.ListLanguageMapNames())
|
||||
err = hidCtl.Keyboard.SetActiveLanguageMap("DE") //first loaded language map is set by default
|
||||
if err != nil { fmt.Println(err)}
|
||||
fmt.Printf("Chosen keyboard language mapping '%s'\n", hidCtl.Keyboard.ActiveLanguageLayout.Name)
|
||||
|
||||
// tests
|
||||
//TestComboPress(hidCtl)
|
||||
//TestLEDTriggers(hidCtl)
|
||||
//TestStringTyping(hidCtl)
|
||||
//TestConcurrentLEDTriggers(hidCtl)
|
||||
//TestMouseNoScript(hidCtl)
|
||||
//TestCombinedScript(hidCtl)
|
||||
//TestMouseCircle(hidCtl)
|
||||
|
||||
|
||||
//add bg jobs waiting for LED
|
||||
jobList := make([]int,0)
|
||||
fmt.Println("Adding sleeping jobs with 5 seconds timeout context")
|
||||
ctxT,_ := context.WithTimeout(context.Background(), time.Second * 2)
|
||||
//script := "console.log('START ' + JID + ' on VM ' + VMID);delay(5000);console.log(JID + ' returned from 5s blocking delay');"
|
||||
script := "console.log('START ' + JID + ' on VM ' + VMID);waitLEDRepeat(ANY,5000);console.log(JID + ' returned from 5s blocking delay');"
|
||||
startTime := time.Now()
|
||||
for i:=1; i<4; i++ {
|
||||
job,err := hidCtl.StartScriptAsBackgroundJob(ctxT,script)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed adding background job: %v\n", err)
|
||||
} else {
|
||||
// ad job to slice
|
||||
jobList = append(jobList, job.Id)
|
||||
}
|
||||
}
|
||||
//Wait for all jobs to finish
|
||||
fmt.Printf("Waiting for Job results for IDs: %+v\n", jobList)
|
||||
for _,jid := range jobList {
|
||||
job,err := hidCtl.GetBackgroundJobByID(jid)
|
||||
if err != nil {
|
||||
fmt.Printf("Job with ID %d not found, skipping...\n", jid)
|
||||
continue
|
||||
} else {
|
||||
fmt.Printf("Waiting for finish of job with ID %d \n", jid)
|
||||
jRes,jErr := hidCtl.WaitBackgroundJobResult(context.Background(),job)
|
||||
fmt.Printf("JID: %d, Result: %+v, Err: %v\n", jid, jRes, jErr)
|
||||
}
|
||||
}
|
||||
fmt.Printf("All results received after %v\n", time.Since(startTime))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//try to load script file
|
||||
filepath := "./hidtest1.js"
|
||||
if scriptFile, err := ioutil.ReadFile(filepath); err != nil {
|
||||
log.Printf("Couldn't load HIDScript testfile: %s\n", filepath)
|
||||
} else {
|
||||
_,err = hidCtl.RunScript(context.Background(),string(scriptFile))
|
||||
if err != nil { panic(err)}
|
||||
}
|
||||
|
||||
|
||||
|
||||
go http.ListenAndServe(":8080", nil)
|
||||
|
||||
//use a channel to wait for SIGTERM or SIGINT
|
||||
fmt.Println("Waiting for keyboard interrupt")
|
||||
sig := make(chan os.Signal)
|
||||
signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
|
||||
s := <-sig
|
||||
log.Printf("Signal (%v) received, closing ...\n", s)
|
||||
return
|
||||
//log.Fatalf("Signal (%v) received, closing \"Let Me In\" rebind DNS server\n", s)
|
||||
}
|
50
cmd/testwifi/testwifi.go
Normal file
50
cmd/testwifi/testwifi.go
Normal file
@ -0,0 +1,50 @@
|
||||
// +build linux,arm
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/mame82/P4wnP1_go/service"
|
||||
"log"
|
||||
pb "github.com/mame82/P4wnP1_go/proto"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ap_settings := &pb.WiFiSettings{
|
||||
Mode: pb.WiFiSettings_AP,
|
||||
AuthMode: pb.WiFiSettings_WPA2_PSK,
|
||||
Disabled: false,
|
||||
Reg: "US",
|
||||
ApChannel: 6,
|
||||
ApHideSsid: false,
|
||||
BssCfgAP: &pb.BSSCfg{
|
||||
SSID: "P4wnP1",
|
||||
PSK: "MaMe82-P4wnP1",
|
||||
},
|
||||
DisableNexmon: true,
|
||||
BssCfgClient: nil, //not needed
|
||||
}
|
||||
|
||||
sta_settings := &pb.WiFiSettings{
|
||||
Mode: pb.WiFiSettings_STA,
|
||||
AuthMode: pb.WiFiSettings_WPA2_PSK,
|
||||
Disabled: false,
|
||||
Reg: "DE",
|
||||
BssCfgClient: &pb.BSSCfg{
|
||||
SSID: "WLAN-579086",
|
||||
PSK: "5824989790864470",
|
||||
},
|
||||
DisableNexmon: true,
|
||||
BssCfgAP: nil, //not needed
|
||||
}
|
||||
|
||||
err := service.DeployWifiSettings(ap_settings)
|
||||
if err != nil { log.Println(err)}
|
||||
|
||||
err = service.DeployWifiSettings(sta_settings)
|
||||
if err != nil { log.Println(err)}
|
||||
|
||||
fmt.Println("Sleeping 10 seconds")
|
||||
time.Sleep(time.Second * 10)
|
||||
}
|
719
cmd/testwifi2/testwifi2.go
Normal file
719
cmd/testwifi2/testwifi2.go
Normal file
@ -0,0 +1,719 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/mame82/P4wnP1_go/service"
|
||||
"log"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var iw_scan_out = `BSS 4e:66:41:a0:5b:35(on wlan0)
|
||||
TSF: 0 usec (0d, 00:00:00)
|
||||
freq: 2437
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS Privacy SpectrumMgmt ShortSlotTime RadioMeasure (0x1511)
|
||||
signal: -43.01 dBm
|
||||
last seen: 13740 ms ago
|
||||
SSID: Android AP8905
|
||||
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0
|
||||
DS Parameter set: channel 6
|
||||
TIM: DTIM Count 0 DTIM Period 2 Bitmap Control 0x0 Bitmap[0] 0x0
|
||||
Country: DE Environment: Indoor/Outdoor
|
||||
Channels [1 - 13] @ 20 dBm
|
||||
Power constraint: 0 dB
|
||||
TPC report: TX power: 17 dBm
|
||||
ERP: <no flags>
|
||||
Extended supported rates: 6.0 9.0 12.0 48.0
|
||||
RSN: * Version: 1
|
||||
* Group cipher: CCMP
|
||||
* Pairwise ciphers: CCMP
|
||||
* Authentication suites: PSK
|
||||
* Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
|
||||
HT capabilities:
|
||||
Capabilities: 0x1ad
|
||||
RX LDPC
|
||||
HT20
|
||||
SM Power Save disabled
|
||||
RX HT20 SGI
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 3839 bytes
|
||||
No DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: 4 usec (0x05)
|
||||
HT RX MCS rate indexes supported: 0-15
|
||||
HT TX MCS rate indexes are undefined
|
||||
HT operation:
|
||||
* primary channel: 6
|
||||
* secondary channel offset: no secondary
|
||||
* STA channel width: 20 MHz
|
||||
* RIFS: 1
|
||||
* HT protection: no
|
||||
* non-GF present: 0
|
||||
* OBSS non-GF present: 0
|
||||
* dual beacon: 0
|
||||
* dual CTS protection: 0
|
||||
* STBC beacon: 0
|
||||
* L-SIG TXOP Prot: 0
|
||||
* PCO active: 0
|
||||
* PCO phase: 0
|
||||
Extended capabilities: Extended Channel Switching, BSS Transition, 6
|
||||
WMM: * Parameter version 1
|
||||
* BE: CW 15-1023, AIFSN 3
|
||||
* BK: CW 15-1023, AIFSN 7
|
||||
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
|
||||
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
|
||||
BSS 5c:dc:96:b4:59:af(on wlan0)
|
||||
TSF: 0 usec (0d, 00:00:00)
|
||||
freq: 2437
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS Privacy ShortSlotTime RadioMeasure (0x1411)
|
||||
signal: -38.00 dBm
|
||||
last seen: 10 ms ago
|
||||
SSID: WLAN-579086
|
||||
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0
|
||||
DS Parameter set: channel 6
|
||||
Country: DE Environment: Indoor/Outdoor
|
||||
Channels [1 - 13] @ 22 dBm
|
||||
ERP: <no flags>
|
||||
ERP D4.0: <no flags>
|
||||
RSN: * Version: 1
|
||||
* Group cipher: CCMP
|
||||
* Pairwise ciphers: CCMP
|
||||
* Authentication suites: PSK
|
||||
* Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
|
||||
Extended supported rates: 6.0 9.0 12.0 48.0
|
||||
HT capabilities:
|
||||
Capabilities: 0x19fe
|
||||
HT20/HT40
|
||||
SM Power Save disabled
|
||||
RX Greenfield
|
||||
RX HT20 SGI
|
||||
RX HT40 SGI
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 7935 bytes
|
||||
DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: 16 usec (0x07)
|
||||
HT RX MCS rate indexes supported: 0-15, 32
|
||||
HT TX MCS rate indexes are undefined
|
||||
HT operation:
|
||||
* primary channel: 6
|
||||
* secondary channel offset: below
|
||||
* STA channel width: any
|
||||
* RIFS: 1
|
||||
* HT protection: no
|
||||
* non-GF present: 0
|
||||
* OBSS non-GF present: 0
|
||||
* dual beacon: 0
|
||||
* dual CTS protection: 0
|
||||
* STBC beacon: 0
|
||||
* L-SIG TXOP Prot: 0
|
||||
* PCO active: 0
|
||||
* PCO phase: 0
|
||||
Overlapping BSS scan params:
|
||||
* passive dwell: 20 TUs
|
||||
* active dwell: 10 TUs
|
||||
* channel width trigger scan interval: 300 s
|
||||
* scan passive total per channel: 200 TUs
|
||||
* scan active total per channel: 20 TUs
|
||||
* BSS width channel transition delay factor: 5
|
||||
* OBSS Scan Activity Threshold: 0.25 %
|
||||
Extended capabilities: HT Information Exchange Supported, Extended Channel Switching, 6
|
||||
WPS: * Version: 1.0
|
||||
* Wi-Fi Protected Setup State: 2 (Configured)
|
||||
* Response Type: 3 (AP)
|
||||
* UUID: 7470bfaa-0621-242d-7915-13686f9ded23
|
||||
* Manufacturer: ARCADYAN
|
||||
* Model: DT724
|
||||
* Model Number: 1.0
|
||||
* Serial Number: 888
|
||||
* Primary Device Type: 6-0050f204-1
|
||||
* Device name: DT724
|
||||
* Config methods:
|
||||
* RF Bands: 0x3
|
||||
* Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20
|
||||
WMM: * Parameter version 1
|
||||
* u-APSD
|
||||
* BE: CW 15-1023, AIFSN 3
|
||||
* BK: CW 15-1023, AIFSN 7
|
||||
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
|
||||
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
|
||||
BSS 4e:66:41:a0:5b:35(on wlan0)
|
||||
TSF: 0 usec (0d, 00:00:00)
|
||||
freq: 2462
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS SpectrumMgmt ShortSlotTime RadioMeasure (0x1501)
|
||||
signal: -35.00 dBm
|
||||
last seen: 10 ms ago
|
||||
SSID: AndroidAP8905
|
||||
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0
|
||||
DS Parameter set: channel 11
|
||||
TIM: DTIM Count 0 DTIM Period 2 Bitmap Control 0x0 Bitmap[0] 0x0
|
||||
Country: DE Environment: Indoor/Outdoor
|
||||
Channels [1 - 13] @ 20 dBm
|
||||
Power constraint: 0 dB
|
||||
TPC report: TX power: 17 dBm
|
||||
ERP: <no flags>
|
||||
Extended supported rates: 6.0 9.0 12.0 48.0
|
||||
HT capabilities:
|
||||
Capabilities: 0x1ad
|
||||
RX LDPC
|
||||
HT20
|
||||
SM Power Save disabled
|
||||
RX HT20 SGI
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 3839 bytes
|
||||
No DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: 4 usec (0x05)
|
||||
HT RX MCS rate indexes supported: 0-15
|
||||
HT TX MCS rate indexes are undefined
|
||||
HT operation:
|
||||
* primary channel: 11
|
||||
* secondary channel offset: no secondary
|
||||
* STA channel width: 20 MHz
|
||||
* RIFS: 1
|
||||
* HT protection: no
|
||||
* non-GF present: 0
|
||||
* OBSS non-GF present: 0
|
||||
* dual beacon: 0
|
||||
* dual CTS protection: 0
|
||||
* STBC beacon: 0
|
||||
* L-SIG TXOP Prot: 0
|
||||
* PCO active: 0
|
||||
* PCO phase: 0
|
||||
Extended capabilities: Extended Channel Switching, BSS Transition, 6
|
||||
WMM: * Parameter version 1
|
||||
* BE: CW 15-1023, AIFSN 3
|
||||
* BK: CW 15-1023, AIFSN 7
|
||||
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
|
||||
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
|
||||
BSS 88:e3:ab:9d:38:f5(on wlan0)
|
||||
TSF: 0 usec (0d, 00:00:00)
|
||||
freq: 2412
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS Privacy ShortSlotTime RadioMeasure (0x1411)
|
||||
signal: -84.00 dBm
|
||||
last seen: 0 ms ago
|
||||
SSID: WLAN-WGF3FG
|
||||
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0
|
||||
DS Parameter set: channel 1
|
||||
ERP: Barker_Preamble_Mode
|
||||
ERP D4.0: Barker_Preamble_Mode
|
||||
RSN: * Version: 1
|
||||
* Group cipher: CCMP
|
||||
* Pairwise ciphers: CCMP
|
||||
* Authentication suites: PSK
|
||||
* Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
|
||||
Extended supported rates: 6.0 9.0 12.0 48.0
|
||||
HT capabilities:
|
||||
Capabilities: 0x19ac
|
||||
HT20
|
||||
SM Power Save disabled
|
||||
RX HT20 SGI
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 7935 bytes
|
||||
DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: 8 usec (0x06)
|
||||
HT RX MCS rate indexes supported: 0-15
|
||||
HT TX MCS rate indexes are undefined
|
||||
HT operation:
|
||||
* primary channel: 1
|
||||
* secondary channel offset: no secondary
|
||||
* STA channel width: 20 MHz
|
||||
* RIFS: 0
|
||||
* HT protection: no
|
||||
* non-GF present: 1
|
||||
* OBSS non-GF present: 0
|
||||
* dual beacon: 0
|
||||
* dual CTS protection: 0
|
||||
* STBC beacon: 0
|
||||
* L-SIG TXOP Prot: 0
|
||||
* PCO active: 0
|
||||
* PCO phase: 0
|
||||
Overlapping BSS scan params:
|
||||
* passive dwell: 20 TUs
|
||||
* active dwell: 10 TUs
|
||||
* channel width trigger scan interval: 300 s
|
||||
* scan passive total per channel: 200 TUs
|
||||
* scan active total per channel: 20 TUs
|
||||
* BSS width channel transition delay factor: 5
|
||||
* OBSS Scan Activity Threshold: 0.25 %
|
||||
Extended capabilities: HT Information Exchange Supported, Extended Channel Switching, 6
|
||||
WPS: * Version: 1.0
|
||||
* Wi-Fi Protected Setup State: 2 (Configured)
|
||||
* Response Type: 3 (AP)
|
||||
* UUID: 13082394-62d2-8063-e9de-c42e3a2d1071
|
||||
* Manufacturer: Broadcom
|
||||
* Model: Broadcom
|
||||
* Model Number: 123456
|
||||
* Serial Number: 1234
|
||||
* Primary Device Type: 6-0050f204-1
|
||||
* Device name: BroadcomAP
|
||||
* Config methods:
|
||||
* RF Bands: 0x3
|
||||
* Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20
|
||||
WMM: * Parameter version 1
|
||||
* u-APSD
|
||||
* BE: CW 15-1023, AIFSN 3
|
||||
* BK: CW 15-1023, AIFSN 7
|
||||
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
|
||||
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
|
||||
BSS b8:bc:1b:63:33:d9(on wlan0)
|
||||
TSF: 0 usec (0d, 00:00:00)
|
||||
freq: 2412
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS Privacy ShortSlotTime RadioMeasure (0x1411)
|
||||
signal: -81.00 dBm
|
||||
last seen: 0 ms ago
|
||||
SSID: schmidtderhit
|
||||
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0
|
||||
DS Parameter set: channel 1
|
||||
ERP: Barker_Preamble_Mode
|
||||
ERP D4.0: Barker_Preamble_Mode
|
||||
RSN: * Version: 1
|
||||
* Group cipher: CCMP
|
||||
* Pairwise ciphers: CCMP
|
||||
* Authentication suites: PSK
|
||||
* Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
|
||||
Extended supported rates: 6.0 9.0 12.0 48.0
|
||||
HT capabilities:
|
||||
Capabilities: 0x19ac
|
||||
HT20
|
||||
SM Power Save disabled
|
||||
RX HT20 SGI
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 7935 bytes
|
||||
DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: 8 usec (0x06)
|
||||
HT RX MCS rate indexes supported: 0-15
|
||||
HT TX MCS rate indexes are undefined
|
||||
HT operation:
|
||||
* primary channel: 1
|
||||
* secondary channel offset: no secondary
|
||||
* STA channel width: 20 MHz
|
||||
* RIFS: 0
|
||||
* HT protection: no
|
||||
* non-GF present: 1
|
||||
* OBSS non-GF present: 0
|
||||
* dual beacon: 0
|
||||
* dual CTS protection: 0
|
||||
* STBC beacon: 0
|
||||
* L-SIG TXOP Prot: 0
|
||||
* PCO active: 0
|
||||
* PCO phase: 0
|
||||
Overlapping BSS scan params:
|
||||
* passive dwell: 20 TUs
|
||||
* active dwell: 10 TUs
|
||||
* channel width trigger scan interval: 300 s
|
||||
* scan passive total per channel: 200 TUs
|
||||
* scan active total per channel: 20 TUs
|
||||
* BSS width channel transition delay factor: 5
|
||||
* OBSS Scan Activity Threshold: 0.25 %
|
||||
Extended capabilities: HT Information Exchange Supported, Extended Channel Switching, 6
|
||||
WPS: * Version: 1.0
|
||||
* Wi-Fi Protected Setup State: 2 (Configured)
|
||||
* Response Type: 3 (AP)
|
||||
* UUID: 8e998705-3ed2-399e-e43d-0d4c0a412fec
|
||||
* Manufacturer: Broadcom
|
||||
* Model: Broadcom
|
||||
* Model Number: 123456
|
||||
* Serial Number: 1234
|
||||
* Primary Device Type: 6-0050f204-1
|
||||
* Device name: BroadcomAP
|
||||
* Config methods:
|
||||
* RF Bands: 0x3
|
||||
* Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20
|
||||
WMM: * Parameter version 1
|
||||
* u-APSD
|
||||
* BE: CW 15-1023, AIFSN 3
|
||||
* BK: CW 15-1023, AIFSN 7
|
||||
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
|
||||
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
|
||||
BSS 88:e3:ab:9d:38:f6(on wlan0)
|
||||
TSF: 0 usec (0d, 00:00:00)
|
||||
freq: 2412
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS ShortSlotTime RadioMeasure (0x1401)
|
||||
signal: -84.00 dBm
|
||||
last seen: 0 ms ago
|
||||
SSID: Telekom_FON
|
||||
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0
|
||||
DS Parameter set: channel 1
|
||||
ERP: Barker_Preamble_Mode
|
||||
ERP D4.0: Barker_Preamble_Mode
|
||||
Extended supported rates: 6.0 9.0 12.0 48.0
|
||||
HT capabilities:
|
||||
Capabilities: 0x19ac
|
||||
HT20
|
||||
SM Power Save disabled
|
||||
RX HT20 SGI
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 7935 bytes
|
||||
DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: 8 usec (0x06)
|
||||
HT RX MCS rate indexes supported: 0-15
|
||||
HT TX MCS rate indexes are undefined
|
||||
HT operation:
|
||||
* primary channel: 1
|
||||
* secondary channel offset: no secondary
|
||||
* STA channel width: 20 MHz
|
||||
* RIFS: 0
|
||||
* HT protection: no
|
||||
* non-GF present: 1
|
||||
* OBSS non-GF present: 0
|
||||
* dual beacon: 0
|
||||
* dual CTS protection: 0
|
||||
* STBC beacon: 0
|
||||
* L-SIG TXOP Prot: 0
|
||||
* PCO active: 0
|
||||
* PCO phase: 0
|
||||
Overlapping BSS scan params:
|
||||
* passive dwell: 20 TUs
|
||||
* active dwell: 10 TUs
|
||||
* channel width trigger scan interval: 300 s
|
||||
* scan passive total per channel: 200 TUs
|
||||
* scan active total per channel: 20 TUs
|
||||
* BSS width channel transition delay factor: 5
|
||||
* OBSS Scan Activity Threshold: 0.25 %
|
||||
Extended capabilities: HT Information Exchange Supported, Extended Channel Switching, 6
|
||||
WMM: * Parameter version 1
|
||||
* u-APSD
|
||||
* BE: CW 15-1023, AIFSN 3
|
||||
* BK: CW 15-1023, AIFSN 7
|
||||
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
|
||||
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
|
||||
BSS b8:bc:1b:63:33:da(on wlan0)
|
||||
TSF: 0 usec (0d, 00:00:00)
|
||||
freq: 2412
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS ShortSlotTime RadioMeasure (0x1401)
|
||||
signal: -83.00 dBm
|
||||
last seen: 0 ms ago
|
||||
SSID: Telekom_FON
|
||||
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0
|
||||
DS Parameter set: channel 1
|
||||
ERP: Barker_Preamble_Mode
|
||||
ERP D4.0: Barker_Preamble_Mode
|
||||
Extended supported rates: 6.0 9.0 12.0 48.0
|
||||
HT capabilities:
|
||||
Capabilities: 0x19ac
|
||||
HT20
|
||||
SM Power Save disabled
|
||||
RX HT20 SGI
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 7935 bytes
|
||||
DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: 8 usec (0x06)
|
||||
HT RX MCS rate indexes supported: 0-15
|
||||
HT TX MCS rate indexes are undefined
|
||||
HT operation:
|
||||
* primary channel: 1
|
||||
* secondary channel offset: no secondary
|
||||
* STA channel width: 20 MHz
|
||||
* RIFS: 0
|
||||
* HT protection: no
|
||||
* non-GF present: 1
|
||||
* OBSS non-GF present: 0
|
||||
* dual beacon: 0
|
||||
* dual CTS protection: 0
|
||||
* STBC beacon: 0
|
||||
* L-SIG TXOP Prot: 0
|
||||
* PCO active: 0
|
||||
* PCO phase: 0
|
||||
Overlapping BSS scan params:
|
||||
* passive dwell: 20 TUs
|
||||
* active dwell: 10 TUs
|
||||
* channel width trigger scan interval: 300 s
|
||||
* scan passive total per channel: 200 TUs
|
||||
* scan active total per channel: 20 TUs
|
||||
* BSS width channel transition delay factor: 5
|
||||
* OBSS Scan Activity Threshold: 0.25 %
|
||||
Extended capabilities: HT Information Exchange Supported, Extended Channel Switching, 6
|
||||
WMM: * Parameter version 1
|
||||
* u-APSD
|
||||
* BE: CW 15-1023, AIFSN 3
|
||||
* BK: CW 15-1023, AIFSN 7
|
||||
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
|
||||
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
|
||||
BSS 24:65:11:89:1c:28(on wlan0) -- associated
|
||||
TSF: 0 usec (0d, 00:00:00)
|
||||
freq: 2462
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
|
||||
signal: -40.00 dBm
|
||||
last seen: 0 ms ago
|
||||
SSID: spycki3
|
||||
Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0* 9.0 12.0* 18.0
|
||||
DS Parameter set: channel 11
|
||||
TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x1
|
||||
Country: DE Environment: Indoor/Outdoor
|
||||
Channels [1 - 13] @ 20 dBm
|
||||
ERP: <no flags>
|
||||
RSN: * Version: 1
|
||||
* Group cipher: TKIP
|
||||
* Pairwise ciphers: CCMP
|
||||
* Authentication suites: PSK
|
||||
* Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
|
||||
Extended supported rates: 24.0* 36.0 48.0 54.0
|
||||
HT capabilities:
|
||||
Capabilities: 0x11ce
|
||||
HT20/HT40
|
||||
SM Power Save disabled
|
||||
RX HT40 SGI
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 3839 bytes
|
||||
DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: 8 usec (0x06)
|
||||
HT RX MCS rate indexes supported: 0-15
|
||||
HT TX MCS rate indexes are undefined
|
||||
HT operation:
|
||||
* primary channel: 11
|
||||
* secondary channel offset: below
|
||||
* STA channel width: any
|
||||
* RIFS: 1
|
||||
* HT protection: 20 MHz
|
||||
* non-GF present: 1
|
||||
* OBSS non-GF present: 0
|
||||
* dual beacon: 0
|
||||
* dual CTS protection: 0
|
||||
* STBC beacon: 0
|
||||
* L-SIG TXOP Prot: 0
|
||||
* PCO active: 0
|
||||
* PCO phase: 0
|
||||
WPA: * Version: 1
|
||||
* Group cipher: TKIP
|
||||
* Pairwise ciphers: TKIP
|
||||
* Authentication suites: PSK
|
||||
WMM: * Parameter version 1
|
||||
* BE: CW 15-1023, AIFSN 3
|
||||
* BK: CW 15-1023, AIFSN 7
|
||||
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
|
||||
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
|
||||
WPS: * Version: 1.0
|
||||
* Wi-Fi Protected Setup State: 2 (Configured)
|
||||
* UUID: 0cb4b30f-b5d6-7e18-4ec8-246511891c10
|
||||
* RF Bands: 0x3
|
||||
BSS c0:25:06:eb:8e:7d(on wlan0)
|
||||
TSF: 0 usec (0d, 00:00:00)
|
||||
freq: 2437
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
|
||||
signal: -84.00 dBm
|
||||
last seen: 0 ms ago
|
||||
SSID: FRITZ!Box Fon WLAN 7390
|
||||
Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0* 9.0 12.0* 18.0
|
||||
DS Parameter set: channel 6
|
||||
Country: DE Environment: Indoor/Outdoor
|
||||
Channels [1 - 13] @ 20 dBm
|
||||
ERP: <no flags>
|
||||
Extended supported rates: 24.0* 36.0 48.0 54.0
|
||||
HT capabilities:
|
||||
Capabilities: 0x18c
|
||||
HT20
|
||||
SM Power Save disabled
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 3839 bytes
|
||||
No DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: 8 usec (0x06)
|
||||
HT TX/RX MCS rate indexes supported: 0-15
|
||||
HT operation:
|
||||
* primary channel: 6
|
||||
* secondary channel offset: no secondary
|
||||
* STA channel width: 20 MHz
|
||||
* RIFS: 1
|
||||
* HT protection: no
|
||||
* non-GF present: 0
|
||||
* OBSS non-GF present: 0
|
||||
* dual beacon: 0
|
||||
* dual CTS protection: 0
|
||||
* STBC beacon: 0
|
||||
* L-SIG TXOP Prot: 0
|
||||
* PCO active: 0
|
||||
* PCO phase: 0
|
||||
Extended capabilities: 6
|
||||
WMM: * Parameter version 1
|
||||
* BE: CW 15-1023, AIFSN 3
|
||||
* BK: CW 15-1023, AIFSN 7
|
||||
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
|
||||
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
|
||||
RSN: * Version: 1
|
||||
* Group cipher: TKIP
|
||||
* Pairwise ciphers: CCMP
|
||||
* Authentication suites: PSK
|
||||
* Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
|
||||
WPA: * Version: 1
|
||||
* Group cipher: TKIP
|
||||
* Pairwise ciphers: TKIP
|
||||
* Authentication suites: PSK
|
||||
WPS: * Version: 1.0
|
||||
* Wi-Fi Protected Setup State: 2 (Configured)
|
||||
* Response Type: 3 (AP)
|
||||
* UUID: 76fc7d2e-2e0b-5c3b-7135-c02506eb8e7c
|
||||
* Manufacturer: AVM
|
||||
* Model: FBox
|
||||
* Model Number: 0000
|
||||
* Serial Number: 0000
|
||||
* Primary Device Type: 6-0050f204-1
|
||||
* Device name: FBox
|
||||
* Config methods: Display, PBC, Keypad
|
||||
* RF Bands: 0x3
|
||||
* Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20
|
||||
BSS c2:25:06:eb:8e:7d(on wlan0)
|
||||
TSF: 0 usec (0d, 00:00:00)
|
||||
freq: 2437
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
|
||||
signal: -82.00 dBm
|
||||
last seen: 0 ms ago
|
||||
SSID: SDK Gast
|
||||
Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0* 9.0 12.0* 18.0
|
||||
DS Parameter set: channel 6
|
||||
Country: DE Environment: Indoor/Outdoor
|
||||
Channels [1 - 13] @ 20 dBm
|
||||
ERP: <no flags>
|
||||
Extended supported rates: 24.0* 36.0 48.0 54.0
|
||||
HT capabilities:
|
||||
Capabilities: 0x18c
|
||||
HT20
|
||||
SM Power Save disabled
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 3839 bytes
|
||||
No DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: 8 usec (0x06)
|
||||
HT TX/RX MCS rate indexes supported: 0-15
|
||||
HT operation:
|
||||
* primary channel: 6
|
||||
* secondary channel offset: no secondary
|
||||
* STA channel width: 20 MHz
|
||||
* RIFS: 1
|
||||
* HT protection: no
|
||||
* non-GF present: 0
|
||||
* OBSS non-GF present: 0
|
||||
* dual beacon: 0
|
||||
* dual CTS protection: 0
|
||||
* STBC beacon: 0
|
||||
* L-SIG TXOP Prot: 0
|
||||
* PCO active: 0
|
||||
* PCO phase: 0
|
||||
Extended capabilities: 6
|
||||
WMM: * Parameter version 1
|
||||
* BE: CW 15-1023, AIFSN 3
|
||||
* BK: CW 15-1023, AIFSN 7
|
||||
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
|
||||
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
|
||||
RSN: * Version: 1
|
||||
* Group cipher: TKIP
|
||||
* Pairwise ciphers: CCMP
|
||||
* Authentication suites: PSK
|
||||
* Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
|
||||
WPA: * Version: 1
|
||||
* Group cipher: TKIP
|
||||
* Pairwise ciphers: TKIP
|
||||
* Authentication suites: PSK
|
||||
WPS: * Version: 1.0
|
||||
* Wi-Fi Protected Setup State: 2 (Configured)
|
||||
* Response Type: 3 (AP)
|
||||
* UUID: dfb77a7a-25b2-93f6-7ba8-01e7cd0bdb51
|
||||
* Manufacturer: AVM
|
||||
* Model: FBox
|
||||
* Model Number: 0000
|
||||
* Serial Number: 0000
|
||||
* Primary Device Type: 6-0050f204-1
|
||||
* Device name: FBox
|
||||
* Config methods: Display, PBC, Keypad
|
||||
* RF Bands: 0x3
|
||||
* Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20
|
||||
BSS e0:28:6d:dd:b1:fc(on wlan0)
|
||||
TSF: 0 usec (0d, 00:00:00)
|
||||
freq: 2462
|
||||
beacon interval: 100 TUs
|
||||
capability: ESS Privacy ShortPreamble (0x0031)
|
||||
signal: -75.00 dBm
|
||||
last seen: 0 ms ago
|
||||
SSID: FRITZ!Box 7362 SL
|
||||
Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0* 9.0 12.0* 18.0
|
||||
DS Parameter set: channel 11
|
||||
Country: DE Environment: Indoor/Outdoor
|
||||
Channels [1 - 13] @ 20 dBm
|
||||
ERP: <no flags>
|
||||
Extended supported rates: 24.0* 36.0 48.0 54.0
|
||||
HT capabilities:
|
||||
Capabilities: 0x1ad
|
||||
RX LDPC
|
||||
HT20
|
||||
SM Power Save disabled
|
||||
RX HT20 SGI
|
||||
TX STBC
|
||||
RX STBC 1-stream
|
||||
Max AMSDU length: 3839 bytes
|
||||
No DSSS/CCK HT40
|
||||
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
|
||||
Minimum RX AMPDU time spacing: 8 usec (0x06)
|
||||
HT TX/RX MCS rate indexes supported: 0-23
|
||||
HT operation:
|
||||
* primary channel: 11
|
||||
* secondary channel offset: no secondary
|
||||
* STA channel width: 20 MHz
|
||||
* RIFS: 1
|
||||
* HT protection: no
|
||||
* non-GF present: 1
|
||||
* OBSS non-GF present: 0
|
||||
* dual beacon: 0
|
||||
* dual CTS protection: 0
|
||||
* STBC beacon: 0
|
||||
* L-SIG TXOP Prot: 0
|
||||
* PCO active: 0
|
||||
* PCO phase: 0
|
||||
Extended capabilities: 6
|
||||
WMM: * Parameter version 1
|
||||
* BE: CW 15-1023, AIFSN 3
|
||||
* BK: CW 15-1023, AIFSN 7
|
||||
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
|
||||
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
|
||||
RSN: * Version: 1
|
||||
* Group cipher: CCMP
|
||||
* Pairwise ciphers: CCMP
|
||||
* Authentication suites: PSK
|
||||
* Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
|
||||
WPS: * Version: 1.0
|
||||
* Wi-Fi Protected Setup State: 2 (Configured)
|
||||
* Response Type: 3 (AP)
|
||||
* UUID: 80ffd276-a392-0a84-6421-e0286dddb1fc
|
||||
* Manufacturer: AVM
|
||||
* Model: FBox
|
||||
* Model Number: 0000
|
||||
* Serial Number: 0000
|
||||
* Primary Device Type: 6-0050f204-1
|
||||
* Device name: FBox
|
||||
* Config methods: Display, PBC, Keypad
|
||||
* RF Bands: 0x1
|
||||
* Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20`
|
||||
|
||||
func main() {
|
||||
//res, err := service.ParseIwScan(iw_scan_out)
|
||||
res, err := service.WifiScan("wlan0")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("Parsed scan result:\n%v\n", res)
|
||||
err = service.WifiCreateWpaSupplicantConfigFile("spycki1 2 3", "a b c c b b", "/tmp/wpa_supplicant.conf")
|
||||
if err != nil { log.Fatal(err)}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user