Git Product home page Git Product logo

bleah's Introduction

bleah's People

Contributors

bitdefect avatar evilsocket avatar jeffehobbs avatar tautology0 avatar thorsten-sick avatar vekkt0r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bleah's Issues

build issue - Bash Windows

Attempting to install this on Ubuntu - Windows Bash
I get the following error when trying to build

root@DESKTOP-L593AS0:~/bleah# uname -a
Linux DESKTOP-L593AS0 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux

I have installed the required bluepy and termibaltables.
Python version is 2.7.6

root@DESKTOP-L593AS0:~/bleah# python setup.py build
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/bleah
copying bleah/__init__.py -> build/lib.linux-x86_64-2.7/bleah
copying bleah/enumerate.py -> build/lib.linux-x86_64-2.7/bleah
copying bleah/scan.py -> build/lib.linux-x86_64-2.7/bleah
copying bleah/swag.py -> build/lib.linux-x86_64-2.7/bleah
copying bleah/vendors.py -> build/lib.linux-x86_64-2.7/bleah
copying bleah/version.py -> build/lib.linux-x86_64-2.7/bleah
copying bleah/write.py -> build/lib.linux-x86_64-2.7/bleah
running egg_info
creating bleah.egg-info
writing requirements to bleah.egg-info/requires.txt
writing bleah.egg-info/PKG-INFO
writing top-level names to bleah.egg-info/top_level.txt
writing dependency_links to bleah.egg-info/dependency_links.txt
writing manifest file 'bleah.egg-info/SOURCES.txt'
reading manifest file 'bleah.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '*.pyc'
warning: no previously-included files found matching '.DS_Store'
warning: no previously-included files found matching '.gitignore'
warning: no files found matching 'distribute_setup.py'
writing manifest file 'bleah.egg-info/SOURCES.txt'
Traceback (most recent call last):
  File "setup.py", line 42, in <module>
    install_requires     = [ 'bluepy', 'terminaltables' ]
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
    self.run_command(cmd_name)
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 43, in run
    self.build_package_data()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 98, in build_package_data
    for package, src_dir, build_dir, filenames in self.data_files:
  File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 55, in __getattr__
    self.data_files = files = self._get_data_files()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 81, in _get_data_files
    file[plen:] for file in self.find_data_files(package, src_dir)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 89, in find_data_files
    + self.package_data.get(package, []))
TypeError: can only concatenate list (not "str") to list

Scanning error :(

Hello, just have installed but not work.
Have you an idea ? Thanks.

Scanning for devices...
Traceback (most recent call last):
File "/usr/local/bin/blescan", line 11, in
load_entry_point('bluepy==1.1.2', 'console_scripts', 'blescan')()
File "/usr/local/lib/python2.7/dist-packages/bluepy/blescan.py", line 122, in main
devices = scanner.scan(arg.timeout)
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 679, in scan
self.start(passive=passive)
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 616, in start
self._startHelper(iface=self.iface)
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 246, in _startHelper
universal_newlines=True)
File "/usr/lib/python2.7/subprocess.py", line 390, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error

Script not set to UTF-8 encoding

As seen in the extract below:

[dave@mictlan bin]$ python -V
Python 2.7.13
[dave@mictlan bin]$ ./bleah
  File "./bleah", line 66
SyntaxError: Non-ASCII character '\xc2' in file ./bleah on line 66, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

This can be fixed by adding a comment to the bleah script of:

[dave@mictlan bin]$ head -2 bleah
#!/usr/bin/env python
# coding: utf-8

Failed to execute mgmt cmd 'le on'

I know there's a closed issue on this already but I tried to follow what's going on there and nothing seemed to work or maybe I'm just dumb.

 $ sudo /usr/local/bin/blescan
Scanning for devices...
Traceback (most recent call last):
  File "/usr/local/bin/blescan", line 11, in <module>
    load_entry_point('bluepy==1.1.2', 'console_scripts', 'blescan')()
  File "/usr/local/lib/python2.7/dist-packages/bluepy/blescan.py", line 122, in main
    devices = scanner.scan(arg.timeout)
  File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 679, in scan
    self.start(passive=passive)
  File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 617, in start
    self._mgmtCmd("le on")
  File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 276, in _mgmtCmd
    "Failed to execute mgmt cmd '%s'" % (cmd))
bluepy.btle.BTLEException: Failed to execute mgmt cmd 'le on'

Everytime I try to run sudo bleah -t0 it gives me to le on error. Sorry if I'm asking some stupid question here.

Failed to connect to peripheral xx:xx:xx:xx:xx:xx, addr type: random/public

Hi,
I wanted to understand why this exception appears? However when i try to force to connect to peripheral and enumerate it several time it sometimes works and show desired output, but most of the time i got the error - Failed to connect to peripheral xx:xx:xx:xx:xx:xx, addr type: random
or
Failed to connect to peripheral xx:xx:xx:xx:xx:xx, addr type: public

Edit: I use Bluetooth adapter.

TypeError: can only concatenate list (not "str") to list

~/bleah $ python setup.py build
running build
running build_py
running egg_info
writing requirements to bleah.egg-info/requires.txt
writing bleah.egg-info/PKG-INFO
writing top-level names to bleah.egg-info/top_level.txt
writing dependency_links to bleah.egg-info/dependency_links.txt
reading manifest file 'bleah.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '*.pyc'
warning: no previously-included files found matching '.DS_Store'
warning: no previously-included files found matching '.gitignore'
warning: no files found matching 'distribute_setup.py'
writing manifest file 'bleah.egg-info/SOURCES.txt'
Traceback (most recent call last):
File "setup.py", line 42, in
install_requires = [ 'bluepy', 'terminaltables' ]
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
self.run_command(cmd_name)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 52, in run
self.build_package_data()
File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 107, in build_package_data
for package, src_dir, build_dir, filenames in self.data_files:
File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 65, in getattr
self.data_files = self._get_data_files()
File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 79, in _get_data_files
return list(map(self._get_pkg_data_files, self.packages or ()))
File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 91, in _get_pkg_data_files
for file in self.find_data_files(package, src_dir)
File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 98, in find_data_files
+ self.package_data.get(package, []))
TypeError: can only concatenate list (not "str") to list

Write to a handle rather than a UUID

I'm looking at a device here that's got two 2a06 (alert level) characteristics in different services. So it would be nice to be able to specify the handle I want to write to rather than the UUID.

So the command line would be something like:
bleah -i 1 -b aa:bb:cc:dd:ee:ff --handle 0x25 -d A

Documentation Corrections

Bluepy has a prerequisite libglib2.0-dev. This line is missing in Install bluepy from source::
$ sudo apt-get install git build-essential libglib2.0-dev

Alternatively could use the PIP instructions or just reference the BluePy github.

In the Examples:
sudo bleah -b "aa:bb:cc:dd:ee:ff" -e
Quotes around the MAC does not work, at least on Kali Linux
sudo bleah -b aa:bb:cc:dd:ee:ff -e also works without quotes

MacOS bluepy: "sudo python setup.py install"

running install
Working dir is /Users/aslanaliev/bluepy
execute make -C ./bluepy clean
execute make -C bluepy -j1
Failed to compile bluepy-helper. Exiting install.
Command was 'make -C bluepy -j1' in /Users/aslanaliev/bluepy
Return code was 2
Output was:
make: Entering directory '/Users/aslanaliev/bluepy/bluepy'
tar xzf bluez-src.tgz
touch ./bluez-5.29/lib/bluetooth.c ./bluez-5.29/lib/hci.c ./bluez-5.29/lib/sdp.c ./bluez-5.29/lib/uuid.c ./bluez-5.29/attrib/att.c ./bluez-5.29/attrib/gatt.c ./bluez-5.29/attrib/gattrib.c ./bluez-5.29/attrib/utils.c ./bluez-5.29/btio/btio.c ./bluez-5.29/src/log.c ./bluez-5.29/src/shared/mgmt.c ./bluez-5.29/src/shared/crypto.c ./bluez-5.29/src/shared/att.c ./bluez-5.29/src/shared/queue.c ./bluez-5.29/src/shared/util.c ./bluez-5.29/src/shared/io-glib.c ./bluez-5.29/src/shared/timeout-glib.c
make: pkg-config: Command not found
make: pkg-config: Command not found
gcc -L. -Os -g -Wall  -DHAVE_CONFIG_H -I./bluez-5.29/attrib -I./bluez-5.29 -I./bluez-5.29/lib -I./bluez-5.29/src -I./bluez-5.29/gdbus -I./bluez-5.29/btio  -o bluepy-helper bluepy-helper.c ./bluez-5.29/lib/bluetooth.c ./bluez-5.29/lib/hci.c ./bluez-5.29/lib/sdp.c ./bluez-5.29/lib/uuid.c ./bluez-5.29/attrib/att.c ./bluez-5.29/attrib/gatt.c ./bluez-5.29/attrib/gattrib.c ./bluez-5.29/attrib/utils.c ./bluez-5.29/btio/btio.c ./bluez-5.29/src/log.c ./bluez-5.29/src/shared/mgmt.c ./bluez-5.29/src/shared/crypto.c ./bluez-5.29/src/shared/att.c ./bluez-5.29/src/shared/queue.c ./bluez-5.29/src/shared/util.c ./bluez-5.29/src/shared/io-glib.c ./bluez-5.29/src/shared/timeout-glib.c 
bluepy-helper.c:33:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^
1 error generated.
In file included from ./bluez-5.29/lib/bluetooth.c:38:
./bluez-5.29/lib/bluetooth.h:36:10: fatal error: 'endian.h' file not found
#include <endian.h>
         ^
1 error generated.
In file included from ./bluez-5.29/lib/hci.c:44:
./bluez-5.29/lib/bluetooth.h:36:10: fatal error: 'endian.h' file not found
#include <endian.h>
         ^
1 error generated.
In file included from ./bluez-5.29/lib/sdp.c:45:
./bluez-5.29/lib/bluetooth.h:36:10: fatal error: 'endian.h' file not found
#include <endian.h>
         ^
1 error generated.
In file included from ./bluez-5.29/lib/uuid.c:33:
./bluez-5.29/lib/bluetooth.h:36:10: fatal error: 'endian.h' file not found
#include <endian.h>
         ^
1 error generated.
./bluez-5.29/attrib/att.c:33:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^
1 error generated.
./bluez-5.29/attrib/gatt.c:32:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^
1 error generated.
./bluez-5.29/attrib/gattrib.c:34:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^
1 error generated.
./bluez-5.29/attrib/utils.c:30:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^
1 error generated.
./bluez-5.29/btio/btio.c:37:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^
1 error generated.
./bluez-5.29/src/log.c:32:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^
1 error generated.
In file included from ./bluez-5.29/src/shared/mgmt.c:33:
./bluez-5.29/lib/bluetooth.h:36:10: fatal error: 'endian.h' file not found
#include <endian.h>
         ^
1 error generated.
In file included from ./bluez-5.29/src/shared/crypto.c:33:
./bluez-5.29/src/shared/util.h:27:10: fatal error: 'byteswap.h' file not found
#include <byteswap.h>
         ^
1 error generated.
In file included from ./bluez-5.29/src/shared/att.c:34:
./bluez-5.29/src/shared/util.h:27:10: fatal error: 'byteswap.h' file not found
#include <byteswap.h>
         ^
1 error generated.
In file included from ./bluez-5.29/src/shared/queue.c:28:
./bluez-5.29/src/shared/util.h:27:10: fatal error: 'byteswap.h' file not found
#include <byteswap.h>
         ^
1 error generated.
In file included from ./bluez-5.29/src/shared/util.c:38:
./bluez-5.29/src/shared/util.h:27:10: fatal error: 'byteswap.h' file not found
#include <byteswap.h>
         ^
1 error generated.
./bluez-5.29/src/shared/io-glib.c:30:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^
1 error generated.
./bluez-5.29/src/shared/timeout-glib.c:22:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^
1 error generated.
make: *** [Makefile:28: bluepy-helper] Error 1
make: Leaving directory '/Users/aslanaliev/bluepy/bluepy'

Aslans-Air:bluepy aslanaliev$ 

dunno how to fix this :(

Error when installing Bluepy.

I get this output when attempting to install Bluepy.
sudo python setup.py install
running install
Working dir is /root/bluepy
execute make -C ./bluepy clean
execute make -C bluepy -j1
Failed to compile bluepy-helper. Exiting install.
Command was 'make -C bluepy -j1' in /root/bluepy
Return code was 2
Output was:
make: Entering directory '/root/bluepy/bluepy'
tar xzf bluez-src.tgz
touch ./bluez-5.29/lib/bluetooth.c ./bluez-5.29/lib/hci.c ./bluez-5.29/lib/sdp.c ./bluez-5.29/lib/uuid.c ./bluez-5.29/attrib/att.c ./bluez-5.29/attrib/gatt.c ./bluez-5.29/attrib/gattrib.c ./bluez-5.29/attrib/utils.c ./bluez-5.29/btio/btio.c ./bluez-5.29/src/log.c ./bluez-5.29/src/shared/mgmt.c ./bluez-5.29/src/shared/crypto.c ./bluez-5.29/src/shared/att.c ./bluez-5.29/src/shared/queue.c ./bluez-5.29/src/shared/util.c ./bluez-5.29/src/shared/io-glib.c ./bluez-5.29/src/shared/timeout-glib.c
make: pkg-config: Command not found
make: pkg-config: Command not found
gcc -L. -Os -g -Wall -DHAVE_CONFIG_H -I./bluez-5.29/attrib -I./bluez-5.29 -I./bluez-5.29/lib -I./bluez-5.29/src -I./bluez-5.29/gdbus -I./bluez-5.29/btio -o bluepy-helper bluepy-helper.c ./bluez-5.29/lib/bluetooth.c ./bluez-5.29/lib/hci.c ./bluez-5.29/lib/sdp.c ./bluez-5.29/lib/uuid.c ./bluez-5.29/attrib/att.c ./bluez-5.29/attrib/gatt.c ./bluez-5.29/attrib/gattrib.c ./bluez-5.29/attrib/utils.c ./bluez-5.29/btio/btio.c ./bluez-5.29/src/log.c ./bluez-5.29/src/shared/mgmt.c ./bluez-5.29/src/shared/crypto.c ./bluez-5.29/src/shared/att.c ./bluez-5.29/src/shared/queue.c ./bluez-5.29/src/shared/util.c ./bluez-5.29/src/shared/io-glib.c ./bluez-5.29/src/shared/timeout-glib.c
bluepy-helper.c:33:10: fatal error: glib.h: No such file or directory
#include <glib.h>
^~~~~~~~
compilation terminated.
./bluez-5.29/attrib/att.c:33:10: fatal error: glib.h: No such file or directory
#include <glib.h>
^~~~~~~~
compilation terminated.
./bluez-5.29/attrib/gatt.c:32:10: fatal error: glib.h: No such file or directory
#include <glib.h>
^~~~~~~~
compilation terminated.
./bluez-5.29/attrib/gattrib.c:34:10: fatal error: glib.h: No such file or directory
#include <glib.h>
^~~~~~~~
compilation terminated.
./bluez-5.29/attrib/utils.c:30:10: fatal error: glib.h: No such file or directory
#include <glib.h>
^~~~~~~~
compilation terminated.
./bluez-5.29/btio/btio.c:37:10: fatal error: glib.h: No such file or directory
#include <glib.h>
^~~~~~~~
compilation terminated.
./bluez-5.29/src/log.c:32:10: fatal error: glib.h: No such file or directory
#include <glib.h>
^~~~~~~~
compilation terminated.
./bluez-5.29/src/shared/io-glib.c:30:10: fatal error: glib.h: No such file or directory
#include <glib.h>
^~~~~~~~
compilation terminated.
./bluez-5.29/src/shared/timeout-glib.c:22:10: fatal error: glib.h: No such file or directory
#include <glib.h>
^~~~~~~~
compilation terminated.
Makefile:28: recipe for target 'bluepy-helper' failed
make: *** [bluepy-helper] Error 1
make: Leaving directory '/root/bluepy/bluepy'

Error '! Helper not started (did you call connect()?)'

Hello!
While connecting, I got the error
! Helper not started (did you call connect()?)
With enabled debug, I get:

@ Scanning for 5s [-128 dBm of sensitivity] ...

Running  /usr/lib/python2.7/site-packages/bluepy/bluepy-helper
Sent:  le on

Got: 'rsp=$mgmt code=$success\n'
Sent:  scan

Got: 'rsp=$mgmt code=$success\n'
Got: "rsp=$stat state=$scan dst='(null) mtu=h0 sec='low\n"
Got: 'rsp=$scan addr=b476428CFE3E6 type=h2 rssi=h52 flag=h0 d=b02011A0AFF4C00100501183260D8\n'
Got: 'rsp=$scan addr=b6520F4A4CB0D type=h2 rssi=h5B flag=h0 d=b02011A0AFF4C0010050318A5252B\n'
┌ 65:20:f4:a4:cb:0d (-91 dBm) ─────────────────────────────────────────────────────────────────────┐
│ Vendor             │ ?                                                                           │
│ Allows Connections │ ✓                                                                           │
│ Address Type       │ random                                                                      │
│ Manufacturer       │ '4c0010050318a5252b'                                                        │
│ Flags              │ LE General Discoverable, LE + BR/EDR Controller Mode, LE + BR/EDR Host Mode │
└────────────────────┴─────────────────────────────────────────────────────────────────────────────┘

Select timeout
Sent:  scanend

Got: 'rsp=$mgmt code=$success\n'
Stopping  /usr/lib/python2.7/site-packages/bluepy/bluepy-helper
@ Connecting to 65:20:f4:a4:cb:0d ...Running  /usr/lib/python2.7/site-packages/bluepy/bluepy-helper
Sent:  conn 65:20:f4:a4:cb:0d random hci0

Got: "rsp=$stat state=$tryconn dst='65:20:f4:a4:cb:0d mtu=h0 sec='low\n"
Got: "rsp=$stat state=$conn dst='65:20:f4:a4:cb:0d mtu=h0 sec='low\n"
 connected.
@ Enumerating all the things Sent:  svcs

Got: "rsp=$find hstart=h1 hend=h5 uuid='00001800-0000-1000-8000-00805f9b34fb hstart=h6 hend=h9 uuid='00001801-0000-1000-8000-00805f9b34fb hstart=hA hend=hE uuid='d0611e78-bbb4-4591-a5f8-487910ae4366 hstart=hF hend=h13 uuid='9fa480e0-4967-4542-9390-d343dc5d04ae hstart=h14 hend=h17 uuid='0000180f-0000-1000-8000-00805f9b34fb hstart=h18 hend=h1D uuid='00001805-0000-1000-8000-00805f9b34fb hstart=h1E hend=h22 uuid='0000180a-0000-1000-8000-00805f9b34fb hstart=h23 hend=h2C uuid='7905f431-b5ce-4e99-a40f-4b1e122d00d0 hstart=h2D hend=h38 uuid='89d3502b-0f36-433a-8ef4-c502ad55f8dc\n"
Sent:  char 1 5

Got: "rsp=$find hnd=h2 props=h2 vhnd=h3 uuid='00002a00-0000-1000-8000-00805f9b34fb hnd=h4 props=h2 vhnd=h5 uuid='00002a01-0000-1000-8000-00805f9b34fb\n"
Sent:  rd 3

Got: 'rsp=$rd d=b69506164\n'
Sent:  rd 5

Got: 'rsp=$rd d=b8002\n'
Sent:  char 6 9

Got: "rsp=$find hnd=h7 props=h20 vhnd=h8 uuid='00002a05-0000-1000-8000-00805f9b34fb\n"
Sent:  char A E

Got: "rsp=$find hnd=hB props=h98 vhnd=hC uuid='8667556c-9a37-4c91-84ed-54ee27d90049\n"
Sent:  char F 13

Got: "rsp=$find hnd=h10 props=h98 vhnd=h11 uuid='af0badb1-5b99-43cd-917a-a77bc549e3cc\n"
Sent:  char 14 17

Got: "rsp=$find hnd=h15 props=h12 vhnd=h16 uuid='00002a19-0000-1000-8000-00805f9b34fb\n"
Sent:  rd 16

Got: "rsp=$stat state=$disc mtu=h0 sec='low\n"
Stopping  /usr/lib/python2.7/site-packages/bluepy/bluepy-helper
 
! Helper not started (did you call connect()?)

I am running Arch Linux.

Output to non-Curses format

The main reason why I want to use bleah was to have an easy way of dumping characteristics for reports. I'd used some custom scripts with nobel to do this before; but the utter mankiness of nodejs made this way harder than anything as simple as BLE ought to be.

The bleah table is everything I need; but the curses table is a bit inflexible. So, can we have an -o option to write the enumeration table to a generic file format (e.g. a TSV file)?

Error when running bleah - unicode conversion related?

When I run:
sudo bleah -i0 -t0

It returns the following error:

@ Continuous scanning [-128 dBm of sensitivity] ...

Traceback (most recent call last):
  File "/usr/local/bin/bleah", line 4, in <module>
    __import__('pkg_resources').run_script('bleah==1.0.0', 'bleah')
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py",
line 742, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py",
line 1503, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/EGG-INFO/scripts/bleah",
line 116, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/EGG-INFO/scripts/bleah",
line 76, in main
    devices = start_scan(args)
  File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/bleah/scan.py",
line 160, in start_scan
    return scanner.scan(args.timeout)
  File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line
680, in scan
    self.process(timeout)
  File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/bleah/scan.py",
line 78, in process
    self.delegate.handleDiscovery(dev, (dev.updateCount <= 1), isNewData)
  File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/bleah/scan.py",
line 140, in handleDiscovery
    tdata.append([ desc, yellow( val.decode('utf-8') ) ])
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in
position 1: ordinal not in range(128)

In the past I had issues with this error and what I did was first str.encode('utf-8') then the print it self. I don't know if this is the same issue...

BTW my current settings is:
$LANG - en_US.utf8
python 2.7
Running on a Debian machine.

Thanks!

oui's will never get loaded

In vendors.py there is the definition load() for reading the oui.dat file, but this function is never getting called.

parse Argument definition

Hello,

I just had a look at the source code and didn't find where the argument: -d, -e, -h, etc are defined.

Ascii encoding error

Looks like there are problems on some systems for the way the heart emoji in the banner is encoded.
emoji Seems like similar encoding issues in other parts of the application have been patched. Can this also be addressed?

Filed to install due a ethereal list concatenation

running build
running build_py
running egg_info
writing requirements to bleah.egg-info/requires.txt
writing bleah.egg-info/PKG-INFO
writing top-level names to bleah.egg-info/top_level.txt
writing dependency_links to bleah.egg-info/dependency_links.txt
reading manifest file 'bleah.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '*.pyc'
warning: no previously-included files found matching '.DS_Store'
warning: no previously-included files found matching '.gitignore'
warning: no files found matching 'distribute_setup.py'
writing manifest file 'bleah.egg-info/SOURCES.txt'
Traceback (most recent call last):
  File "setup.py", line 42, in <module>
    install_requires     = [ 'bluepy', 'terminaltables' ]
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
    self.run_command(cmd_name)
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 52, in run
    self.build_package_data()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 107, in build_package_data
    for package, src_dir, build_dir, filenames in self.data_files:
  File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 65, in __getattr__
    self.data_files = self._get_data_files()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 79, in _get_data_files
    return list(map(self._get_pkg_data_files, self.packages or ()))
  File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 91, in _get_pkg_data_files
    for file in self.find_data_files(package, src_dir)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 98, in find_data_files
    + self.package_data.get(package, []))
TypeError: can only concatenate list (not "str") to list```

Running on Docker, with
```FROM ubuntu:14.04
MAINTAINER Alessandro Pagiaro <[email protected]>
RUN apt-get update && apt-get upgrade -y && apt-get install -y git python python-setuptools make libperl-dev pkg-config gcc libgtk2.0-dev
RUN git clone https://github.com/IanHarvey/bluepy.git && \
	cd bluepy && \
	python setup.py build && \
	sudo python setup.py install```

bluepy.btle.BTLEException: Device disconnected

@ Continuous scanning [-128 dBm of sensitivity] ...

┌ fc:8f:90:af:xx:xx (-88 dBm) ─────────────────────────────────────────────────┐
│ Vendor │ Samsung Electronics Co. │
│ Allows Connections │ ✓ │
│ Flags │ │
│ Manufacturer │ u'750042040101affc8f90af738cfe8f90af7xxxxxxxxxxxxxx' │
└────────────────────┴─────────────────────────────────────────────────────────┘

Traceback (most recent call last):
File "/usr/local/bin/bleah", line 4, in
import('pkg_resources').run_script('bleah==1.0.0', 'bleah')
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 748, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 1517, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/EGG-INFO/scripts/bleah", line 118, in
main()
File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/EGG-INFO/scripts/bleah", line 78, in main
devices = start_scan(args)
File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/bleah/scan.py", line 162, in start_scan
return scanner.scan(args.timeout)
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 681, in scan
self.stop()
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 630, in stop
self._mgmtCmd(self._cmd()+"end")
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 272, in _mgmtCmd
rsp = self._waitResp('mgmt')
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 326, in _waitResp
raise BTLEException(BTLEException.DISCONNECTED, "Device disconnected")
bluepy.btle.BTLEException: Device disconnected

error reading datafile

Hello,
I wanted to read a data file but I got the following error:
datafile_error

the file.txt is saved under the same directory where the bleah is

local variable 'raw' referenced before assignment

hi,
i get the error in title when enumerating device. moreover, if i try to write i get the same error on a function call.

i fixed it as follows:

in scan.py:
added from bleah.write import *

in enumerate.py (function enumerate_device_properties):
added raw=None initialization

read handle failed

Hello,
I tried just Tool and noticed that the read handle option did n't work properly I mean I wasn't able to read the handles of my BLE device
handle_read

Error when enumerating

Hi,

Experiencing errors while enumerating:

@ Connecting to 69:03:97:xx:xx:xx ... connected.
@ Enumerating all the things ........*** Error in `/usr/local/lib/python2.7/dist-packages/bluepy/bluepy-helper': corrupted size vs. prev_size: 0x000055a64419e46f ***

Not quite sure where/how the error appears - appears constantly for that device.

On a broadcom bluetooth stack on ubuntu 17.10.

Write without response doesn't work properly

I have a device with WWR permissions on one characteristic. Bleah (through Bluepy) tries to write to it. If I manually alter the write call to be char.write(arg.data, True) it works; even though this makes no sense according to bluepy's docs.

Looking through bluepy's source it looks like bluepy has the function of the withResponse parameter backwards (I'll be raising this on the bluepy project too).

For now we can work around this by checking where the permissions for it have "WRITE NOT RESPONSE". I have a patch for this I can send as a PR.

For future; if a characteristic has both write and WWR permissions, if would be nice if the user could chose which way they want to send the message.

"TypeError: can only concatenate list to list"

Hi,

Last night I was able to build and install on Ubuntu 16, but now I'm trying on Ubutu 14 but get this error when trying "python setup.py build";

Traceback (most recent call last):
  File "setup.py", line 42, in <module>
    install_requires     = [ 'bluepy', 'terminaltables' ]
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
    self.run_command(cmd_name)
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 52, in run
    self.build_package_data()
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 107, in build_package_data
    for package, src_dir, build_dir, filenames in self.data_files:
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 65, in __getattr__
    self.data_files = self._get_data_files()
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 79, in _get_data_files
    return list(map(self._get_pkg_data_files, self.packages or ()))
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 91, in _get_pkg_data_files
    for file in self.find_data_files(package, src_dir)
  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 98, in find_data_files
    + self.package_data.get(package, []))
TypeError: can only concatenate list (not "str") to list

Could you please give me some help to overcome the installation ?

I really appreciate any help you can provide.

Error after running bleah

After running, "sudo bleah" in the terminal the following error will appear :

Traceback (most recent call last):
File "/usr/local/bin/bleah", line 4, in
import('pkg_resources').run_script('bleah==1.0.0', 'bleah')
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 719, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1505, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/EGG-INFO/scripts/bleah", line 118, in
main()
File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/EGG-INFO/scripts/bleah", line 78, in main
devices = start_scan(args)
File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/bleah/scan.py", line 162, in start_scan
return scanner.scan(args.timeout)
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 679, in scan
self.start(passive=passive)
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 617, in start
self._mgmtCmd("le on")
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 276, in _mgmtCmd
"Failed to execute mgmt cmd '%s'" % (cmd))
bluepy.btle.BTLEException: Failed to execute mgmt cmd 'le on'

I would like help for solving this :D
OS : Kali Linux 2016.2

Traceback error

Hi, here is what i get with "sudo bleah -t0" :
Could you advice me?

@ Continuous scanning [-128 dBm of sensitivity] ...

Traceback (most recent call last):
File "/usr/local/bin/bleah", line 4, in
import('pkg_resources').run_script('bleah==1.0.0', 'bleah')
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 748, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1517, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/EGG-INFO/scripts/bleah", line 145, >in
main()
File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/EGG-INFO/scripts/bleah", line 105, >in main
devices = start_scan(args)
File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/bleah/scan.py", line 162, in >start_scan
return scanner.scan(args.timeout)
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 679, in scan
self.start(passive=passive)
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 616, in start
self._startHelper(iface=self.iface)
File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 246, in _startHelper
universal_newlines=True)
File "/usr/lib/python2.7/subprocess.py", line 390, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1025, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
zsh: exit 1 sudo bleah -t0

setup.py error

there was an error in the setup.py packages line (line 37) that cause the build command to fail.
with this error

TypeError: can only concatenate list (not "str") to list

i fixed it by changing that line to add a package selection as follows.

packages=find_packages(where='bleah.*'), 

hope that helps

Feature req: bluetooth stack debug when crashing

When experiencing 'comerr' from the bluetooth stack, it'd be great to have debug info:

│ 0018 -> 001d │ Current Time Service ( 00001805-0000-1000-8000-00805f9b34fb ) │ │ │
│ 001a │ Current Time ( 00002a2b-0000-1000-8000-00805f9b34fb ) │ NOTIFY READ │ Error from Bluetooth stack (comerr) │
│ 001d │ Local Time Information ( 00002a0f-0000-1000-8000-00805f9b34fb ) │ READ │ Error from Bluetooth stack (comerr) │

rpi3

hi got this error now:

osmc@osmc:~/bleah$ sudo bleah -t0


Traceback (most recent call last):
  File "/usr/local/bin/bleah", line 4, in <module>
    __import__('pkg_resources').run_script('bleah==1.0.0', 'bleah')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 534, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1438, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/EGG-INFO/scripts/bleah", line 145, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/EGG-INFO/scripts/bleah", line 84, in main
    print_sexy_banner()
  File "/usr/local/lib/python2.7/dist-packages/bleah-1.0.0-py2.7.egg/bleah/swag.py", line 71, in print_sexy_banner
    print "                " + blue("Made with ") + red(u"\u2764") + blue(" by Simone 'evilsocket' Margaritelli")
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2764' in position 40: ordinal not in range(128)

setup.py - error: can't copy

Commit 926f889 not working for me -- setup not decoding path ./

error: can't copy 'bleah/USERNAME/bleah/bleah/oui.dat': doesn't exist or not a regular file

Linux 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux

build on raspberry issue

hi got this when building on rp3:

root@osmc:/home/osmc/bleah# python setup.py build
running build
running build_py
running egg_info
writing requirements to bleah.egg-info/requires.txt
writing bleah.egg-info/PKG-INFO
writing top-level names to bleah.egg-info/top_level.txt
writing dependency_links to bleah.egg-info/dependency_links.txt
reading manifest file 'bleah.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '*.pyc'
warning: no previously-included files found matching '.DS_Store'
warning: no previously-included files found matching '.gitignore'
warning: no files found matching 'distribute_setup.py'
writing manifest file 'bleah.egg-info/SOURCES.txt'
error: can't copy 'bleah/osmc/bleah/bleah/oui.dat': doesn't exist or not a regular file

i am using the osmc (media center distribution) but mainly is a raspbian, got many tools running on it.

Feature: Nicknames for devices and characteristics

In addition to some hard coded names for default profiles (already in the code) it would be cool to have nicknames for devices and characteristics. This would make the table simpler to read.

Nicknames could be read from a json data file the user generated.
This feature could be opt-in and a special command line argument (together with the json file containing the nick names) would activate it.

I want to implement this anyway. Just wanted to collect some more ideas and feedback before I start coding.

A question about write.py

wwrflag=False

            if "NO RESPONSE" in char.propertiesToString():
                wwrflag=True

            try:
                char.write( args.data, wwrflag )

when recently I read the source code, I have a question. Why the wwrflag is true ,when the character is " NO RESPONSE". It is contrary to my understanding. Thank you for your help!!

Write binary values to a characteristic

At the moment you can only write ASCII data to a characteristic. Many characteristics (e.g. 2a06) take only a binary value. At the moment you have to mangle it into a file.

So, can we have an option to write a hex string (similar to the way gatttool works), e.g. to send \x01\x02\x03

bleah -i 1 -b aa:bb:cc:dd:ee:ff -u 0123 -x 010203

Alternatively, allow python style escapes in the string, such as:

bleah -i 1 -b aa:bb:cc:dd:ee:ff -u 0123 -d '\x01\x02\x03'

Issue running setup.py build

I've tried on 2 different linux machines to run the setup.py build and I'm receiving the following error:

writing manifest file 'bleah.egg-info/SOURCES.txt' Traceback (most recent call last): File "setup.py", line 42, in <module> install_requires = [ 'bluepy', 'terminaltables' ] File "/usr/lib/python2.7/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run self.run_command(cmd_name) File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command self.distribution.run_command(command) File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 52, in run self.build_package_data() File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 107, in build_package_data for package, src_dir, build_dir, filenames in self.data_files: File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 65, in __getattr__ self.data_files = self._get_data_files() File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 79, in _get_data_files return list(map(self._get_pkg_data_files, self.packages or ())) File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 91, in _get_pkg_data_files for file in self.find_data_files(package, src_dir) File "/usr/lib/python2.7/dist-packages/setuptools/command/build_py.py", line 98, in find_data_files + self.package_data.get(package, [])) TypeError: can only concatenate list (not "str") to list

I've tried with both python2 and python3, any thoughts? Seems to be an issue with the install_requires and list vs. string concatenation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.