Class: RbResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_burp/rb_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base64, text, redirected) ⇒ RbResponse

Returns a new instance of RbResponse.



4
5
6
7
8
# File 'lib/ruby_burp/rb_response.rb', line 4

def initialize(base64, text, redirected)
  self.base64 = base64
  self.text = text
  self.redirected = redirected
end

Instance Attribute Details

#base64Object

Returns the value of attribute base64.



2
3
4
# File 'lib/ruby_burp/rb_response.rb', line 2

def base64
  @base64
end

#redirectedObject

Returns the value of attribute redirected.



2
3
4
# File 'lib/ruby_burp/rb_response.rb', line 2

def redirected
  @redirected
end

#textObject

Returns the value of attribute text.



2
3
4
# File 'lib/ruby_burp/rb_response.rb', line 2

def text
  @text
end

Class Method Details

.parse(xml) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ruby_burp/rb_response.rb', line 11

def parse(xml)
  responses = []
  html_doc = Nokogiri::XML(xml)
  res = html_doc.xpath('//requestresponse//response').first      
  begin
    redirected = html_doc.xpath('//requestresponse//responseRedirected').first.text
  rescue
    redirected = ''
  end

  begin
    base64 = res.attribute('base64').value
  rescue
    base64 = ''
  end

  begin
    res = res.text
  rescue
    res = ''
  end      
  
  responses.push(RbResponse.new(base64, res, redirected))
  
  responses
end