Class: Schatz::Output::CMD
Instance Attribute Summary
Attributes inherited from Out
Instance Method Summary collapse
- #direct(connection) ⇒ Object
-
#initialize(options = {}) ⇒ CMD
constructor
A new instance of CMD.
- #link(connection) ⇒ Object
- #print(connection) ⇒ Object
Methods inherited from Out
Constructor Details
#initialize(options = {}) ⇒ CMD
Returns a new instance of CMD.
4 5 6 |
# File 'lib/schatz/output/cmd.rb', line 4 def initialize(={}) = end |
Instance Method Details
#direct(connection) ⇒ Object
18 19 20 21 |
# File 'lib/schatz/output/cmd.rb', line 18 def direct(connection) color = connection.result == "open" ? :green : :red puts (connection.host+" "+connection.port.to_s+" "+connection.scheme).foreground(color) end |
#link(connection) ⇒ Object
23 24 25 26 27 |
# File 'lib/schatz/output/cmd.rb', line 23 def link(connection) codes = %w(403 302 200) color = codes.include?(connection.result) ? :green : :red puts (connection.scheme+"://"+connection.host+" "+connection.port.to_s+" via "+ connection.proxy).foreground(color) end |
#print(connection) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/schatz/output/cmd.rb', line 7 def print(connection) case connection.scheme when "tcp" direct(connection) when "http" link(connection) when "https" link(connection) end end |