summaryrefslogtreecommitdiff
path: root/lib/oxidized
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2018-04-25 16:30:52 +0300
committerytti <saku@ytti.fi>2018-04-25 16:30:52 +0300
commit8afffb852b55dfa74f2e694e5c27d9db4cc34373 (patch)
tree3c842505264f832ecadc9b386bd9a48a110ca1fa /lib/oxidized
parent583bc422448a234a215113a15f8a6976c50b2296 (diff)
Add option to force input string into 8bit-ascii
Essentially binary blob or UTF8 Closes #1210
Diffstat (limited to 'lib/oxidized')
-rw-r--r--lib/oxidized/config.rb9
-rw-r--r--lib/oxidized/model/model.rb1
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/oxidized/config.rb b/lib/oxidized/config.rb
index a825d39..9eb9b90 100644
--- a/lib/oxidized/config.rb
+++ b/lib/oxidized/config.rb
@@ -34,10 +34,11 @@ module Oxidized
asetus.default.models = {} # model level configuration
asetus.default.pid = File.join(Oxidized::Config::Root, 'pid')
- asetus.default.input.default = 'ssh, telnet'
- asetus.default.input.debug = false # or String for session log file
- asetus.default.input.ssh.secure = false # complain about changed certs
- asetus.default.input.ftp.passive = true # ftp passive mode
+ asetus.default.input.default = 'ssh, telnet'
+ asetus.default.input.debug = false # or String for session log file
+ asetus.default.input.ssh.secure = false # complain about changed certs
+ asetus.default.input.ftp.passive = true # ftp passive mode
+ asetus.default.input.utf8_encoded = true # configuration is utf8 encoded or ascii-8bit
asetus.default.output.default = 'file' # file, git
asetus.default.source.default = 'csv' # csv, sql
diff --git a/lib/oxidized/model/model.rb b/lib/oxidized/model/model.rb
index a650560..438357f 100644
--- a/lib/oxidized/model/model.rb
+++ b/lib/oxidized/model/model.rb
@@ -91,6 +91,7 @@ module Oxidized
Oxidized.logger.debug "lib/oxidized/model/model.rb Executing #{string}"
out = @input.cmd(string)
return false unless out
+ out = out.b unless Oxidized.config.input.utf8_encoded?
self.class.cmds[:all].each do |all_block|
out = instance_exec Oxidized::String.new(out), string, &all_block
end