Module: CMSScanner::Target::Platform::PHP

Defined in:
lib/cms_scanner/target/platform/php.rb

Overview

Some PHP specific implementation

Constant Summary collapse

DEBUG_LOG_PATTERN =
/\[[^\]]+\] PHP (?:Warning|Error|Notice):/
FPD_PATTERN =
/Fatal error:.+? in (.+?) on/

Instance Method Summary collapse

Instance Method Details

#debug_log?(path = nil, params = {}) ⇒ Boolean



13
14
15
16
17
# File 'lib/cms_scanner/target/platform/php.rb', line 13

def debug_log?(path = nil, params = {})
  res = NS::Browser.get(url(path), params.merge(headers: { 'range' => 'bytes=0-700' }))

  res.body =~ DEBUG_LOG_PATTERN ? true : false
end

#full_path_disclosure?(path = nil, params = {}) ⇒ Boolean



23
24
25
# File 'lib/cms_scanner/target/platform/php.rb', line 23

def full_path_disclosure?(path = nil, params = {})
  !full_path_disclosure_entries(path, params).empty?
end

#full_path_disclosure_entries(path = nil, params = {}) ⇒ Array<String>



31
32
33
34
35
# File 'lib/cms_scanner/target/platform/php.rb', line 31

def full_path_disclosure_entries(path = nil, params = {})
  res = NS::Browser.get(url(path), params)

  res.body.scan(FPD_PATTERN).flatten
end