Snorby / snorby

Ruby On Rails Application For Network Security Monitoring
Other
1k stars 226 forks source link

Fix Invalid multibyte escape errors/compatibility with ruby 2.0 #275

Open da667 opened 11 years ago

da667 commented 11 years ago

attempting to rake snorby:setup and using ruby2.0.0-p0 at first fails spectacularly due to a version check. Blowing away the version check works until snorby to explodes in a fit of rage, implicating lib/snorby/payload.rb as the culprit, claiming there are invalid multibyte escape errors.

Unfortunately, my knowledge of ruby extends far enough for me to:

I would like to request support for ruby 2.x.

djcas9 commented 11 years ago

Working on it.

ckoehler commented 11 years ago

Those I fixed by changing the /..../ parts to Regexp.new("..."), and escaping the . Not sure if it's functionally the same (it should be, but didn't test), but it does continue from there.

ckoehler commented 11 years ago

After that, I got an error in the seed task. Something like "Duplicate entry '' for key PRIMARY." Not sure what those are about, and didn't pursue those further.

ckoehler commented 11 years ago

Argh, I mean escaping the backslashes. It filtered those out in the comment.

da667 commented 11 years ago

I appreciate the turn-around/acknowledgement of this issue, and appreciate the hard work that has gone into this interface. Thank you for your time and apologies for not knowing enough about ruby to actually help here :\

On Fri, May 3, 2013 at 11:01 PM, Christoph Koehler <notifications@github.com

wrote:

Argh, I mean escaping the backslashes. It filtered those out in the comment.

— Reply to this email directly or view it on GitHubhttps://github.com/Snorby/snorby/issues/275#issuecomment-17426785 .

when does reality end? when does fantasy begin?

tampinc commented 11 years ago

I got rid of the "Duplicate entry '' for key PRIMARY." errors using ruby 2.0.0p247. I found I had to explicitly pass strings instead of symbols in all the Setting.set() calls in db/seeds.rb i.e. Setting.set(:company, 'Snorby.org') unless Setting.company? becomes Setting.set(:company.to_s, 'Snorby.org') unless Setting.company? etc etc for the other calls The existing code was trying to insert multiple records with empty string primary key values into the settings table.

This gets past the db::seed job failing. I will continue testing ...... I'm a C++ developer who started learning ruby tonight :-) Don't know if my hack is backward compatible with 1.9.X. Has ruby v2 tightened up the way symbols are passed as parameters maybe? Is it a bug in v2?

Cheers, Chris

B0fH commented 9 years ago

Hello, I was able to resolve this issue by adding:

encoding: US-ASCII

to the top of payload.rb. That solution came from here: http://techoverflow.net/blog/2013/12/29/solve-invalid-multibyte-escape-xfe-xff-in-ruby-vpim/ I am running ruby 2.2.3(ruby 2.2.3p173 (2015-08-18 revision 51636) [i586-linux]).

Thanks, Elazar