Class: Codesake::Commons::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/codesake/commons/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Target

Returns a new instance of Target.



26
27
28
29
30
31
32
33
# File 'lib/codesake/commons/target.rb', line 26

def initialize(options={})
  $logger = Codesake::Commons::Logging.instance
  @agent  = Mechanize.new

  @url      ||= options[:url]
  @username ||= options[:username]
  @password ||= options[:password]
end

Instance Attribute Details

#cmsObject (readonly)

Returns the value of attribute cms.



12
13
14
# File 'lib/codesake/commons/target.rb', line 12

def cms
  @cms
end

#cookiesObject (readonly)

Returns the value of attribute cookies.



21
22
23
# File 'lib/codesake/commons/target.rb', line 21

def cookies
  @cookies
end

#languageObject (readonly)

Returns the value of attribute language.



11
12
13
# File 'lib/codesake/commons/target.rb', line 11

def language
  @language
end

#passwordObject (readonly)

Returns the value of attribute password.



6
7
8
# File 'lib/codesake/commons/target.rb', line 6

def password
  @password
end

#scoreObject (readonly)

Returns the value of attribute score.



23
24
25
# File 'lib/codesake/commons/target.rb', line 23

def score
  @score
end

#site_treeObject (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, …)



19
20
21
# File 'lib/codesake/commons/target.rb', line 19

def site_tree
  @site_tree
end

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/codesake/commons/target.rb', line 4

def url
  @url
end

#usernameObject (readonly)

Returns the value of attribute username.



5
6
7
# File 'lib/codesake/commons/target.rb', line 5

def username
  @username
end

#vulnsObject (readonly)

Returns the value of attribute vulns.



24
25
26
# File 'lib/codesake/commons/target.rb', line 24

def vulns
  @vulns
end

#webserverObject (readonly)

This will be fed by codesake-gengiscan



10
11
12
# File 'lib/codesake/commons/target.rb', line 10

def webserver
  @webserver
end

Instance Method Details

#is_alive?Boolean

Returns:

  • (Boolean)


35
36
37
38
39
40
41
42
43
44
45
# File 'lib/codesake/commons/target.rb', line 35

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