Back|Track 2 & Bluetooth GPS

I upgraded my old Inspiron 2100 ultra-portable a while back to the best security suite ever, Backtrack 2.0, and had not gotten around to checking out it's new tools yet until recently at a storage & virtualization seminar.

It turns out the Bluetooth/GPS script I posted previously is broken in V. 2.0, because they did away with the "start-gps-daemon" and "stop-gps-daemon" scripts (I believe it's no longer necessary because the newer version of gpsd hunts down the baud rate automatically). Easily remedied, though I just wanted to update the BT1 GPS post to reflect these changes, and to provide some slightly better documentation for users wishing to get their bluetooth receivers working for their wardriving needs. This assumes you have a hard drive install of BT2, a Bluetooth GPS receiver, and a Bluetooth interface (ie. USB) to get them talking.

First, we need to get your USB interface up and find out your GPS receiver's MAC address:

bt ~ # hciconfig hci0 up && hcitool scan
Scanning ...
        00:0H:B7:72:45:8B       BT-GPS-33847A

So copy down the MAC address ("00:0H:B7:72:45:8B" in this example), open up "/usr/etc/bluetooth/rfcomm.conf" and change the device parameter to look like this:

rfcomm0 {
bind yes;
device 00:0H:B7:72:45:8B;
channel 1;
comment "OnCourse Bluetooth GPS";
}

Now, just create a file called "start-gps" (preferably in /usr/local/bin), and paste this in there (you need to specify your GPS's MAC once more on the 9th line):

#!/bin/bash
# start-gps

    echo "Starting Bluetooth..."
    hciconfig hci0 up

    # insert your own hwaddr below
    echo "Connecting to GPS ..."
    hcitool cc 00:0H:B7:72:45:8B

    # show connected
    hcitool con

    echo "Binding to rfcomm0..."
    rfcomm bind rfcomm0

    echo "Starting GPSD..."
    #start gpsd in daemon mode on port /dev/rfcomm0
    gpsd -n -D 2 /dev/rfcomm0

echo "Done."

And something to shut things down cleanly (call it /usr/local/bin/stop-gps):

#!/bin/bash
# stop-gps

    echo "Stopping GPSD..."
    killall gpsd

    echo "Releasing rfcomm0..."
    rfcomm release rfcomm0

    echo "Disconnecting from GPS Reciever..."
    hcitool dc 00:0H:B7:72:45:8B

    echo "Stopping Bluetooth..."
    hciconfig hci0 down

echo "Done."

Don't forget to "chmod 755" these guys. And now to cap off, a cut and paste from my original post:

If no error messages displayed, and GPSD confirmed it's running on port 2947, you should be good to go. To test communication, try running "xgps". If there's nothing happening, try "telnet localhost 2947" and type "r" to see if there is any GPS output scrolling down your terminal (hit "ctrl+]" to stop, "q" to quit). If you connected to the port fine, but there's no output, type "rfcomm" to ensure there is a device bound. Double check rfcomm.conf is configured correctly, and try to bind again with "rfcomm bind rfcomm0". Once you have this working, you should have a nice range of GPS-aware apps like Kismet and GpsDrive (or both in conjunction) to experiment with. Have fun!