= BT3 ONLY! =
Hey every1,
This is my very first post and after reading alot of tuts on this forum i decided to give something back.
Setting up bluetooth properly can be a pain in the ass(if you know little about it). Thats why i've made a little shell script menu wich allows the configuration to be easy and reliable.
This script is build out of drgr33n's bluetooth tutorial in combination with some other users comments and other sources.
I havent tested this with bluesnarf and bluebug due lack of equipment. But the least it can do is let you properly pair with your cell.
Here is the shell code:
Code:
menu=n
while [ $menu = n ]
do
menu=y
clear
echo -----------------------------------------------
echo "Blue-Build v1.0c"
echo "Made by DavetehDuud"
echo
echo "Special tnx to drgr33n, DARTIS, and thewheelieking"
echo -----------------------------------------------
echo
echo "[1] Config Bluetooth"
echo "[2] Bind rfcomm multi"
echo "[3] Bind rfcomm solo"
echo "[4] Test obexftp connection"
echo "[5] Change your mac adress"
echo
echo Choice? "(1,2,3)"
read choice
case $choice in
1)
echo
echo
echo "What is your hci adapter? (e.g. hci0)"
read dhci
echo "Pincode? (e.g. 0000, 1234)"
read dpin
echo "Your broadcast name?"
read dname
echo "Local device class? (eg. 0x5a0204)"
read dclass
echo
echo "Removing old hcid.conf..."
rm /etc/bluetooth/hcid.conf
echo "Building hcid.conf..."
echo '#
# HCI daemon configuration file.
#
# HCId options
options {
# Automatically initialize new devices
autoinit yes;
# Security Manager mode
# none - Security manager disabled
# auto - Use local PIN for incoming connections
# user - Always ask user for a PIN
#
security auto;
# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired devices
# once - Pair once and deny successive attempts
pairing multi;
# Default PIN code for incoming connections
passkey "'$dpin'";
}
# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
name "'$dname'";
# Local device class
class '$dclass';
#use hcitool inq to determine a devices class
# Default packet type
#pkt_type DH1,DM1,HV1;
# Inquiry and Page scan
iscan enable;
pscan enable;
# Default link mode
# none - no specific policy
# accept - always accept incoming connections
# master - become master on incoming connections,
# deny role switch on outgoing connections
lm accept,master;
# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
lp rswitch,hold,sniff,park;
auth enable;
encrypt enable;
}' >> /etc/bluetooth/hcid.conf
chmod +x /etc/bluetooth/hcid.conf
echo "Building PIN..."
echo "$dpin" >> /etc/bluetooth/passkeys/default
chmod +x /etc/bluetooth/passkeys/default
echo
echo "Restarting bluetooth..."
bash /etc/rc.d/rc.bluetooth restart
hciconfig $dhci reset
echo "Done..."
;;
2)
echo
echo
echo Target MAC?
read mac
echo "Interface? (hci*)"
read int
echo Dailup channel?
read dail
echo OBEX Push channel?
read obexp
echo OBEX FTP channel?
read obex
echo
echo "Releasing old rfcomm binds..."
rfcomm release 0
rfcomm release 1
rfcomm release 2
rfcomm release 3
#echo restarting bluetooth...
#bash /etc/rc.d/rc.bluetooth restart
#hciconfig $int up
#echo enabling Inquiry and Page scan...
#hciconfig $int piscan
#echo mknod...
#mknod -m 666 /dev/rfcomm1 c 216 1
#mknod -m 666 /dev/rfcomm2 c 216 2
#mknod -m 666 /dev/rfcomm3 c 216 3
#echo sdptool...
#sdptool add --channel=1 DUN
#sdptool add --channel=2 FTP
#sdptool add --channel=3 OPUSH
echo "Binding new rfcomm..."
rfcomm bind 0 $mac $dail
rfcomm bind 1 $mac $obexp
rfcomm bind 2 $mac $obex
echo printing rfcomm binds...
rfcomm
echo done...
;;
3)
menu=n
while [ $menu = n ]
do
menu=y
echo
echo
echo "Wich service would you bind on rfcomm0?"
echo "[1] Dial-up"
echo "[2] Obex ftp"
echo "[3] Obex-push-profile"
echo
echo Choice? "(1,2,3)"
read choice
case $choice in
1)
ser="DUN"
;;
2)
ser="FTP"
;;
3)
ser="OPUSH"
;;
*)
clear;
echo Error, Wrong choice;
echo ;
echo "Press [enter] key to continue. . .";
read enterKey;
menu=n;;
esac
done
echo Target MAC?
read mac
echo "Interface? (hci*)"
read int
echo Service channel?
read cnnl
echo "Releasing old rfcomm binds..."
rfcomm release 0
rfcomm release 1
rfcomm release 2
rfcomm release 3
#echo restarting bluetooth...
#bash /etc/rc.d/rc.bluetooth restart
#hciconfig $int up
#echo enabling Inquiry and Page scan...
#hciconfig $int piscan
#echo mknod...
#mknod -m 666 /dev/rfcomm0 c 216 1
#echo setting up sdptool...
#sdptool add --channel=1 $ser
echo "Binding new rfcomm..."
rfcomm bind 0 $mac $ser
echo printing rfcomm bind...
rfcomm
echo done...
;;
4)
echo "Client mac you want to connect with?"
read pmac
obexftp -b $pmac -c / -l
;;
5)
echo "All rfcomm binds will be released during a mac change"
echo
echo "Your new mac adress?"
read smac
echo "The hci adapter? (e.g. hci0)"
read sdev
bdaddr $smac
echo "Restarting bluetooth..."
bash /etc/rc.d/rc.bluetooth restart
hciconfig $sdev reset
hciconfig $sdev
echo
echo "If your mac remained the same, please replug your bt-adapter."
;;
*)
clear;
echo Error, Wrong choice;
echo ;
echo "Press [enter] key to continue. . .";
read enterKey;
menu=n;;
esac
done
Im unsure if the rfcomm bindings are correct, also I cant garantue that the mac change option will work. So @ everyone who knows something about bluetooth, PLEASE look into this 
later.