Class: Arachni::State::HTTP
Overview
Instance Attribute Summary collapse
-
#cookie_jar ⇒ CookieJar
readonly
Cookie-jar for HTTP::Client#cookie_jar.
-
#headers ⇒ Hash
readonly
HTTP headers for the HTTP::Client#headers.
Class Method Summary collapse
Instance Method Summary collapse
- #clear ⇒ Object
- #dump(directory) ⇒ Object
-
#initialize ⇒ HTTP
constructor
A new instance of HTTP.
- #statistics ⇒ Object
Constructor Details
Instance Attribute Details
#cookie_jar ⇒ CookieJar (readonly)
Returns Cookie-jar for HTTP::Client#cookie_jar.
21 22 23 |
# File 'lib/arachni/state/http.rb', line 21 def @cookie_jar end |
#headers ⇒ Hash (readonly)
Returns HTTP headers for the HTTP::Client#headers.
17 18 19 |
# File 'lib/arachni/state/http.rb', line 17 def headers @headers end |
Class Method Details
.load(directory) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/arachni/state/http.rb', line 42 def self.load( directory ) http = new %w(headers cookie_jar).each do |attribute| http.send(attribute).merge! Marshal.load( IO.binread( "#{directory}/#{attribute}" ) ) end http end |
Instance Method Details
#clear ⇒ Object
52 53 54 55 |
# File 'lib/arachni/state/http.rb', line 52 def clear @cookie_jar.clear @headers.clear end |
#dump(directory) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/arachni/state/http.rb', line 34 def dump( directory ) FileUtils.mkdir_p( directory ) %w(headers cookie_jar).each do |attribute| IO.binwrite( "#{directory}/#{attribute}", Marshal.dump( send(attribute) ) ) end end |
#statistics ⇒ Object
28 29 30 31 32 |
# File 'lib/arachni/state/http.rb', line 28 def statistics { cookies: @cookie_jar..map(&:to_s).uniq } end |