Class: Gengiscan::Engine
- Inherits:
-
Object
- Object
- Gengiscan::Engine
- Defined in:
- lib/gengiscan/engine.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#res ⇒ Object
readonly
Returns the value of attribute res.
Instance Method Summary collapse
- #detect(url) ⇒ Object
-
#initialize ⇒ Engine
constructor
A new instance of Engine.
Constructor Details
#initialize ⇒ Engine
Returns a new instance of Engine.
11 12 13 |
# File 'lib/gengiscan/engine.rb', line 11 def initialize end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
9 10 11 |
# File 'lib/gengiscan/engine.rb', line 9 def body @body end |
#res ⇒ Object (readonly)
Returns the value of attribute res.
8 9 10 |
# File 'lib/gengiscan/engine.rb', line 8 def res @res end |
Instance Method Details
#detect(url) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/gengiscan/engine.rb', line 16 def detect(url) uri = URI(url) agent = Mechanize.new page = agent.get(url) begin phpbb = {:cookies=>{:version=>"", :detected=>false}, :body=>{:version=>"", :detected=>false}, :changelog=>{:version=>"", :detected=>false}, :style=>{:version=>"", :detected=>false}} phpbb[:cookies] = (agent.) phpbb[:body] = phpbb_body_detect(page) phpbb[:changelog] = nil changelog_html = agent.get(url+'/docs/CHANGELOG.html') phpbb[:changelog] = phpbb_changelog_checksum(changelog_html.body) phpbb[:style] = phpbb_theme_cfg_detect(page, url, agent) {:status=>:OK, :code=>page.code, :server=>page.header['server'], :powered=>page.header['X-Powered-By'], :generator=>get_generator_signature(page.body), :message=>""} unless is_phpbb?(phpbb) {:status=>:OK, :code=>page.code, :server=>page.header['server'], :powered=>page.header['X-Powered-By'], :generator=>get_generator_signature(page.body), :message=>"", :cms=>"phpbb", :version=>get_phpbb_version(phpbb)} if is_phpbb?(phpbb) rescue => e $logger.err("detect(): #{e.}") {:status=>:OK, :code=>page.code, :server=>page.header['server'], :powered=>page.header['X-Powered-By'], :generator=>get_generator_signature(page.body), :message=>e.} end end |