schollz / find3-cli-scanner

The command-line scanner that supports Bluetooth and WiFi
https://www.internalpositioning.com/doc/tracking_your_computer.md
149 stars 55 forks source link

How could I use the cli-scanner on Docker for Windows? #7

Closed Lazzaretti closed 6 years ago

Lazzaretti commented 6 years ago

I started the container with the command: docker run --net="host" --privileged --name scanner -d -i -t schollz/find3-cli-scanner

The interfaces of the container:

docker exec scanner sh -c "ifconfig"
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:46ff:fe66:5537  prefixlen 64  scopeid 0x20<link>
        ether 02:42:46:66:55:37  txqueuelen 0  (Ethernet)
        RX packets 93  bytes 165994 (165.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 126  bytes 15926 (15.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.65.3  netmask 255.255.255.0  broadcast 192.168.65.255
        ether 02:50:00:00:00:01  txqueuelen 1000  (Ethernet)
        RX packets 153161  bytes 213995777 (213.9 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 58267  bytes 3198194 (3.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

hvint0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.75.2  netmask 255.255.255.0  broadcast 0.0.0.0
        inet6 fe80::215:5dff:fe95:103  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:95:01:03  txqueuelen 1000  (Ethernet)
        RX packets 1036  bytes 214405 (214.4 KB)
        RX errors 0  dropped 7  overruns 0  frame 0
        TX packets 620  bytes 267703 (267.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 162  bytes 14948 (14.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 162  bytes 14948 (14.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth8eaa615: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::2097:cdff:fee5:31b0  prefixlen 64  scopeid 0x20<link>
        ether 22:97:cd:e5:31:b0  txqueuelen 0  (Ethernet)
        RX packets 63  bytes 7328 (7.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 85  bytes 9818 (9.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

They don't look like WiFi adapters to me... But I tried to use all of them like this:

docker exec scanner sh -c "find3-cli-scanner -i docker0 -device laptop -family mytest -server  http://localhost:11883 -scantime 1 -debug"
2018-04-02 10:49:45 [INFO] main.go main:76 scanning with docker0
2018-04-02 10:49:45 [DEBUG] utils.go RunCommand:14 /sbin/iw dev docker0 scan -u
2018-04-02 10:49:45 [ERROR] utils.go RunCommand:40 exit status 1: /sbin/iw dev docker0 scan -u
2018-04-02 10:49:45 [DEBUG] main.go basicCapture:162 {
 "t": 1522666185525,
 "f": "mytest",
 "d": "laptop",
 "s": {
  "wifi": {}
 },
 "gps": {}
}
2018-04-02 10:49:45 [DEBUG] server-main.go postData:47 posting data
2018-04-02 10:49:45 [ERROR] main.go basicCapture:164 Post http://localhost:11883/data: EOF

How could I use the scanner with Docker for Windows?

schollz commented 6 years ago

docker0 is not the interface to use. I think you want hvint0

Lazzaretti commented 6 years ago

Same error with hvint0:

>docker exec scanner sh -c "find3-cli-scanner -i hvint0 -device laptop -family mytest -server  http://localhost:11883 -scantime 1 -debug"
2018-04-09 06:24:38 [INFO] main.go main:76 scanning with hvint0
2018-04-09 06:24:38 [DEBUG] utils.go RunCommand:14 /sbin/iw dev hvint0 scan -u
2018-04-09 06:24:38 [ERROR] utils.go RunCommand:40 exit status 1: /sbin/iw dev hvint0 scan -u
2018-04-09 06:24:38 [DEBUG] main.go basicCapture:162 {
 "t": 1523255078668,
 "f": "mytest",
 "d": "laptop",
 "s": {
  "wifi": {}
 },
 "gps": {}
}
2018-04-09 06:24:38 [DEBUG] server-main.go postData:47 posting data
2018-04-09 06:24:38 [ERROR] main.go basicCapture:164 Post http://localhost:11883/data: EOF
schollz commented 6 years ago

What about the other interfaces?

Lazzaretti commented 6 years ago

I get the same error with all listed interfaces

schollz commented 6 years ago

Hm, I'm not sure then. I haven't tested with Docker on Windows, we'll have to wait for someone else to try.

schollz commented 6 years ago

It should now work natively on Windows