bluetooth spam

Carlo Minucci gecco at napodano.com
Wed Apr 22 13:38:44 CEST 2009


i have write a little application for spam a file via bluetooth :)

this is the code (you need openpush package)

#!/usr/bin/python

import os
import string
import time

start_bluetooth="echo 1 > 
/sys/bus/platform/devices/neo1973-pm-bt.0/power_on; echo 0 > 
/sys/bus/platform/devices/neo1973-pm-bt.0/reset; /etc/init.d/bluetooth 
start"
os.system(start_bluetooth)

while 1>0:
    dev_scan = "hcitool scan"
    list_dev=os.popen(dev_scan)
    tot= list_dev.read()
    tot= tot.split("\n")
    tot.pop(0)
    tot.reverse()
    tot.pop(0)
    for dev in tot:
        dev=dev.split("\t")
        get_channel = "sdptool search --bdaddr " + dev[1] + " OPUSH | 
sed 's/ //g' | grep Channel | cut -d: -f 2"
        channel_scan=os.popen(get_channel)
        channel=channel_scan.read()
        print "!" + channel[:-1] + "!"
        if channel != "":
            send_file="obextool push file.txt " + dev[1] +  " " + channel
            print "sending file to \"" + dev[2] + "\""
            print send_file
            send=os.system(send_file)
    time.sleep(5)




More information about the community mailing list