Class: BurpExtender::ConsolePane Private

Inherits:
Java::JavaxSwing::JScrollPane
  • Object
show all
Defined in:
lib/buby/burp_extender/console_pane.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

HEADER =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

" Welcome to the Burp JRuby IRB Console [#{JRUBY_VERSION} (#{RUBY_VERSION})]\n\n"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConsolePane

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ConsolePane.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/buby/burp_extender/console_pane.rb', line 6

def initialize
  super
  @text = Java::JavaxSwing::JTextPane.new
  @text.font = find_font('Monospaced', Java::JavaAwt::Font::PLAIN, 14, 'Anonymous Pro', 'Anonymous', 'Monaco', 'Andale Mono')
  @text.margin = Java::JavaAwt::Insets.new(8,8,8,8)
  @text.caret_color = Java::JavaAwt::Color.new(0xa40000)
  @text.background  = Java::JavaAwt::Color.new(0xf2f2f2)
  @text.foreground  = Java::JavaAwt::Color.new(0xa40000)
  self.viewport_view = @text
  @tar = begin
    Java::OrgJrubyDemo::TextAreaReadline.new(@text, HEADER)
  rescue NameError
    require 'readline'
    Java::OrgJrubyDemoReadline::TextAreaReadline.new(text, HEADER)
  end
    
  JRuby.objectspace = true # useful for code completion
  @tar.hook_into_runtime_with_streams(JRuby.runtime)
end

Instance Attribute Details

#tarObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
# File 'lib/buby/burp_extender/console_pane.rb', line 5

def tar
  @tar
end

#textObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
# File 'lib/buby/burp_extender/console_pane.rb', line 5

def text
  @text
end

Instance Method Details

#find_font(otherwise, style, size, *families) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Try to find preferred font family, use otherwise – err – otherwise



27
28
29
30
31
# File 'lib/buby/burp_extender/console_pane.rb', line 27

def find_font(otherwise, style, size, *families)
  avail_families = Java::JavaAwt::GraphicsEnvironment.local_graphics_environment.available_font_family_names
  fontname = families.find(proc {otherwise}) { |name| avail_families.include? name }
  Java::JavaAwt::Font.new(fontname, style, size)
end