Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser thread undefined method `compact' #131

Open
blue-eyes1544 opened this issue Mar 6, 2019 · 4 comments
Open

Parser thread undefined method `compact' #131

blue-eyes1544 opened this issue Mar 6, 2019 · 4 comments

Comments

@blue-eyes1544
Copy link

I get the following error when running Blue Hydra.
Blue Hydra will only run for a few seconds and then quit.

# Logfile created on 2019-03-06 15:11:24 +0100 by logger.rb/v1.2.7
I, [2019-03-06T15:11:25.482719 #14992]  INFO -- : BlueHydra Starting...
I, [2019-03-06T15:11:25.493943 #14992]  INFO -- : No devices found in DB, starting clean.
I, [2019-03-06T15:11:25.494852 #14992]  INFO -- : Result thread starting
I, [2019-03-06T15:11:25.495559 #14992]  INFO -- : Parser thread starting
I, [2019-03-06T15:11:25.539094 #14992]  INFO -- : Pulse sync starting...
I, [2019-03-06T15:11:25.540156 #14992]  INFO -- : Chunker thread starting
I, [2019-03-06T15:11:25.550361 #14992]  INFO -- : 0 host sync complete
I, [2019-03-06T15:11:25.551305 #14992]  INFO -- : Btmon thread starting
I, [2019-03-06T15:11:25.551876 #14992]  INFO -- : ...Pulse sync complete
I, [2019-03-06T15:11:25.552813 #14992]  INFO -- : Discovery thread starting
I, [2019-03-06T15:11:25.575871 #14992]  INFO -- : Command Line UI thread starting
W, [2019-03-06T15:11:28.751300 #14992]  WARN -- : 1D:1B:D1:2B:34:7C can not save.
W, [2019-03-06T15:11:28.752511 #14992]  WARN -- : le_company_data: ["Le company data must be at most 50 characters long"] (01092002dfbb6440c382202118de885826310fe7db5a10baf603dc)
W, [2019-03-06T15:11:28.753026 #14992]  WARN -- : 1D:1B:D1:2B:34:7C save failed.
E, [2019-03-06T15:11:29.365020 #14992] ERROR -- : Parser thread undefined method `compact' for {"long_vendor"=>"Intel Corporate", "short_vendor"=>"IntelCor"}:Hash
E, [2019-03-06T15:11:29.365336 #14992] ERROR -- : /var/lib/gems/2.3.0/gems/louis-2.1.0/lib/louis.rb:35:in `lookup'
E, [2019-03-06T15:11:29.365444 #14992] ERROR -- : /home/pi/blue_hydra/lib/blue_hydra/cli_user_interface_tracker.rb:159:in `update_cui_status'
E, [2019-03-06T15:11:29.365530 #14992] ERROR -- : /home/pi/blue_hydra/lib/blue_hydra/runner.rb:745:in `block in start_parser_thread'
I, [2019-03-06T15:11:30.726112 #14992]  INFO -- : Ubertooth thread starting
E, [2019-03-06T15:11:30.732701 #14992] ERROR -- : Thread failure: parser_thread
I, [2019-03-06T15:11:30.753918 #14992]  INFO -- : Runner stopped. Exiting after clearing queue...
I, [2019-03-06T15:11:30.754843 #14992]  INFO -- : Queue clear! Exiting.
W, [2019-03-06T15:11:30.756187 #14992]  WARN -- : GOODBYE! ^_^
@GarryQualls
Copy link

I am also having this same problem with a clean Raspbian install on a Pi 3 B+ and an Ubertooth One. Everything is running the latest versions of everything as far as I can tell. I get 4 seconds of data and then it errors out, as above.

@GarryQualls
Copy link

OK, I seem to have gotten around this error by modifying the "louis.rb" file that is referenced in the 2nd error message above. On a Raspberry Pi running Raspbian Stretch, I did the following:

cd /var/lib/gems/2.3.0/gems/louis-2.1.0/lib/
sudo chmod 777 louis.rb

Then, I opened /var/lib/gems/2.3.0/gems/louis-2.1.0/lib/louis.rb with simple text editor, deleted .compact from line 35 and from line 40, and saved the file. Then I changed the file permissions on louis.rb back to 644 (not that it matters much in a hack this sloppy).

After that, blue_hydra runs without generating errors that bring it to a halt. There are a few warnings about discarding chunks with no addresses in the log file. I do not know if that is related to my change.

From a little googling, compact() in Ruby is supposed to return a copy of the array with all the nil elements removed, so now that section of louis.rb is probably returning the array instead of a copy of the array? This is the first time I've actually seen ruby code, so I don't understand the potential implications of this and I don't know what kind of havoc making this change to louis.rb is likely to unleash.

@zhilton
Copy link

zhilton commented Apr 18, 2019

This issue is not entirely with BlueHydra. BlueHydra utilizes Louis for looking up addresses and attributing them to a manufacturer. Louis was being developed under https://github.com/pwnieexpress/louis but seems to have gone quiet as of October 2017. One of the contributors @sstelfox seems to have continued the project at https://github.com/sstelfox/louis. As of release 2.0.8 of Louis, the project added Hash#compact to lines 35 and 40 of lib/louis.rb. This serves to remove elements with a 'nil' value from the returned hash (I didn't check if this would negatively impact BlueHydra), but wasn't added to the Ruby language until Ruby 2.4.0. BlueHydra currently claims to require Ruby version 2.1. By default, when you gem install louis, you get the latest version, updated quite recently, and seemingly requiring Ruby >2.4.0.

Possible fixes to this are to either do bundle install as recommended and then change the version of Louis to 2.0.7 (I don't ruby often so I would do

gem uninstall louis
gem install louis -v 2.0.7

but there is likely a better way) or to change the required language from Ruby 2.1 to Ruby 2.4.0. Also I guess it may be possible to define the gemfile to grab the appropriate version, but then BlueHydra will stop receiving updates of Louis...

As for the Raspberry Pi (which is why I also found this bug), the default repository for when you issue apt install ruby-dev is installing Ruby 2.3.3 (at least when I tried this recently), which should work fine for BlueHydra as stated, but doesn't support the latest Louis. I'll be submitting an issue to the new Louis repository as well to up-rev the required language.

@zhilton
Copy link

zhilton commented Apr 18, 2019

After opening an issue to update the required Ruby version in Louis, @sstelfox implemented a backwards compatible fix, release 2.1.4, that should fix this particular issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants