Class: Codesake::Core::Target
- Inherits:
-
Object
- Object
- Codesake::Core::Target
- Defined in:
- lib/codesake/core/target.rb
Instance Attribute Summary collapse
-
#cms ⇒ Object
readonly
Returns the value of attribute cms.
-
#cookies ⇒ Object
readonly
Returns the value of attribute cookies.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#site_tree ⇒ Object
readonly
This is the website tree.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#vulns ⇒ Object
readonly
Returns the value of attribute vulns.
-
#webserver ⇒ Object
readonly
This will be fed by codesake-gengiscan.
Instance Method Summary collapse
- #get_page(url = nil) ⇒ Object
- #has_page? ⇒ Boolean
-
#initialize(options = {}) ⇒ Target
constructor
A new instance of Target.
- #is_alive? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Target
Returns a new instance of Target.
31 32 33 34 35 36 37 38 39 |
# File 'lib/codesake/core/target.rb', line 31 def initialize(={}) $logger = Codesake::Commons::Logging.instance @agent = Mechanize.new @page = nil @url ||= [:url] @username ||= [:username] @password ||= [:password] end |
Instance Attribute Details
#cms ⇒ Object (readonly)
Returns the value of attribute cms.
17 18 19 |
# File 'lib/codesake/core/target.rb', line 17 def cms @cms end |
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
26 27 28 |
# File 'lib/codesake/core/target.rb', line 26 def @cookies end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
16 17 18 |
# File 'lib/codesake/core/target.rb', line 16 def language @language end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
11 12 13 |
# File 'lib/codesake/core/target.rb', line 11 def page @page end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
9 10 11 |
# File 'lib/codesake/core/target.rb', line 9 def password @password end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
28 29 30 |
# File 'lib/codesake/core/target.rb', line 28 def score @score end |
#site_tree ⇒ Object (readonly)
This is the website tree. Fed by codesake-links. Each tree element is an hash like :code, :kind, :dynamic :dynamic is true or false if the page has some dynamic content that needs to be exploited (url parameters, forms, …)
24 25 26 |
# File 'lib/codesake/core/target.rb', line 24 def site_tree @site_tree end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/codesake/core/target.rb', line 7 def url @url end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
8 9 10 |
# File 'lib/codesake/core/target.rb', line 8 def username @username end |
#vulns ⇒ Object (readonly)
Returns the value of attribute vulns.
29 30 31 |
# File 'lib/codesake/core/target.rb', line 29 def vulns @vulns end |
#webserver ⇒ Object (readonly)
This will be fed by codesake-gengiscan
15 16 17 |
# File 'lib/codesake/core/target.rb', line 15 def webserver @webserver end |
Instance Method Details
#get_page(url = nil) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/codesake/core/target.rb', line 45 def get_page(url = nil) url = @url if url.nil? begin @page = @agent.get(url) @cookies = @agent. rescue => e $logger.err "get_page(): #{e.}" @page = nil end @page end |
#has_page? ⇒ Boolean
41 42 43 |
# File 'lib/codesake/core/target.rb', line 41 def has_page? ! @page.nil? end |
#is_alive? ⇒ Boolean
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/codesake/core/target.rb', line 59 def is_alive? return false unless url return false unless @agent begin @agent.get('/') return true rescue Net::HTTP::Persistent::Error=>e return false end end |