hubsmoke / bro

A CLI to interact with bropages.org
bropages.org
Other
404 stars 29 forks source link

'command isn't in our database' for every query #65

Closed jonascarpay closed 8 years ago

jonascarpay commented 8 years ago

For example; The curl command isn't in our database.

Is there a way I can troubleshoot the issue? I have made sure I'm on the most recent version of gem/ruby and bro and I have verified that there are no network issues.

hubsmoke commented 8 years ago

Can you access http://bropages.org/curl.json

On Sunday, October 16, 2016, Jonas Carpay notifications@github.com wrote:

For example; The curl command isn't in our database.

Is there a way I can troubleshoot the issue? I have made sure I'm on the most recent version of gem/ruby and bro and I have verified that there are no network issues.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hubsmoke/bro/issues/65, or mute the thread https://github.com/notifications/unsubscribe-auth/AARBZiwp0AB4hhiB1J2EkOj7jIrvRGeIks5q0jxlgaJpZM4KX_f7 .

jonascarpay commented 8 years ago

Yes

➜  ~ curl http://bropages.org/curl.json | tail -b 1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5188    0  5188    0     0  13787      0 --:--:-- --:--:-- --:--:-- 13908
":"2015-09-22T22:51:43.000Z","id":477,"up":1,"down":1},{"cmd":"curl","msg":"# your_comment_here\nman curl","updated_at":"2016-05-31T20:58:47.000Z","id":1283,"up":1,"down":2},{"cmd":"curl","msg":"# Download http://test.com/file.txt and print it to stdout. \ncurl -o - http://test.com/file.txt","updated_at":"2015-11-16T00:19:10.000Z","id":116,"up":1,"down":5},{"cmd":"curl","msg":"# your_comment_here\ncurl\nls\ngit\nwget\ndd\ndu\ncal\nln\nlink","updated_at":"2016-09-01T03:27:46.000Z","id":251,"up":2,"down":54}]%

➜  ~ bro curl
The curl command isn't in our database.

    * Typing bro add will let you add curl to our database!

    * There's nothing to lose by typing bro add, it will just launch an
editor with instructions.

    * Need help? Visit http://bropages.org/help
hubsmoke commented 8 years ago

What do

echo $HTTP_PROXY And echo $http_proxy

Output?

If it's not a network issue it might be a permissions issue since the program reads from the ~/.bro file in your home directory. I haven't tested what happens when that isn't writeable

If none of these produce results next thing I would do is write a small tester ruby script that uses the Net::HTTP library to make a request and see what happens

What's your ruby version and your OS?

On Monday, October 17, 2016, Jonas Carpay notifications@github.com wrote:

Yes

➜ ~ curl http://bropages.org/curl.json | tail -b 1 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 5188 0 5188 0 0 13787 0 --:--:-- --:--:-- --:--:-- 13908 ":"2015-09-22T22:51:43.000Z","id":477,"up":1,"down":1},{"cmd":"curl","msg":"# your_comment_here\nman curl","updated_at":"2016-05-31T20:58:47.000Z","id":1283,"up":1,"down":2},{"cmd":"curl","msg":"# Download http://test.com/file.txt and print it to stdout. \ncurl -o - http://test.com/file.txt","updated_at":"2015-11-16T00:19:10.000Z","id":116,"up":1,"down":5},{"cmd":"curl","msg":"# your_comment_here\ncurl\nls\ngit\nwget\ndd\ndu\ncal\nln\nlink","updated_at":"2016-09-01T03:27:46.000Z","id":251,"up":2,"down":54}]%

➜ ~ bro curl The curl command isn't in our database.

* Typing bro add will let you add curl to our database!

* There's nothing to lose by typing bro add, it will just launch an

editor with instructions.

* Need help? Visit http://bropages.org/help

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hubsmoke/bro/issues/65#issuecomment-254291178, or mute the thread https://github.com/notifications/unsubscribe-auth/AARBZsPWQK3k73w1tnRprc07x0x8AzBoks5q072cgaJpZM4KX_f7 .

jonascarpay commented 8 years ago

Neither are defined:

➜  ~ echo $HTTP_PROXY

➜  ~ echo $http_proxy

I don't think it's a permissions thing either:

➜  ~ ls -l .bro
-rwxrwxrwx  1 jmc  staff  9 Oct 18 15:30 .bro
➜  ~ bro curl
The curl command isn't in our database.

I'm not familiar with ruby, but I slapped together this quick script from an example:

require 'net/http'
require 'uri'

uri_ref = URI.parse("http://google.com/")
uri_bro = URI.parse("http://bropages.org/curl.json")

Net::HTTP.get_print(uri_ref)
Net::HTTP.get_print(uri_bro)

Which gives correct responses for both URLs.

I'm running OS X with ruby and gem installed through homebrew:

➜  ~ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.11.6
BuildVersion:   15G31
➜  ~ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
➜  ~ gem -v
2.5.1
hubsmoke commented 8 years ago

I'm going to check the site's logs to see if I see your requests coming through. I'm going to assume you were making requests for curl.json at 9 Oct 18 15:30

Can you also trying making a request for 'bro testing-bropages-error'? That will help too. Only do that through the bropages gem

On Tue, Oct 18, 2016 at 8:49 AM, Jonas Carpay notifications@github.com wrote:

Neither are defined:

➜ ~ echo $HTTP_PROXY

➜ ~ echo $http_proxy

I don't think it's a permissions thing either:

➜ ~ ls -l .bro -rwxrwxrwx 1 jmc staff 9 Oct 18 15:30 .bro ➜ ~ bro curl The curl command isn't in our database.

I'm not familiar with ruby, but I slapped together this quick script from an example:

require 'net/http'require 'uri'

uri_ref = URI.parse("http://google.com/") uri_bro = URI.parse("http://bropages.org/curl.json") Net::HTTP.get_print(uri_ref)Net::HTTP.get_print(uri_bro)

Which gives correct responses for both URLs.

I'm running OS X with ruby and gem installed through homebrew:

➜ ~ sw_vers ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G31 ➜ ~ ruby -v ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15] ➜ ~ gem -v 2.5.1

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hubsmoke/bro/issues/65#issuecomment-254513208, or mute the thread https://github.com/notifications/unsubscribe-auth/AARBZvfBq0rwSEEWprIQ2PZE7Tw9Ywzoks5q1M59gaJpZM4KX_f7 .

jonascarpay commented 8 years ago

Alright, I just made a single request. Note that my times are in GMT+1, so my 15:30 is 6:30 PST

hubsmoke commented 8 years ago

Thanks Jonas I'll take a look and report back

On Tuesday, October 18, 2016, Jonas Carpay notifications@github.com wrote:

Alright, I just made a single request. Note that my times are in GMT+1, so my 15:30 is 6:30 PST

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hubsmoke/bro/issues/65#issuecomment-254555372, or mute the thread https://github.com/notifications/unsubscribe-auth/AARBZl2QZoVV_1h9NE5GOWt7gtpgcse5ks5q1O3JgaJpZM4KX_f7 .

hubsmoke commented 8 years ago

Hey Jonas, I see no request for 'testing-bropages-error' in my logs. I can only conclude that there is some hard to debug network issue.

Do you have the BROPAGES_URL environment variable set? If so try unsetting it, we recently changed IP addresses.

On Tue, Oct 18, 2016 at 11:23 AM, Sina Iman sina.iman@gmail.com wrote:

Thanks Jonas I'll take a look and report back

On Tuesday, October 18, 2016, Jonas Carpay notifications@github.com wrote:

Alright, I just made a single request. Note that my times are in GMT+1, so my 15:30 is 6:30 PST

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hubsmoke/bro/issues/65#issuecomment-254555372, or mute the thread https://github.com/notifications/unsubscribe-auth/AARBZl2QZoVV_1h9NE5GOWt7gtpgcse5ks5q1O3JgaJpZM4KX_f7 .

jonascarpay commented 8 years ago

So I was messing around in irb when this happened:

irb(main):007:0> RestClient.get("http://bropages.org/curl.json")
Netrc::Error: Permission bits for '/Users/jmc/.netrc' should be 0600, but are 640

and sure enough

➜  ~ ls -l .netrc
-rw-r-----  1 jmc  staff  101 Mar 16  2016 .netrc
➜  ~ bro curl
The curl command isn't in our database.
...
➜  ~ chmod 600 .netrc
➜  ~ ls -l .netrc
-rw-------  1 jmc  staff  101 Mar 16  2016 .netrc
➜  ~ bro curl
26 entries for curl -- submit your own example with "bro add curl"

Anyway, I'm glad we figured it out. Thank you for your help!

hubsmoke commented 8 years ago

Thanks for reporting. This goes to show swallowing exceptions is bad. I will have to update the code to give a better error

On Wednesday, October 19, 2016, Jonas Carpay notifications@github.com wrote:

So I was messing around in irb when this happened:

irb(main):007:0> RestClient.get("http://bropages.org/curl.json")Netrc::Error: Permission bits for '/Users/jmc/.netrc' should be 0600, but are 640

and sure enough

➜ ~ ls -l .netrc -rw-r----- 1 jmc staff 101 Mar 16 2016 .netrc ➜ ~ bro curl The curl command isn't in our database. ... ➜ ~ chmod 600 .netrc ➜ ~ ls -l .netrc -rw------- 1 jmc staff 101 Mar 16 2016 .netrc ➜ ~ bro curl 26 entries for curl -- submit your own example with "bro add curl"

Anyway, I'm glad we figured it out. Thank you for your help!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hubsmoke/bro/issues/65#issuecomment-254797701, or mute the thread https://github.com/notifications/unsubscribe-auth/AARBZuvHL5y0-fcU__DogWbVV-jQsEloks5q1gz1gaJpZM4KX_f7 .