Exception: Msf::BadcharError
- Inherits:
-
EncodingError
- Object
- RuntimeError
- EncodingError
- Msf::BadcharError
- Defined in:
- lib/msf/core/exceptions.rb
Overview
Thrown when an encoder fails to encode a buffer due to a bad character.
Instance Attribute Summary collapse
-
#buf ⇒ Object
readonly
Returns the value of attribute buf.
-
#char ⇒ Object
readonly
Returns the value of attribute char.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#stub_size ⇒ Object
readonly
Returns the value of attribute stub_size.
Instance Method Summary collapse
-
#initialize(buf = nil, index = nil, stub_size = nil, char = nil) ⇒ BadcharError
constructor
A new instance of BadcharError.
- #to_s ⇒ Object
Constructor Details
#initialize(buf = nil, index = nil, stub_size = nil, char = nil) ⇒ BadcharError
Returns a new instance of BadcharError.
94 95 96 97 98 99 |
# File 'lib/msf/core/exceptions.rb', line 94 def initialize(buf = nil, index = nil, stub_size = nil, char = nil) @buf = buf @index = index @stub_size = stub_size @char = char end |
Instance Attribute Details
#buf ⇒ Object (readonly)
Returns the value of attribute buf
116 117 118 |
# File 'lib/msf/core/exceptions.rb', line 116 def buf @buf end |
#char ⇒ Object (readonly)
Returns the value of attribute char
116 117 118 |
# File 'lib/msf/core/exceptions.rb', line 116 def char @char end |
#index ⇒ Object (readonly)
Returns the value of attribute index
116 117 118 |
# File 'lib/msf/core/exceptions.rb', line 116 def index @index end |
#stub_size ⇒ Object (readonly)
Returns the value of attribute stub_size
116 117 118 |
# File 'lib/msf/core/exceptions.rb', line 116 def stub_size @stub_size end |
Instance Method Details
#to_s ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/msf/core/exceptions.rb', line 101 def to_s # Deal with elements of a String being an instance of String instead of # Integer in ruby 1.9. if (char.respond_to? :ord) c = char.ord else c = char end if (c) return "Encoding failed due to a bad character (index=#{index}, char=#{sprintf("0x%.2x", c)})" else return "Encoding failed due to a nil character" end end |