Class: RbRequest

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, base64, text) ⇒ RbRequest

Returns a new instance of RbRequest.



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

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

Instance Attribute Details

#base64Object

Returns the value of attribute base64.



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

def base64
  @base64
end

#methodObject

Returns the value of attribute method.



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

def method
  @method
end

#textObject

Returns the value of attribute text.



2
3
4
# File 'lib/ruby_burp/rb_request.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
37
38
# File 'lib/ruby_burp/rb_request.rb', line 11

def parse(xml)
  requests = []
  html_doc = Nokogiri::XML(xml)
  
  req = html_doc.xpath('//requestresponse/request').first
  
  begin
    method = req.attribute('method').value
  rescue
    method = ''
  end

  begin
    base64 = req.attribute('base64').value
  rescue
    base64 = ''
  end
  
  begin
    req = req.text
  rescue
    req = ''
  end  

  requests.push(RbRequest.new(method, base64, req))
  
  requests
end