#!/bin/bash # # mass-blue is a bluetooth mass-sending tool for files of any kind. # It's useful for commercials or mass-deploying software. # # It uses hcitool to search for devices, then uses sdptool to get the correct # channel and then does an OBEX Object Push. The ussp-push tool does not always # get the correct channel on a "Sony Ericsson K610" and maybe others; I have no idea why. # # You can use the "list" functions (-o/-F) to only send a file once to every user; # which I strongly suggest! Bombing really doesn't make sense. # # The script was successfully tested with an SGH-i300 and an K610. # # Copyright (c) 2007 by Stefan Behte # # mass-blue is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # mass-blue is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with mass-blue; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Written by Stefan Behte # # Please send bugs, comments, wishes and success stories to: # Stefan.Behte at gmx dot net # # Also have a look at my page: # http://ge.mine.nu/ # # BTW: mass-blue needs ussp-push (http://www.xmailserver.org/ussp-push.html) # FILE=/dev/null FILE_PHONE=software SLEEP_INTERVAL=15 LIST=/dev/null usage() { echo -e "\nmass-blue v0.1 by Stefan Behte\nMass-deployment tool for bluetooth files" echo -e "\nusage: $0 -f [file to send] -p [filename on the phone] -s [sleep between scans] -F [listfile] -o {only send once to every device}\n" exit 1 } die() { printf "$@\n" exit 1 } if [ ! -n "`which ussp-push`" ] then die "ussp-push not found.\n" fi while getopts "f:p:s:oF:" Option do case $Option in f) if [ -e ${OPTARG} ]; then FILE=${OPTARG};else die "file $OPTARG does not exist.\n";fi;; p) FILE_PHONE=${OPTARG};; s) SLEEP_INTERVAL=${OPTARG};; o) LIST=/tmp/.mass-blue.tmp;; F) if [ -e ${OPTARG} ]; then LIST=${OPTARG};else die "file $OPTARG does not exist.\n";fi;; *) usage;; esac done if [ ! -n "$1" ] then usage fi echo -e "\nlocal file:\t$FILE" echo -e "remote file:\t$FILE_PHONE" echo -e "sleep interval:\t$SLEEP_INTERVAL" echo -e "list:\t\t$LIST\n" while [ 1 ] do hcitool scan | grep ":" | awk '{print $1}' | while read MAC do if ! grep ${MAC} ${LIST} &>/dev/null then CHANNEL=`sdptool browse $MAC | grep -A11 "Service Name: OBEX Object Push" | grep "Channel: " | awk '{print $2}'` ussp-push ${MAC}@${CHANNEL} ${FILE} ${FILE_PHONE} & echo ${MAC} >> ${LIST} fi done sleep ${SLEEP_INTERVAL} done